[med-svn] [aevol] 03/10: New upstream version 5.0

Andreas Tille tille at debian.org
Mon Sep 11 18:55:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository aevol.

commit 1503de1c6196813c5c3759163a23d57146a5f464
Author: Andreas Tille <tille at debian.org>
Date:   Mon Sep 11 20:23:00 2017 +0200

    New upstream version 5.0
---
 AUTHORS                                            |    5 +-
 INSTALL                                            |   19 +-
 Makefile.am                                        |    9 +-
 Makefile.in                                        |  364 +-
 NEWS                                               |   11 +
 README                                             |    8 +-
 aclocal.m4                                         |  830 ++--
 compile                                            |  232 +-
 config.guess                                       | 1420 ++++++
 config.sub                                         | 1799 ++++++++
 configure                                          | 4583 ++++++++++++++------
 configure.ac                                       |  228 +-
 depcomp                                            |  531 ++-
 doc/Makefile.am                                    |    6 +-
 doc/Makefile.in                                    |  170 +-
 doc/aevol_create.1                                 |   22 +-
 ...misc_ancstats.1 => aevol_misc_ancestor_stats.1} |   28 +-
 doc/aevol_misc_compute_pop_stats.1                 |    2 +-
 doc/aevol_misc_create_eps.1                        |   28 +-
 doc/aevol_misc_extract.1                           |   41 +-
 doc/aevol_misc_fixed_mutations.1                   |   34 -
 doc/aevol_misc_gene_families.1                     |    2 +-
 doc/aevol_misc_lineage.1                           |   37 +-
 doc/aevol_misc_robustness.1                        |   41 +-
 ...ol_misc_view_generation.1 => aevol_misc_view.1} |   22 +-
 doc/aevol_modify.1                                 |   16 +-
 doc/aevol_propagate.1                              |   66 +-
 doc/aevol_run.1                                    |   28 +-
 examples/README                                    |   57 -
 examples/basic/param.in                            |   22 +-
 examples/lateral-transfer-by-replacement/README    |   32 -
 examples/lateral-transfer-by-replacement/param.in  |   93 -
 examples/with_space/param.in                       |   74 -
 examples/workflow/{README.txt => README}           |  184 +-
 examples/workflow/wild_type/param.in               |   22 +-
 install-sh                                         |   35 +-
 m4/ax_boost_base.m4                                |  285 ++
 m4/ax_boost_filesystem.m4                          |  118 +
 m4/ax_boost_system.m4                              |  121 +
 m4/ax_cxx_compile_stdcxx_11.m4                     |  142 +
 m4/ax_cxx_compile_stdcxx_14.m4                     |  142 +
 missing                                            |    4 +-
 src/Makefile.am                                    |    7 +-
 src/Makefile.in                                    |  397 +-
 src/aevol_create.cpp                               |  395 +-
 src/aevol_modify.cpp                               | 1700 ++++----
 src/aevol_propagate.cpp                            |  520 +--
 src/aevol_run.cpp                                  |  465 +-
 src/libaevol/AbstractFuzzy.cpp                     |    5 +
 src/libaevol/AbstractFuzzy.h                       |   83 +
 src/libaevol/{ae_phenotype.cpp => AeTime.cpp}      |   74 +-
 src/libaevol/{ae_dump.h => AeTime.h}               |  135 +-
 src/libaevol/Alignment.cpp                         |  316 ++
 src/libaevol/{ae_dump.h => Alignment.h}            |  135 +-
 src/libaevol/{ae_vis_a_vis.cpp => Codon.cpp}       |   99 +-
 src/libaevol/{ae_dump.h => Codon.h}                |  110 +-
 src/libaevol/{ae_phenotype.cpp => Deletion.cpp}    |  127 +-
 src/libaevol/Deletion.h                            |  102 +
 src/libaevol/Dna.cpp                               | 3293 ++++++++++++++
 src/libaevol/Dna.h                                 |  201 +
 src/libaevol/DnaReplicationReport.cpp              |  327 ++
 src/libaevol/DnaReplicationReport.h                |   99 +
 src/libaevol/Dump.cpp                              |  242 ++
 src/libaevol/{ae_dump.h => Dump.h}                 |  122 +-
 src/libaevol/{f_line.cpp => Duplication.cpp}       |  104 +-
 src/libaevol/Duplication.h                         |  104 +
 src/libaevol/ExpManager.cpp                        |  676 +++
 src/libaevol/ExpManager.h                          |  239 +
 src/libaevol/ExpManager_X11.cpp                    | 1257 ++++++
 .../{ae_exp_manager_X11.h => ExpManager_X11.h}     |  161 +-
 src/libaevol/ExpSetup.cpp                          |  356 ++
 src/libaevol/ExpSetup.h                            |  359 ++
 src/libaevol/Fuzzy.cpp                             |  440 ++
 src/libaevol/Fuzzy.h                               |  158 +
 src/libaevol/{ae_codon.cpp => FuzzyFactory.cpp}    |  162 +-
 src/libaevol/{ae_dump.h => FuzzyFactory.h}         |  173 +-
 src/libaevol/{ae_dump.h => Gaussian.h}             |  139 +-
 src/libaevol/GeneticUnit.cpp                       | 3489 +++++++++++++++
 src/libaevol/GeneticUnit.h                         |  563 +++
 src/libaevol/GridCell.cpp                          |  162 +
 src/libaevol/GridCell.h                            |  209 +
 src/libaevol/GzHelpers.h                           |   79 +
 src/libaevol/{ae_codon.cpp => Habitat.cpp}         |  142 +-
 src/libaevol/Habitat.h                             |  150 +
 src/libaevol/HabitatFactory.cpp                    |   51 +
 src/libaevol/HabitatFactory.h                      |   28 +
 src/libaevol/HorizontalTransfer.h                  |   84 +
 src/libaevol/HybridFuzzy.cpp                       |  229 +
 src/libaevol/HybridFuzzy.h                         |   91 +
 src/libaevol/Individual.cpp                        | 1743 ++++++++
 src/libaevol/Individual.h                          |  630 +++
 src/libaevol/IndividualFactory.cpp                 |  229 +
 src/libaevol/IndividualFactory.h                   |  148 +
 src/libaevol/Individual_X11.cpp                    |  840 ++++
 .../{ae_fuzzy_set_X11.h => Individual_X11.h}       |   97 +-
 src/libaevol/{ae_grid_cell.cpp => InsertionHT.cpp} |  122 +-
 src/libaevol/InsertionHT.h                         |  136 +
 src/libaevol/{f_line.cpp => Inversion.cpp}         |   99 +-
 src/libaevol/Inversion.h                           |  118 +
 src/libaevol/JumpPoly.h                            |   62 +
 src/libaevol/{ae_jumping_mt.cpp => JumpingMT.cpp}  |  282 +-
 src/libaevol/{ae_jumping_mt.h => JumpingMT.h}      |  110 +-
 src/libaevol/LocalMutation.h                       |   83 +
 src/libaevol/Logging.cpp                           |  446 ++
 src/libaevol/{ae_logs.h => Logging.h}              |  111 +-
 src/libaevol/Makefile.am                           |  188 +-
 src/libaevol/Makefile.in                           | 1396 +++---
 src/libaevol/Metrics.h                             |  208 +
 src/libaevol/Mutation.cpp                          |  264 ++
 src/libaevol/{ae_dump.h => Mutation.h}             |  154 +-
 src/libaevol/MutationParams.cpp                    |  268 ++
 src/libaevol/MutationParams.h                      |  571 +++
 src/libaevol/NonCodingMetrics.h                    |  174 +
 .../{tests/run_tests.cpp => Observable.cpp}        |  101 +-
 src/libaevol/Observable.h                          |  101 +
 src/libaevol/{ae_object.h => ObservableEvent.h}    |   44 +-
 src/libaevol/Observer.h                            |   89 +
 src/libaevol/OutputManager.cpp                     |  252 ++
 src/libaevol/OutputManager.h                       |  244 ++
 src/libaevol/ParamLoader.cpp                       | 2104 +++++++++
 src/libaevol/ParamLoader.h                         |  321 ++
 src/libaevol/{f_line.cpp => ParameterLine.cpp}     |   21 +-
 src/libaevol/{f_line.h => ParameterLine.h}         |   40 +-
 src/libaevol/{ae_utils.h => Phenotype.h}           |   81 +-
 .../{ae_point_1d.h => PhenotypicSegment.h}         |  147 +-
 src/libaevol/PhenotypicTarget.cpp                  |  148 +
 src/libaevol/PhenotypicTarget.h                    |  152 +
 src/libaevol/PhenotypicTargetHandler.cpp           |  395 ++
 src/libaevol/PhenotypicTargetHandler.h             |  228 +
 src/libaevol/{ae_object.h => Point.cpp}            |   45 +-
 src/libaevol/{ae_object.h => Point.h}              |   47 +-
 src/libaevol/{f_line.cpp => PointMutation.cpp}     |   85 +-
 src/libaevol/PointMutation.h                       |  103 +
 src/libaevol/Protein.cpp                           |  703 +++
 src/libaevol/{ae_protein.h => Protein.h}           |  190 +-
 src/libaevol/Rearrangement.h                       |   83 +
 .../{ae_phenotype.cpp => ReplacementHT.cpp}        |  131 +-
 src/libaevol/ReplacementHT.h                       |  141 +
 src/libaevol/ReplicationReport.cpp                 |  270 ++
 src/libaevol/ReplicationReport.h                   |  275 ++
 src/libaevol/{ae_codon.cpp => Rna.cpp}             |  119 +-
 src/libaevol/{ae_codon.h => Rna.h}                 |  160 +-
 src/libaevol/SFMT-src-1.4/Makefile.in              |  304 +-
 src/libaevol/Selection.cpp                         |  759 ++++
 src/libaevol/{ae_selection.h => Selection.h}       |  157 +-
 src/libaevol/{f_line.cpp => SmallDeletion.cpp}     |   93 +-
 src/libaevol/SmallDeletion.h                       |  109 +
 src/libaevol/SmallInsertion.cpp                    |  107 +
 src/libaevol/SmallInsertion.h                      |  114 +
 src/libaevol/StatRecord.cpp                        |  939 ++++
 src/libaevol/{ae_stat_record.h => StatRecord.h}    |  231 +-
 src/libaevol/Stats.cpp                             |  860 ++++
 src/libaevol/Stats.h                               |  179 +
 src/libaevol/Translocation.cpp                     |   91 +
 src/libaevol/Translocation.h                       |  139 +
 src/libaevol/Tree.cpp                              |  216 +
 src/libaevol/{ae_align.h => Tree.h}                |  133 +-
 src/libaevol/{ae_phenotype.cpp => Utils.cpp}       |  142 +-
 src/libaevol/Utils.h                               |  106 +
 src/libaevol/{ae_grid_cell.cpp => VisAVis.cpp}     |   77 +-
 src/libaevol/VisAVis.h                             |  348 ++
 src/libaevol/World.cpp                             |  502 +++
 src/libaevol/World.h                               |  312 ++
 src/libaevol/X11Window.cpp                         |  555 +++
 src/libaevol/{ae_X11_window.h => X11Window.h}      |  200 +-
 src/libaevol/ae_X11_window.cpp                     |  558 ---
 src/libaevol/ae_align.cpp                          |  316 --
 src/libaevol/ae_dna.cpp                            | 3388 ---------------
 src/libaevol/ae_dna.h                              |  246 --
 src/libaevol/ae_dna_replic_report.cpp              |  200 -
 src/libaevol/ae_dna_replic_report.h                |  257 --
 src/libaevol/ae_dump.cpp                           |  254 --
 src/libaevol/ae_enums.h                            |   81 +-
 src/libaevol/ae_environment.cpp                    |  835 ----
 src/libaevol/ae_environment.h                      |  439 --
 src/libaevol/ae_exp_manager.cpp                    |  827 ----
 src/libaevol/ae_exp_manager.h                      |  605 ---
 src/libaevol/ae_exp_manager_X11.cpp                |  809 ----
 src/libaevol/ae_exp_setup.cpp                      |  219 -
 src/libaevol/ae_exp_setup.h                        |  382 --
 src/libaevol/ae_fuzzy_set.cpp                      | 1026 -----
 src/libaevol/ae_fuzzy_set.h                        |  210 -
 src/libaevol/ae_fuzzy_set_X11.cpp                  |  124 -
 src/libaevol/ae_gaussian.h                         |  201 -
 src/libaevol/ae_gene_mutation.cpp                  |  292 --
 src/libaevol/ae_gene_mutation.h                    |  193 -
 src/libaevol/ae_gene_tree.cpp                      |  234 -
 src/libaevol/ae_gene_tree.h                        |  215 -
 src/libaevol/ae_gene_tree_node.cpp                 | 1216 ------
 src/libaevol/ae_gene_tree_node.h                   |  189 -
 src/libaevol/ae_genetic_unit.cpp                   | 4168 ------------------
 src/libaevol/ae_genetic_unit.h                     |  857 ----
 src/libaevol/ae_grid_cell.h                        |  202 -
 src/libaevol/ae_individual.cpp                     | 1567 -------
 src/libaevol/ae_individual.h                       | 1581 -------
 src/libaevol/ae_individual_X11.cpp                 |  890 ----
 src/libaevol/ae_individual_X11.h                   |  141 -
 src/libaevol/ae_jump_poly.h                        |   58 -
 src/libaevol/ae_list.h                             |  981 -----
 src/libaevol/ae_logger.h                           |   91 +
 src/libaevol/ae_logs.cpp                           |  427 --
 src/libaevol/ae_macros.h                           |  113 -
 src/libaevol/ae_mutation.cpp                       |  959 ----
 src/libaevol/ae_mutation.h                         |  195 -
 src/libaevol/ae_output_manager.cpp                 |  360 --
 src/libaevol/ae_output_manager.h                   |  277 --
 src/libaevol/ae_params_mut.cpp                     |  267 --
 src/libaevol/ae_params_mut.h                       |  567 ---
 src/libaevol/ae_population.cpp                     |  405 --
 src/libaevol/ae_population.h                       |  504 ---
 src/libaevol/ae_population_X11.cpp                 |  230 -
 src/libaevol/ae_protein.cpp                        |  521 ---
 src/libaevol/ae_replication_report.cpp             |  390 --
 src/libaevol/ae_replication_report.h               |  331 --
 src/libaevol/ae_rna.cpp                            |  156 -
 src/libaevol/ae_rna.h                              |  224 -
 src/libaevol/ae_selection.cpp                      |  870 ----
 src/libaevol/ae_spatial_structure.cpp              |  227 -
 src/libaevol/ae_spatial_structure.h                |  301 --
 src/libaevol/ae_stat_record.cpp                    | 1052 -----
 src/libaevol/ae_stats.cpp                          |  729 ----
 src/libaevol/ae_stats.h                            |  184 -
 src/libaevol/ae_string.cpp                         |  246 +-
 src/libaevol/ae_string.h                           |  195 +-
 src/libaevol/ae_tree.cpp                           |  417 --
 src/libaevol/ae_tree.h                             |  214 -
 src/libaevol/ae_vis_a_vis.h                        |  358 --
 src/libaevol/aevol.h                               |   89 +
 src/libaevol/macros.h                              |  112 +
 src/libaevol/{ae_object.h => make_unique.h}        |   45 +-
 src/libaevol/param_loader.cpp                      | 1971 ---------
 src/libaevol/param_loader.h                        |  308 --
 .../{ae_codon.cpp => raevol/Habitat_R.cpp}         |  145 +-
 src/libaevol/raevol/Habitat_R.h                    |  149 +
 src/libaevol/raevol/Individual_R.cpp               |  492 +++
 .../{ae_point_2d.h => raevol/Individual_R.h}       |  216 +-
 src/libaevol/raevol/Individual_R_X11.cpp           |  601 +++
 .../Individual_R_X11.h}                            |  109 +-
 src/libaevol/raevol/PhenotypicTargetHandler_R.cpp  |  442 ++
 src/libaevol/raevol/PhenotypicTargetHandler_R.h    |  198 +
 .../PhenotypicTarget_R.cpp}                        |  122 +-
 src/libaevol/raevol/PhenotypicTarget_R.h           |  132 +
 src/libaevol/raevol/Protein_R.cpp                  |  218 +
 .../{ae_env_segment.h => raevol/Protein_R.h}       |  227 +-
 src/libaevol/raevol/Rna_R.cpp                      |  280 ++
 src/libaevol/{ae_phenotype.h => raevol/Rna_R.h}    |  119 +-
 src/libaevol/tests/Makefile.am                     |   47 -
 src/libaevol/tests/Makefile.in                     |  659 ---
 src/libaevol/tests/Test_ae_individual.cpp          |  327 --
 src/libaevol/tests/Test_ae_individual.h            |  162 -
 src/libaevol/tests/Test_ae_jumping_mt.cpp          |  122 -
 src/libaevol/tests/Test_ae_jumping_mt.h            |  157 -
 src/libaevol/tests/Test_ae_list.cpp                |  290 --
 src/libaevol/tests/Test_ae_list.h                  |  164 -
 src/post_treatments/IndivAnalysis.cpp              |  197 +
 src/post_treatments/IndivAnalysis.h                |   68 +
 src/post_treatments/Makefile.am                    |   50 +-
 src/post_treatments/Makefile.in                    |  459 +-
 src/post_treatments/ancestor_robustness.cpp        |  303 ++
 src/post_treatments/ancestor_stats.cpp             |  741 ++++
 src/post_treatments/ancstats.cpp                   |  889 ----
 src/post_treatments/compute_pop_stats.cpp          |  259 --
 src/post_treatments/create_eps.cpp                 | 1282 +++---
 src/post_treatments/extract.cpp                    |  799 ++--
 src/post_treatments/fixed_mutations.cpp            |  629 ---
 src/post_treatments/gene_families.cpp              |  872 ----
 src/post_treatments/lineage.cpp                    |  784 ++--
 src/post_treatments/mutagenesis.cpp                | 1185 +++++
 src/post_treatments/population_statistics.cpp      |  542 ---
 src/post_treatments/population_statistics.h        |  133 -
 src/post_treatments/robustness.cpp                 |  373 +-
 src/post_treatments/template.cpp                   |  193 -
 src/post_treatments/view.cpp                       |  158 +
 src/post_treatments/view_generation.cpp            |  167 -
 274 files changed, 52213 insertions(+), 52788 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index e2a3697..e72f11f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,8 +4,9 @@ Original authors:
   David P. Parsons
   
 Major Contributors:
-  B�r�nice Batut
-  Antoine Fr�noy
+  Bérénice Batut
+  Antoine Frénoy
+  Vincent Liard
   Dusan Misevic
   Virginie Mathivet
   Yolanda Sanchez-Dehesa
diff --git a/INSTALL b/INSTALL
index 7d1c323..2099840 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -12,8 +12,8 @@ without warranty of any kind.
 Basic Installation
 ==================
 
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
 instructions specific to this package.  Some packages provide this
 `INSTALL' file but do not implement all of the features documented
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
 parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
 a workaround.  If GNU CC is not installed, it is therefore recommended
@@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
 overridden in the site shell script).
 
 Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug.  Until the bug is fixed you can use this workaround:
+an Autoconf limitation.  Until the limitation is lifted, you can use
+this workaround:
 
-     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
 
 `configure' Invocation
 ======================
@@ -362,4 +368,3 @@ operates.
 
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
-
diff --git a/Makefile.am b/Makefile.am
index c8ee5ed..b9f7b10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,8 @@
-SUBDIRS = src doc
 
-EXTRA_DIST = examples
+# Specify the location of additional local Autoconf macros
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src doc
+EXTRA_DIST  = examples/basic/param.in
+EXTRA_DIST += examples/workflow/wild_type/param.in
+EXTRA_DIST += examples/workflow/README
diff --git a/Makefile.in b/Makefile.in
index 4b8a92c..cca4364 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -48,28 +85,47 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
-	ChangeLog INSTALL NEWS compile depcomp install-sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+	$(am__configure_deps) $(am__DIST_COMMON)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -77,12 +133,36 @@ am__can_run_installinfo = \
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir dist dist-all distcheck
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+	cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \
+	INSTALL NEWS README compile config.guess config.sub depcomp \
+	install-sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -92,6 +172,7 @@ am__remove_distdir = \
       && rm -rf "$(distdir)" \
       || { sleep 5 && rm -rf "$(distdir)"; }; \
   else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -119,6 +200,7 @@ am__relativize = \
   reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
 distuninstallcheck_listfiles = find . -type f -print
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -128,19 +210,21 @@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -152,6 +236,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -165,6 +251,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -195,14 +282,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -218,6 +313,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -226,8 +322,12 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Specify the location of additional local Autoconf macros
+ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = src doc
-EXTRA_DIST = examples
+EXTRA_DIST = examples/basic/param.in \
+	examples/workflow/wild_type/param.in examples/workflow/README
 all: all-recursive
 
 .SUFFIXES:
@@ -246,7 +346,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -267,22 +366,25 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -297,57 +399,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -363,12 +420,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -380,15 +432,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -397,9 +445,31 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
@@ -467,40 +537,42 @@ distdir: $(DISTFILES)
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-lzip: distdir
 	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-	$(am__remove_distdir)
-
-dist-lzma: distdir
-	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-xz: distdir
 	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-shar: distdir
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-zip: distdir
 	-rm -f $(distdir).zip
 	zip -rq $(distdir).zip $(distdir)
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
-dist dist-all: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
@@ -511,8 +583,6 @@ distcheck: dist
 	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lzma*) \
-	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.lz*) \
 	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
@@ -524,18 +594,19 @@ distcheck: dist
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
-	chmod -R a-w $(distdir); chmod u+w $(distdir)
-	mkdir $(distdir)/_build
-	mkdir $(distdir)/_inst
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
-	  && $(am__cd) $(distdir)/_build \
-	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	  && $(am__cd) $(distdir)/_build/sub \
+	  && ../../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -558,7 +629,7 @@ distcheck: dist
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
 	  && cd "$$am__cwd" \
 	  || exit 1
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -692,13 +763,12 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
+.MAKE: $(am__recursive_targets) install-am install-strip
 
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am am--refresh check check-am clean clean-generic \
-	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
-	dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+	dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
 	distcheck distclean distclean-generic distclean-tags \
 	distcleancheck distdir distuninstallcheck dvi dvi-am html \
 	html-am info info-am install install-am install-data \
@@ -708,7 +778,9 @@ uninstall-am:
 	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs installdirs-am maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+	pdf-am ps ps-am tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/NEWS b/NEWS
index fe2209a..5f2d69d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+New in 5.0: [TO BE CONTINUED]
+
+* Grid
+
+* Command-line options
+
+* Post-treatments refactoring
+
+* New color map in X outputs for fitness visualization. The scale now
+  ranges from green (good) to red (bad).
+
 New in 4.4:
 
 * aevol_create now gives a name to the created strain. It can be defined using
diff --git a/README b/README
index 0a31f73..c371c9e 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@ distributions. Please visit www.aevol.fr
 To take a quick tour, please take the following steps:
 
 1) install aevol
-  cd into the main dir
+  cd into aevol main dir
   ./configure
   make
   sudo make install
@@ -40,17 +40,17 @@ To take a quick tour, please take the following steps:
 
   NOTE: If you don't have sudo rights or simply don't want to install aevol
   just yet, skip the "sudo make install" step and run the executables "locally"
-  with ../../src/aevol_create and ../../src/aevol_run_X11
+  with ../../src/aevol_create and ../../src/aevol_run
 
 
 2) To run an example, cd into it then run:
    aevol_create
-   aevol_run_X11
+   aevol_run
    
 The first command will create an experiment with the parameters contained
 in the "param.in" file
 The second command will launch the simulation for 1000 generations
-(use --nbgener XXX or -n XXX to run for XXX generations)
+(use --nb-timesteps XXX or -n XXX to run for XXX generations)
 
 For more information, please see the manpages (e.g. man aevol_create), run any
 executable with the -h option (e.g. aevol_create -h) and ultimately visit 
diff --git a/aclocal.m4 b/aclocal.m4
index 6bba7a5..314a356 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,126 +11,31 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
 [m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
-dnl
-dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl
-AC_DEFUN([AM_PATH_CPPUNIT],
-[
-
-AC_ARG_WITH(cppunit-prefix,[  --with-cppunit-prefix=PFX   Prefix where CppUnit is installed (optional)],
-            cppunit_config_prefix="$withval", cppunit_config_prefix="")
-AC_ARG_WITH(cppunit-exec-prefix,[  --with-cppunit-exec-prefix=PFX  Exec prefix where CppUnit is installed (optional)],
-            cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
-
-  if test x$cppunit_config_exec_prefix != x ; then
-     cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
-     if test x${CPPUNIT_CONFIG+set} != xset ; then
-        CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
-     fi
-  fi
-  if test x$cppunit_config_prefix != x ; then
-     cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
-     if test x${CPPUNIT_CONFIG+set} != xset ; then
-        CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
-     fi
-  fi
-
-  AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
-  cppunit_version_min=$1
-
-  AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
-  no_cppunit=""
-  if test "$CPPUNIT_CONFIG" = "no" ; then
-    AC_MSG_RESULT(no)
-    no_cppunit=yes
-  else
-    CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
-    CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
-    cppunit_version=`$CPPUNIT_CONFIG --version`
-
-    cppunit_major_version=`echo $cppunit_version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    cppunit_minor_version=`echo $cppunit_version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    cppunit_micro_version=`echo $cppunit_version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
-    cppunit_major_min=`echo $cppunit_version_min | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    if test "x${cppunit_major_min}" = "x" ; then
-       cppunit_major_min=0
-    fi
-    
-    cppunit_minor_min=`echo $cppunit_version_min | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    if test "x${cppunit_minor_min}" = "x" ; then
-       cppunit_minor_min=0
-    fi
-    
-    cppunit_micro_min=`echo $cppunit_version_min | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-    if test "x${cppunit_micro_min}" = "x" ; then
-       cppunit_micro_min=0
-    fi
-
-    cppunit_version_proper=`expr \
-        $cppunit_major_version \> $cppunit_major_min \| \
-        $cppunit_major_version \= $cppunit_major_min \& \
-        $cppunit_minor_version \> $cppunit_minor_min \| \
-        $cppunit_major_version \= $cppunit_major_min \& \
-        $cppunit_minor_version \= $cppunit_minor_min \& \
-        $cppunit_micro_version \>= $cppunit_micro_min `
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-    if test "$cppunit_version_proper" = "1" ; then
-      AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
-    else
-      AC_MSG_RESULT(no)
-      no_cppunit=yes
-    fi
-  fi
-
-  if test "x$no_cppunit" = x ; then
-     ifelse([$2], , :, [$2])     
-  else
-     CPPUNIT_CFLAGS=""
-     CPPUNIT_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
-
-  AC_SUBST(CPPUNIT_CFLAGS)
-  AC_SUBST(CPPUNIT_LIBS)
-])
-
-
-
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.15], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -147,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.15])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -183,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -201,30 +103,26 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 # configured tree to be moved without reconfiguration.
 
 AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 ])
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -243,16 +141,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
 
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -262,7 +158,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -275,12 +171,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -288,8 +185,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -329,16 +226,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -347,8 +244,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -356,7 +253,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -404,7 +301,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -414,9 +311,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
@@ -431,20 +332,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -457,7 +356,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -469,21 +368,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
@@ -501,7 +398,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
 # This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
+# is enabled.  FIXME.  This creates each '.P' file that we will
 # need in order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
@@ -511,18 +408,21 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
-
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -535,7 +435,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -564,33 +464,42 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@@ -599,34 +508,82 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake at gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+  fi
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
 ])
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 
-
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
 # that is generated.  The stamp files are numbered to have different names.
@@ -648,21 +605,18 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\	*)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -670,16 +624,14 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
 
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -695,14 +647,12 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -720,7 +670,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -745,52 +695,14 @@ AC_MSG_RESULT([$_am_result])
 rm -f confinc confmf
 ])
 
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 6
-
-# AM_PROG_CC_C_O
-# --------------
-# Like AC_PROG_CC_C_O, but changed for automake.
-AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
-dnl Make sure AC_PROG_CC is never called again, or it will override our
-dnl setting of CC.
-m4_define([AC_PROG_CC],
-          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
-])
-
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -798,11 +710,10 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
-
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -815,54 +726,22 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
+  AC_MSG_WARN(['missing' script is too old or missing])
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -872,7 +751,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 # --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
 # ------------------------
@@ -886,24 +765,82 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -914,32 +851,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$[2]" = conftest.file
    )
 then
@@ -949,46 +894,118 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # AM_PROG_INSTALL_STRIP
 # ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 3
-
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -1002,18 +1019,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -1023,77 +1038,120 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
 [# Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
 
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([m4/ax_boost_base.m4])
+m4_include([m4/ax_boost_filesystem.m4])
+m4_include([m4/ax_boost_system.m4])
+m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
+m4_include([m4/ax_cxx_compile_stdcxx_14.m4])
diff --git a/compile b/compile
index c0096a7..531136b 100755
--- a/compile
+++ b/compile
@@ -1,10 +1,9 @@
 #! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
+# Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2012-10-14.11; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
-# Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -29,21 +28,224 @@ scriptversion=2009-10-06.20; # UTC
 # bugs to <bug-automake at gnu.org> or send patches to
 # <automake-patches at gnu.org>.
 
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""	$nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+	# lazily determine how to convert abs files
+	case `uname -s` in
+	  MINGW*)
+	    file_conv=mingw
+	    ;;
+	  CYGWIN*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv/,$2, in
+	*,$file_conv,*)
+	  ;;
+	mingw/*)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine/*)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+	-o)
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
+	  eat=1
+	  case $2 in
+	    *.o | *.[oO][bB][jJ])
+	      func_file_conv "$2"
+	      set x "$@" -Fo"$file"
+	      shift
+	      ;;
+	    *)
+	      func_file_conv "$2"
+	      set x "$@" -Fe"$file"
+	      shift
+	      ;;
+	  esac
+	  ;;
+	-I)
+	  eat=1
+	  func_file_conv "$2" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-I*)
+	  func_file_conv "${1#-I}" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-l)
+	  eat=1
+	  func_cl_dashl "$2"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-l*)
+	  func_cl_dashl "${1#-l}"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-L)
+	  eat=1
+	  func_cl_dashL "$2"
+	  ;;
+	-L*)
+	  func_cl_dashL "${1#-L}"
+	  ;;
+	-static)
+	  shared=false
+	  ;;
+	-Wl,*)
+	  arg=${1#-Wl,}
+	  save_ifs="$IFS"; IFS=','
+	  for flag in $arg; do
+	    IFS="$save_ifs"
+	    linker_opts="$linker_opts $flag"
+	  done
+	  IFS="$save_ifs"
+	  ;;
+	-Xlinker)
+	  eat=1
+	  linker_opts="$linker_opts $2"
+	  ;;
+	-*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+	  func_file_conv "$1"
+	  set x "$@" -Tp"$file"
+	  shift
+	  ;;
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+	  func_file_conv "$1" mingw
+	  set x "$@" "$file"
+	  shift
+	  ;;
+	*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
     cat <<\EOF
 Usage: compile [--help] [--version] PROGRAM [ARGS]
 
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
 arguments, and rename the output as expected.
 
 If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
+right script to run: please start by reading the file 'INSTALL'.
 
 Report bugs to <bug-automake at gnu.org>.
 EOF
@@ -53,11 +255,13 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
 esac
 
 ofile=
 cfile=
-eat=
 
 for arg
 do
@@ -66,8 +270,8 @@ do
   else
     case $1 in
       -o)
-	# configure might choose to run compile as `compile cc -o foo foo.c'.
-	# So we strip `-o arg' only if arg is an object.
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
+	# So we strip '-o arg' only if arg is an object.
 	eat=1
 	case $2 in
 	  *.o | *.obj)
@@ -94,10 +298,10 @@ do
 done
 
 if test -z "$ofile" || test -z "$cfile"; then
-  # If no `-o' option was seen then we might have been invoked from a
+  # If no '-o' option was seen then we might have been invoked from a
   # pattern rule where we don't need one.  That is ok -- this is a
   # normal compilation that the losing compiler can handle.  If no
-  # `.c' file was seen then we are probably linking.  That is also
+  # '.c' file was seen then we are probably linking.  That is also
   # ok.
   exec "$@"
 fi
@@ -106,7 +310,7 @@ fi
 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
 
 # Create the lock directory.
-# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
 # that we are using for the .o file.  Also, base the name on the expected
 # object file name, since that is what matters with a parallel build.
 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..1f5c50c
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1420 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-03-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+		os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+	echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[4567])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			esac ;;
+		    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^		//' << EOF >$dummy.c
+
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+	exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+	exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+	exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+	exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    5000:UNIX_System_V:4.*:*)
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    *:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
+    i*:windows32*:*)
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	else
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+	    fi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    cris:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	exit ;;
+    crisv32:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	exit ;;
+    frv:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    i*86:Linux:*:*)
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	;;
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
+	exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-${LIBC}
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-${LIBC}
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+	exit ;;
+    sh64*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	exit ;;
+    x86_64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    xtensa*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+	# Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel at ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+		echo mips-nec-sysv${UNAME_RELEASE}
+	else
+		echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    grep IS_64BIT_ARCH >/dev/null
+		then
+		    case $UNAME_PROCESSOR in
+			i386) UNAME_PROCESSOR=x86_64 ;;
+			powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		    esac
+		fi
+	    fi
+	elif test "$UNAME_PROCESSOR" = i386 ; then
+	    # Avoid executing cc on OS X 10.9, as it ships with a stub
+	    # that puts up a graphical alert prompting to install
+	    # developer tools.  Any system running Mac OS X 10.7 or
+	    # later (Darwin 11 and later) is required to have a 64-bit
+	    # processor. This is not true of the ARM version of Darwin
+	    # that Apple uses in portable devices.
+	    UNAME_PROCESSOR=x86_64
+	fi
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+	echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
+esac
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..bba4efb
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1799 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-09-11'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze*)
+		os=
+		basic_machine=$1
+		;;
+	-bluegene*)
+		os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+	-chorusrdb)
+		os=-chorusrdb
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| aarch64 | aarch64_be \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
+	| bfin \
+	| c4x | c8051 | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| k1om \
+	| le32 | le64 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa32r6 | mipsisa32r6el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64r6 | mipsisa64r6el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 | nios2eb | nios2el \
+	| ns16k | ns32k \
+	| open8 | or1k | or1knd | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pyramid \
+	| riscv32 | riscv64 \
+	| rl78 | rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| we32k \
+	| x86 | xc16x | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| aarch64-* | aarch64_be-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| be32-* | be64-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| c8051-* | clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| k1om-* \
+	| le32-* | le64-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa32r6-* | mipsisa32r6el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64r6-* | mipsisa64r6el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| or1k*-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pyramid-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16 | cr16-*)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	microblaze*)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
+	mingw32)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	msys)
+		basic_machine=i686-pc
+		os=-msys
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc | ppcbe)	basic_machine=powerpc-unknown
+		;;
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tile*)
+		basic_machine=$basic_machine-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+	# First match some system type aliases
+	# that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	c8051-*)
+		os=-elf
+		;;
+	hexagon-*)
+		os=-elf
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
index 12b5c58..b3bd9b6 100755
--- a/configure
+++ b/configure
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for AEVOL 4.4.
+# Generated by GNU Autoconf 2.69 for AEVOL 5.0.
 #
-# Report bugs to <aevol-bug-report at lists.gforge.liris.cnrs.fr>.
+# Report bugs to <aevol-bugs at lists.gforge.inria.fr>.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -267,8 +267,8 @@ fi
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
     $as_echo "$0: Please tell bug-autoconf at gnu.org and
-$0: aevol-bug-report at lists.gforge.liris.cnrs.fr about your
-$0: system, including any error possibly output before this
+$0: aevol-bugs at lists.gforge.inria.fr about your system,
+$0: including any error possibly output before this
 $0: message. Then install a modern shell, or manually run
 $0: the script under such a shell if you do have one."
   fi
@@ -580,9 +580,9 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='AEVOL'
 PACKAGE_TARNAME='aevol'
-PACKAGE_VERSION='4.4'
-PACKAGE_STRING='AEVOL 4.4'
-PACKAGE_BUGREPORT='aevol-bug-report at lists.gforge.liris.cnrs.fr'
+PACKAGE_VERSION='5.0'
+PACKAGE_STRING='AEVOL 5.0'
+PACKAGE_BUGREPORT='aevol-bugs at lists.gforge.inria.fr'
 PACKAGE_URL='www.aevol.fr'
 
 ac_unique_file="src/aevol_run.cpp"
@@ -626,17 +626,24 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
-WITH_IN2P3_FALSE
-WITH_IN2P3_TRUE
+WITH_TRACING_FALSE
+WITH_TRACING_TRUE
+WITH_TBB_FALSE
+WITH_TBB_TRUE
+WITH_ATLAS_FALSE
+WITH_ATLAS_TRUE
+WITH_MKL_FALSE
+WITH_MKL_TRUE
+WITH_BLAS_FALSE
+WITH_BLAS_TRUE
+WITH_RAEVOL_FALSE
+WITH_RAEVOL_TRUE
+WITH_PROFILING_FALSE
+WITH_PROFILING_TRUE
 WITH_DEBUG_FALSE
 WITH_DEBUG_TRUE
-WITH_CPPUNIT_FALSE
-WITH_CPPUNIT_TRUE
 WANT_DOXYGEN_FALSE
 WANT_DOXYGEN_TRUE
-CPPUNIT_LIBS
-CPPUNIT_CFLAGS
-CPPUNIT_CONFIG
 HAVE_DOXYGEN
 ENABLE_DEVEL_FALSE
 ENABLE_DEVEL_TRUE
@@ -653,19 +660,34 @@ X_CFLAGS
 XMKMF
 WITH_X_FALSE
 WITH_X_TRUE
-EGREP
-GREP
-CPP
 AEVOLLDFLAGS
 AEVOLCXXFLAGS
 AEVOLCPPFLAGS
-RANLIB
+BOOST_FILESYSTEM_LIB
+BOOST_SYSTEM_LIB
+BOOST_LDFLAGS
+BOOST_CPPFLAGS
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+EGREP
+GREP
+CXXCPP
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
 ac_ct_CC
 CFLAGS
 CC
+OPENMP_CXXFLAGS
+RANLIB
+HAVE_CXX11
+HAVE_CXX14
 am__fastdepCXX_FALSE
 am__fastdepCXX_TRUE
 CXXDEPMODE
@@ -683,6 +705,10 @@ CPPFLAGS
 LDFLAGS
 CXXFLAGS
 CXX
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
 am__untar
 am__tar
 AMTAR
@@ -725,6 +751,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -747,17 +774,27 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_silent_rules
 enable_dependency_tracking
+enable_openmp
+with_boost
+with_boost_libdir
+with_boost_system
+with_boost_filesystem
 with_x
 enable_optim
 enable_normalized_fitness
 enable_mtperiod
 enable_trivialjumps
 enable_devel
-with_cppunit_prefix
-with_cppunit_exec_prefix
 enable_debug
-enable_in2p3
+enable_profiling
+with_raevol
+with_blas
+with_mkl
+with_atlas
+with_tbb
+with_tracing
 '
       ac_precious_vars='build_alias
 host_alias
@@ -770,7 +807,7 @@ CPPFLAGS
 CCC
 CC
 CFLAGS
-CPP
+CXXCPP
 XMKMF'
 
 
@@ -810,6 +847,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1062,6 +1100,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1199,7 +1246,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1312,7 +1359,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures AEVOL 4.4 to adapt to many kinds of systems.
+\`configure' configures AEVOL 5.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1352,6 +1399,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1377,12 +1425,16 @@ Program names:
 X features:
   --x-includes=DIR    X include files are in DIR
   --x-libraries=DIR   X library files are in DIR
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
 _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of AEVOL 4.4:";;
+     short | recursive ) echo "Configuration of AEVOL 5.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1390,8 +1442,13 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
+  --disable-openmp        do not use OpenMP
   --disable-optim turn off compile time optimization
   --enable-normalized-fitness to enable fitness normalization
   --enable-mtperiod=period
@@ -1420,15 +1477,36 @@ Optional Features:
 
   --enable-devel turn on development features
   --enable-debug to enable degugging features
-  --enable-in2p3 to enable IN2P3 specific features
+  --enable-profiling to enable profiling
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-boost[=ARG]      use Boost library from a standard location
+                          (ARG=yes), from the specified location (ARG=<path>),
+                          or disable it (ARG=no) [ARG=yes]
+  --with-boost-libdir=LIB_DIR
+                          Force given directory for boost libraries. Note that
+                          this will override library path detection, so use
+                          this parameter only if default library detection
+                          fails and you know exactly where your boost
+                          libraries are located.
+  --with-boost-system[=special-lib]
+                          use the System library from boost - it is possible
+                          to specify a certain library for the linker e.g.
+                          --with-boost-system=boost_system-gcc-mt
+  --with-boost-filesystem[=special-lib]
+                          use the Filesystem library from boost - it is
+                          possible to specify a certain library for the linker
+                          e.g. --with-boost-filesystem=boost_filesystem-gcc-mt
   --without-x to disable graphical output
   --with-x                use the X Window System
-  --with-cppunit-prefix=PFX   Prefix where CppUnit is installed (optional)
-  --with-cppunit-exec-prefix=PFX  Exec prefix where CppUnit is installed (optional)
+--with-raevol to enable regulation
+--with-blas to the use of BLAS library
+--with-mkl to the use of MKL library
+--with-atlas to the use of ATLAS library
+--with-tbb to the use of TBB library
+--with-tracing to enable tracing
 
 Some influential environment variables:
   CXX         C++ compiler command
@@ -1440,13 +1518,13 @@ Some influential environment variables:
               you have headers in a nonstandard directory <include dir>
   CC          C compiler command
   CFLAGS      C compiler flags
-  CPP         C preprocessor
+  CXXCPP      C++ preprocessor
   XMKMF       Path to xmkmf, Makefile generator for X Window System
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <aevol-bug-report at lists.gforge.liris.cnrs.fr>.
+Report bugs to <aevol-bugs at lists.gforge.inria.fr>.
 AEVOL home page: <www.aevol.fr>.
 _ACEOF
 ac_status=$?
@@ -1510,7 +1588,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-AEVOL configure 4.4
+AEVOL configure 5.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1562,21 +1640,21 @@ fi
 
 } # ac_fn_cxx_try_compile
 
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
-  if { { ac_try="$ac_compile"
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
 $as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>conftest.err
+  (eval "$ac_link") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
     grep -v '^ *+' conftest.err >conftest.er1
@@ -1585,9 +1663,12 @@ $as_echo "$ac_try_echo"; } >&5
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
+	 test -z "$ac_cxx_werror_flag" ||
 	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
   ac_retval=0
 else
   $as_echo "$as_me: failed program was:" >&5
@@ -1595,26 +1676,31 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_compile
+} # ac_fn_cxx_try_link
 
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
 $as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
+  (eval "$ac_compile") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
     grep -v '^ *+' conftest.err >conftest.er1
@@ -1625,10 +1711,7 @@ $as_echo "$ac_try_echo"; } >&5
   test $ac_status = 0; } && {
 	 test -z "$ac_c_werror_flag" ||
 	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
+       } && test -s conftest.$ac_objext; then :
   ac_retval=0
 else
   $as_echo "$as_me: failed program was:" >&5
@@ -1636,20 +1719,15 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_link
+} # ac_fn_c_try_compile
 
-# ac_fn_c_try_cpp LINENO
-# ----------------------
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
+ac_fn_cxx_try_cpp ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   if { { ac_try="$ac_cpp conftest.$ac_ext"
@@ -1668,7 +1746,7 @@ $as_echo "$ac_try_echo"; } >&5
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
 	 test ! -s conftest.err
        }; then :
   ac_retval=0
@@ -1681,14 +1759,14 @@ fi
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_cpp
+} # ac_fn_cxx_try_cpp
 
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
+# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
 # the include files in INCLUDES and setting the cache variable VAR
 # accordingly.
-ac_fn_c_check_header_mongrel ()
+ac_fn_cxx_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   if eval \${$3+:} false; then :
@@ -1709,7 +1787,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 $4
 #include <$2>
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
   ac_header_compiler=yes
 else
   ac_header_compiler=no
@@ -1725,7 +1803,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <$2>
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_cxx_try_cpp "$LINENO"; then :
   ac_header_preproc=yes
 else
   ac_header_preproc=no
@@ -1735,7 +1813,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext
 $as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
   yes:no: )
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -1753,9 +1831,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ---------------------------------------------------------- ##
-## Report this to aevol-bug-report at lists.gforge.liris.cnrs.fr ##
-## ---------------------------------------------------------- ##"
+( $as_echo "## ----------------------------------------------- ##
+## Report this to aevol-bugs at lists.gforge.inria.fr ##
+## ----------------------------------------------- ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
@@ -1772,13 +1850,13 @@ $as_echo "$ac_res" >&6; }
 fi
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_header_mongrel
+} # ac_fn_cxx_check_header_mongrel
 
-# ac_fn_c_try_run LINENO
-# ----------------------
+# ac_fn_cxx_try_run LINENO
+# ------------------------
 # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
 # that executables *can* be run.
-ac_fn_c_try_run ()
+ac_fn_cxx_try_run ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   if { { ac_try="$ac_link"
@@ -1814,13 +1892,13 @@ fi
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_run
+} # ac_fn_cxx_try_run
 
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
+# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
 # Tests whether HEADER exists and can be compiled using the include files in
 # INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
+ac_fn_cxx_check_header_compile ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
@@ -1833,7 +1911,7 @@ else
 $4
 #include <$2>
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
   eval "$3=yes"
 else
   eval "$3=no"
@@ -1845,13 +1923,13 @@ eval ac_res=\$$3
 $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_header_compile
+} # ac_fn_cxx_check_header_compile
 
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
+# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES
+# ---------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
 # variable VAR accordingly.
-ac_fn_c_check_type ()
+ac_fn_cxx_check_type ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
@@ -1872,7 +1950,7 @@ if (sizeof ($2))
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $4
@@ -1885,7 +1963,7 @@ if (sizeof (($2)))
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
 
 else
   eval "$3=yes"
@@ -1899,7 +1977,7 @@ eval ac_res=\$$3
 $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_type
+} # ac_fn_cxx_check_type
 
 # ac_fn_c_find_intX_t LINENO BITS VAR
 # -----------------------------------
@@ -1933,7 +2011,7 @@ return test_array [0];
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
@@ -1950,7 +2028,7 @@ return test_array [0];
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
 
 else
   case $ac_type in #(
@@ -2008,7 +2086,7 @@ return test_array [0];
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
   case $ac_type in #(
   uint$2_t) :
     eval "$3=yes" ;; #(
@@ -2031,10 +2109,10 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_find_uintX_t
 
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
+# ac_fn_cxx_check_func LINENO FUNC VAR
+# ------------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
+ac_fn_cxx_check_func ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
@@ -2083,7 +2161,7 @@ return $2 ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   eval "$3=yes"
 else
   eval "$3=no"
@@ -2096,12 +2174,12 @@ eval ac_res=\$$3
 $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_func
+} # ac_fn_cxx_check_func
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by AEVOL $as_me 4.4, which was
+It was created by AEVOL $as_me 5.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2450,8 +2528,25 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+# Set C++ as the main language
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+# Change default value for CXXFLAGS
+test_CXXFLAGS=${CXXFLAGS+set}
+if test "$test_CXXFLAGS" != set; then
+  CXXFLAGS=""
+fi
+
+# Specify the location of additional local Autoconf macros
+
+
 # We want to use automake
-am__api_version='1.11'
+am__api_version='1.15'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2577,9 +2672,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -2590,32 +2682,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$2" = conftest.file
    )
 then
@@ -2627,6 +2727,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2637,8 +2747,8 @@ test "$program_suffix" != NONE &&
 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 if test x"${MISSING+set}" != xset; then
   case $am_aux_dir in
@@ -2649,15 +2759,15 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\	*)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -2666,10 +2776,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2808,12 +2918,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2896,6 +3000,45 @@ else
 fi
 rmdir .tst 2>/dev/null
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
   # is not polluted with repeated "-I."
@@ -2918,7 +3061,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='aevol'
- VERSION='4.4'
+ VERSION='5.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2946,12 +3089,22 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AMTAR='$${TAR-tar}'
 
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
+
 am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
@@ -2959,21 +3112,50 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
-# Check the existance of an arbitrary source file
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
 
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
 
-# Build config.h using config.h.in as a template
-#AC_CONFIG_HEADERS([config.h:config.h.in])
+Please tell bug-automake at gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
 
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
 
-# Change default value for CXXFLAGS
-test_CXXFLAGS=${CXXFLAGS+set}
-if test "$test_CXXFLAGS" != set; then
-  CXXFLAGS=""
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+  fi
 fi
 
 
-# Checks for programs
+# Select compiler
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2984,7 +3166,7 @@ if test -z "$CXX"; then
     CXX=$CCC
   else
     if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  for ac_prog in clang-omp++ clang++ g++ icc
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -3028,7 +3210,7 @@ fi
 fi
 if test -z "$CXX"; then
   ac_ct_CXX=$CXX
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  for ac_prog in clang-omp++ clang++ g++ icc
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -3475,11 +3657,11 @@ else
     CXXFLAGS=
   fi
 fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3499,7 +3681,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -3555,8 +3737,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -3591,16 +3773,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -3609,8 +3791,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -3618,7 +3800,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -3672,114 +3854,307 @@ else
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+
+# Detect C++11 or C++14
+
+    ax_cxx_compile_cxx14_required=false
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+  ac_success=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++14 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx14+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_cxx_compile_cxx14=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  ax_cv_cxx_compile_cxx14=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx14" >&5
+$as_echo "$ax_cv_cxx_compile_cxx14" >&6; }
+  if test x$ax_cv_cxx_compile_cxx14 = xyes; then
+    ac_success=yes
+  fi
 
 
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
+
+    if test x$ac_success = xno; then
+    for switch in -std=c++14 -std=c++1y; do
+      cachevar=`$as_echo "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5
+$as_echo_n "checking whether $CXX supports C++14 features with $switch... " >&6; }
+if eval \${$cachevar+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval $cachevar=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  eval $cachevar=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         CXXFLAGS="$ac_save_CXXFLAGS"
+fi
+eval ac_res=\$$cachevar
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-  if test "x$ac_ct_CC" = x; then
-    CC=""
+  if test x$ax_cxx_compile_cxx14_required = xtrue; then
+    if test x$ac_success = xno; then
+      as_fn_error $? "*** A compiler with support for C++14 language features is required." "$LINENO" 5
+    fi
   else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
+    if test x$ac_success = xno; then
+      HAVE_CXX14=0
+      { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++14 support was found" >&5
+$as_echo "$as_me: No compiler with C++14 support was found" >&6;}
+    else
+      HAVE_CXX14=1
+
+$as_echo "#define HAVE_CXX14 1" >>confdefs.h
+
+    fi
+
+
   fi
+
+    ax_cxx_compile_cxx11_required=true
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+  ac_success=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx11+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  CC="$ac_cv_prog_CC"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_cxx_compile_cxx11=yes
+else
+  ax_cv_cxx_compile_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
+$as_echo "$ax_cv_cxx_compile_cxx11" >&6; }
+  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+    ac_success=yes
+  fi
 
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
+
+
+    if test x$ac_success = xno; then
+    for switch in -std=c++11 -std=c++1y; do
+      cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
+$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
+if eval \${$cachevar+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval $cachevar=yes
+else
+  eval $cachevar=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         CXXFLAGS="$ac_save_CXXFLAGS"
+fi
+eval ac_res=\$$cachevar
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  if test x$ax_cxx_compile_cxx11_required = xtrue; then
+    if test x$ac_success = xno; then
+      as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5
+    fi
+  else
+    if test x$ac_success = xno; then
+      HAVE_CXX11=0
+      { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5
+$as_echo "$as_me: No compiler with C++11 support was found" >&6;}
+    else
+      HAVE_CXX11=1
+
+$as_echo "#define HAVE_CXX11 1" >>confdefs.h
+
+    fi
+
+
+  fi
+
+
+#if test -z "$HAVE_CXX14";
+#fi
+
+# Check the existance of an arbitrary source file
+
+
+# Build config.h using config.h.in as a template
+#AC_CONFIG_HEADERS([config.h:config.h.in])
+
+# Checks for programs
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -3788,7 +4163,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3798,30 +4173,29 @@ IFS=$as_save_IFS
 
 fi
 fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  fi
 fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
 else
-  ac_prog_rejected=no
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
@@ -3829,11 +4203,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3841,37 +4211,106 @@ done
   done
 IFS=$as_save_IFS
 
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
 fi
 fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
 
+  OPENMP_CXXFLAGS=
+  # Check whether --enable-openmp was given.
+if test "${enable_openmp+set}" = set; then :
+  enableval=$enable_openmp;
 fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+
+  if test "$enable_openmp" != no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support OpenMP" >&5
+$as_echo_n "checking for $CXX option to support OpenMP... " >&6; }
+if ${ac_cv_prog_cxx_openmp+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_prog_cxx_openmp='none needed'
+else
+  ac_cv_prog_cxx_openmp='unsupported'
+	  	  	  	  	  	  	                                	  	  	  	  	  	  for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
+                           -Popenmp --openmp; do
+	    ac_save_CXXFLAGS=$CXXFLAGS
+	    CXXFLAGS="$CXXFLAGS $ac_option"
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_prog_cxx_openmp=$ac_option
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	    CXXFLAGS=$ac_save_CXXFLAGS
+	    if test "$ac_cv_prog_cxx_openmp" != unsupported; then
+	      break
+	    fi
+	  done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_openmp" >&5
+$as_echo "$ac_cv_prog_cxx_openmp" >&6; }
+    case $ac_cv_prog_cxx_openmp in #(
+      "none needed" | unsupported)
+	;; #(
+      *)
+	OPENMP_CXXFLAGS=$ac_cv_prog_cxx_openmp ;;
+    esac
+  fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_prog_CC+:} false; then :
@@ -3887,7 +4326,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3907,15 +4346,11 @@ $as_echo "no" >&6; }
 fi
 
 
-    test -n "$CC" && break
-  done
 fi
-if test -z "$CC"; then
+if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_prog_ac_ct_CC+:} false; then :
@@ -3931,7 +4366,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
+    ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3950,10 +4385,6 @@ else
 $as_echo "no" >&6; }
 fi
 
-
-  test -n "$ac_ct_CC" && break
-done
-
   if test "x$ac_ct_CC" = x; then
     CC=""
   else
@@ -3965,13 +4396,213 @@ ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
   fi
+else
+  CC="$ac_cv_prog_CC"
 fi
 
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
 See \`config.log' for more details" "$LINENO" 5; }
 
@@ -4205,11 +4836,70 @@ if test "x$ac_cv_prog_cc_c89" != xno; then :
 
 fi
 
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
 
 depcc="$CC"   am_compiler_list=
 
@@ -4222,8 +4912,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -4258,16 +4948,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -4276,8 +4966,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -4285,7 +4975,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4340,112 +5030,283 @@ fi
 
 
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
+
+# Print warning if openmp not found
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
 
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  # Broken: fails on valid input.
+continue
 fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
 
 fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&6
+  CXXCPP=$ac_cv_prog_CXXCPP
 else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
   done
-IFS=$as_save_IFS
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  ac_cv_path_GREP=$GREP
 fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
-    RANLIB=$ac_ct_RANLIB
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
-  RANLIB="$ac_cv_prog_RANLIB"
+  ac_cv_path_EGREP=$EGREP
 fi
 
-if test "x$CC" != xcc; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
-$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
-$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+   fi
 fi
-set dummy $CC; ac_cc=`$as_echo "$2" |
-		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
 int
 main ()
@@ -4455,857 +5316,1307 @@ main ()
   return 0;
 }
 _ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } &&
-   test -f conftest2.$ac_objext && { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; };
-then
-  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
-  if test "x$CC" != xcc; then
-    # Test first that cc exists at all.
-    if { ac_try='cc -c conftest.$ac_ext >&5'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-      rm -f conftest2.*
-      if { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } &&
-	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; };
-      then
-	# cc works too.
-	:
-      else
-	# cc exists but doesn't like -o.
-	eval ac_cv_prog_cc_${ac_cc}_c_o=no
-      fi
-    fi
-  fi
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
 else
-  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+  ac_cv_header_stdc=no
 fi
-rm -f core conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
 
-$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
 fi
 
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-# Initialize configure-time defined flags
-AEVOLCPPFLAGS=""
- # C PreProcessor flags
-AEVOLCXXFLAGS=""
- # C++ Compile flags
-AEVOLLDFLAGS=""
-  # Linker flags
-
-
-# Checks for libraries.
+fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
-  $as_echo_n "(cached) " >&6
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
-char cos ();
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-return cos ();
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_m_cos=yes
+if ac_fn_cxx_try_run "$LINENO"; then :
+
 else
-  ac_cv_lib_m_cos=no
+  ac_cv_header_stdc=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
 
-else
-  as_fn_error $? "PACKAGE_NAME requires the math library, please install it." "$LINENO" 5
 fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5
-$as_echo_n "checking for gzread in -lz... " >&6; }
-if ${ac_cv_lib_z_gzread+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gzread ();
-int
-main ()
-{
-return gzread ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_gzread=yes
-else
-  ac_cv_lib_z_gzread=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5
-$as_echo "$ac_cv_lib_z_gzread" >&6; }
-if test "x$ac_cv_lib_z_gzread" = xyes; then :
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBZ 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
-  LIBS="-lz $LIBS"
+fi
+
+done
+
+
+ac_fn_cxx_check_header_mongrel "$LINENO" "omp.h" "ac_cv_header_omp_h" "$ac_includes_default"
+if test "x$ac_cv_header_omp_h" = xyes; then :
 
 else
-  as_fn_error $? "PACKAGE_NAME requires the zlib development library, please install it." "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: openmp not found - continuing without openmp support" >&5
+$as_echo "$as_me: WARNING: openmp not found - continuing without openmp support" >&2;}
 fi
 
 
 
-# Checks for header files.
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
+# Check for boost
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  # Broken: fails on valid input.
-continue
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then :
+  withval=$with_boost;
+    if test "$withval" = "no"; then
+        want_boost="no"
+    elif test "$withval" = "yes"; then
+        want_boost="yes"
+        ac_boost_path=""
+    else
+        want_boost="yes"
+        ac_boost_path="$withval"
+    fi
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
+else
+  want_boost="yes"
 fi
 
-    done
-    ac_cv_prog_CPP=$CPP
 
-fi
-  CPP=$ac_cv_prog_CPP
+
+
+# Check whether --with-boost-libdir was given.
+if test "${with_boost_libdir+set}" = set; then :
+  withval=$with_boost_libdir;
+        if test -d "$withval"
+        then
+                ac_boost_lib_path="$withval"
+        else
+                as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
+        fi
+
 else
-  ac_cv_prog_CPP=$CPP
+  ac_boost_lib_path=""
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
 
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+if test "x$want_boost" = "xyes"; then
+    boost_lib_version_req=1.55
+    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
+    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
+    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
+    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+        boost_lib_version_req_sub_minor="0"
+        fi
+    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5
+$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
+    succeeded=no
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+                        libsubdirs="lib"
+    ax_arch=`uname -m`
+    case $ax_arch in
+      x86_64)
+        libsubdirs="lib64 libx32 lib lib64"
+        ;;
+      ppc64|s390x|sparc64|aarch64|ppc64le)
+        libsubdirs="lib64 lib lib64 ppc64le"
+        ;;
+    esac
 
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+    libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
 
+    case ${host_cpu} in
+      i?86)
+        libsubdirs="lib/i386-${host_os} $libsubdirs"
+        ;;
+    esac
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
+                if test "$ac_boost_path" != ""; then
+        BOOST_CPPFLAGS="-I$ac_boost_path/include"
+        for ac_boost_path_tmp in $libsubdirs; do
+                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
+                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
+                        break
+                fi
+        done
+    elif test "$cross_compiling" != yes; then
+        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
+                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+                break;
+            fi
+        done
     fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
+            if test "$ac_boost_lib_path" != ""; then
+       BOOST_LDFLAGS="-L$ac_boost_lib_path"
     fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
 
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
+    CPPFLAGS_SAVED="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+    export CPPFLAGS
 
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
+    LDFLAGS_SAVED="$LDFLAGS"
+    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+    export LDFLAGS
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
+
+    #include <boost/version.hpp>
 
 int
 main ()
 {
 
+    #if BOOST_VERSION >= $WANT_BOOST_VERSION
+    // Everything is okay
+    #else
+    #  error Boost version is too old
+    #endif
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    succeeded=yes
+    found_system=yes
+
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
 
-fi
+            if test "x$succeeded" != "xyes"; then
+        CPPFLAGS="$CPPFLAGS_SAVED"
+        LDFLAGS="$LDFLAGS_SAVED"
+        BOOST_CPPFLAGS=
+        BOOST_LDFLAGS=
+        _version=0
+        if test "$ac_boost_path" != ""; then
+            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                    V_CHECK=`expr $_version_tmp \> $_version`
+                    if test "$V_CHECK" = "1" ; then
+                        _version=$_version_tmp
+                    fi
+                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+                done
+                                if test -z "$BOOST_CPPFLAGS"; then
+                    if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
+                        BOOST_CPPFLAGS="-I$ac_boost_path"
+                    fi
+                fi
+            fi
+        else
+            if test "$cross_compiling" != yes; then
+                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                            V_CHECK=`expr $_version_tmp \> $_version`
+                            if test "$V_CHECK" = "1" ; then
+                                _version=$_version_tmp
+                                best_path=$ac_boost_path
+                            fi
+                        done
+                    fi
+                done
+
+                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+                if test "$ac_boost_lib_path" = ""; then
+                    for libsubdir in $libsubdirs ; do
+                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                    done
+                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
+                fi
+            fi
+
+            if test "x$BOOST_ROOT" != "x"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
+                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+                        stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
+                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
+$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
+                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
+                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
+                    fi
+                fi
+            fi
+        fi
+
+        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+        export CPPFLAGS
+        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+        export LDFLAGS
+
+        ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
 
+        #include <boost/version.hpp>
+
+int
+main ()
+{
+
+        #if BOOST_VERSION >= $WANT_BOOST_VERSION
+        // Everything is okay
+        #else
+        #  error Boost version is too old
+        #endif
+
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        succeeded=yes
+        found_system=yes
 
-else
-  ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+    fi
 
+    if test "$succeeded" != "yes" ; then
+        if test "$_version" = "0" ; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
+$as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
+$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
+        fi
+        # execute ACTION-IF-NOT-FOUND (if present):
+        as_fn_error $? "boost not found, please check that you have boost installed on your system and retry" "$LINENO" 5
+    else
+
+
+
+$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
+
+        # execute ACTION-IF-FOUND (if present):
+        :
+    fi
+
+    CPPFLAGS="$CPPFLAGS_SAVED"
+    LDFLAGS="$LDFLAGS_SAVED"
 fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
+
+
+
+# Check whether --with-boost-system was given.
+if test "${with_boost_system+set}" = set; then :
+  withval=$with_boost_system;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_system_lib=""
+        else
+		    want_boost="yes"
+		ax_boost_user_system_lib="$withval"
+		fi
+
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
+  want_boost="yes"
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::System library is available" >&5
+$as_echo_n "checking whether the Boost::System library is available... " >&6; }
+if ${ax_cv_boost_system+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+			 CXXFLAGS_SAVE=$CXXFLAGS
+			 CXXFLAGS=
+
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/system/error_code.hpp>
 int
 main ()
 {
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
+boost::system::error_category *a = 0;
+  ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_system=yes
 else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+  ax_cv_boost_system=no
 fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_system" >&5
+$as_echo "$ax_cv_boost_system" >&6; }
+		if test "x$ax_cv_boost_system" = "xyes"; then
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
+$as_echo "#define HAVE_BOOST_SYSTEM /**/" >>confdefs.h
 
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
 
-for ac_header in inttypes.h limits.h stdint.h stdlib.h string.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+			LDFLAGS_SAVE=$LDFLAGS
+            if test "x$ax_boost_user_system_lib" = "x"; then
+                for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
 fi
 
-done
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
-$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if ${ac_cv_header_stdbool_h+:} false; then :
+				done
+                if test "x$link_system" != "xyes"; then
+                for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-             #include <stdbool.h>
-             #ifndef bool
-              "error: bool is not defined"
-             #endif
-             #ifndef false
-              "error: false is not defined"
-             #endif
-             #if false
-              "error: false is not 0"
-             #endif
-             #ifndef true
-              "error: true is not defined"
-             #endif
-             #if true != 1
-              "error: true is not 1"
-             #endif
-             #ifndef __bool_true_false_are_defined
-              "error: __bool_true_false_are_defined is not defined"
-             #endif
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
+fi
 
-             struct s { _Bool s: 1; _Bool t; } s;
+				done
+                fi
 
-             char a[true == 1 ? 1 : -1];
-             char b[false == 0 ? 1 : -1];
-             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-             char d[(bool) 0.5 == true ? 1 : -1];
-             /* See body of main program for 'e'.  */
-             char f[(_Bool) 0.0 == false ? 1 : -1];
-             char g[true];
-             char h[sizeof (_Bool)];
-             char i[sizeof s.t];
-             enum { j = false, k = true, l = false * true, m = true * 256 };
-             /* The following fails for
-                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
-             _Bool n[m];
-             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-             /* Catch a bug in an HP-UX C compiler.  See
-                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-              */
-             _Bool q = true;
-             _Bool *pq = &q;
+            else
+               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
 int
 main ()
 {
-
-             bool e = &s;
-             *pq |= q;
-             *pq |= ! q;
-             /* Refer to every declared value, to avoid compiler optimizations.  */
-             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                     + !m + !n + !o + !p + !q + !pq);
-
+return exit ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdbool_h=yes
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_header_stdbool_h=no
+  eval "$as_ac_Lib=no"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
-$as_echo "$ac_cv_header_stdbool_h" >&6; }
-   ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = xyes; then :
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE__BOOL 1
-_ACEOF
+                  done
 
+            fi
+            if test "x$ax_lib" = "x"; then
+                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
+            fi
+			if test "x$link_system" = "xno"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
 
-fi
+		CPPFLAGS="$CPPFLAGS_SAVED"
+	LDFLAGS="$LDFLAGS_SAVED"
+	fi
 
 
-if test $ac_cv_header_stdbool_h = yes; then
 
-$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+# Check whether --with-boost-filesystem was given.
+if test "${with_boost_filesystem+set}" = set; then :
+  withval=$with_boost_filesystem;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_filesystem_lib=""
+        else
+		    want_boost="yes"
+		ax_boost_user_filesystem_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if ${ac_cv_c_inline+:} false; then :
+
+	if test "x$want_boost" = "xyes"; then
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		LIBS_SAVED=$LIBS
+		LIBS="$LIBS $BOOST_SYSTEM_LIB"
+		export LIBS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Filesystem library is available" >&5
+$as_echo_n "checking whether the Boost::Filesystem library is available... " >&6; }
+if ${ax_cv_boost_filesystem+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/filesystem/path.hpp>
+int
+main ()
+{
+using namespace boost::filesystem;
+                                   path my_path( "foo/bar/data.txt" );
+                                   return 0;
+  ;
+  return 0;
+}
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_inline=$ac_kw
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_filesystem=yes
+else
+  ax_cv_boost_filesystem=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  test "$ac_cv_c_inline" != no && break
-done
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_filesystem" >&5
+$as_echo "$ax_cv_boost_filesystem" >&6; }
+		if test "x$ax_cv_boost_filesystem" = "xyes"; then
 
-case $ac_cv_c_inline in
-  inline | yes) ;;
-  *)
-    case $ac_cv_c_inline in
-      no) ac_val=;;
-      *) ac_val=$ac_cv_c_inline;;
-    esac
-    cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
+$as_echo "#define HAVE_BOOST_FILESYSTEM /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+            if test "x$ax_boost_user_filesystem_lib" = "x"; then
+                for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
 #endif
+char exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
 _ACEOF
-    ;;
-esac
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
 
-ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
-case $ac_cv_c_int16_t in #(
-  no|yes) ;; #(
-  *)
+				done
+                if test "x$link_filesystem" != "xyes"; then
+                for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cat >>confdefs.h <<_ACEOF
-#define int16_t $ac_cv_c_int16_t
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
 _ACEOF
-;;
-esac
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
 
-ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
-case $ac_cv_c_int32_t in #(
-  no|yes) ;; #(
-  *)
+				done
+		    fi
+            else
+               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cat >>confdefs.h <<_ACEOF
-#define int32_t $ac_cv_c_int32_t
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
 _ACEOF
-;;
-esac
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
 
-ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
-case $ac_cv_c_int8_t in #(
-  no|yes) ;; #(
-  *)
+                  done
 
-cat >>confdefs.h <<_ACEOF
-#define int8_t $ac_cv_c_int8_t
-_ACEOF
-;;
-esac
+            fi
+            if test "x$ax_lib" = "x"; then
+                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
+            fi
+			if test "x$link_filesystem" != "xyes"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
 
-ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
+		CPPFLAGS="$CPPFLAGS_SAVED"
+		LDFLAGS="$LDFLAGS_SAVED"
+		LIBS="$LIBS_SAVED"
+	fi
+
+
+# Initialize configure-time defined flags
+AEVOLCPPFLAGS=""
+ # C PreProcessor flags
+AEVOLCXXFLAGS="$OPENMP_CXXFLAGS"
+ # C++ Compile flags
+AEVOLLDFLAGS="$OPENMP_CXXFLAGS"
+  # Linker flags
 
+# Checks for libraries.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
 _ACEOF
-
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_lib_m_cos=yes
+else
+  ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
 
-ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
-case $ac_cv_c_uint32_t in #(
-  no|yes) ;; #(
-  *)
+  LIBS="-lm $LIBS"
 
-$as_echo "#define _UINT32_T 1" >>confdefs.h
+else
+  as_fn_error $? "PACKAGE_NAME requires the math library, please install it." "$LINENO" 5
+fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5
+$as_echo_n "checking for gzread in -lz... " >&6; }
+if ${ac_cv_lib_z_gzread+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cat >>confdefs.h <<_ACEOF
-#define uint32_t $ac_cv_c_uint32_t
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gzread ();
+int
+main ()
+{
+return gzread ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_lib_z_gzread=yes
+else
+  ac_cv_lib_z_gzread=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5
+$as_echo "$ac_cv_lib_z_gzread" >&6; }
+if test "x$ac_cv_lib_z_gzread" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
 _ACEOF
-;;
-  esac
-
-ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
-case $ac_cv_c_uint8_t in #(
-  no|yes) ;; #(
-  *)
-
-$as_echo "#define _UINT8_T 1" >>confdefs.h
 
+  LIBS="-lz $LIBS"
 
-cat >>confdefs.h <<_ACEOF
-#define uint8_t $ac_cv_c_uint8_t
-_ACEOF
-;;
-  esac
+else
+  as_fn_error $? "PACKAGE_NAME requires the zlib development library, please install it." "$LINENO" 5
+fi
 
 
-# Checks for library functions.
-for ac_func in floor memset mkdir pow rint sqrt gzread
+# Checks for header files.
+for ac_header in inttypes.h limits.h stdint.h stdlib.h string.h unistd.h
 do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
-done
-
-
 
+done
 
 
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+             #include <stdbool.h>
+             #ifndef bool
+              "error: bool is not defined"
+             #endif
+             #ifndef false
+              "error: false is not defined"
+             #endif
+             #if false
+              "error: false is not 0"
+             #endif
+             #ifndef true
+              "error: true is not defined"
+             #endif
+             #if true != 1
+              "error: true is not 1"
+             #endif
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
+             #endif
+
+             struct s { _Bool s: 1; _Bool t; } s;
+
+             char a[true == 1 ? 1 : -1];
+             char b[false == 0 ? 1 : -1];
+             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+             char d[(bool) 0.5 == true ? 1 : -1];
+             /* See body of main program for 'e'.  */
+             char f[(_Bool) 0.0 == false ? 1 : -1];
+             char g[true];
+             char h[sizeof (_Bool)];
+             char i[sizeof s.t];
+             enum { j = false, k = true, l = false * true, m = true * 256 };
+             /* The following fails for
+                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+             _Bool n[m];
+             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+             /* Catch a bug in an HP-UX C compiler.  See
+                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+              */
+             _Bool q = true;
+             _Bool *pq = &q;
+
+int
+main ()
+{
+
+             bool e = &s;
+             *pq |= q;
+             *pq |= ! q;
+             /* Refer to every declared value, to avoid compiler optimizations.  */
+             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                     + !m + !n + !o + !p + !q + !pq);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_header_stdbool_h=yes
+else
+  ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+   ac_fn_cxx_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
+case $ac_cv_c_int16_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int16_t $ac_cv_c_int16_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
+case $ac_cv_c_int32_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t $ac_cv_c_int32_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
+case $ac_cv_c_int8_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int8_t $ac_cv_c_int8_t
+_ACEOF
+;;
+esac
+
+ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT32_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t $ac_cv_c_uint32_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
+case $ac_cv_c_uint8_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT8_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t $ac_cv_c_uint8_t
+_ACEOF
+;;
+  esac
+
+
+# Checks for library functions.
+for ac_func in floor memset mkdir pow rint sqrt gzread
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
+fi
+done
 
 
 # ****************************************************************************
@@ -5319,45 +6630,16 @@ done
 #     --enable-trivialjumps=jumpsize    [disabled]
 #     --enable-devel                    [disabled]
 #     --enable-debug                    [disabled]
-#     --enable-in2p3                    [disabled]
+#     --enable-profiling                [disabled]
 #
 # ****************************************************************************
 
-
-
-
-
-
-#  ******************* check option consistency ***************************
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking checking parameter consistency" >&5
-$as_echo_n "checking checking parameter consistency... " >&6; }
-if test "x$enable_in2p3" = "xyes" ; then
-  if test "x$enable_debug" = "xyes" ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: FAIL" >&5
-$as_echo "FAIL" >&6; }
-    as_fn_error $? "debug and in2p3 are not compatible" "$LINENO" 5
-  fi
-  if test "x$with_x" != xno ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: FAIL" >&5
-$as_echo "FAIL" >&6; }
-    as_fn_error $? "x and in2p3 are not compatible" "$LINENO" 5
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK" >&5
-$as_echo "OK" >&6; }
-
-
-
-
-
 #   ************************ --without-x option *********************
 #
-#   When this option is set, typing make will produce aevol and
-#   most post-treatment programs, but not aevol_X11.
+#   When this option is set, running make will produce aevol and
+#   most post-treatment programs without visualization capabilities
 #   This is useful if we want to run computations on a cluster where the
-#   X libraries are not present. If, on the contrary, we type ./configure
-#   without this option, then typing make will produce aevol_X11 and
-#   view_generation_X11 (and the other post-treatment programs).
+#   X libraries are not present.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable graphical outputs" >&5
 $as_echo_n "checking whether to enable graphical outputs... " >&6; }
@@ -5490,7 +6772,7 @@ if test "$ac_x_includes" = no; then
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_cxx_try_cpp "$LINENO"; then :
   # We can compile using X headers with no special include directory.
 ac_x_includes=
 else
@@ -5521,7 +6803,7 @@ XrmInitialize ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   LIBS=$ac_save_LIBS
 # We can link X programs with no special library path.
 ac_x_libraries=
@@ -5594,8 +6876,8 @@ else
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5
 $as_echo_n "checking whether -R must be followed by a space... " >&6; }
     ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-    ac_xsave_c_werror_flag=$ac_c_werror_flag
-    ac_c_werror_flag=yes
+    ac_xsave_cxx_werror_flag=$ac_cxx_werror_flag
+    ac_cxx_werror_flag=yes
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5607,7 +6889,7 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
        X_LIBS="$X_LIBS -R$x_libraries"
@@ -5624,7 +6906,7 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 	  X_LIBS="$X_LIBS -R $x_libraries"
@@ -5637,7 +6919,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-    ac_c_werror_flag=$ac_xsave_c_werror_flag
+    ac_cxx_werror_flag=$ac_xsave_cxx_werror_flag
     LIBS=$ac_xsave_LIBS
   fi
 
@@ -5670,7 +6952,7 @@ return XOpenDisplay ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
@@ -5698,7 +6980,7 @@ return dnet_ntoa ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_dnet_dnet_ntoa=yes
 else
   ac_cv_lib_dnet_dnet_ntoa=no
@@ -5739,7 +7021,7 @@ return dnet_ntoa ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_dnet_stub_dnet_ntoa=yes
 else
   ac_cv_lib_dnet_stub_dnet_ntoa=no
@@ -5768,7 +7050,7 @@ rm -f core conftest.err conftest.$ac_objext \
     # on Irix 5.2, according to T.E. Dickey.
     # The functions gethostbyname, getservbyname, and inet_addr are
     # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
+    ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
 if test "x$ac_cv_func_gethostbyname" = xyes; then :
 
 fi
@@ -5799,7 +7081,7 @@ return gethostbyname ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_nsl_gethostbyname=yes
 else
   ac_cv_lib_nsl_gethostbyname=no
@@ -5840,7 +7122,7 @@ return gethostbyname ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_bsd_gethostbyname=yes
 else
   ac_cv_lib_bsd_gethostbyname=no
@@ -5865,7 +7147,7 @@ fi
     # variants that don't use the name server (or something).  -lsocket
     # must be given before -lnsl if both are needed.  We assume that
     # if connect needs -lnsl, so does gethostbyname.
-    ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+    ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect"
 if test "x$ac_cv_func_connect" = xyes; then :
 
 fi
@@ -5896,7 +7178,7 @@ return connect ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_socket_connect=yes
 else
   ac_cv_lib_socket_connect=no
@@ -5914,7 +7196,7 @@ fi
     fi
 
     # Guillermo Gomez says -lposix is necessary on A/UX.
-    ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove"
+    ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove"
 if test "x$ac_cv_func_remove" = xyes; then :
 
 fi
@@ -5945,7 +7227,7 @@ return remove ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_posix_remove=yes
 else
   ac_cv_lib_posix_remove=no
@@ -5963,7 +7245,7 @@ fi
     fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
+    ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
 if test "x$ac_cv_func_shmat" = xyes; then :
 
 fi
@@ -5994,7 +7276,7 @@ return shmat ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_ipc_shmat=yes
 else
   ac_cv_lib_ipc_shmat=no
@@ -6046,7 +7328,7 @@ return IceConnectionNumber ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_ICE_IceConnectionNumber=yes
 else
   ac_cv_lib_ICE_IceConnectionNumber=no
@@ -6098,7 +7380,7 @@ return XOpenDisplay ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_cxx_try_link "$LINENO"; then :
   ac_cv_lib_X11_XOpenDisplay=yes
 else
   ac_cv_lib_X11_XOpenDisplay=no
@@ -6123,7 +7405,7 @@ fi
    for ac_header in X11/Xlib.h X11/Xutil.h X11/keysym.h X11/Xatom.h X11/cursorfont.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
 if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -6139,8 +7421,6 @@ else
 
 fi
 
-
-
 #  ******************* --enable-optim option ***************************
 #
 #  With this option, the programs are compiled with the
@@ -6172,8 +7452,6 @@ else
   AEVOLCXXFLAGS+=" -O0"
 fi
 
-
-
 #  ******************* --enable-normalized-fitness option ***************************
 #
 #  With this option, the NORMALIZED_FITNESS flag is defined,
@@ -6203,10 +7481,6 @@ if test "x$enable_normalized_fitness" = "xyes" ; then
 
 fi
 
-
-
-
-
 #  ************************* --enable-mtperiod=period option *******************************
 #
 #  This option sets a particular period for the Mersenne Twister.
@@ -6239,10 +7513,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-
-
-
-
 #  ************************* --enable-trivialjumps=jumpsize option *******************************
 #
 #  When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method.
@@ -6256,372 +7526,766 @@ _ACEOF
 #  avoid overlaps in most cases.
 #
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use trivial Mersenne Twister jumps" >&5
-$as_echo_n "checking whether to use trivial Mersenne Twister jumps... " >&6; }
-# Check whether --enable-trivialjumps was given.
-if test "${enable_trivialjumps+set}" = set; then :
-  enableval=$enable_trivialjumps; trivialjumps=$enableval
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use trivial Mersenne Twister jumps" >&5
+$as_echo_n "checking whether to use trivial Mersenne Twister jumps... " >&6; }
+# Check whether --enable-trivialjumps was given.
+if test "${enable_trivialjumps+set}" = set; then :
+  enableval=$enable_trivialjumps; trivialjumps=$enableval
+else
+  trivialjumps=no
+fi
+
+if test "x$trivialjumps" != "xyes" && test "x$trivialjumps" != "xno" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($trivialjumps)" >&5
+$as_echo "yes ($trivialjumps)" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $trivialjumps" >&5
+$as_echo "$trivialjumps" >&6; }
+fi
+ if test x"$trivialjumps" != xno; then
+  ENABLE_FORCEPJ_TRUE=
+  ENABLE_FORCEPJ_FALSE='#'
+else
+  ENABLE_FORCEPJ_TRUE='#'
+  ENABLE_FORCEPJ_FALSE=
+fi
+
+if test "x$trivialjumps" = "xyes" ; then
+  $as_echo "#define TRIVIAL_METHOD_JUMP_SIZE 1000" >>confdefs.h
+
+elif test "x$trivialjumps" != "xno" ; then
+  cat >>confdefs.h <<_ACEOF
+#define TRIVIAL_METHOD_JUMP_SIZE $trivialjumps
+_ACEOF
+
+fi
+
+
+#  ******************* --enable-devel option ***************************
+#
+#  This enables developers' features:
+#    adds a call to make clean at the end of the configure script.
+#    enables doxygen if available
+#
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use devel features" >&5
+$as_echo_n "checking whether to use devel features... " >&6; }
+# Check whether --enable-devel was given.
+if test "${enable_devel+set}" = set; then :
+  enableval=$enable_devel;
+else
+  enable_devel=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_devel" >&5
+$as_echo "$enable_devel" >&6; }
+ if test x"$enable_devel" != xno; then
+  ENABLE_DEVEL_TRUE=
+  ENABLE_DEVEL_FALSE='#'
+else
+  ENABLE_DEVEL_TRUE='#'
+  ENABLE_DEVEL_FALSE=
+fi
+
+if test "x$enable_devel" = "xyes" ; then
+  # Make clean at the end of the configuration process
+  # (usefull when several configurations are done consecutively, typically during development)
+  ac_config_commands="$ac_config_commands make"
+
+
+  # Check for Doxygen
+  for ac_prog in doxygen
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_HAVE_DOXYGEN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$HAVE_DOXYGEN"; then
+  ac_cv_prog_HAVE_DOXYGEN="$HAVE_DOXYGEN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_HAVE_DOXYGEN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+HAVE_DOXYGEN=$ac_cv_prog_HAVE_DOXYGEN
+if test -n "$HAVE_DOXYGEN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DOXYGEN" >&5
+$as_echo "$HAVE_DOXYGEN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$HAVE_DOXYGEN" && break
+done
+
+  if test -z "$HAVE_DOXYGEN";
+     then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Doxygen not found - continuing without Doxygen support" >&5
+$as_echo "$as_me: WARNING: Doxygen not found - continuing without Doxygen support" >&2;}
+  fi
+else
+  # Output a warning message about multi-configuration and make clean
+  ac_config_commands="$ac_config_commands user_warning"
+
+fi
+ if test -n "$HAVE_DOXYGEN"; then
+  WANT_DOXYGEN_TRUE=
+  WANT_DOXYGEN_FALSE='#'
+else
+  WANT_DOXYGEN_TRUE='#'
+  WANT_DOXYGEN_FALSE=
+fi
+
+
+
+#  ******************* --enable-debug option ***************************
+#
+#  With this option, the DEBUG flag is defined, and the programs are
+#  compiled with debugging options (-g -Wall).
+#
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debugging features" >&5
+$as_echo_n "checking whether to use debugging features... " >&6; }
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+  enableval=$enable_debug;
+else
+  enable_debug=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_debug" >&5
+$as_echo "$enable_debug" >&6; }
+ if test x"$enable_debug" != xno; then
+  WITH_DEBUG_TRUE=
+  WITH_DEBUG_FALSE='#'
+else
+  WITH_DEBUG_TRUE='#'
+  WITH_DEBUG_FALSE=
+fi
+
+if test "x$enable_debug" = "xyes" ; then
+   $as_echo "#define DEBUG 1" >>confdefs.h
+
+   AEVOLCXXFLAGS+=" -g -Wall"
+else
+   $as_echo "#define NDEBUG 1" >>confdefs.h
+
+fi
+
+
+#  ******************* --enable-profiling option ***************************
+#
+#  With this option, the -pg flag is defined.
+#
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable profiling" >&5
+$as_echo_n "checking whether to enable profiling... " >&6; }
+# Check whether --enable-profiling was given.
+if test "${enable_profiling+set}" = set; then :
+  enableval=$enable_profiling;
+else
+  enable_profiling=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_profiling" >&5
+$as_echo "$enable_profiling" >&6; }
+ if test x"$enable_profiling" != xno; then
+  WITH_PROFILING_TRUE=
+  WITH_PROFILING_FALSE='#'
+else
+  WITH_PROFILING_TRUE='#'
+  WITH_PROFILING_FALSE=
+fi
+
+if test "x$enable_profiling" = "xyes" ; then
+   AEVOLCXXFLAGS+=" -pg"
+   AEVOLLDFLAGS+=" -pg"
+fi
+
+#  ************************* --with-raevol option *******************************
+#
+#  With this option, regulation is enabled (RAevol) and the __REGUL flag is defined
+#
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use raevol" >&5
+$as_echo_n "checking whether to use raevol... " >&6; }
+
+# Check whether --with-raevol was given.
+if test "${with_raevol+set}" = set; then :
+  withval=$with_raevol; raevol=$withval
+else
+  raevol=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $raevol" >&5
+$as_echo "$raevol" >&6; }
+ if test x"$raevol" != xno; then
+  WITH_RAEVOL_TRUE=
+  WITH_RAEVOL_FALSE='#'
+else
+  WITH_RAEVOL_TRUE='#'
+  WITH_RAEVOL_FALSE=
+fi
+
+if test "x$raevol" = "xyes" ; then
+   $as_echo "#define __REGUL 1" >>confdefs.h
+
+   if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='aevol'
+ VERSION='5.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
 else
-  trivialjumps=no
+  am_cv_CXX_dependencies_compiler_type=none
 fi
 
-if test "x$trivialjumps" != "xyes" && test "x$trivialjumps" != "xno" ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($trivialjumps)" >&5
-$as_echo "yes ($trivialjumps)" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $trivialjumps" >&5
-$as_echo "$trivialjumps" >&6; }
 fi
- if test x"$trivialjumps" != xno; then
-  ENABLE_FORCEPJ_TRUE=
-  ENABLE_FORCEPJ_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
 else
-  ENABLE_FORCEPJ_TRUE='#'
-  ENABLE_FORCEPJ_FALSE=
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
 fi
 
-if test "x$trivialjumps" = "xyes" ; then
-  $as_echo "#define TRIVIAL_METHOD_JUMP_SIZE 1000" >>confdefs.h
-
-elif test "x$trivialjumps" != "xno" ; then
-  cat >>confdefs.h <<_ACEOF
-#define TRIVIAL_METHOD_JUMP_SIZE $trivialjumps
-_ACEOF
-
-fi
 
 
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
 
-#  ******************* --enable-devel option ***************************
-#
-#  This enables developers' features:
-#    adds a call to make clean at the end of the configure script.
-#    enables doxygen if available
-#    enforces use of cppunit
-#
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use devel features" >&5
-$as_echo_n "checking whether to use devel features... " >&6; }
-# Check whether --enable-devel was given.
-if test "${enable_devel+set}" = set; then :
-  enableval=$enable_devel;
-else
-  enable_devel=no
-fi
+Please tell bug-automake at gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_devel" >&5
-$as_echo "$enable_devel" >&6; }
- if test x"$enable_devel" != xno; then
-  ENABLE_DEVEL_TRUE=
-  ENABLE_DEVEL_FALSE='#'
-else
-  ENABLE_DEVEL_TRUE='#'
-  ENABLE_DEVEL_FALSE=
-fi
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
 
-if test "x$enable_devel" = "xyes" ; then
-  # Make clean at the end of the configuration process
-  # (usefull when several configurations are done consecutively, typically during development)
-  ac_config_commands="$ac_config_commands make"
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
 
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
 
-  # Check for Doxygen
-  for ac_prog in doxygen
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_HAVE_DOXYGEN+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$HAVE_DOXYGEN"; then
-  ac_cv_prog_HAVE_DOXYGEN="$HAVE_DOXYGEN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_HAVE_DOXYGEN="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
   fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-HAVE_DOXYGEN=$ac_cv_prog_HAVE_DOXYGEN
-if test -n "$HAVE_DOXYGEN"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DOXYGEN" >&5
-$as_echo "$HAVE_DOXYGEN" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
 fi
 
+fi
 
-  test -n "$HAVE_DOXYGEN" && break
-done
-
-  if test -z "$HAVE_DOXYGEN";
-     then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Doxygen not found - continuing without Doxygen support" >&5
-$as_echo "$as_me: WARNING: Doxygen not found - continuing without Doxygen support" >&2;}
-  fi
-
-  # Check for CppUnit
-    # AC_CHECK_LIB does not work with C++ libraries, this is why we use AM_PATH_CPPUNIT
-    # This macro will check whether a Cppunit version >= 1.10.2 is installed
-    # and, if, yes, will define CPPUNIT_CFLAGS and CPPUNIT_LIBS.
-    # This macro is defined in the cppunit.m4 file provided by the cppunit package
-    # when it is installed. Hence aclocal must be run before autoconf to have the
-    # macro known by autoconf.  If cppunit is installed in a non-standard
-    # directory, you need to specify where to find cppunit.m4. For example, if
-    # cppunit is installed under /usr/local, run:
-    #   ACLOCAL="aclocal -I /usr/local/share/aclocal" autoreconf -if
-  cppunit_missing=no
+#  ************************* --with-blas option *******************************
+#
+#  With this option, BLAS matrix/vector manipulation is enabled, __BLAS__ flag is defined and -lopenblas added
+#
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use BLAS library" >&5
+$as_echo_n "checking whether to use BLAS library... " >&6; }
 
-# Check whether --with-cppunit-prefix was given.
-if test "${with_cppunit_prefix+set}" = set; then :
-  withval=$with_cppunit_prefix; cppunit_config_prefix="$withval"
+# Check whether --with-blas was given.
+if test "${with_blas+set}" = set; then :
+  withval=$with_blas; blas=$withval
 else
-  cppunit_config_prefix=""
+  blas=no
 fi
 
-
-# Check whether --with-cppunit-exec-prefix was given.
-if test "${with_cppunit_exec_prefix+set}" = set; then :
-  withval=$with_cppunit_exec_prefix; cppunit_config_exec_prefix="$withval"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $blas" >&5
+$as_echo "$blas" >&6; }
+ if test x"$blas" != xno; then
+  WITH_BLAS_TRUE=
+  WITH_BLAS_FALSE='#'
 else
-  cppunit_config_exec_prefix=""
+  WITH_BLAS_TRUE='#'
+  WITH_BLAS_FALSE=
 fi
 
+if test "x$blas" = "xyes" ; then
+   $as_echo "#define __BLAS__ 1" >>confdefs.h
 
-  if test x$cppunit_config_exec_prefix != x ; then
-     cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
-     if test x${CPPUNIT_CONFIG+set} != xset ; then
-        CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
-     fi
-  fi
-  if test x$cppunit_config_prefix != x ; then
-     cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
-     if test x${CPPUNIT_CONFIG+set} != xset ; then
-        CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
-     fi
-  fi
-
-  # Extract the first word of "cppunit-config", so it can be a program name with args.
-set dummy cppunit-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CPPUNIT_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CPPUNIT_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CPPUNIT_CONFIG="$CPPUNIT_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_CPPUNIT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_CPPUNIT_CONFIG" && ac_cv_path_CPPUNIT_CONFIG="no"
-  ;;
-esac
-fi
-CPPUNIT_CONFIG=$ac_cv_path_CPPUNIT_CONFIG
-if test -n "$CPPUNIT_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPPUNIT_CONFIG" >&5
-$as_echo "$CPPUNIT_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+   LIBS+=" -lopenblas"
 fi
 
+#  ************************* --with-mkl option *******************************
+#
+#  With this option, MKL library is enabled, __BLAS__ flag is defined and -lmkl.. added
+#
 
-  cppunit_version_min=1.10.2
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cppunit - version >= $cppunit_version_min" >&5
-$as_echo_n "checking for Cppunit - version >= $cppunit_version_min... " >&6; }
-  no_cppunit=""
-  if test "$CPPUNIT_CONFIG" = "no" ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    no_cppunit=yes
-  else
-    CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
-    CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
-    cppunit_version=`$CPPUNIT_CONFIG --version`
-
-    cppunit_major_version=`echo $cppunit_version | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
-    cppunit_minor_version=`echo $cppunit_version | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
-    cppunit_micro_version=`echo $cppunit_version | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
-
-    cppunit_major_min=`echo $cppunit_version_min | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
-    if test "x${cppunit_major_min}" = "x" ; then
-       cppunit_major_min=0
-    fi
 
-    cppunit_minor_min=`echo $cppunit_version_min | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
-    if test "x${cppunit_minor_min}" = "x" ; then
-       cppunit_minor_min=0
-    fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use MKL library" >&5
+$as_echo_n "checking whether to use MKL library... " >&6; }
 
-    cppunit_micro_min=`echo $cppunit_version_min | \
-           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
-    if test "x${cppunit_micro_min}" = "x" ; then
-       cppunit_micro_min=0
-    fi
+# Check whether --with-mkl was given.
+if test "${with_mkl+set}" = set; then :
+  withval=$with_mkl; mkl=$withval
+else
+  mkl=no
+fi
 
-    cppunit_version_proper=`expr \
-        $cppunit_major_version \> $cppunit_major_min \| \
-        $cppunit_major_version \= $cppunit_major_min \& \
-        $cppunit_minor_version \> $cppunit_minor_min \| \
-        $cppunit_major_version \= $cppunit_major_min \& \
-        $cppunit_minor_version \= $cppunit_minor_min \& \
-        $cppunit_micro_version \>= $cppunit_micro_min `
-
-    if test "$cppunit_version_proper" = "1" ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&5
-$as_echo "$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&6; }
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-      no_cppunit=yes
-    fi
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mkl" >&5
+$as_echo "$mkl" >&6; }
+ if test x"$mkl" != xno; then
+  WITH_MKL_TRUE=
+  WITH_MKL_FALSE='#'
+else
+  WITH_MKL_TRUE='#'
+  WITH_MKL_FALSE=
+fi
 
-  if test "x$no_cppunit" = x ; then
-     :
-  else
-     CPPUNIT_CFLAGS=""
-     CPPUNIT_LIBS=""
-     cppunit_missing=yes
-  fi
+if test "x$mkl" = "xyes" ; then
+   $as_echo "#define __BLAS__ 1" >>confdefs.h
 
+   LIBS+=" -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential"
+fi
 
+#  ************************* --with-atlas option *******************************
+#
+#  With this option, ATLAS library is enabled, __BLAS__ flag is defined and -latlas added
+#
 
 
-  if test "x$cppunit_missing" != xno ; then
-    as_fn_error $? "cppunit not found, make will fail - please install cppunit." "$LINENO" 5
-  fi
-else
-  # Output a warning message about multi-configuration and make clean
-  ac_config_commands="$ac_config_commands user_warning"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use ATLAS library" >&5
+$as_echo_n "checking whether to use ATLAS library... " >&6; }
 
-fi
- if test -n "$HAVE_DOXYGEN"; then
-  WANT_DOXYGEN_TRUE=
-  WANT_DOXYGEN_FALSE='#'
+# Check whether --with-atlas was given.
+if test "${with_atlas+set}" = set; then :
+  withval=$with_atlas; atlas=$withval
 else
-  WANT_DOXYGEN_TRUE='#'
-  WANT_DOXYGEN_FALSE=
+  atlas=no
 fi
 
- if test -n "$cppunit_missing"; then
-  WITH_CPPUNIT_TRUE=
-  WITH_CPPUNIT_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $atlas" >&5
+$as_echo "$atlas" >&6; }
+ if test x"$atlas" != xno; then
+  WITH_ATLAS_TRUE=
+  WITH_ATLAS_FALSE='#'
 else
-  WITH_CPPUNIT_TRUE='#'
-  WITH_CPPUNIT_FALSE=
+  WITH_ATLAS_TRUE='#'
+  WITH_ATLAS_FALSE=
 fi
 
+if test "x$atlas" = "xyes" ; then
+   $as_echo "#define __BLAS__ 1" >>confdefs.h
 
+   LIBS+=" -lcblas -latlas"
+fi
 
 
-#  ******************* --enable-debug option ***************************
+
+#  ************************* --with-tbb option *******************************
 #
-#  With this option, the DEBUG flag is defined, and the programs are
-#  compiled with debugging options (-g -Wall).
+#  With this option, Intel TBB local parallelization is enabled, __TBB flag is defined and -ltbb added
 #
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debugging features" >&5
-$as_echo_n "checking whether to use debugging features... " >&6; }
-# Check whether --enable-debug was given.
-if test "${enable_debug+set}" = set; then :
-  enableval=$enable_debug;
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use TBB library" >&5
+$as_echo_n "checking whether to use TBB library... " >&6; }
+
+# Check whether --with-tbb was given.
+if test "${with_tbb+set}" = set; then :
+  withval=$with_tbb; tbb=$withval
 else
-  enable_debug=no
+  tbb=no
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_debug" >&5
-$as_echo "$enable_debug" >&6; }
- if test x"$enable_debug" != xno; then
-  WITH_DEBUG_TRUE=
-  WITH_DEBUG_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tbb" >&5
+$as_echo "$tbb" >&6; }
+ if test x"$tbb" != xno; then
+  WITH_TBB_TRUE=
+  WITH_TBB_FALSE='#'
 else
-  WITH_DEBUG_TRUE='#'
-  WITH_DEBUG_FALSE=
+  WITH_TBB_TRUE='#'
+  WITH_TBB_FALSE=
 fi
 
-if test "x$enable_debug" = "xyes" ; then
-   $as_echo "#define DEBUG 1" >>confdefs.h
-
-   AEVOLCXXFLAGS+=" -g -Wall"
-else
-   $as_echo "#define NDEBUG 1" >>confdefs.h
+if test "x$tbb" = "xyes" ; then
+   $as_echo "#define __TBB 1" >>confdefs.h
 
+   LIBS+=" -ltbb"
 fi
 
+#  ************************* --with-tracing option *******************************
+#
+#  With this option, tracing is enabled and the __TRACING__ flag is defined
+#
 
 
-#  ******************* --enable-in2p3 option ***************************
-#
-#  With this option, the IN2P3 flag is defined
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use tracing" >&5
+$as_echo_n "checking whether to use tracing... " >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use IN2P3 specific features" >&5
-$as_echo_n "checking whether to use IN2P3 specific features... " >&6; }
-# Check whether --enable-in2p3 was given.
-if test "${enable_in2p3+set}" = set; then :
-  enableval=$enable_in2p3;
+# Check whether --with-tracing was given.
+if test "${with_tracing+set}" = set; then :
+  withval=$with_tracing; tracing=$withval
 else
-  enable_in2p3=no
+  tracing=no
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_in2p3" >&5
-$as_echo "$enable_in2p3" >&6; }
- if test x"$enable_in2p3" != xno; then
-  WITH_IN2P3_TRUE=
-  WITH_IN2P3_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tracing" >&5
+$as_echo "$tracing" >&6; }
+ if test x"$tracing" != xno; then
+  WITH_TRACING_TRUE=
+  WITH_TRACING_FALSE='#'
 else
-  WITH_IN2P3_TRUE='#'
-  WITH_IN2P3_FALSE=
+  WITH_TRACING_TRUE='#'
+  WITH_TRACING_FALSE=
 fi
 
-if test "x$enable_in2p3" = "xyes" ; then
-   $as_echo "#define __IN2P3 1" >>confdefs.h
+if test "x$tracing" = "xyes" ; then
+   $as_echo "#define __TRACING__ 1" >>confdefs.h
 
 fi
 
 
-
-
 #  ************************* back to GENERAL stuff *******************************
 
-ac_config_files="$ac_config_files Makefile src/Makefile src/libaevol/Makefile src/libaevol/SFMT-src-1.4/Makefile src/libaevol/tests/Makefile src/post_treatments/Makefile doc/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile src/libaevol/Makefile src/libaevol/SFMT-src-1.4/Makefile src/post_treatments/Makefile doc/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -6768,6 +8432,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
  if test -n "$EXEEXT"; then
   am__EXEEXT_TRUE=
   am__EXEEXT_FALSE='#'
@@ -6812,16 +8484,52 @@ if test -z "${WANT_DOXYGEN_TRUE}" && test -z "${WANT_DOXYGEN_FALSE}"; then
   as_fn_error $? "conditional \"WANT_DOXYGEN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${WITH_CPPUNIT_TRUE}" && test -z "${WITH_CPPUNIT_FALSE}"; then
-  as_fn_error $? "conditional \"WITH_CPPUNIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${WITH_DEBUG_TRUE}" && test -z "${WITH_DEBUG_FALSE}"; then
   as_fn_error $? "conditional \"WITH_DEBUG\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${WITH_IN2P3_TRUE}" && test -z "${WITH_IN2P3_FALSE}"; then
-  as_fn_error $? "conditional \"WITH_IN2P3\" was never defined.
+if test -z "${WITH_PROFILING_TRUE}" && test -z "${WITH_PROFILING_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_PROFILING\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_RAEVOL_TRUE}" && test -z "${WITH_RAEVOL_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_RAEVOL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${WITH_BLAS_TRUE}" && test -z "${WITH_BLAS_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_BLAS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_MKL_TRUE}" && test -z "${WITH_MKL_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_MKL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_ATLAS_TRUE}" && test -z "${WITH_ATLAS_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_ATLAS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_TBB_TRUE}" && test -z "${WITH_TBB_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_TBB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_TRACING_TRUE}" && test -z "${WITH_TRACING_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_TRACING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
@@ -7221,7 +8929,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by AEVOL $as_me 4.4, which was
+This file was extended by AEVOL $as_me 5.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7272,14 +8980,14 @@ $config_files
 Configuration commands:
 $config_commands
 
-Report bugs to <aevol-bug-report at lists.gforge.liris.cnrs.fr>.
+Report bugs to <aevol-bugs at lists.gforge.inria.fr>.
 AEVOL home page: <www.aevol.fr>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-AEVOL config.status 4.4
+AEVOL config.status 5.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -7404,7 +9112,6 @@ do
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/libaevol/Makefile") CONFIG_FILES="$CONFIG_FILES src/libaevol/Makefile" ;;
     "src/libaevol/SFMT-src-1.4/Makefile") CONFIG_FILES="$CONFIG_FILES src/libaevol/SFMT-src-1.4/Makefile" ;;
-    "src/libaevol/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/libaevol/tests/Makefile" ;;
     "src/post_treatments/Makefile") CONFIG_FILES="$CONFIG_FILES src/post_treatments/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
 
@@ -7837,7 +9544,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -7850,7 +9557,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -7884,21 +9591,19 @@ $as_echo X"$mf" |
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`$as_dirname -- "$file" ||
diff --git a/configure.ac b/configure.ac
index a6ef133..e4d7f91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,44 +5,62 @@
 AC_PREREQ([2.65])
 
 # Provide FULL-PACKAGE-NAME, VERSION and BUG-REPORT-ADDRESS
-AC_INIT([AEVOL], [4.4], [aevol-bug-report at lists.gforge.liris.cnrs.fr], , [www.aevol.fr])
+AC_INIT([AEVOL], [5.0], [aevol-bugs at lists.gforge.inria.fr], , [www.aevol.fr])
+
+# Set C++ as the main language
+AC_LANG([C++])
+
+# Change default value for CXXFLAGS
+test_CXXFLAGS=${CXXFLAGS+set}
+if test "$test_CXXFLAGS" != set; then
+  CXXFLAGS=""
+fi
+
+# Specify the location of additional local Autoconf macros
+AC_CONFIG_MACRO_DIR([m4])
 
 # We want to use automake
 AM_INIT_AUTOMAKE
 
+# Select compiler
+AC_PROG_CXX([clang-omp++ clang++ g++ icc])
+
+# Detect C++11 or C++14
+AX_CXX_COMPILE_STDCXX_14([noext],[optional])
+AX_CXX_COMPILE_STDCXX_11([noext])
+
+#if test -z "$HAVE_CXX14";
+#fi
+
 # Check the existance of an arbitrary source file
 AC_CONFIG_SRCDIR([src/aevol_run.cpp])
 
 # Build config.h using config.h.in as a template
 #AC_CONFIG_HEADERS([config.h:config.h.in])
 
-
-# Change default value for CXXFLAGS
-test_CXXFLAGS=${CXXFLAGS+set}
-if test "$test_CXXFLAGS" != set; then
-  CXXFLAGS=""
-fi
-
-
 # Checks for programs
-AC_PROG_CXX
-AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_RANLIB
+AC_OPENMP
 AM_PROG_CC_C_O
 
+# Print warning if openmp not found
+AC_CHECK_HEADER([omp.h], , [AC_MSG_WARN([openmp not found - continuing without openmp support])])
+
+# Check for boost
+AX_BOOST_BASE([1.55],, [AC_MSG_ERROR([boost not found, please check that you have boost installed on your system and retry])])
+AX_BOOST_SYSTEM
+AX_BOOST_FILESYSTEM
 
 # Initialize configure-time defined flags
 AC_SUBST(AEVOLCPPFLAGS, "") # C PreProcessor flags
-AC_SUBST(AEVOLCXXFLAGS, "") # C++ Compile flags
-AC_SUBST(AEVOLLDFLAGS, "")  # Linker flags
-
+AC_SUBST(AEVOLCXXFLAGS, "$OPENMP_CXXFLAGS") # C++ Compile flags
+AC_SUBST(AEVOLLDFLAGS, "$OPENMP_CXXFLAGS")  # Linker flags
 
 # Checks for libraries.
 AC_CHECK_LIB([m], [cos], , [AC_MSG_ERROR([PACKAGE_NAME requires the math library, please install it.])])
 AC_CHECK_LIB([z], [gzread], , [AC_MSG_ERROR([PACKAGE_NAME requires the zlib development library, please install it.])])
 
-
 # Checks for header files.
 AC_CHECK_HEADERS([inttypes.h limits.h stdint.h stdlib.h string.h unistd.h])
 
@@ -59,12 +77,6 @@ AC_TYPE_UINT8_T
 # Checks for library functions.
 AC_CHECK_FUNCS([floor memset mkdir pow rint sqrt gzread])
 
-
-
-
-
-
-
 # ****************************************************************************
 #                                  OPTIONS
 #
@@ -76,41 +88,16 @@ AC_CHECK_FUNCS([floor memset mkdir pow rint sqrt gzread])
 #     --enable-trivialjumps=jumpsize    [disabled]
 #     --enable-devel                    [disabled]
 #     --enable-debug                    [disabled]
-#     --enable-in2p3                    [disabled]
+#     --enable-profiling                [disabled]
 #
 # ****************************************************************************
 
-
-
-
-
-
-#  ******************* check option consistency ***************************
-AC_MSG_CHECKING([checking parameter consistency])
-if test "x$enable_in2p3" = "xyes" ; then
-  if test "x$enable_debug" = "xyes" ; then
-    AC_MSG_RESULT([FAIL])
-    AC_MSG_ERROR([debug and in2p3 are not compatible])
-  fi
-  if test "x$with_x" != xno ; then
-    AC_MSG_RESULT([FAIL])
-    AC_MSG_ERROR([x and in2p3 are not compatible])
-  fi
-fi
-AC_MSG_RESULT([OK])
-
-
-
-
-
 #   ************************ --without-x option *********************
 #
-#   When this option is set, typing make will produce aevol and
-#   most post-treatment programs, but not aevol_X11.
+#   When this option is set, running make will produce aevol and
+#   most post-treatment programs without visualization capabilities
 #   This is useful if we want to run computations on a cluster where the
-#   X libraries are not present. If, on the contrary, we type ./configure
-#   without this option, then typing make will produce aevol_X11 and
-#   view_generation_X11 (and the other post-treatment programs).
+#   X libraries are not present.
 
 AC_MSG_CHECKING([whether to enable graphical outputs])
 AC_ARG_WITH(x, [  --without-x to disable graphical output], , with_x=yes)
@@ -134,8 +121,6 @@ else
    AC_DEFINE(__NO_X)
 fi
 
-
-
 #  ******************* --enable-optim option ***************************
 #
 #  With this option, the programs are compiled with the
@@ -152,8 +137,6 @@ else
   AEVOLCXXFLAGS+=" -O0"
 fi
 
-
-
 #  ******************* --enable-normalized-fitness option ***************************
 #
 #  With this option, the NORMALIZED_FITNESS flag is defined,
@@ -167,10 +150,6 @@ if test "x$enable_normalized_fitness" = "xyes" ; then
    AC_DEFINE(NORMALIZED_FITNESS)
 fi
 
-
-
-
-
 #  ************************* --enable-mtperiod=period option *******************************
 #
 #  This option sets a particular period for the Mersenne Twister.
@@ -202,10 +181,6 @@ fi
 AC_MSG_RESULT($period)
 AC_DEFINE_UNQUOTED([SFMT_MEXP], [$period])
 
-
-
-
-
 #  ************************* --enable-trivialjumps=jumpsize option *******************************
 #
 #  When this option is set, a trivial jump algorithm will be used instead of the polynomial-based method.
@@ -251,13 +226,11 @@ elif test "x$trivialjumps" != "xno" ; then
 fi
 
 
-
 #  ******************* --enable-devel option ***************************
 #
 #  This enables developers' features:
 #    adds a call to make clean at the end of the configure script.
 #    enables doxygen if available
-#    enforces use of cppunit
 #
 
 AC_MSG_CHECKING([whether to use devel features])
@@ -274,29 +247,11 @@ if test "x$enable_devel" = "xyes" ; then
   if test -z "$HAVE_DOXYGEN";
      then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
   fi
-
-  # Check for CppUnit
-    # AC_CHECK_LIB does not work with C++ libraries, this is why we use AM_PATH_CPPUNIT
-    # This macro will check whether a Cppunit version >= 1.10.2 is installed
-    # and, if, yes, will define CPPUNIT_CFLAGS and CPPUNIT_LIBS.
-    # This macro is defined in the cppunit.m4 file provided by the cppunit package
-    # when it is installed. Hence aclocal must be run before autoconf to have the
-    # macro known by autoconf.  If cppunit is installed in a non-standard
-    # directory, you need to specify where to find cppunit.m4. For example, if
-    # cppunit is installed under /usr/local, run:
-    #   ACLOCAL="aclocal -I /usr/local/share/aclocal" autoreconf -if
-  cppunit_missing=no
-  AM_PATH_CPPUNIT(1.10.2, , cppunit_missing=yes)
-  if test "x$cppunit_missing" != xno ; then
-    AC_MSG_ERROR([cppunit not found, make will fail - please install cppunit.])
-  fi
 else
   # Output a warning message about multi-configuration and make clean
   AC_CONFIG_COMMANDS([user_warning], [AC_MSG_NOTICE([Consider using make clean if you are re-configuring.])])
 fi
 AM_CONDITIONAL([WANT_DOXYGEN], [test -n "$HAVE_DOXYGEN"])
-AM_CONDITIONAL([WITH_CPPUNIT], [test -n "$cppunit_missing"])
-
 
 
 #  ******************* --enable-debug option ***************************
@@ -317,20 +272,110 @@ else
 fi
 
 
+#  ******************* --enable-profiling option ***************************
+#
+#  With this option, the -pg flag is defined.
+#
+
+AC_MSG_CHECKING([whether to enable profiling])
+AC_ARG_ENABLE(profiling, [  --enable-profiling to enable profiling], , enable_profiling=no)
+AC_MSG_RESULT($enable_profiling)
+AM_CONDITIONAL(WITH_PROFILING, test x"$enable_profiling" != xno)
+if test "x$enable_profiling" = "xyes" ; then
+   AEVOLCXXFLAGS+=" -pg"
+   AEVOLLDFLAGS+=" -pg"
+fi
 
-#  ******************* --enable-in2p3 option ***************************
+#  ************************* --with-raevol option *******************************
+#
+#  With this option, regulation is enabled (RAevol) and the __REGUL flag is defined
 #
-#  With this option, the IN2P3 flag is defined
-
-AC_MSG_CHECKING([whether to use IN2P3 specific features])
-AC_ARG_ENABLE(in2p3, [  --enable-in2p3 to enable IN2P3 specific features], , enable_in2p3=no)
-AC_MSG_RESULT($enable_in2p3)
-AM_CONDITIONAL(WITH_IN2P3, test x"$enable_in2p3" != xno)
-if test "x$enable_in2p3" = "xyes" ; then
-   AC_DEFINE(__IN2P3)
+
+
+AC_MSG_CHECKING([whether to use raevol])
+AC_ARG_WITH(raevol, [--with-raevol to enable regulation], raevol=$withval, raevol=no)
+AC_MSG_RESULT($raevol)
+AM_CONDITIONAL(WITH_RAEVOL, test x"$raevol" != xno)
+if test "x$raevol" = "xyes" ; then
+   AC_DEFINE(__REGUL)
+   AM_INIT_AUTOMAKE([subdir-objects])
 fi
 
+#  ************************* --with-blas option *******************************
+#
+#  With this option, BLAS matrix/vector manipulation is enabled, __BLAS__ flag is defined and -lopenblas added
+#
+
+
+AC_MSG_CHECKING([whether to use BLAS library])
+AC_ARG_WITH(blas, [--with-blas to the use of BLAS library], blas=$withval, blas=no)
+AC_MSG_RESULT($blas)
+AM_CONDITIONAL(WITH_BLAS, test x"$blas" != xno)
+if test "x$blas" = "xyes" ; then
+   AC_DEFINE(__BLAS__)
+   LIBS+=" -lopenblas"
+fi
 
+#  ************************* --with-mkl option *******************************
+#
+#  With this option, MKL library is enabled, __BLAS__ flag is defined and -lmkl.. added
+#
+
+
+AC_MSG_CHECKING([whether to use MKL library])
+AC_ARG_WITH(mkl, [--with-mkl to the use of MKL library], mkl=$withval, mkl=no)
+AC_MSG_RESULT($mkl)
+AM_CONDITIONAL(WITH_MKL, test x"$mkl" != xno)
+if test "x$mkl" = "xyes" ; then
+   AC_DEFINE(__BLAS__)
+   LIBS+=" -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential"
+fi
+
+#  ************************* --with-atlas option *******************************
+#
+#  With this option, ATLAS library is enabled, __BLAS__ flag is defined and -latlas added
+#
+
+
+AC_MSG_CHECKING([whether to use ATLAS library])
+AC_ARG_WITH(atlas, [--with-atlas to the use of ATLAS library], atlas=$withval, atlas=no)
+AC_MSG_RESULT($atlas)
+AM_CONDITIONAL(WITH_ATLAS, test x"$atlas" != xno)
+if test "x$atlas" = "xyes" ; then
+   AC_DEFINE(__BLAS__)
+   LIBS+=" -lcblas -latlas"
+fi
+
+
+
+#  ************************* --with-tbb option *******************************
+#
+#  With this option, Intel TBB local parallelization is enabled, __TBB flag is defined and -ltbb added
+#
+
+
+AC_MSG_CHECKING([whether to use TBB library])
+AC_ARG_WITH(tbb, [--with-tbb to the use of TBB library], tbb=$withval, tbb=no)
+AC_MSG_RESULT($tbb)
+AM_CONDITIONAL(WITH_TBB, test x"$tbb" != xno)
+if test "x$tbb" = "xyes" ; then
+   AC_DEFINE(__TBB)
+   LIBS+=" -ltbb"
+fi
+
+#  ************************* --with-tracing option *******************************
+#
+#  With this option, tracing is enabled and the __TRACING__ flag is defined
+#
+
+
+AC_MSG_CHECKING([whether to use tracing])
+AC_ARG_WITH(tracing, [--with-tracing to enable tracing], tracing=$withval, tracing=no)
+AC_MSG_RESULT($tracing)
+AM_CONDITIONAL(WITH_TRACING, test x"$tracing" != xno)
+if test "x$tracing" = "xyes" ; then
+   AC_DEFINE(__TRACING__)
+fi
 
 
 #  ************************* back to GENERAL stuff *******************************
@@ -339,7 +384,6 @@ AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/libaevol/Makefile
                  src/libaevol/SFMT-src-1.4/Makefile
-                 src/libaevol/tests/Makefile
                  src/post_treatments/Makefile
                  doc/Makefile])
 AC_OUTPUT
diff --git a/depcomp b/depcomp
index df8eea7..4ebd5b3 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2013-05-30.07; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
   -h | --h*)
     cat <<\EOF
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -40,11 +39,11 @@ as side-effects.
 
 Environment variables:
   depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
+  tmpdepfile  Temporary file to use when outputting dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
@@ -57,6 +56,66 @@ EOF
     ;;
 esac
 
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
+# A tabulation character.
+tab='	'
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
 
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
 # Some modes work just like other modes, but use different flags.  We
 # parameterize here, but still list the modes in the big case below,
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
@@ -80,18 +142,32 @@ if test "$depmode" = hp; then
 fi
 
 if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
 fi
 
 cygpath_u="cygpath -u -f -"
 if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
-   depmode=msvisualcpp
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
 fi
 
 case "$depmode" in
@@ -114,8 +190,7 @@ gcc3)
   done
   "$@"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -123,13 +198,17 @@ gcc3)
   ;;
 
 gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
 ## There are various ways to get dependency output from gcc.  Here's
 ## why we pick this rather obscure method:
 ## - Don't want to use -MD because we'd like the dependencies to end
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   (We might end up doing this anyway to support other compilers.)
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
 ## - Using -M directly means running the compiler twice (even worse
 ##   than renaming).
   if test -z "$gccflag"; then
@@ -137,31 +216,31 @@ gcc)
   fi
   "$@" -Wp,"$gccflag$tmpdepfile"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
 ## The problem is that when a header file which appears in a .P file
 ## is deleted, the dependency causes make to die (because there is
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
+## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -179,8 +258,7 @@ sgi)
     "$@" -MDupdate "$tmpdepfile"
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -188,43 +266,41 @@ sgi)
 
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
     echo "$object : \\" > "$depfile"
-
     # Clip off the initial element (the dependent).  Don't try to be
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
+    # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
-
     # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
   else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile"
   ;;
 
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
   # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.u
     tmpdepfile2=$base.u
@@ -237,9 +313,7 @@ aix)
     "$@" -M
   fi
   stat=$?
-
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
@@ -248,44 +322,100 @@ aix)
   do
     test -f "$tmpdepfile" && break
   done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
   fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
+  # and will wrap long lines using '\' :
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
 
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -297,8 +427,8 @@ icc)
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -309,9 +439,8 @@ hp2)
   # 'foo.d', which lands next to the object file, wherever that
   # happens to be.
   # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from  "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.d
     tmpdepfile2=$dir.libs/$base.d
@@ -322,8 +451,7 @@ hp2)
     "$@" +Maked
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
   fi
@@ -333,77 +461,107 @@ hp2)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add 'dependent.h:' lines.
     sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
   else
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile" "$tmpdepfile2"
   ;;
 
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
 
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
@@ -422,7 +580,7 @@ dashmstdout)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -442,18 +600,18 @@ dashmstdout)
   done
 
   test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
+  # Require at least two characters before searching for ':'
   # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -503,12 +661,15 @@ makedepend)
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   ;;
 
@@ -525,7 +686,7 @@ cpp)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -544,10 +705,10 @@ cpp)
     esac
   done
 
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -579,23 +740,23 @@ msvisualcpp)
       shift
       ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
+        set fnord "$@"
+        shift
+        shift
+        ;;
     *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
     esac
   done
   "$@" -E 2>/dev/null |
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
diff --git a/doc/Makefile.am b/doc/Makefile.am
index bf844eb..938dea5 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -9,10 +9,10 @@ endif
 
 # Man pages
 dist_man1_MANS = aevol_create.1 aevol_run.1 aevol_modify.1 aevol_propagate.1
-dist_man1_MANS += aevol_misc_lineage.1 aevol_misc_ancstats.1
+dist_man1_MANS += aevol_misc_lineage.1 aevol_misc_ancestor_stats.1
 dist_man1_MANS += aevol_misc_robustness.1 aevol_misc_compute_pop_stats.1
-dist_man1_MANS += aevol_misc_view_generation.1 aevol_misc_create_eps.1
-dist_man1_MANS += aevol_misc_extract.1 aevol_misc_fixed_mutations.1
+dist_man1_MANS += aevol_misc_view.1 aevol_misc_create_eps.1
+dist_man1_MANS += aevol_misc_extract.1
 dist_man1_MANS += aevol_misc_gene_families.1
 
 
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 2fdb69f..c5046b2 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -48,16 +85,34 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 subdir = doc
-DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
 am__can_run_installinfo = \
@@ -96,25 +151,29 @@ man1dir = $(mandir)/man1
 am__installdirs = "$(DESTDIR)$(man1dir)"
 NROFF = nroff
 MANS = $(dist_man1_MANS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -126,6 +185,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -139,6 +200,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -169,14 +231,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -192,6 +262,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -203,10 +274,10 @@ top_srcdir = @top_srcdir@
 
 # Man pages
 dist_man1_MANS = aevol_create.1 aevol_run.1 aevol_modify.1 \
-	aevol_propagate.1 aevol_misc_lineage.1 aevol_misc_ancstats.1 \
-	aevol_misc_robustness.1 aevol_misc_compute_pop_stats.1 \
-	aevol_misc_view_generation.1 aevol_misc_create_eps.1 \
-	aevol_misc_extract.1 aevol_misc_fixed_mutations.1 \
+	aevol_propagate.1 aevol_misc_lineage.1 \
+	aevol_misc_ancestor_stats.1 aevol_misc_robustness.1 \
+	aevol_misc_compute_pop_stats.1 aevol_misc_view.1 \
+	aevol_misc_create_eps.1 aevol_misc_extract.1 \
 	aevol_misc_gene_families.1
 
 # Cleaning rules
@@ -229,7 +300,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu doc/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -288,27 +358,14 @@ uninstall-man1:
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
 	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
+
+ctags CTAGS:
 
-ctags: CTAGS
-CTAGS:
+cscope cscopelist:
 
 
 distdir: $(DISTFILES)
-	@list='$(MANS)'; if test -n "$$list"; then \
-	  list=`for p in $$list; do \
-	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
-	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
-	  if test -n "$$list" && \
-	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
-	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
-	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
-	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
-	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
-	    exit 1; \
-	  else :; fi; \
-	else :; fi
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -447,16 +504,19 @@ uninstall-man: uninstall-man1
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-local \
-	distclean distclean-generic distdir dvi dvi-am html html-am \
-	info info-am install install-am install-data install-data-am \
-	install-dvi install-dvi-am install-exec install-exec-am \
-	install-html install-html-am install-info install-info-am \
-	install-man install-man1 install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+	cscopelist-am ctags-am distclean distclean-generic distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
 	uninstall-am uninstall-man uninstall-man1
 
+.PRECIOUS: Makefile
+
 
 # Set default behaviour depending on configure options
 @WANT_DOXYGEN_TRUE at all: doxygen
diff --git a/doc/aevol_create.1 b/doc/aevol_create.1
index ebed9aa..3642162 100644
--- a/doc/aevol_create.1
+++ b/doc/aevol_create.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_create \-h
 or
@@ -11,14 +11,14 @@ or
 or
 .B \-\-version
 .br
-.B aevol_create \fR[\fB\-v\fR] \fR[\fB\-f\fI PARAM_FILE\fR] \fR[\fB\-o\fI OUTDIR\fR] \fR[\fB\-c\fI CFILE\fR] \fR[\fB\-p\fI PFILE\fR]
+.B aevol_create \fR[\fB\-f\fI PARAM_FILE\fR] \fR[\fB\-C\fI CHROM_FILE\fR] \fR[\fB\-p\fI PLASMID_FILE\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
 .B aevol_create
 create an experiment with setup as specified in
-.I param_file
+.I PARAM_FILE
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -32,19 +32,15 @@ print version number, then exit
 .br
 specify parameter file (default: param.in)
 .HP
-.B \-o, \-\-out
-.I OUTDIR
-.br
-specify output directory (default "./")
 .HP
-.B \-c, \-\-chromosome
-.I CFILE
+.B \-C, \-\-chromosome
+.I CHROM_FILE
 .br
 load chromosome from given text file instead of generating it
 .HP
-.B \-p, \-\-plasmid
-.I PFILE
+.B \-P, \-\-plasmid
+.I PLASMID_FILE
 .br
-load plasmid from given text file instead of generating it (params must allow plasmids)
+load plasmid from given text file instead of generating it
 .SH "SEE ALSO"
 .B aevol_run, aevol_modify, aevol_propagate
diff --git a/doc/aevol_misc_ancstats.1 b/doc/aevol_misc_ancestor_stats.1
similarity index 51%
rename from doc/aevol_misc_ancstats.1
rename to doc/aevol_misc_ancestor_stats.1
index d6ffe5b..caa6c12 100644
--- a/doc/aevol_misc_ancstats.1
+++ b/doc/aevol_misc_ancestor_stats.1
@@ -1,23 +1,23 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
-.B aevol_misc_ancstats \-h
+.B aevol_misc_ancestor_stats \-h
 |
 .B \-\-help
 .br
-.B aevol_misc_ancstats \-V
+.B aevol_misc_ancestor_stats \-V
 |
 .B \-\-version
 .br
-.B aevol_misc_ancstats \fB\-f\fI LINEAGE_FILE
+.B aevol_misc_ancestor_stats \fILINEAGE_FILE \fR[\fB\-FMv\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
-.B aevol_misc_ancstats
-issues statistics for the line of descent of a given individual.
+.B aevol_misc_ancestor_stats
+issues statistics for the line of descent described in LINEAGE_FILE.
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -25,10 +25,14 @@ print help, then exit
 .TP
 .B \-V, \-\-version
 print version number, then exit
-.HP
-.B \-f, \-\-file
-.I  LINEAGE_FILE
-.br
-specify which lineage file to use. Lineage files are created by the ae_misc_lineage tool
+.TP
+.B \-F, \-\-full-check
+perform genome checks whenever possible
+.TP
+.B \-M, \-\-trace-mutations
+outputs the fixed mutations (in a separate file)
+.TP
+.B \-v, \-\-verbose
+be verbose
 .SH "SEE ALSO"
 .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_misc_compute_pop_stats.1 b/doc/aevol_misc_compute_pop_stats.1
index d938b20..4d922ec 100644
--- a/doc/aevol_misc_compute_pop_stats.1
+++ b/doc/aevol_misc_compute_pop_stats.1
@@ -1,5 +1,5 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
 aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
diff --git a/doc/aevol_misc_create_eps.1 b/doc/aevol_misc_create_eps.1
index 36ca35f..e23ce05 100644
--- a/doc/aevol_misc_create_eps.1
+++ b/doc/aevol_misc_create_eps.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_misc_create_eps \-h
 |
@@ -11,13 +11,13 @@ aevol \- an in silico experimental evolution platform
 |
 .B \-\-version
 .br
-.B aevol_misc_create_eps \fR[\fB\-i\fI INDEX\fR | \fB\-r\fI RANK\fR] \fB\-g\fI GENER
+.B aevol_misc_create_eps \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] \fR[\fB\-v\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
 .B aevol_misc_create_eps
-produces several eps files describing an individual of this population
+creates EPS files with the triangles, the positive and negative	profiles, the phenotype, the CDS and the mRNAs of the individual of interest.
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -26,19 +26,23 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-i, \-\-index
+.B \-t, \-\-timestep
+.I TIMESTEP
+.br
+specify timestep of the individual of interest
+.br
+default: that contained in file last_gener.txt, if any
+.HP
+.B \-I, \-\-index
 .I  INDEX
 .br
-specify the index (ID in current generation) of the individual
+specify the index of the individual of interest
 .HP
-.B \-r, \-\-rank
+.B \-R, \-\-rank
 .I  RANK
 .br
-specify the rank of the individual
-.HP
-.B \-g, \-\-gener
-.I  GENER
+specify the rank of the individual of interest
 .br
-specify the generation of the individual
+default: best individual
 .SH "SEE ALSO"
 .B aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_misc_extract.1 b/doc/aevol_misc_extract.1
index 681fb48..dbb7770 100644
--- a/doc/aevol_misc_extract.1
+++ b/doc/aevol_misc_extract.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_misc_extract \-h
 |
@@ -11,7 +11,7 @@ aevol \- an in silico experimental evolution platform
 |
 .B \-\-version
 .br
-.B aevol_misc_extract \fR[\fB\-r\fI GENER\fR | \fB\-p\fI POP_FILE\fR] \fR[\fB\-t\fI PHEN_FILE\fR] \fR[\fB\-s\fI SEQ_FILE\fR] \fR[\fB\-g\fI NUM_GU\fR] \fR[\fB\-b\fR]
+.B aevol_misc_extract \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-S\fI SEQ_FILE\fR] \fR[\fB\-T\fI TRIANGLE_FILE\fR] \fR[\fB\-U\fI NUM_GU\fR] \fR[\fB\-a\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
@@ -26,33 +26,32 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-r
-.I  GENER
+.B \-t
+.I TIMESTEP
 .br
-read generation GENER from a full aevol backup
+specify timestep of the individual(s) of interest
 .HP
-.B \-p
-.I  POP_FILE
+.B \-S
+.I  SEQ_FILE
 .br
-read the population saved in population file POP_FILE
+extract sequences into file SEQ_FILE
 .HP
-.B \-t
-.I  PHEN_FILE
+.B \-T
+.I  TRIANGLE_FILE
 .br
-extract and save some infos about the phenotypes of the individuals to file PHEN_FILE
+extract phenotypic data into file TRIANGLE_FILE
 .HP
-.B \-s
-.I  SEQ_FILE
+.B \-U
+.I  NUM_GU
 .br
-extract and save the sequences of the individuals to file SEQ_FILE
-.HP
-.B \-g
-.I  num_gu
+only treat genetic unit #NUM_GU
 .br
-only treat this genetic unit (by default: treat all genetic units)
+default: treat all genetic units
 .HP
-.B \-b
+.B \-a
+.br
+treat all the individuals
 .br
-only treat the best individual
+default: treat only the best
 .SH "SEE ALSO"
 .B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_misc_fixed_mutations.1 b/doc/aevol_misc_fixed_mutations.1
deleted file mode 100644
index ab34822..0000000
--- a/doc/aevol_misc_fixed_mutations.1
+++ /dev/null
@@ -1,34 +0,0 @@
-./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
-.SH NAME
-aevol \- an in silico experimental evolution platform
-.SH SYNOPSIS
-.B aevol_misc_fixed_mutations \-h
-|
-.B \-\-help
-.br
-.B aevol_misc_fixed_mutations \-V
-|
-.B \-\-version
-.br
-.B aevol_misc_fixed_mutations \fB\-f\fI LINEAGE_FILE
-.SH DESCRIPTION
-.B Aevol
-is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
-.TP
-.B aevol_misc_fixed_mutations
-issues the detailed list of mutations that occurred in the lineage of a given individual
-.SH OPTIONS
-.TP
-.B \-h, \-\-help
-print help, then exit
-.TP
-.B \-V, \-\-version
-print version number, then exit
-.HP
-.B \-f, \-\-file
-.I  LINEAGE_FILE
-.br
-specify which lineage file to use. Lineage files are created by the ae_misc_lineage tool
-.SH "SEE ALSO"
-.B ae_misc_lineage, aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_misc_gene_families.1 b/doc/aevol_misc_gene_families.1
index 18ebd4e..9ea009a 100644
--- a/doc/aevol_misc_gene_families.1
+++ b/doc/aevol_misc_gene_families.1
@@ -1,5 +1,5 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
 aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
diff --git a/doc/aevol_misc_lineage.1 b/doc/aevol_misc_lineage.1
index 00333fe..75c02b9 100644
--- a/doc/aevol_misc_lineage.1
+++ b/doc/aevol_misc_lineage.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_misc_lineage \-h
 |
@@ -11,13 +11,13 @@ aevol \- an in silico experimental evolution platform
 |
 .B \-\-version
 .br
-.B aevol_misc_lineage \fR[\fB\-i\fI INDEX\fR | \fB\-r\fI RANK\fR] \fR[\fB\-b\fI GENER1\fR] \fB\-e\fI GENER2
+.B aevol_misc_lineage \fR[\fB\-b\fI TIMESTEP\fR] \fR[\fB\-e\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] \fR[\fB\-F\fR] \fR[\fB\-v\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
 .B aevol_misc_lineage
-allows for the reconstruction of the lineage of a given individual. Requires the tree to have been recorded during evolution.
+reconstruct the lineage of a given individual from the tree files
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -26,24 +26,33 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-i, \-\-index
+.B \-b, \-\-begin
+.I  TIMESTEP
+.br
+specify time t0 up to which to reconstruct the lineage
+.HP
+.B \-e, \-\-end
+.I  TIMESTEP
+.br
+specify time t_end of the indiv whose lineage is to be reconstructed
+.HP
+.B \-I, \-\-index
 .I  INDEX
 .br
-specify the index (ID in current generation) of the individual whose lineage is to be reconstructed
+specify the index of the indiv whose lineage is to be reconstructed
 .HP
-.B \-r, \-\-rank
+.B \-R, \-\-rank
 .I  RANK
 .br
-specify the rank of the individual whose lineage is to be reconstructed
+specify the rank of the indiv whose lineage is to be reconstructed
+default: best individual
 .HP
-.B \-b, \-\-begin
-.I  GENER
+.B \-F, \-\-full-check
 .br
-specify the generation up to which the lineage is to be reconstructed
+perform genome checks whenever possible
 .HP
-.B \-e, \-\-end
-.I  GENER
+.B \-v, \-\-verbose
 .br
-specify the generation of the individual whose lineage is to be reconstructed
+be verbose
 .SH "SEE ALSO"
 .B aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_misc_robustness.1 b/doc/aevol_misc_robustness.1
index 0a3ab5d..765b62f 100644
--- a/doc/aevol_misc_robustness.1
+++ b/doc/aevol_misc_robustness.1
@@ -1,17 +1,13 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
-.B aevol_misc_robustness \-h
-|
-.B \-\-help
+.B aevol_misc_robustness \-h \fR|\fB \-\-help
 .br
-.B aevol_misc_robustness \-V
-|
-.B \-\-version
+.B aevol_misc_robustness \-V \fR|\fB \-\-version
 .br
-.B aevol_misc_robustness \fR\fB\-g\fI GENER\fR [\fB\-n\fI NBCHILDREN] \fR[\fB\-i\fI INDEX\fR | \fB\-r\fI RANK\fR]
+.B aevol_misc_robustness \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-I\fI INDEX\fR | \fB\-R\fI RANK\fR] [\fB\-n\fI NB_MUTANTS]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
@@ -27,25 +23,26 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-g, \-\-gener
-.I  GENER
+.B \-t, \-\-timestep
+.I  TIMESTEP
 .br
-specify the generation number for which the robustness statistics are desired
+specify timestep of the individual of interest
 .HP
-.B \-n, \-\-nb\-children
-.I  NBCHILDREN
-.br
-specify the number of reproductions to simulate for each individual
-.HP
-.B \-i, \-\-index
+.B \-I, \-\-index
 .I  INDEX
 .br
-specify the index (ID in current generation) of the individual for whom detailed reproduction statistics are desired
+specify the index of the individual of interest
 .HP
-.B \-r, \-\-rank
+.B \-R, \-\-rank
 .I  RANK
 .br
-specify the rank of the individual for whom detailed reproduction statistics are desired
+specify the rank of the individual of interest
+default: best individual
+.HP
+.B \-n, \-\-nb\-mutants
+.I  NB_MUTANTS
+.br
+specify the number of mutants to be generated
 
 .SH "SEE ALSO"
-.B aevol_create, aevol_modify, aevol_propagate, aevol_run, aevol_misc_view_generation, aevol_misc_create_eps
+.B aevol_create, aevol_modify, aevol_propagate, aevol_run, aevol_misc_ancestor_robustness
diff --git a/doc/aevol_misc_view_generation.1 b/doc/aevol_misc_view.1
similarity index 56%
rename from doc/aevol_misc_view_generation.1
rename to doc/aevol_misc_view.1
index 3edee6a..03dae1f 100644
--- a/doc/aevol_misc_view_generation.1
+++ b/doc/aevol_misc_view.1
@@ -1,23 +1,23 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
-.B aevol_misc_view_generation \-h
+.B aevol_misc_view \-h
 |
 .B \-\-help
 .br
-.B aevol_misc_view_generation \-V
+.B aevol_misc_view \-V
 |
 .B \-\-version
 .br
-.B aevol_misc_view_generation \fB\-g\fI GENER
+.B aevol_misc_view \fB\-t\fI TIMESTEP
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
-.B aevol_misc_view_generation
-allows one to visualize a generation using the exact same graphical outputs used in aevol_run.
+.B aevol_misc_view
+view the simulation at the provided timestep
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -26,9 +26,11 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-g, \-\-gener
-.I  GENER
+.B \-t, \-\-timestep
+.I TIMESTEP
 .br
-specify generation to visualize (default 0)
+specify timestep to display
+.br
+default: that contained in file last_gener.txt, if any
 .SH "SEE ALSO"
 .B aevol_create, aevol_modify, aevol_propagate, aevol_run
diff --git a/doc/aevol_modify.1 b/doc/aevol_modify.1
index b35abc9..235d85f 100644
--- a/doc/aevol_modify.1
+++ b/doc/aevol_modify.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_modify \-h
 or
@@ -11,14 +11,14 @@ or
 or
 .B \-\-version
 .br
-.B aevol_modify \-g\fI GENER \fR[\fB\-f\fI param_file\fR]
+.B aevol_modify \fR[\fB\-T\fI TIMESTEP\fR] \fR[\fB\-F\fI PARAM_FILE\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
 .B aevol_modify
 modify an experiment as specified in
-.I param_file
+.I PARAM_FILE
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -27,13 +27,13 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-g, \-\-gener
-.I GENER
+.B \-t, \-\-timestep
+.I TIMESTEP
 .br
-specify generation number
+specify timestep
 .HP
 .B \-f, \-\-file
-.I param_file
+.I PARAM_FILE
 .br
 specify parameter file (default: param.in)
 .SH "SEE ALSO"
diff --git a/doc/aevol_propagate.1 b/doc/aevol_propagate.1
index 54620de..3a2e672 100644
--- a/doc/aevol_propagate.1
+++ b/doc/aevol_propagate.1
@@ -1,7 +1,7 @@
-\"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+./"test with man -l <file>
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_propagate \-h
 or
@@ -11,15 +11,13 @@ or
 or
 .B \-\-version
 .br
-.B aevol_propagate \fR[\fB\-v\fR]  \fR[\fB\-g\fI GENER\fR]  \fR[\fB\-i\fI INDIR\fR] \fR[\fB\-o\fI OUTDIR\fR] \fR[\fB\-S\fI GENERALSEED\fR]
-.br
-.B aevol_propagate \fR[\fB\-v\fR]  \fR[\fB\-g\fI GENER\fR]  \fR[\fB\-i\fI INDIR\fR] \fR[\fB\-o\fI OUTDIR\fR] \fR[\fB\-s\fI SELSEED\fR]   \fR[\fB\-m\fI MUTSEED\fR]   \fR[\fB\-t\fI STOCHSEED\fR]   \fR[\fB\-e\fI ENVVARSEED\fR]   \fR[\fB\-n\fI ENVNOISESEED\fR]
+.B aevol_propagate \fR[\fB\-t\fI TIMESTEP\fR] \fR[\fB\-K\fR] \fR[\fB\-o\fI OUTDIR\fR] \fR[\fB\-v\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
 .TP
 .B aevol_propagate
-creates a fresh copy of the experiment as it was at the given generation. The generation number of the copy will be reset to 0. If you use aevol_propagate repeatedly to initialize several simulations, you should specify a different seed for each simulation, otherwise all simulations will yield exactly the same results. You can use the option -S to do so. In this case, the random drawings will be different for all random processes enabled in your simulations (mutations, stochastic gene ex [...]
+creates a fresh copy of the experiment as it was at the given timestep. The timestep of the copy will be reset to 0.
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
@@ -27,54 +25,26 @@ print help, then exit
 .TP
 .B \-V, \-\-version
 print version number, then exit
-.TP
-.B \-v, \-\-verbose
-be verbose
 .HP
-.B \-g, \-\-gener
-.I GENER
+.B \-t, \-\-timestep
+.I TIMESTEP
 .br
-specify generation number
-(default: that contained in file last_gener.txt, if any)
-.HP
-.B \-i, \-\-in
-.I INDIR
+specify timestep to propagate
 .br
-specify input directory (default ".")
+default: that contained in file last_gener.txt, if any
+.TP
+.B \-K, \-\-keep-prng-st
+.br
+do not alter prng states
 .HP
 .B \-o, \-\-out
 .I OUTDIR
 .br
-specify output directory (default "./output")
-.HP
-.B \-S, \-\-general\-seed
-.I GENERALSEED
+specify output directory
 .br
-specify an integer to be used as a seed for random numbers. If you use aevol_propagate repeatedly to initialize several simulations, you should specify a different	seed for each simulation, otherwise all simulations will yield exactly the same results. If you specify this general seed, random drawings will be different for all random processes enabled in your simulations (mutations, stochastic gene expression, selection, migration, environmental variation, environmental noise). To change [...]
-.HP
-.B \-s, \-\-sel\-seed
-.I SELSEED
-.br
-specify an integer as a seed for random numbers needed for selection and migration (if spatial structure is enabled).
-.HP
-.B \-m, \-\-mut\-seed
-.I MUTSEED
-.br
-specify an integer as a seed for random numbers needed for mutations.
-.HP
-.B \-t, \-\-stoch\-seed
-.I STOCHSEED
-.br
-specify an integer as a seed for random numbers needed for stochastic gene expression.
-.HP
-.B \-e, \-\-env\-var\-seed
-.I ENVVARSEED
-.br
-specify an integer as a seed for random numbers needed for environmental variation.
-.HP
-.B \-n, \-\-env\-noise\-seed
-.I ENVNOISESEED
-.br
-specify an integer as a seed for random numbers needed for environmental noise.
+default "./output"
+.TP
+.B \-v, \-\-verbose
+be verbose
 .SH "SEE ALSO"
 .B aevol_create, aevol_run, aevol_modify
diff --git a/doc/aevol_run.1 b/doc/aevol_run.1
index 8da1e45..17eb88e 100644
--- a/doc/aevol_run.1
+++ b/doc/aevol_run.1
@@ -1,7 +1,7 @@
 ./"test with man -l <file>
-.TH AEVOL "1" "July 2014" "aevol 4.4" "User Manual"
+.TH AEVOL "1" "July 2016" "aevol 5.0" "User Manual"
 .SH NAME
-aevol \- an in silico experimental evolution platform
+Aevol \- an in silico experimental evolution platform
 .SH SYNOPSIS
 .B aevol_run \-h
 |
@@ -11,7 +11,7 @@ aevol \- an in silico experimental evolution platform
 |
 .B \-\-version
 .br
-.B aevol_run \fR[\fB\-r\fI GENER\fR] \fR[\fB\-n\fI NB_GENER\fR] \fR[\fB\-tvwx\fR]
+.B aevol_run \fR[\fB\-b\fI TIMESTEP\fR] \fR[\fB\-e\fI TIMESTEP\fR | \fB\-n\fI NB_TIMESTEP\fR] \fR[\fB\-p\fI NB_THREADS\fR] \fR[\fB\-vwx\fR]
 .SH DESCRIPTION
 .B Aevol
 is a simulation platform that allows one to let populations of digital organisms evolve in different conditions and study experimentally the mechanisms responsible for the structuration of the genome and the transcriptome.
@@ -26,18 +26,24 @@ print help, then exit
 .B \-V, \-\-version
 print version number, then exit
 .HP
-.B \-r, \-\-resume
-.I  GENER
+.B \-b, \-\-begin
+.I  TIMESTEP
 .br
-specify generation to resume simulation at (default 0)
+specify time t0 to resume simulation at (default read in last_gener.txt)
 .HP
-.B \-n, \-\-nbgener
-.I NB_GENER
+.B \-e, \-\-end
+.I  TIMESTEP
 .br
-specify number of generations to be run (default 1000)
+specify time of the end of the simulation
+.HP
+.B \-n, \-\-nb-timesteps
+.I NB_TIMESTEPS
+.br
+specify number of timesteps to be simulated (default 1000)
 .TP
-.B \-t, \-\-text
-use text files instead of binary files when possible
+.B \-p, \-\-parallel
+.I NB_THREADS
+run on NB_THREADS threads (use -1 for system default)
 .TP
 .B \-v, \-\-verbose
 be verbose
diff --git a/examples/README b/examples/README
deleted file mode 100644
index 0a31f73..0000000
--- a/examples/README
+++ /dev/null
@@ -1,57 +0,0 @@
-###############################################################################
-#
-#  Aevol - An in silico experimental evolution platform
-#
-###############################################################################
-# 
-#  Aevol is a digital genetics model: populations of digital organisms are
-#  subjected to a process of selection and variation, which creates a
-#  Darwinian dynamics.
-#  .
-#  By modifying the characteristics of selection (e.g. population size,
-#  type of environment, environmental variations) or variation (e.g.
-#  mutation rates, chromosomal rearrangement rates, types of
-#  rearrangements, horizontal transfer), one can study experimentally the
-#  impact of these parameters on the structure of the evolved organisms.
-#  In particular, since Aevol integrates a precise and realistic model of
-#  the genome, it allows for the study of structural variations of the
-#  genome (e.g. number of genes, synteny, proportion of coding sequences).
-#  .
-#  The simulation platform comes along with a set of tools for analysing
-#  phylogenies and measuring many characteristics of the organisms and
-#  populations along evolution.
-#
-###############################################################################
-
-
-The complete documentation being quite heavy, it is not included in basic
-distributions. Please visit www.aevol.fr
-
-
-To take a quick tour, please take the following steps:
-
-1) install aevol
-  cd into the main dir
-  ./configure
-  make
-  sudo make install
-
-  (see INSTALL in the main dir or run ./configure --help for more information)
-
-  NOTE: If you don't have sudo rights or simply don't want to install aevol
-  just yet, skip the "sudo make install" step and run the executables "locally"
-  with ../../src/aevol_create and ../../src/aevol_run_X11
-
-
-2) To run an example, cd into it then run:
-   aevol_create
-   aevol_run_X11
-   
-The first command will create an experiment with the parameters contained
-in the "param.in" file
-The second command will launch the simulation for 1000 generations
-(use --nbgener XXX or -n XXX to run for XXX generations)
-
-For more information, please see the manpages (e.g. man aevol_create), run any
-executable with the -h option (e.g. aevol_create -h) and ultimately visit 
-www.aevol.fr
diff --git a/examples/basic/param.in b/examples/basic/param.in
index 15f1551..9303881 100644
--- a/examples/basic/param.in
+++ b/examples/basic/param.in
@@ -1,29 +1,31 @@
 ###################################
-#         AEVOL PARAMATERS        #
+#         AEVOL PARAMETERS        #
 ###################################
 
 ##### 1. Initial setup ############
 STRAIN_NAME             basic_example
 SEED                    7250909
-INIT_POP_SIZE           1000
+INIT_POP_SIZE           1024
+WORLD_SIZE              32 32
 INIT_METHOD             ONE_GOOD_GENE CLONE
 CHROMOSOME_INITIAL_LENGTH   5000
+FUZZY_FLAVOR            0
 
 ##### 2. Selection ################
-SELECTION_SCHEME        exponential_ranking   0.998
+SELECTION_SCHEME        fitness_proportionate   1000
 
 ##### 3. Mutation rates ###########
-POINT_MUTATION_RATE     5e-5
-SMALL_INSERTION_RATE    5e-5
-SMALL_DELETION_RATE     5e-5
+POINT_MUTATION_RATE     1e-6
+SMALL_INSERTION_RATE    1e-6
+SMALL_DELETION_RATE     1e-6
 MAX_INDEL_SIZE          6
 
 ##### 4. Rearrangement rates (w/o alignements)
 WITH_ALIGNMENTS         false
-DUPLICATION_RATE        5e-5
-DELETION_RATE           5e-5
-TRANSLOCATION_RATE      5e-5
-INVERSION_RATE          5e-5
+DUPLICATION_RATE        1e-5
+DELETION_RATE           1e-5
+TRANSLOCATION_RATE      1e-5
+INVERSION_RATE          1e-5
 
 
 ##### 5. Population Structure #####
diff --git a/examples/lateral-transfer-by-replacement/README b/examples/lateral-transfer-by-replacement/README
deleted file mode 100644
index 5d17e85..0000000
--- a/examples/lateral-transfer-by-replacement/README
+++ /dev/null
@@ -1,32 +0,0 @@
-In this example, when an individual reproduces, there is a 50% probability
-that a lateral transfer is attempted. If yes, a donor individual is randomly chosen
-in the population. A segment of its chromosome is copied and transferred in the
-recipient individual (the one which was reproducing). This foreign DNA then replaces
-the homologous segment in the recipient chromosome. This is a way to perform allelic 
-recombination.
-
-To run this example for 200 generations, type the following commands:
-aevol_create
-aevol_run_X11 -n 200
-
-Then you can look at all the transfer events that took place by typing:
-more log_transfer.out
-
-You can also reconstruct the ancestral lineage of the final best individual and the
-mutations that occurred on this lineage, to see whether some transfer events were 
-selected:
-aevol_misc_lineage -b 0 -e 200
-aevol_misc_fixed_mutations -f lineage-b000000-e000200-i...-r...ae 
-more stats/fixedmut-b000000-e000200-i...-r...out
- 
-
-
-Details:
-
-A transfer attempt starts by searching for a short region of strong sequence similarity
-between the recipient chromosome and the donor chromosome. If none is found, there
-will be no transfer. If on the contrary an alignment is found with a sufficient 
-score, this initial alignment is extended until there is no sequence similarity 
-anymore or until a random event stops the extension -- at each extension step, there 
-is a probability called REPL_TRANSFER_DETACH_RATE to stop the extension even if there 
-is some sequence similarity. 
diff --git a/examples/lateral-transfer-by-replacement/param.in b/examples/lateral-transfer-by-replacement/param.in
deleted file mode 100644
index 21d37f7..0000000
--- a/examples/lateral-transfer-by-replacement/param.in
+++ /dev/null
@@ -1,93 +0,0 @@
-###################################
-#         AEVOL PARAMATERS        #
-###################################
-
-##### 1. Initial setup ############
-SEED                    7250909
-INIT_POP_SIZE           500
-INIT_METHOD             ONE_GOOD_GENE CLONE
-CHROMOSOME_INITIAL_LENGTH  5000
-
-##### 2. Selection ################
-SELECTION_SCHEME        fitness   750
-
-##### 3. Mutation rates ###########
-POINT_MUTATION_RATE     5e-6
-SMALL_INSERTION_RATE    5e-6
-SMALL_DELETION_RATE     1e-5
-MAX_INDEL_SIZE          6
-
-##### 4. Rearrangement rates (w/o alignements)
-DUPLICATION_RATE        5e-5
-DELETION_RATE           5e-5
-TRANSLOCATION_RATE      5e-5
-INVERSION_RATE          5e-5
-
-##### 5. Population Structure #####
-
-##### 6. Target function ##########
-ENV_SAMPLING      300
-ENV_ADD_GAUSSIAN  0.5   0.2   0.05
-ENV_ADD_GAUSSIAN  0.5   0.6   0.05
-ENV_ADD_GAUSSIAN  0.5   0.8   0.05
-
-MAX_TRIANGLE_WIDTH  0.005
-
-##### 7. Recording ################
-RECORD_TREE             true
-TREE_MODE               normal
-TREE_STEP               50
-MORE_STATS              false
-DUMP_STEP               0
-BACKUP_STEP             100
-LOG                     BARRIER TRANSFER
-
-##### 8. Environment variation ####
-ENV_VARIATION           autoregressive_height_variation 0.05 5000 123840
-
-##### 9. Phenotypic axis ##########
-ENV_AXIS_FEATURES METABOLISM
-
-##### 10. Secretion ###############
-
-##### 11. Plasmids ################
-ALLOW_PLASMIDS                  false
-WITH_TRANSFER                   true
-TRANSFER_REPL_RATE              0.1
-REPL_TRANSFER_WITH_CLOSE_POINTS true
-REPL_TRANSFER_DETACH_RATE       0.3
-
-##### 12. Alignment ###############
-ALIGN_FUNCTION          SIGMOID 0 40 
-ALIGN_W_ZONE_H_LEN      50
-ALIGN_MAX_SHIFT         20
-ALIGN_MATCH_BONUS       1
-ALIGN_MISMATCH_COST     2
-
-WITH_ALIGNMENTS         false
-# MIN_ALIGN_SCORE         40  
-# MAX_ALIGN_SCORE         100 
-# MAX_SHIFT               20  
-# W_ZONE_H_LEN            50
-
-##### 13. Rearrangement rates (w/ alignements)
-NEIGHBOURHOOD_RATE       1e-1
-DUPLICATION_PROPORTION   5e-5
-DELETION_PROPORTION      5e-5
-TRANSLOCATION_PROPORTION 5e-5
-INVERSION_PROPORTION     5e-5
-
-##### 14. Regulation ##############
-# HILL_SHAPE_N                   4 
-# HILL_SHAPE_THETA               0.5
-# DEGRADATION_RATE               1 
-# DEGRADATION_STEP               0.1
-# INDIVIDUAL_EVALUATION_DATES    NULL
-# INDIVIDUAL_LIFE_TIME           0
-# BINDING_ZEROS_PERCENTAGE       0.75
-# WITH_HEREDITY                  false
-# PROTEIN_PRESENCE_LIMIT         1e-5
-
-##### 15. Random, to be (fully) implemented
-TRANSLATION_COST                0
-
diff --git a/examples/with_space/param.in b/examples/with_space/param.in
deleted file mode 100644
index baad792..0000000
--- a/examples/with_space/param.in
+++ /dev/null
@@ -1,74 +0,0 @@
-###################################
-#         AEVOL PARAMATERS        #
-###################################
-
-##### 1. Initial setup ############
-SEED                    7250909
-INIT_POP_SIZE           1000
-INIT_METHOD             ONE_GOOD_GENE CLONE
-CHROMOSOME_INITIAL_LENGTH   5000
-
-##### 2. Selection ################
-SELECTION_SCHEME        fittest
-
-##### 3. Mutation rates ###########
-POINT_MUTATION_RATE     5e-5
-SMALL_INSERTION_RATE    5e-5
-SMALL_DELETION_RATE     5e-5
-MAX_INDEL_SIZE          6
-
-##### 4. Rearrangement rates (w/o alignements)
-DUPLICATION_RATE        5e-5
-DELETION_RATE           5e-5
-TRANSLOCATION_RATE      5e-5
-INVERSION_RATE          5e-5
-
-##### 5. Population Structure #####
-POP_STRUCTURE           grid 25 40
-MIGRATION_NUMBER        0
-
-##### 6. Target function ##########
-ENV_SAMPLING      300
-ENV_ADD_GAUSSIAN  0.2   0.3   0.04
-ENV_ADD_GAUSSIAN  0.3   0.2   0.02
-
-ENV_ADD_GAUSSIAN  0.2   0.7   0.02
-ENV_ADD_GAUSSIAN  0.3   0.8   0.04
-
-##### 7. Recording ################
-RECORD_TREE             false
-TREE_MODE               normal
-MORE_STATS              false
-DUMP_STEP               0
-BACKUP_STEP             100
-
-##### 8. Environment variation ####
-ENV_VARIATION           none
-
-##### 9. Phenotypic axis ##########
-ENV_AXIS_FEATURES SECRETION 0.50 METABOLISM  
-
-##### 10. Secretion ###############
-SECRETION_CONTRIB_TO_FITNESS  1  
-SECRETION_INITIAL             0
-SECRETION_DIFFUSION_PROP      0.01
-SECRETION_DEGRADATION_PROP    0.1
-SECRETION_COST                0
-
-##### 11. Plasmids ################
-ALLOW_PLASMIDS              false
-WITH_TRANSFER               false
-
-##### 12. Alignment ###############
-WITH_ALIGNMENTS         false
-# MIN_ALIGN_SCORE         40  
-# MAX_ALIGN_SCORE         100 
-# MAX_SHIFT               20  
-# W_ZONE_H_LEN            50
-
-##### 13. Rearrangement rates (w/ alignements)
-NEIGHBOURHOOD_RATE       5e-5
-DUPLICATION_PROPORTION   5e-5
-DELETION_PROPORTION      5e-5
-TRANSLOCATION_PROPORTION 5e-5
-INVERSION_PROPORTION     5e-5
diff --git a/examples/workflow/README.txt b/examples/workflow/README
similarity index 56%
rename from examples/workflow/README.txt
rename to examples/workflow/README
index 9720c14..adc89e3 100644
--- a/examples/workflow/README.txt
+++ b/examples/workflow/README
@@ -22,8 +22,9 @@
 # The following set of commands should work as is if you have installed aevol
 # with make install, which is recommended.
 #
-# If you haven't installed aevol, you will need to specify where to find the
-# executables, which should be in <aevol_dir>/src for the 4 main executables
+# If you haven't installed aevol, you will nedd to either add the binaries'
+# locations in your PATH or to specify where to find them at each step.
+# They should be in <aevol_dir>/src for the 4 main executables
 # and in <aevol_dir>/src/post_treatments for the rest, <aevol_dir> being the
 # main aevol directory you have downloaded.
 # E.g. if your <aevol_dir> is /home/login/aevol, then the command
@@ -36,77 +37,103 @@
 
 # ========== Wild-Type generation ==========
 #
-
-#mkdir wild_type 
+#mkdir wild_type
 cd wild_type
 aevol_create
-aevol_run_X11 -n 5000   
-# or aevol_run -n 5000   depending on whether you compiled with graphical output enabled or not
-
+aevol_run -n 5000 -p -1
+# "-p -1" means you ask aevol to be run on n threads, with n
+# being determined by your system's settings
 
 
 # ========== Experimental setup ==========
 #
-
-cd ..
 # Propagate the experiment, meaning prepare directories for different
-# runs starting from the wild type 
-mydirnamesA="line01 line02 line03 line04 line05"
-mydirnamesB="line06 line07 line08 line09 line10"
-for mydir in $mydirnamesA $mydirnamesB
+# runs starting from the wild type
+# By default, the random generator states are modified so that you
+# don't end up with the exact same simulation repeated several times
+# but rather different repetitions with the same set of parameters
+#
+outdirsA="line01 line02 line03 line04 line05"
+outdirsB="line06 line07 line08 line09 line10"
+outdirsC="line11 line12 line13 line14 line15"
+for mydir in $outdirsA $outdirsB $outdirsC
 do
-   echo $mydir
-   aevol_propagate -g 5000 -i wild_type -o $mydir -S $RANDOM
-done  
+  aevol_propagate -o ../$mydir
+done
+
+# Go back to the workflow example directory
+cd ..
 
 # For each experiment, create a file with the parameters to change
-echo "# New environment 
-    ENV_GAUSSIAN  0.5   0.2   0.05
-    ENV_GAUSSIAN  0.5   0.4   0.05
-    ENV_GAUSSIAN  0.5   0.8   0.05
-    ENV_VARIATION none" > newparam-groupA.in
+echo "# New environment
+ENV_GAUSSIAN  0.5   0.2   0.05
+ENV_GAUSSIAN  0.5   0.4   0.05
+ENV_GAUSSIAN  0.5   0.8   0.05
+ENV_VARIATION none
+# New rearrangement rates
+DUPLICATION_RATE    1e-4
+DELETION_RATE       1e-4
+TRANSLOCATION_RATE  1e-4
+INVERSION_RATE      1e-4" > newparam-groupA.in
+
+echo "# New environment
+ENV_GAUSSIAN  0.5   0.2   0.05
+ENV_GAUSSIAN  0.5   0.4   0.05
+ENV_GAUSSIAN  0.5   0.8   0.05
+ENV_VARIATION none
+# New rearrangement rates
+DUPLICATION_RATE    1e-6
+DELETION_RATE       1e-6
+TRANSLOCATION_RATE  1e-6
+INVERSION_RATE      1e-6" > newparam-groupB.in
 
 echo "# New environment
-    ENV_GAUSSIAN  0.5   0.2   0.05
-    ENV_GAUSSIAN  0.5   0.4   0.05
-    ENV_GAUSSIAN  0.5   0.8   0.05
-    ENV_VARIATION none
-   # New rearrangement rates
-    DUPLICATION_RATE          1e-5
-    DELETION_RATE                1e-5
-    TRANSLOCATION_RATE    1e-5
-    INVERSION_RATE              1e-5" > newparam-groupB.in
+ENV_GAUSSIAN  0.5   0.2   0.05
+ENV_GAUSSIAN  0.5   0.4   0.05
+ENV_GAUSSIAN  0.5   0.8   0.05
+ENV_VARIATION none" > newparam-groupC.in
 
 
 # Apply these modifications
 #
-for mydir in $mydirnamesA 
+for mydir in $outdirsA
 do
    cd $mydir
-   echo $mydir
-   aevol_modify  --gener 0 --file ../newparam-groupA.in
+   aevol_modify -f ../newparam-groupA.in
    cd ..
-done 
+done
 
-for mydir in $mydirnamesB 
+for mydir in $outdirsB
 do
-   cd $mydir
-   echo $mydir
-   aevol_modify  --gener 0 --file ../newparam-groupB.in
-   cd ..
-done 
+  cd $mydir
+  aevol_modify -f ../newparam-groupB.in
+  cd ..
+done
+
+for mydir in $outdirsC
+do
+  cd $mydir
+  aevol_modify -f ../newparam-groupC.in
+  cd ..
+done
 
 
 
 
 # ========== Run the simulations ==========
 #
-for mydir in $mydirnamesA $mydirnamesB
+for mydir in $outdirsA $outdirsB $outdirsC
 do
-   cd mydir
-   aevol_run_X11 -n 20000
-   cd ..
-done 
+  cd $mydir
+  aevol_run -e 20000 -p -1
+  cd ..
+done
+
+# You can stop any simulation at any time and resume it from where you've
+# stopped it with the exact same command (from within the same directory)
+# e.g.
+# cd line01
+# aevol_run -e 20000 -p -1
 
 
 
@@ -115,15 +142,17 @@ done
 # A set of post-treatment tools is available to help analyse the outcome.
 # 
 
-# ---------- aevol_misc_view_generation ----------
+# ---------- aevol_misc_view ----------
 #
-# The simplest miscellaneous tool is view_generation. It allows one to
-# visualize a generation using the exact same graphical outputs used in
-# aevol_run.
+# The simplest miscellaneous tool is view. It allows one to
+# visualize a simulation at a given timestep using the exact
+# same graphical outputs used in aevol_run.
 # However, since it relies on graphics, it is only available when aevol is
 # compiled with x enabled (which is the default).
 #
-aevol_misc_view_generation -g 10000
+#cd line01
+#aevol_misc_view
+#cd ..
 
 
 # ---------- aevol_misc_create_eps ----------
@@ -132,7 +161,12 @@ aevol_misc_view_generation -g 10000
 # create_eps tool. Files will be outputted in eps_files_xxxxxx (with 
 # xxxxxx the generation number)
 #
-aevol_misc_create_eps -g 10000
+for mydir in $outdirsA $outdirsB $outdirsC
+do
+  cd $mydir
+  aevol_misc_create_eps &
+  cd ..
+done
 
 
 # ---------- aevol_misc_robustness ----------
@@ -150,8 +184,12 @@ aevol_misc_create_eps -g 10000
 # stats/replication_numgener.out, with one line per simulated child of this 
 # particular individual.
 #
-aevol_misc_robustness -g 10000 
-
+for mydir in $outdirsA $outdirsB $outdirsC
+do
+   cd $mydir
+   aevol_misc_robustness &
+   cd ..
+done
 
 
 # ---------- aevol_misc_lineage ----------
@@ -162,35 +200,25 @@ aevol_misc_robustness -g 10000
 # history of a given individual of a given generation.
 # This file can then be used as the input for subsequent post-treatments.
 #
-aevol_misc_lineage -e 10000
+for mydir in $outdirsA $outdirsB $outdirsC
+do
+   cd $mydir
+   aevol_misc_lineage
+   cd ..
+done
 
 
 # ---------- aevol_misc_ancstats ----------
 #
 # Statistics of a lineage can be obtained with this tool.
-# The generated stats are outputted in stats/ancstats/
+# The generated output is in stats/ancstats/
 #
-aevol_misc_ancstats -f lineage-b000000-e010000-i*-r1000.ae
-
-
-
-
-# ---------- aevol_misc_fixed_mutations ----------
+# The option -M adds the list of mutational events that occurred
+# on the lineage as an additional output (in stats/).
 #
-# This tool outputs the list of mutational events that occurred
-# on the lineage given as input.
-# The generated list is outputted in stats/
-#
-aevol_misc_fixed_mutations -f lineage-b000000-e010000-i*-r1000.ae
-
-
-# ---------- aevol_misc_gene_families ----------
-#
-# This tool outputs the history of each gene family in the lineage 
-# given as input. 
-# The generated gene trees are outputted in gene_trees/
-# This analysis can be longer than ancstats or fixed_mutations,
-# it can take from a few minutes to a few hours depending on
-# gene number evolution in the lineage.
-
-aevol_misc_gene_families -f lineage-b000000-e010000-i*-r1000.ae
+for mydir in $outdirsA $outdirsB $outdirsC
+do
+   cd $mydir
+   aevol_misc_ancestor_stats lineage-*.ae -M &
+   cd ..
+done
diff --git a/examples/workflow/wild_type/param.in b/examples/workflow/wild_type/param.in
index 0c1ef55..4bacf89 100644
--- a/examples/workflow/wild_type/param.in
+++ b/examples/workflow/wild_type/param.in
@@ -4,25 +4,26 @@
 
 ##### 1. Initial setup ############
 SEED                    486343
-INIT_POP_SIZE           1000
+INIT_POP_SIZE           400
+WORLD_SIZE              20 20
 INIT_METHOD             ONE_GOOD_GENE CLONE
 MAX_TRIANGLE_WIDTH  	0.01
 CHROMOSOME_INITIAL_LENGTH   5000
 
 ##### 2. Selection ################
-SELECTION_SCHEME        exponential_ranking    0.998
+SELECTION_SCHEME        fitness_proportionate   1000
 
 ##### 3. Mutation rates ###########
-POINT_MUTATION_RATE     5e-6
-SMALL_INSERTION_RATE    5e-6
-SMALL_DELETION_RATE     5e-6
+POINT_MUTATION_RATE     1e-5
+SMALL_INSERTION_RATE    1e-5
+SMALL_DELETION_RATE     1e-5
 MAX_INDEL_SIZE          6
 
 ##### 4. Rearrangement rates (w/o alignements)
-DUPLICATION_RATE        5e-6
-DELETION_RATE           5e-6
-TRANSLOCATION_RATE      5e-6
-INVERSION_RATE          5e-6
+DUPLICATION_RATE        1e-5
+DELETION_RATE           1e-5
+TRANSLOCATION_RATE      1e-5
+INVERSION_RATE          1e-5
 
 ##### 5. Population Structure #####
 
@@ -34,11 +35,10 @@ ENV_GAUSSIAN  0.5   0.8   0.05
 
 ##### 7. Recording ################
 RECORD_TREE             true
-TREE_MODE               normal
 TREE_STEP               100
 MORE_STATS              false
 DUMP_STEP               0
-BACKUP_STEP             500
+BACKUP_STEP             1000
 
 ##### 8. Environment variation ####
 ENV_VARIATION           autoregressive_height_variation 0.05 5000 7687534
diff --git a/install-sh b/install-sh
index 6781b98..377bb86 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-11-20.07; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2009-04-28.21; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for 'test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -194,13 +202,17 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call `install-sh -d' without argument.
+  # It's OK to call 'install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for 'test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -347,7 +354,7 @@ do
 	      if test -z "$dir_arg" || {
 		   # Check for POSIX incompatibilities with -m.
 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
+		   # other-writable bit of parent directory when it shouldn't.
 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
 		   case $ls_ld_tmpdir in
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/m4/ax_boost_base.m4 b/m4/ax_boost_base.m4
new file mode 100644
index 0000000..f3279f2
--- /dev/null
+++ b/m4/ax_boost_base.m4
@@ -0,0 +1,285 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# DESCRIPTION
+#
+#   Test for the Boost C++ libraries of a particular version (or newer)
+#
+#   If no path to the installed boost library is given the macro searchs
+#   under /usr, /usr/local, /opt and /opt/local and evaluates the
+#   $BOOST_ROOT environment variable. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
+#
+#   And sets:
+#
+#     HAVE_BOOST
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas at randspringer.de>
+#   Copyright (c) 2009 Peter Adolphs
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 26
+
+AC_DEFUN([AX_BOOST_BASE],
+[
+AC_ARG_WITH([boost],
+  [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
+    [use Boost library from a standard location (ARG=yes),
+     from the specified location (ARG=<path>),
+     or disable it (ARG=no)
+     @<:@ARG=yes@:>@ ])],
+    [
+    if test "$withval" = "no"; then
+        want_boost="no"
+    elif test "$withval" = "yes"; then
+        want_boost="yes"
+        ac_boost_path=""
+    else
+        want_boost="yes"
+        ac_boost_path="$withval"
+    fi
+    ],
+    [want_boost="yes"])
+
+
+AC_ARG_WITH([boost-libdir],
+        AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
+        [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
+        [
+        if test -d "$withval"
+        then
+                ac_boost_lib_path="$withval"
+        else
+                AC_MSG_ERROR(--with-boost-libdir expected directory name)
+        fi
+        ],
+        [ac_boost_lib_path=""]
+)
+
+if test "x$want_boost" = "xyes"; then
+    boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
+    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
+    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
+    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+        boost_lib_version_req_sub_minor="0"
+        fi
+    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+    AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
+    succeeded=no
+
+    dnl On 64-bit systems check for system libraries in both lib64 and lib.
+    dnl The former is specified by FHS, but e.g. Debian does not adhere to
+    dnl this (as it rises problems for generic multi-arch support).
+    dnl The last entry in the list is chosen by default when no libraries
+    dnl are found, e.g. when only header-only libraries are installed!
+    libsubdirs="lib"
+    ax_arch=`uname -m`
+    case $ax_arch in
+      x86_64)
+        libsubdirs="lib64 libx32 lib lib64"
+        ;;
+      ppc64|s390x|sparc64|aarch64|ppc64le)
+        libsubdirs="lib64 lib lib64 ppc64le"
+        ;;
+    esac
+
+    dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
+    dnl them priority over the other paths since, if libs are found there, they
+    dnl are almost assuredly the ones desired.
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
+
+    case ${host_cpu} in
+      i?86)
+        libsubdirs="lib/i386-${host_os} $libsubdirs"
+        ;;
+    esac
+
+    dnl first we check the system location for boost libraries
+    dnl this location ist chosen if boost libraries are installed with the --layout=system option
+    dnl or if you install boost with RPM
+    if test "$ac_boost_path" != ""; then
+        BOOST_CPPFLAGS="-I$ac_boost_path/include"
+        for ac_boost_path_tmp in $libsubdirs; do
+                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
+                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
+                        break
+                fi
+        done
+    elif test "$cross_compiling" != yes; then
+        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
+                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+                break;
+            fi
+        done
+    fi
+
+    dnl overwrite ld flags if we have required special directory with
+    dnl --with-boost-libdir parameter
+    if test "$ac_boost_lib_path" != ""; then
+       BOOST_LDFLAGS="-L$ac_boost_lib_path"
+    fi
+
+    CPPFLAGS_SAVED="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+    export CPPFLAGS
+
+    LDFLAGS_SAVED="$LDFLAGS"
+    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+    export LDFLAGS
+
+    AC_REQUIRE([AC_PROG_CXX])
+    AC_LANG_PUSH(C++)
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+    @%:@include <boost/version.hpp>
+    ]], [[
+    #if BOOST_VERSION >= $WANT_BOOST_VERSION
+    // Everything is okay
+    #else
+    #  error Boost version is too old
+    #endif
+    ]])],[
+        AC_MSG_RESULT(yes)
+    succeeded=yes
+    found_system=yes
+        ],[
+        ])
+    AC_LANG_POP([C++])
+
+
+
+    dnl if we found no boost with system layout we search for boost libraries
+    dnl built and installed without the --layout=system option or for a staged(not installed) version
+    if test "x$succeeded" != "xyes"; then
+        CPPFLAGS="$CPPFLAGS_SAVED"
+        LDFLAGS="$LDFLAGS_SAVED"
+        BOOST_CPPFLAGS=
+        BOOST_LDFLAGS=
+        _version=0
+        if test "$ac_boost_path" != ""; then
+            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                    V_CHECK=`expr $_version_tmp \> $_version`
+                    if test "$V_CHECK" = "1" ; then
+                        _version=$_version_tmp
+                    fi
+                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+                done
+                dnl if nothing found search for layout used in Windows distributions
+                if test -z "$BOOST_CPPFLAGS"; then
+                    if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
+                        BOOST_CPPFLAGS="-I$ac_boost_path"
+                    fi
+                fi
+            fi
+        else
+            if test "$cross_compiling" != yes; then
+                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                            V_CHECK=`expr $_version_tmp \> $_version`
+                            if test "$V_CHECK" = "1" ; then
+                                _version=$_version_tmp
+                                best_path=$ac_boost_path
+                            fi
+                        done
+                    fi
+                done
+
+                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+                if test "$ac_boost_lib_path" = ""; then
+                    for libsubdir in $libsubdirs ; do
+                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                    done
+                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
+                fi
+            fi
+
+            if test "x$BOOST_ROOT" != "x"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
+                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+                        stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
+                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
+                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+                        AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
+                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
+                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
+                    fi
+                fi
+            fi
+        fi
+
+        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+        export CPPFLAGS
+        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+        export LDFLAGS
+
+        AC_LANG_PUSH(C++)
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        @%:@include <boost/version.hpp>
+        ]], [[
+        #if BOOST_VERSION >= $WANT_BOOST_VERSION
+        // Everything is okay
+        #else
+        #  error Boost version is too old
+        #endif
+        ]])],[
+            AC_MSG_RESULT(yes)
+        succeeded=yes
+        found_system=yes
+            ],[
+            ])
+        AC_LANG_POP([C++])
+    fi
+
+    if test "$succeeded" != "yes" ; then
+        if test "$_version" = "0" ; then
+            AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
+        else
+            AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
+        fi
+        # execute ACTION-IF-NOT-FOUND (if present):
+        ifelse([$3], , :, [$3])
+    else
+        AC_SUBST(BOOST_CPPFLAGS)
+        AC_SUBST(BOOST_LDFLAGS)
+        AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
+        # execute ACTION-IF-FOUND (if present):
+        ifelse([$2], , :, [$2])
+    fi
+
+    CPPFLAGS="$CPPFLAGS_SAVED"
+    LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+])
diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4
new file mode 100644
index 0000000..f162163
--- /dev/null
+++ b/m4/ax_boost_filesystem.m4
@@ -0,0 +1,118 @@
+# ===========================================================================
+#    http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_FILESYSTEM
+#
+# DESCRIPTION
+#
+#   Test for Filesystem library from the Boost C++ libraries. The macro
+#   requires a preceding call to AX_BOOST_BASE. Further documentation is
+#   available at <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_FILESYSTEM_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_FILESYSTEM
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Thomas Porschberg <thomas at randspringer.de>
+#   Copyright (c) 2009 Michael Tindal
+#   Copyright (c) 2009 Roman Rybalko <libtorrent at romanr.info>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 26
+
+AC_DEFUN([AX_BOOST_FILESYSTEM],
+[
+	AC_ARG_WITH([boost-filesystem],
+	AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
+                   [use the Filesystem library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_filesystem_lib=""
+        else
+		    want_boost="yes"
+		ax_boost_user_filesystem_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		LIBS_SAVED=$LIBS
+		LIBS="$LIBS $BOOST_SYSTEM_LIB"
+		export LIBS
+
+        AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
+					   ax_cv_boost_filesystem,
+        [AC_LANG_PUSH([C++])
+         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
+                                   [[using namespace boost::filesystem;
+                                   path my_path( "foo/bar/data.txt" );
+                                   return 0;]])],
+					       ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_filesystem" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+            if test "x$ax_boost_user_filesystem_lib" = "x"; then
+                for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+				done
+                if test "x$link_filesystem" != "xyes"; then
+                for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+				done
+		    fi
+            else
+               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                   [link_filesystem="no"])
+                  done
+
+            fi
+            if test "x$ax_lib" = "x"; then
+                AC_MSG_ERROR(Could not find a version of the library!)
+            fi
+			if test "x$link_filesystem" != "xyes"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+		LDFLAGS="$LDFLAGS_SAVED"
+		LIBS="$LIBS_SAVED"
+	fi
+])
diff --git a/m4/ax_boost_system.m4 b/m4/ax_boost_system.m4
new file mode 100644
index 0000000..43570a5
--- /dev/null
+++ b/m4/ax_boost_system.m4
@@ -0,0 +1,121 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_SYSTEM
+#
+# DESCRIPTION
+#
+#   Test for System library from the Boost C++ libraries. The macro requires
+#   a preceding call to AX_BOOST_BASE. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_SYSTEM_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_SYSTEM
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas at randspringer.de>
+#   Copyright (c) 2008 Michael Tindal
+#   Copyright (c) 2008 Daniel Casimiro <dan.casimiro at gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 18
+
+AC_DEFUN([AX_BOOST_SYSTEM],
+[
+	AC_ARG_WITH([boost-system],
+	AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
+                   [use the System library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-system=boost_system-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_system_lib=""
+        else
+		    want_boost="yes"
+		ax_boost_user_system_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+        AC_REQUIRE([AC_CANONICAL_BUILD])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::System library is available,
+					   ax_cv_boost_system,
+        [AC_LANG_PUSH([C++])
+			 CXXFLAGS_SAVE=$CXXFLAGS
+			 CXXFLAGS=
+
+			 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
+				    [[boost::system::error_category *a = 0;]])],
+                   ax_cv_boost_system=yes, ax_cv_boost_system=no)
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_system" = "xyes"; then
+			AC_SUBST(BOOST_CPPFLAGS)
+
+			AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+
+			LDFLAGS_SAVE=$LDFLAGS
+            if test "x$ax_boost_user_system_lib" = "x"; then
+                for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                 [link_system="no"])
+				done
+                if test "x$link_system" != "xyes"; then
+                for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                 [link_system="no"])
+				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                   [link_system="no"])
+                  done
+
+            fi
+            if test "x$ax_lib" = "x"; then
+                AC_MSG_ERROR(Could not find a version of the library!)
+            fi
+			if test "x$link_system" = "xno"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
new file mode 100644
index 0000000..3019ab5
--- /dev/null
+++ b/m4/ax_cxx_compile_stdcxx_11.m4
@@ -0,0 +1,142 @@
+# ============================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++11
+#   standard; if necessary, add switches to CXXFLAGS to enable support.
+#
+#   The first argument, if specified, indicates whether you insist on an
+#   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+#   -std=c++11).  If neither is specified, you get whatever works, with
+#   preference for an extended mode.
+#
+#   The second argument, if specified 'mandatory' or if left unspecified,
+#   indicates that baseline C++11 support is required and that the macro
+#   should error out if no mode with that support is found.  If specified
+#   'optional', then configuration proceeds regardless, after defining
+#   HAVE_CXX11 if and only if a supporting mode is found.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+#   Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+#   Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+#   Copyright (c) 2014 Alexey Sokolov <sokolov at google.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 4
+
+m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+]])
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
+  m4_if([$1], [], [],
+        [$1], [ext], [],
+        [$1], [noext], [],
+        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
+  m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
+        [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
+        [$2], [optional], [ax_cxx_compile_cxx11_required=false],
+        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
+  AC_LANG_PUSH([C++])dnl
+  ac_success=no
+  AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
+  ax_cv_cxx_compile_cxx11,
+  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+    [ax_cv_cxx_compile_cxx11=yes],
+    [ax_cv_cxx_compile_cxx11=no])])
+  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+    ac_success=yes
+  fi
+
+  m4_if([$1], [noext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=gnu++11 -std=gnu++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+
+  m4_if([$1], [ext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=c++11 -std=c++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+  AC_LANG_POP([C++])
+  if test x$ax_cxx_compile_cxx11_required = xtrue; then
+    if test x$ac_success = xno; then
+      AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
+    fi
+  else
+    if test x$ac_success = xno; then
+      HAVE_CXX11=0
+      AC_MSG_NOTICE([No compiler with C++11 support was found])
+    else
+      HAVE_CXX11=1
+      AC_DEFINE(HAVE_CXX11,1,
+                [define if the compiler supports basic C++11 syntax])
+    fi
+
+    AC_SUBST(HAVE_CXX11)
+  fi
+])
diff --git a/m4/ax_cxx_compile_stdcxx_14.m4 b/m4/ax_cxx_compile_stdcxx_14.m4
new file mode 100644
index 0000000..db57c0c
--- /dev/null
+++ b/m4/ax_cxx_compile_stdcxx_14.m4
@@ -0,0 +1,142 @@
+# ============================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional])
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++14
+#   standard; if necessary, add switches to CXXFLAGS to enable support.
+#
+#   The first argument, if specified, indicates whether you insist on an
+#   extended mode (e.g. -std=gnu++14) or a strict conformance mode (e.g.
+#   -std=c++14).  If neither is specified, you get whatever works, with
+#   preference for an extended mode.
+#
+#   The second argument, if specified 'mandatory' or if left unspecified,
+#   indicates that baseline C++14 support is required and that the macro
+#   should error out if no mode with that support is found.  If specified
+#   'optional', then configuration proceeds regardless, after defining
+#   HAVE_CXX14 if and only if a supporting mode is found.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+#   Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+#   Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+#   Copyright (c) 2014 Alexey Sokolov <sokolov at google.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 4
+
+m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+]])
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
+  m4_if([$1], [], [],
+        [$1], [ext], [],
+        [$1], [noext], [],
+        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl
+  m4_if([$2], [], [ax_cxx_compile_cxx14_required=true],
+        [$2], [mandatory], [ax_cxx_compile_cxx14_required=true],
+        [$2], [optional], [ax_cxx_compile_cxx14_required=false],
+        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])])
+  AC_LANG_PUSH([C++])dnl
+  ac_success=no
+  AC_CACHE_CHECK(whether $CXX supports C++14 features by default,
+  ax_cv_cxx_compile_cxx14,
+  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
+    [ax_cv_cxx_compile_cxx14=yes],
+    [ax_cv_cxx_compile_cxx14=no])])
+  if test x$ax_cv_cxx_compile_cxx14 = xyes; then
+    ac_success=yes
+  fi
+
+  m4_if([$1], [noext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=gnu++14 -std=gnu++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+
+  m4_if([$1], [ext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=c++14 -std=c++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+  AC_LANG_POP([C++])
+  if test x$ax_cxx_compile_cxx14_required = xtrue; then
+    if test x$ac_success = xno; then
+      AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.])
+    fi
+  else
+    if test x$ac_success = xno; then
+      HAVE_CXX14=0
+      AC_MSG_NOTICE([No compiler with C++14 support was found])
+    else
+      HAVE_CXX14=1
+      AC_DEFINE(HAVE_CXX14,1,
+                [define if the compiler supports basic C++14 syntax])
+    fi
+
+    AC_SUBST(HAVE_CXX14)
+  fi
+])
diff --git a/missing b/missing
index cdea514..db98974 100755
--- a/missing
+++ b/missing
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2012-06-26.16; # UTC
+scriptversion=2013-10-28.13; # UTC
 
 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
@@ -160,7 +160,7 @@ give_advice ()
       ;;
    autom4te*)
       echo "You might have modified some maintainer files that require"
-      echo "the 'automa4te' program to be rebuilt."
+      echo "the 'autom4te' program to be rebuilt."
       program_details 'autom4te'
       ;;
     bison*|yacc*)
diff --git a/src/Makefile.am b/src/Makefile.am
index 7812b86..f49506e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,16 +38,15 @@ AM_CPPFLAGS += -D_FORTIFY_SOURCE=2
 #  LDADD = -laevol
 #####  #####
 
-
 LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
 
 
-
-
 bin_PROGRAMS = aevol_run aevol_create aevol_modify aevol_propagate
 CLEANFILES = aevol_run aevol_create aevol_modify aevol_propagate
 
-
+aevol_propagate_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS)
+aevol_propagate_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS)
+aevol_propagate_LDADD = $(LDADD) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
 
 aevol_run_SOURCES = aevol_run.cpp
 aevol_create_SOURCES = aevol_create.cpp
diff --git a/src/Makefile.in b/src/Makefile.in
index 4e5fa97..6c2ace3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,14 +86,21 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 bin_PROGRAMS = aevol_run$(EXEEXT) aevol_create$(EXEEXT) \
 	aevol_modify$(EXEEXT) aevol_propagate$(EXEEXT)
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -72,36 +116,64 @@ aevol_modify_OBJECTS = $(am_aevol_modify_OBJECTS)
 aevol_modify_LDADD = $(LDADD)
 aevol_modify_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_propagate_OBJECTS = aevol_propagate.$(OBJEXT)
+am_aevol_propagate_OBJECTS =  \
+	aevol_propagate-aevol_propagate.$(OBJEXT)
 aevol_propagate_OBJECTS = $(am_aevol_propagate_OBJECTS)
-aevol_propagate_LDADD = $(LDADD)
-aevol_propagate_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \
-	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
+am__DEPENDENCIES_1 =
+aevol_propagate_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+aevol_propagate_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+	$(aevol_propagate_LDFLAGS) $(LDFLAGS) -o $@
 am_aevol_run_OBJECTS = aevol_run.$(OBJEXT)
 aevol_run_OBJECTS = $(am_aevol_run_OBJECTS)
 aevol_run_LDADD = $(LDADD)
 aevol_run_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
+AM_V_lt = $(am__v_lt_ at AM_V@)
+am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(aevol_create_SOURCES) $(aevol_modify_SOURCES) \
 	$(aevol_propagate_SOURCES) $(aevol_run_SOURCES)
 DIST_SOURCES = $(aevol_create_SOURCES) $(aevol_modify_SOURCES) \
 	$(aevol_propagate_SOURCES) $(aevol_run_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -109,12 +181,33 @@ am__can_run_installinfo = \
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
 	distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -146,19 +239,21 @@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -170,6 +265,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -183,6 +280,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -213,14 +311,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -236,6 +342,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -278,6 +385,9 @@ SUBDIRS = libaevol post_treatments
 #####  #####
 LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
 CLEANFILES = aevol_run aevol_create aevol_modify aevol_propagate
+aevol_propagate_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS)
+aevol_propagate_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS)
+aevol_propagate_LDADD = $(LDADD) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
 aevol_run_SOURCES = aevol_run.cpp
 aevol_create_SOURCES = aevol_create.cpp
 aevol_modify_SOURCES = aevol_modify.cpp
@@ -298,7 +408,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu src/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -325,10 +434,11 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -349,25 +459,30 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
 
 clean-binPROGRAMS:
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
 aevol_create$(EXEEXT): $(aevol_create_OBJECTS) $(aevol_create_DEPENDENCIES) $(EXTRA_aevol_create_DEPENDENCIES) 
 	@rm -f aevol_create$(EXEEXT)
-	$(CXXLINK) $(aevol_create_OBJECTS) $(aevol_create_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_create_OBJECTS) $(aevol_create_LDADD) $(LIBS)
+
 aevol_modify$(EXEEXT): $(aevol_modify_OBJECTS) $(aevol_modify_DEPENDENCIES) $(EXTRA_aevol_modify_DEPENDENCIES) 
 	@rm -f aevol_modify$(EXEEXT)
-	$(CXXLINK) $(aevol_modify_OBJECTS) $(aevol_modify_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_modify_OBJECTS) $(aevol_modify_LDADD) $(LIBS)
+
 aevol_propagate$(EXEEXT): $(aevol_propagate_OBJECTS) $(aevol_propagate_DEPENDENCIES) $(EXTRA_aevol_propagate_DEPENDENCIES) 
 	@rm -f aevol_propagate$(EXEEXT)
-	$(CXXLINK) $(aevol_propagate_OBJECTS) $(aevol_propagate_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(aevol_propagate_LINK) $(aevol_propagate_OBJECTS) $(aevol_propagate_LDADD) $(LIBS)
+
 aevol_run$(EXEEXT): $(aevol_run_OBJECTS) $(aevol_run_DEPENDENCIES) $(EXTRA_aevol_run_DEPENDENCIES) 
 	@rm -f aevol_run$(EXEEXT)
-	$(CXXLINK) $(aevol_run_OBJECTS) $(aevol_run_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_run_OBJECTS) $(aevol_run_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -377,40 +492,59 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aevol_create.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aevol_modify.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aevol_propagate.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aevol_propagate-aevol_propagate.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aevol_run.Po at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+aevol_propagate-aevol_propagate.o: aevol_propagate.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aevol_propagate-aevol_propagate.o -MD -MP -MF $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo -c -o aevol_propagate-aevol_propagate.o `test -f 'aevol_propagate.cpp' || echo '$(srcdir)/'`aevol_propagate.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo $(DEPDIR)/aevol_propagate-aevol_propagate.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='aevol_propagate.cpp' object='aevol_propagate-aevol_propagate.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aevol_propagate-aevol_propagate.o `test -f 'aevol_propagate.cpp' || echo '$(srcdir)/'`aevol_propagate.cpp
+
+aevol_propagate-aevol_propagate.obj: aevol_propagate.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT aevol_propagate-aevol_propagate.obj -MD -MP -MF $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo -c -o aevol_propagate-aevol_propagate.obj `if test -f 'aevol_propagate.cpp'; then $(CYGPATH_W) 'aevol_propagate.cpp'; else $(CYGPATH_W) '$(srcdir)/aevol_propagate.cpp'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/aevol_propagate-aevol_propagate.Tpo $(DEPDIR)/aevol_propagate-aevol_propagate.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='aevol_propagate.cpp' object='aevol_propagate-aevol_propagate.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(aevol_propagate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o aevol_propagate-aevol_propagate.obj `if test -f 'aevol_propagate.cpp'; then $(CYGPATH_W) 'aevol_propagate.cpp'; else $(CYGPATH_W) '$(srcdir)/aevol_propagate.cpp'; fi`
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -425,57 +559,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -491,12 +580,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -508,15 +592,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -525,6 +605,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -692,23 +787,23 @@ ps-am:
 
 uninstall-am: uninstall-binPROGRAMS
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic ctags ctags-recursive distclean \
-	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-binPROGRAMS
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+	check-am clean clean-binPROGRAMS clean-generic cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/aevol_create.cpp b/src/aevol_create.cpp
index 1915bbe..1e4f73e 100644
--- a/src/aevol_create.cpp
+++ b/src/aevol_create.cpp
@@ -1,17 +1,18 @@
-//*****************************************************************************
+// ****************************************************************************
 //
-//                         aevol - Artificial Evolution
+//          Aevol - An in silico experimental evolution platform
 //
-// Copyright (C) 2004 LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
+// ****************************************************************************
 //
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
 //
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,271 +20,231 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class
- *  \brief
- */
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
 
 const char* DEFAULT_PARAM_FILE_NAME = "param.in";
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
 #include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
 
-// =================================================================
-//                            Project Files
-// =================================================================
 #ifdef __X11
-  #include <ae_exp_manager_X11.h>
+  #include "ExpManager_X11.h"
 #else
-  #include <ae_exp_manager.h>
+  #include "ExpManager.h"
 #endif
-#include <param_loader.h>
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
 
+#include "ExpManager.h"
+#include "ParamLoader.h"
 
 
+using namespace aevol;
 
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
 
-int main( int argc, char* argv[] )
-{
-  // 1) Initialize command-line option variables with default values
-  char* param_file_name = NULL;
-  char* output_dir = NULL;
-  char* chromosome_file_name = NULL;
-  char* plasmid_file_name = NULL;
+// Command-line option variables
+static char* param_file_name = nullptr;
+static char* chromosome_file_name = nullptr;
+static char* plasmid_file_name = nullptr;
 
 
-  // 2) Define allowed options
-  const char * options_list = "hVf:o:c:p:";
-  static struct option long_options_list[] = {
-    { "help",     no_argument,        NULL, 'h' },
-    { "version",  no_argument,        NULL, 'V' },
-    { "file",     required_argument,  NULL, 'f' },
-    { "out",      required_argument,  NULL, 'o' },
-    { "chromosome",   required_argument,  NULL, 'c' },
-    { "plasmid",   required_argument,  NULL, 'p' },
-    { 0, 0, 0, 0 }
-  };
-
-
-  // 3) Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 )
-  {
-    switch ( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'f' :
-      {
-        param_file_name = new char[strlen(optarg)+1];
-        strcpy( param_file_name, optarg );
-        break;
-      }
-      case 'o' :
-      {
-        output_dir = new char[strlen(optarg)+1];
-        strcpy( output_dir, optarg );
-        break;
-      }
-      case 'c':
-      {
-        chromosome_file_name = new char [strlen(optarg)+1];
-        strcpy( chromosome_file_name, optarg );
-        break;
-      }
-      case 'p':
-      {
-        plasmid_file_name = new char [strlen(optarg)+1];
-        strcpy( plasmid_file_name, optarg );
-        break;
-      }
-      default :
-      {
-        // An error message is printed in getopt_long, we just need to exit
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-
-  // 4) Set undefined command line parameters to default values
-  if ( param_file_name == NULL )
-  {
-    param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME)+1];
-    sprintf( param_file_name, "%s", DEFAULT_PARAM_FILE_NAME );
-  }
 
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
 
-  // 5) Create a param loader for the parameter file
-  param_loader* my_param_loader = new param_loader( param_file_name );
-  delete param_file_name;
+  // Create a param loader for the parameter file
+  ParamLoader* my_param_loader = new ParamLoader(param_file_name);
+  delete[] param_file_name;
 
 
-  // 6) Initialize the experiment manager
-  ae_exp_manager* exp_manager = new ae_exp_manager();
+  // Initialize the experiment manager
+  ExpManager* exp_manager = new ExpManager();
 
 
-  // 7) Initialize the simulation from the parameter file
-  int32_t lchromosome=-1;
+  // Initialize the simulation from the parameter file
+  int32_t lchromosome = -1;
   char* chromosome;
 
-  if ( chromosome_file_name != NULL )
-  {
-    char rawchromosome[1000000];
-    FILE* chromosome_file = fopen(chromosome_file_name,"r");
-    if (chromosome_file==NULL)
+  if (chromosome_file_name != nullptr) {
+    const int max_input_chrom_size = 1000000;
+    char raw_chromosome[max_input_chrom_size];
+    FILE* chromosome_file = fopen(chromosome_file_name, "r");
+    if (chromosome_file == nullptr) {
+      printf("ERROR: failed to open source chromosome file %s\n",
+             chromosome_file_name);
+      exit(EXIT_FAILURE);
+    }
+    if (fgets(raw_chromosome, max_input_chrom_size, chromosome_file) == nullptr)
     {
-      printf("ERROR: failed to open source chromosome file %s\n",chromosome_file_name);
-      exit( EXIT_FAILURE );
+      printf("ERROR: failed to read from chromosome file %s\n",
+             chromosome_file_name);
+      exit(EXIT_FAILURE);
     }
-    fgets(rawchromosome, 1000000, chromosome_file);
-    lchromosome = strlen(rawchromosome)-1;
-    chromosome = new char[lchromosome]; // Warning: will become the DNA of the first individual created -> no not delete, will be freed in ~ae_dna.
-    strncpy(chromosome, rawchromosome, lchromosome);
-    printf("Loading chromosome from text file %s (%"PRId32" base pairs) \n",chromosome_file_name,lchromosome);
+    lchromosome = strlen(raw_chromosome) - 1;
+    chromosome = new char[lchromosome]; // Warning: will become the DNA of the
+                                        // first individual created -> do not
+                                        // delete, will be freed in Dna
+    strncpy(chromosome, raw_chromosome, lchromosome);
+    printf("Loading chromosome from text file %s (%" PRId32 " base pairs) \n",
+        chromosome_file_name, lchromosome);
     fclose(chromosome_file);
   }
 
-  int32_t lplasmid=-1;
+  int32_t lplasmid = -1;
   char* plasmid;
 
-  if ( plasmid_file_name != NULL )
-  {
-    char rawplasmid[1000000];
-    FILE* plasmid_file = fopen(plasmid_file_name,"r");
-    if (plasmid_file==NULL)
-    {
-      printf("ERROR: failed to open source chromosome file %s\n",plasmid_file_name);
-      exit( EXIT_FAILURE );
+  if (plasmid_file_name != nullptr) {
+    const int max_input_plasmid_size = 1000000;
+    char raw_plasmid[max_input_plasmid_size];
+    FILE* plasmid_file = fopen(plasmid_file_name, "r");
+    if (plasmid_file == nullptr) {
+      printf("ERROR: failed to open source chromosome file %s\n",
+             plasmid_file_name);
+      exit(EXIT_FAILURE);
+    }
+    if (fgets(raw_plasmid, max_input_plasmid_size, plasmid_file) == nullptr) {
+      printf("ERROR: failed to read from chromosome file %s\n",
+             chromosome_file_name);
+      exit(EXIT_FAILURE);
     }
-    fgets(rawplasmid, 1000000, plasmid_file);
-    lplasmid = strlen(rawplasmid)-1;
-    plasmid = new char[lplasmid]; // Warning: will become the DNA of the first individual created -> no not delete, will be freed in ~ae_dna.
-    strncpy(plasmid, rawplasmid, lplasmid);
-    printf("Loading plasmid from text file %s (%"PRId32" base pairs) \n",plasmid_file_name,lplasmid);
+    lplasmid = strlen(raw_plasmid) - 1;
+    plasmid = new char[lplasmid]; // Warning: will become the DNA of the first
+                                  // individual created -> no not delete,
+                                  // will be freed in Dna
+    strncpy(plasmid, raw_plasmid, lplasmid);
+    printf("Loading plasmid from text file %s (%" PRId32 " base pairs) \n",
+        plasmid_file_name, lplasmid);
     fclose(plasmid_file);
   }
 
-  if (lchromosome > -1)
-  {
-    if (lplasmid > -1)
-    {
-      my_param_loader->load( exp_manager, true, chromosome, lchromosome, plasmid, lplasmid );
+  if (lchromosome > -1) {
+    if (lplasmid > -1) {
+      my_param_loader->load(exp_manager, true, chromosome, lchromosome, plasmid,
+                            lplasmid);
     }
-    else
-    {
-      my_param_loader->load( exp_manager, true, chromosome, lchromosome );
+    else {
+      my_param_loader->load(exp_manager, true, chromosome, lchromosome);
     }
   }
-  else
-  {
-    my_param_loader->load( exp_manager, true );
+  else {
+    my_param_loader->load(exp_manager, true);
   }
   delete my_param_loader;
 
 
-  //~ ((ae_exp_manager_X11*)exp_manager)->toggle_display_on_off();
+  //~ ((ExpManager_X11*)exp_manager)->toggle_display_on_off();
   //~ exp_manager->display();
   //~ getchar();
 
   // 8) Save the experiment
-  if (output_dir == NULL)
-  {
-    // Create the static setup files (experimental setup and output profile)
-    exp_manager->write_setup_files();
-
-    // Create the initial backups
-    exp_manager->save();
-  }
-  else
-  {
-    // Save everything in the provided directory
-    exp_manager->save_copy(output_dir);
-
-    delete output_dir;
-  }
+  exp_manager->Save();
 
   delete exp_manager;
 }
 
 
-
-
-
-
-
 /*!
   \brief
 
 */
-void print_help(char* prog_path)
-{
+void print_help(char* prog_path) {
   // Get the program file-name in prog_name (strip prog_path of the path)
   char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( ( prog_name = strrchr( prog_path, '/' ) ) ) prog_name++;
-  else prog_name = prog_path;
-
-	printf( "******************************************************************************\n" );
-	printf( "*                                                                            *\n" );
-	printf( "*                        aevol - Artificial Evolution                        *\n" );
-	printf( "*                                                                            *\n" );
-	printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-	printf( "*                                                                            *\n" );
-	printf( "******************************************************************************\n" );
-  printf( "\n" );
-	printf( "%s: create an experiment with setup as specified in param_file.\n", prog_name );
-  printf( "\n" );
-	printf( "Usage : %s -h or --help\n", prog_name );
-	printf( "   or : %s -V or --version\n", prog_name );
-	printf( "   or : %s [-f PARAM_FILE] [-o OUTDIR] [-c CFILE] [-p PFILE]\n", prog_name );
-	printf( "\nOptions\n" );
-	printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-	printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-	printf( "  -f, --file PARAM_FILE\n\tspecify parameter file (default: param.in)\n" );
-  printf( "  -o, --out OUTDIR\n\tspecify output directory (default \"./\")\n\n" );
-  printf( "  -c, --chromosome CFILE\n\tload chromosome from given text file instead of generating it\n");
-  printf( "  -p, --plasmid PFILE\n\tload plasmid from given text file instead of generating it\n");
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s: create an experiment with setup as specified in PARAM_FILE.\n",
+         prog_name);
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-f PARAM_FILE] [-C CHROM_FILE] [-P PLASMID_FILE]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -f, --file PARAM_FILE\n");
+  printf("\tspecify parameter file (default: param.in)\n");
+  printf("  -C, --chromosome CHROM_FILE\n");
+  printf("\tload chromosome from given text file instead of generating it\n");
+  printf("  -P, --plasmid PLASMID_FILE\n");
+  printf("\tload plasmid from given text file instead of generating it\n");
 }
 
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char* options_list = "hVf:C:P:";
+  static struct option long_options_list[] = {
+      {"help",       no_argument,       nullptr, 'h'},
+      {"version",    no_argument,       nullptr, 'V'},
+      {"file",       required_argument, nullptr, 'f'},
+      {"chromosome", required_argument, nullptr, 'C'},
+      {"plasmid",    required_argument, nullptr, 'P'},
+      {0, 0, 0, 0}
+  };
 
-/*!
-  \brief Print aevol version number
+  // Get actual values of the CLI options
+  int option;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               nullptr)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 'f' : {
+        param_file_name = new char[strlen(optarg) + 1];
+        strcpy(param_file_name, optarg);
+        break;
+      }
+      case 'C': {
+        chromosome_file_name = new char[strlen(optarg) + 1];
+        strcpy(chromosome_file_name, optarg);
+        break;
+      }
+      case 'P': {
+        plasmid_file_name = new char[strlen(optarg) + 1];
+        strcpy(plasmid_file_name, optarg);
+        break;
+      }
+      default : {
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
 
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
+  // Set undefined command line parameters to default values
+  if (param_file_name == nullptr) {
+    param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME) + 1];
+    sprintf(param_file_name, "%s", DEFAULT_PARAM_FILE_NAME);
+  }
 }
diff --git a/src/aevol_modify.cpp b/src/aevol_modify.cpp
index ccc362a..7f7d74b 100644
--- a/src/aevol_modify.cpp
+++ b/src/aevol_modify.cpp
@@ -3,546 +3,641 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
- 
 const char* DEFAULT_PARAM_FILE_NAME = "param.in";
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-#include <ae_population.h>
-#ifdef __X11
-#include <ae_exp_manager_X11.h>
-#else
-#include <ae_exp_manager.h>
-#endif
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-enum population_change_type
-  {
-    SUBPOPULATIONS_BASED_ON_NON_CODING_BASES = 3,
-    REMOVE_NON_CODING_BASES_BEST_IND = 4,
-    REMOVE_NON_CODING_BASES_POPULATION = 5,
-    DOUBLE_NON_CODING_BASES_BEST_IND = 6,
-    DOUBLE_NON_CODING_BASES_POPULATION = 7
-  };
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
-void print_help( char* prog_path );
-void print_version( void );
+#include <getopt.h>
 
-f_line* get_line( FILE* param_file );
-void format_line( f_line* formated_line, char* line, bool* line_is_interpretable );
-void change_by_cloning_best(ae_population* pop, ae_exp_manager* exp_m);
-void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ae_exp_manager* exp_m, population_change_type type);
-void change_based_on_non_coding_bases_in_population(ae_population* pop, ae_exp_manager* exp_m, population_change_type type);
-ae_individual* create_clone( ae_individual* dolly, int32_t id );
+#include <list>
 
+#if __cplusplus == 201103L
+  #include "make_unique.h"
+#endif
 
+#include "ParameterLine.h"
 
-int main( int argc, char* argv[] )
-{
-  // 1) Initialize command-line option variables with default values
-  char* param_file_name = NULL;
-  bool verbose          = false;
-  int32_t num_gener = -1;  
-  
-  // 2) Define allowed options
-  const char * options_list = "hf:g:V";
-  static struct option long_options_list[] = {
-    { "help",     no_argument,        NULL, 'h' },
-    { "file",     required_argument,  NULL, 'f' }, // Provide file with parameters to change
-    { "gener",    required_argument,  NULL, 'g' },
-    { "version",  no_argument,        NULL, 'V' },
-    { 0, 0, 0, 0 }
-  };
-      
-  // 3) Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 ) 
-    {
-      switch ( option ) 
-        {
-        case 'h' :
-          {
-            print_help( argv[0] );
-            exit( EXIT_SUCCESS );
-          }
-        case 'V' :
-          {
-            print_version();
-            exit( EXIT_SUCCESS );
-          }
-        case 'f' :
-          {
-            if ( strcmp( optarg, "" ) == 0 )
-              {
-                printf( "%s: error: Option -f or --file : missing argument.\n", argv[0] );
-                exit( EXIT_FAILURE );
-              }
-        
-            param_file_name = optarg;
-            break;
-          }
-        case 'g' :
-          {
-            num_gener = atoi( optarg );
-            break;
-          }
-        default :
-          {
-            // An error message is printed in getopt_long, we just need to exit
-            exit( EXIT_FAILURE );
-          }
-        }
-    }  
-  
-  // 4) Set undefined command line parameters to default values
-  if ( param_file_name == NULL )
-    {
-      param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME)+1];
-      sprintf( param_file_name, "%s", DEFAULT_PARAM_FILE_NAME );
-    }
-  
-  // 5) Check the consistancy of the command-line options
-  if ( num_gener == -1 )
-    {
-      printf( "%s: error: You must provide a generation number.\n", argv[0] );
-      exit( EXIT_FAILURE );
-    }
-  
-  // 6) Initialize the experiment manager
-#ifndef __NO_X
-  ae_exp_manager* exp_manager = new ae_exp_manager_X11();
+#ifdef __X11
+  #include "ExpManager_X11.h"
 #else
-  ae_exp_manager* exp_manager = new ae_exp_manager();
+  #include "ExpManager.h"
+  #include "libaevol/ParameterLine.h"
+  #include "libaevol/JumpingMT.h"
 #endif
-  exp_manager->load( num_gener, false, verbose );
 
-  // 7) Define syntaxic sugars for the population, the environment, the selection...  
-  ae_population* pop = exp_manager->get_pop();
-  ae_environment* env = exp_manager->get_env();
-  ae_selection* sel = exp_manager->get_sel();
+using namespace aevol;
+
+enum population_change_type {
+  SUBPOPULATIONS_BASED_ON_NON_CODING_BASES = 3,
+  REMOVE_NON_CODING_BASES_BEST_IND = 4,
+  REMOVE_NON_CODING_BASES_POPULATION = 5,
+  DOUBLE_NON_CODING_BASES_BEST_IND = 6,
+  DOUBLE_NON_CODING_BASES_POPULATION = 7
+};
+
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
+ParameterLine* get_line(FILE* param_file);
+void format_line(ParameterLine* formatted_line, char* line,
+                 bool* line_is_interpretable);
+// void change_by_cloning_best(ae_population* pop, ae_exp_manager* exp_m);
+// void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ae_exp_manager* exp_m, population_change_type type);
+// void change_based_on_non_coding_bases_in_population(ae_population* pop, ae_exp_manager* exp_m, population_change_type type);
+
+// Command-line option variables
+char* param_file_name = nullptr;
+bool verbose = false;
+int64_t timestep = -1;
+
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  // Initialize the experiment manager
+  #ifndef __NO_X
+    ExpManager* exp_manager = new ExpManager_X11();
+  #else
+    ExpManager* exp_manager = new ExpManager();
+  #endif
+  exp_manager->load(timestep, false, verbose);
+
+  // Define shorthands
+  //Environment* env = exp_manager->env();
+  Selection* sel = exp_manager->sel();
+  World* world = exp_manager->world();
+
+
+  // If relevant, load the tree information
+  char tree_file_name[50];
+  Tree* tree = nullptr;
+  bool take_care_of_the_tree = exp_manager->record_tree() &&
+                               time() > 0;
 
+  if (take_care_of_the_tree) {
+    // If a tree is available, assign the replication reports to the individuals
+    #ifdef __REGUL
+      sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", timestep);
+    #else
+      sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", timestep);
+    #endif
+
+    tree = new Tree(exp_manager, tree_file_name);
+  }
 
-  // If relevant, load the tree information 
-  char tree_file_name[50];
-  ae_tree * tree = NULL;
-  bool take_care_of_the_tree = exp_manager->get_record_tree() && (exp_manager->get_tree_mode() == NORMAL) && (exp_manager->get_num_gener() > 0);
-
-  if ( take_care_of_the_tree )
-    {
-      // If a tree is available, assign the replication reports to the individuals
-#ifdef __REGUL
-      sprintf( tree_file_name,"tree/tree_%06"PRId32".rae", num_gener ); 
-#else
-      sprintf( tree_file_name,"tree/tree_%06"PRId32".ae", num_gener ); 
-#endif
-      
-      tree = new ae_tree( exp_manager, tree_file_name );
-      pop->set_replication_reports(tree, num_gener);
-    }
 
- 
 
 
 
 
-  // 8) Interpret and apply changes
+  // Interpret and apply changes
   printf("Interpret and apply changes\n");
-  FILE* param_file  = fopen( param_file_name,  "r" );
-  if ( param_file == NULL )
-    {
-      printf( "%s:%d: error: could not open parameter file %s\n", __FILE__, __LINE__, param_file_name );
-      exit( EXIT_FAILURE );
-    }
-  
-  bool env_change = false;
-  bool env_hasbeenmodified = false;
-  
-  f_line* line;
+  FILE* param_file = fopen(param_file_name, "r");
+  if (param_file == nullptr) {
+    printf("%s:%d: error: could not open parameter file %s\n", __FILE__,
+           __LINE__, param_file_name);
+    exit(EXIT_FAILURE);
+  }
+
+  std::list<Gaussian> new_gaussians;
+  bool phen_target_change = false;
+  bool start_to_record_tree = false;
+  bool set_tree_step = false;
+  int32_t tree_step = 100;
+
+  ParameterLine* line;
   int32_t cur_line = 0;
-  while ( ( line = get_line(param_file) ) != NULL ) 
-    {
-      cur_line++;
-      if ( strcmp( line->words[0], "ENV_AXIS_FEATURES" ) == 0 )
-        {
-          int16_t env_axis_nb_segments = line->nb_words / 2;
-          double* env_axis_segment_boundaries = new double [env_axis_nb_segments + 1];
-          env_axis_segment_boundaries[0] = X_MIN;
-          for ( int16_t i = 1 ; i < env_axis_nb_segments ; i++ )
-            {
-              env_axis_segment_boundaries[i] = atof( line->words[2*i] );
-            }
-          env_axis_segment_boundaries[env_axis_nb_segments] = X_MAX;
-      
-          // Set segment features
-          ae_env_axis_feature* env_axis_features = new ae_env_axis_feature[env_axis_nb_segments];
-          for ( int16_t i = 0 ; i < env_axis_nb_segments ; i++ )
-            {
-              if ( strcmp( line->words[2*i+1], "NEUTRAL" ) == 0 )
-                {
-                  env_axis_features[i] = NEUTRAL;
-                }
-              else if ( strcmp( line->words[2*i+1], "METABOLISM" ) == 0 )
-                {
-                  env_axis_features[i] = METABOLISM;
-                }
-              else if ( strcmp( line->words[2*i+1], "SECRETION" ) == 0 )
-                {
-                  exp_manager->get_exp_s()->set_with_secretion( true );
-                  env_axis_features[i] = SECRETION;
-                }
-              else if ( strcmp( line->words[2*i+1], "DONOR" ) == 0 )
-                {
-                  env_axis_features[i] = DONOR;
-                }
-              else if ( strcmp( line->words[2*i+1], "RECIPIENT" ) == 0 )
-                {
-                  env_axis_features[i] = RECIPIENT;
-                }
-              else
-                {
-                  printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown axis feature \"%s\".\n",
-                          param_file_name, cur_line, line->words[2*i+1] );
-                  exit( EXIT_FAILURE );
-                }
-            }
-          env->set_segmentation( env_axis_nb_segments,
-                                 env_axis_segment_boundaries,
-                                 env_axis_features );
-          env_hasbeenmodified = true;
-          delete env_axis_segment_boundaries;
-          delete env_axis_features;
-        }
-      else if ( strcmp( line->words[0], "POPULATION_SIZE") == 0 )
-        {
-          if (exp_manager->is_spatially_structured())
-            {
-              printf( "ERROR in param file \"%s\" on line %"PRId32": the change of population size is not implemented yet\n for spatially structured populations",
-                      param_file_name, cur_line );
-              exit( EXIT_FAILURE );
-            }
-          pop->set_nb_indivs(atol( line->words[1] ));
-          printf("\tChange of population size to %ld\n",atol( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "SELECTION_PRESSURE") == 0 )
-        {
-          sel->set_selection_pressure(atof( line->words[1] ) );
-          printf("\tChange of selection pressure to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "POINT_MUTATION_RATE" ) == 0 )
-        {
-          pop->set_overall_point_mutation_rate( atof( line->words[1] ) );
-          printf("\tChange of overall point mutation rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "SMALL_INSERTION_RATE" ) == 0 )
-        {
-          pop->set_overall_small_insertion_rate( atof( line->words[1] ) );
-          printf("\tChange of overall small insertion rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "SMALL_DELETION_RATE" ) == 0 )
-        {
-          pop->set_overall_small_deletion_rate( atof( line->words[1] ) );
-          printf("\tChange of overall small deletion rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "MAX_INDEL_SIZE" ) == 0 )
-        {
-          pop->set_overall_max_indel_size( atol( line->words[1] ) );
-          printf("\tChange of overall maximum indel size to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "DUPLICATION_RATE" ) == 0 )
-        {
-          pop->set_overall_duplication_rate( atof( line->words[1] ) );
-          printf("\tChange of overall duplication rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "DELETION_RATE" ) == 0 )
-        {
-          pop->set_overall_deletion_rate( atof( line->words[1] ) );
-          printf("\tChange of overall deletion rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "TRANSLOCATION_RATE" ) == 0 )
-        {
-          pop->set_overall_translocation_rate( atof( line->words[1] ) );
-          printf("\tChange of overall translocation rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "INVERSION_RATE" ) == 0 )
-        {
-          pop->set_overall_inversion_rate( atof( line->words[1] ) );
-          printf("\tChange of overall inversion to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "TRANSFER_INS_RATE" ) == 0 )
-        {
-          pop->set_overall_transfer_ins_rate( atof( line->words[1] ) );
-          exp_manager->set_HT_ins_rate(atof( line->words[1] ));
-          printf("\tChange of overall transfer insertion rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "TRANSFER_REPL_RATE" ) == 0 )
-        {
-          pop->set_overall_transfer_repl_rate( atof( line->words[1] ) );
-          exp_manager->set_HT_repl_rate(atof( line->words[1] ));
-          printf("\tChange of overall transfer replacement rate to %f\n",atof( line->words[1] ));
-        }
-      else if ( ( strcmp( line->words[0], "ENV_ADD_GAUSSIAN" ) == 0 ) || ( strcmp( line->words[0], "ENV_GAUSSIAN" ) == 0 ) )
-        {
-          if ( env_change )
-            {
-              env->add_gaussian( atof(line->words[1]), atof(line->words[2]), atof(line->words[3]));
-              printf("\tAddition of a gaussian with %f, %f, %f \n",atof(line->words[1]), atof(line->words[2]), atof(line->words[3]));
-            }
-          else
-            {
-              env->clear_custom_points();
-              env->clear_gaussians();
-              env->clear_initial_gaussians();
-              env->set_gaussians(new ae_list<ae_gaussian*>());
-              env->add_gaussian( atof(line->words[1]), atof(line->words[2]), atof(line->words[3]));
-              printf("\tChange of the environment: first gaussian with %f, %f, %f \n",atof(line->words[1]), atof(line->words[2]), atof(line->words[3]));
-              env_change = true;
-            }
-          env_hasbeenmodified = true;
-        }
-      else if ( strcmp( line->words[0], "ENV_ADD_POINT" ) == 0 ) 
-        {
-          if ( env_change )
-            {
-              env->add_custom_point( atof(line->words[1]), atof(line->words[2]) );
-              printf("\tAddition of a custom point with x=%f, y=%f\n",atof(line->words[1]), atof(line->words[2]));
-            }
-          else
-            {
-              env->clear_custom_points();
-              env->clear_gaussians();
-              env->clear_initial_gaussians();
-              env->set_custom_points(new ae_list<ae_point_2d*>());
-              env->add_custom_point( atof(line->words[1]), atof(line->words[2]));
-              printf("\tChange of the environment: first custom point with x=%f, y=%f \n",atof(line->words[1]), atof(line->words[2]));
-              env_change = true;
-            }
-          env_hasbeenmodified = true;
-        }
-      else if ( strcmp( line->words[0], "ENV_VARIATION" ) == 0 )
-        {
-          static bool env_var_already_set = false;
-          if ( env_var_already_set )
-            {
-              printf( "%s:%d: ERROR in param file : duplicate entry for %s.\n", __FILE__, __LINE__, line->words[0] );
-              exit( EXIT_FAILURE );
-            }
-          env_var_already_set = true;
-      
-          if ( strcmp( line->words[1], "none" ) == 0 )
-            {
-              assert( line->nb_words == 2 );
-              env->set_var_method( NO_VAR );
-              printf("\tNo more environmental variation\n");
-            }
-          else if ( strcmp( line->words[1], "autoregressive_mean_variation" ) == 0 )
-            {
-              assert( line->nb_words == 5 );
-              env->set_var_method( AUTOREGRESSIVE_MEAN_VAR );
-              env->set_var_sigma( atof( line->words[2] ) );
-              env->set_var_tau( atol( line->words[3] ) );
-              env->set_var_prng( new ae_jumping_mt(atoi( line->words[4])));
-              printf("\tChange of environmental variation to a autoregressive mean variation with sigma=%f, tau=%ld and seed=%d\n", atof( line->words[2] ),atol( line->words[3] ),atoi( line->words[4]));
-            }
-          else if ( strcmp( line->words[1], "autoregressive_height_variation" ) == 0 )
-            {
-              assert( line->nb_words == 5 );
-              env->set_var_method( AUTOREGRESSIVE_HEIGHT_VAR );
-              env->set_var_sigma( atof( line->words[2] ) );
-              env->set_var_tau( atol( line->words[3] ) );
-              env->set_var_prng( new ae_jumping_mt(atoi( line->words[4])));
-              printf("\tChange of environmental variation to a autoregressive height variation with sigma=%f, tau=%ld and seed=%d\n", atof( line->words[2] ),atol( line->words[3] ),atoi( line->words[4]));
-            }
-          else if ( strcmp( line->words[1], "add_local_gaussians" ) == 0 )
-            {
-              assert( line->nb_words == 3 );
-              env->set_var_method( LOCAL_GAUSSIANS_VAR );
-              env->set_var_prng( new ae_jumping_mt(atoi(line->words[2])));
-              printf("\tChange of environmental variation to a local gaussians variation with seed=%d\n", atoi( line->words[2]));
-            }
-          else
-            {
-              printf( "%s:%d: ERROR in param file : unknown environment variation method.\n", __FILE__, __LINE__ );
-              exit( EXIT_FAILURE );
-            }
-        }
-      else if ( strcmp( line->words[0], "SECRETION_COST" ) == 0 )
-        {
-          exp_manager->get_exp_s()->set_secretion_cost( atof( line->words[1] ) );
-        }
-      else if ( strcmp( line->words[0], "SEED" ) == 0 )
-        {
-          int32_t seed = atoi( line->words[1] ) ;
-      
-          ae_jumping_mt* prng = new ae_jumping_mt( seed );
-      
-          // Change prng in ae_selection 
-          sel->set_prng( new ae_jumping_mt(*prng) );
-      
-          if( exp_manager->is_spatially_structured())
-            {
-              ae_spatial_structure* sp_struct = exp_manager->get_spatial_structure();
-              sp_struct->set_prng(new ae_jumping_mt(*prng) );
-            }
-      
-          printf("\tChange of the seed to %d in selection \n",atoi( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "MUT_SEED" ) == 0 )
-        {
-          int32_t mut_seed = atoi( line->words[1] ) ;
-      
-          ae_jumping_mt* mut_prng = new ae_jumping_mt( mut_seed );
-      
-          // Change prng of the population
-          pop->set_mut_prng( new ae_jumping_mt(*mut_prng) );
-          printf("\tChange of the seed to %d in mutations \n",atoi( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "STOCH_SEED" ) == 0 )
-        {
-          int32_t stoch_seed = atoi( line->words[1] ) ;
-      
-          ae_jumping_mt* stoch_prng = new ae_jumping_mt( stoch_seed );
-      
-          // Change prng of the population
-          pop->set_stoch_prng( new ae_jumping_mt(*stoch_prng) );
-          printf("\tChange of the seed to %d in individuals' stochasticity \n",atoi( line->words[1] ));
-        }
-      else if ( strcmp( line->words[0], "CLONE_BEST" ) == 0 )
-        {
-          change_by_cloning_best(pop, exp_manager);
-          printf("\tChange of the population for a population with %"PRId32" individuals, all clones of the best one\n",pop->get_nb_indivs());
-        }
-      else if ( strcmp( line->words[0], "CREATE_3_SUBPOPULATIONS_BASED_ON_NON_CODING_BASES" ) == 0 )
-        {
-          change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, SUBPOPULATIONS_BASED_ON_NON_CODING_BASES);
-          printf("\tChange of the population for a population with %"PRId32" individuals in 3 equal subpopulations (A: clones of the previous best individual, B: clones of the previous best individual without any non coding bases, C: clones of the previous best individual with twice non bases\n",pop->get_nb_indivs());
-          printf("WARNING: lineage will not work properly if called with \n");
-          printf("         a begin generation anterior to this modification \n");
-        }
-      else if ( strcmp( line->words[0], "REMOVE_NON_CODING_BASES_BEST" ) == 0 )
-        {
-          change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, REMOVE_NON_CODING_BASES_BEST_IND);
-          printf("\tChange of the population for a population with %"PRId32" clones of the best individual ancestor without any non coding bases\n",pop->get_nb_indivs());
-          printf("WARNING: lineage will not work properly if called with \n");
-          printf("         a begin generation anterior to this modification \n");
-        }
-      else if ( strcmp( line->words[0], "REMOVE_NON_CODING_BASES_POP" ) == 0 )
-        {
-          change_based_on_non_coding_bases_in_population(pop, exp_manager,  REMOVE_NON_CODING_BASES_POPULATION);
-          printf("\tChange of the population for a population with %"PRId32" individuals without any non coding bases\n",pop->get_nb_indivs());
-          printf("WARNING: lineage will not work properly if called with \n");
-          printf("         a begin generation anterior to this modification \n");
-        }
-      else if ( strcmp( line->words[0], "DOUBLE_NON_CODING_BASES_BEST" ) == 0 )
-        {
-          change_based_on_non_coding_bases_of_best_individual(pop, exp_manager,  DOUBLE_NON_CODING_BASES_BEST_IND);
-          printf("\tChange of the population for a population with %"PRId32" clones of the best individual ancestor with twice the non coding bases number \n",pop->get_nb_indivs());
-          printf("WARNING: lineage will not work properly if called with \n");
-          printf("         a begin generation anterior to this modification \n");
-        }
-      else if ( strcmp( line->words[0], "DOUBLE_NON_CODING_BASES_POP" ) == 0 )
-        {
-          change_based_on_non_coding_bases_in_population(pop, exp_manager, DOUBLE_NON_CODING_BASES_POPULATION);
-          printf("\tChange of the population for a population with %"PRId32" individuals with twice the non coding bases number\n",pop->get_nb_indivs());
-          printf("WARNING: lineage will not work properly if called with \n");
-          printf("         a begin generation anterior to this modification \n");
-        }
-      else
-        {
-          printf( "%s:%d: error: the change %s is not implemented yet \n", __FILE__, __LINE__, line->words[0] );
-          exit( EXIT_FAILURE );
-        }
-
-      delete line;
+  while ((line = get_line(param_file)) != nullptr) {
+    cur_line++;
+    if (strcmp(line->words[0], "ENV_AXIS_FEATURES") == 0) {
+      // TODO <dpa> adapt to new organization
+      printf(
+          "%s:%d: error: ENV_AXIS_FEATURES has to be adapted to the new organization.\n",
+          __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+//      int16_t env_axis_nb_segments = line->nb_words / 2;
+//      double* env_axis_segment_boundaries = new double [env_axis_nb_segments + 1];
+//      env_axis_segment_boundaries[0] = X_MIN;
+//      for (int16_t i = 1 ; i < env_axis_nb_segments ; i++)
+//      {
+//        env_axis_segment_boundaries[i] = atof(line->words[2*i]);
+//      }
+//      env_axis_segment_boundaries[env_axis_nb_segments] = X_MAX;
+//
+//      // Set segment features
+//      PhenotypicFeature* env_axis_features = new PhenotypicFeature[env_axis_nb_segments];
+//      for (int16_t i = 0 ; i < env_axis_nb_segments ; i++)
+//      {
+//        if (strcmp(line->words[2*i+1], "NEUTRAL") == 0)
+//        {
+//          env_axis_features[i] = NEUTRAL;
+//        }
+//        else if (strcmp(line->words[2*i+1], "METABOLISM") == 0)
+//        {
+//          env_axis_features[i] = METABOLISM;
+//        }
+//        else if (strcmp(line->words[2*i+1], "SECRETION") == 0)
+//        {
+//          exp_manager->exp_s()->set_with_secretion(true);
+//          env_axis_features[i] = SECRETION;
+//        }
+//        else if (strcmp(line->words[2*i+1], "DONOR") == 0)
+//        {
+//          env_axis_features[i] = DONOR;
+//        }
+//        else if (strcmp(line->words[2*i+1], "RECIPIENT") == 0)
+//        {
+//          env_axis_features[i] = RECIPIENT;
+//        }
+//        else
+//        {
+//          printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown axis feature \"%s\".\n",
+//                  param_file_name, cur_line, line->words[2*i+1]);
+//          exit(EXIT_FAILURE);
+//        }
+//      }
+//      env->set_segmentation(env_axis_nb_segments,
+//                             env_axis_segment_boundaries,
+//                             env_axis_features);
+//      env_hasbeenmodified = true;
+//      delete env_axis_segment_boundaries;
+//      delete env_axis_features;
     }
-  fclose( param_file );
-
-
-  // Check for incompatible options
-  if ( ( env->get_gaussians() != NULL ) && (env->get_custom_points() != NULL)) 
-    {
-      printf( "ERROR in param file \"%s\" : parameters ENV_ADD_POINT and ENV_ADD_GAUSSIAN are incompatible.\n",
-              param_file_name );
-      exit( EXIT_FAILURE ); 
+    else if (strcmp(line->words[0], "RECORD_TREE") == 0) {
+      if (strncmp(line->words[1], "true", 4) == 0) {
+        start_to_record_tree = true;
+      }
+      else if (strncmp(line->words[1], "false", 5) == 0) {
+        printf("ERROR stop recording tree is not implemented yet.\n");
+        exit(EXIT_FAILURE);
+      }
+      else {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+        " : unknown tree recording option (use true/false).\n",
+            param_file_name, cur_line);
+        exit(EXIT_FAILURE);
+      }
+      if (exp_manager->output_m()->record_tree()) {
+        printf(
+            "ERROR modification of already existing tree not impemented yet\n");
+        exit(EXIT_FAILURE);
+      }
     }
-
-  if ( ( env->get_custom_points() != NULL) && ( env->get_var_method() != NO_VAR ))
-    {
-      printf( "ERROR in param file \"%s\" : environmental variation is incompatible with ENV_ADD_POINT, please use ENV_ADD_GAUSSIAN instead. \n", param_file_name );
-      exit( EXIT_FAILURE ); 
+    else if (strcmp(line->words[0], "TREE_STEP") == 0) {
+      tree_step = atol(line->words[1]);
+      set_tree_step = true;
+    }
+    else if (strcmp(line->words[0], "TREE_MODE") == 0) {
+      printf("ERROR : Tree mode management has been removed.\n");
+      exit(EXIT_FAILURE);
+    }
+    else if (strcmp(line->words[0], "DUMP_STEP") == 0) {
+      int step = atoi(line->words[1]);
+      if (step > 0) {
+        exp_manager->output_m()->set_dump_step(step);
+      }
+    }
+    else if (strcmp(line->words[0], "BACKUP_STEP") == 0) {
+      exp_manager->output_m()->set_backup_step(atol(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "BIG_BACKUP_STEP") == 0) {
+      exp_manager->output_m()->set_big_backup_step(atol(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "POPULATION_SIZE") == 0) {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+      ": the change of population size is not implemented yet\n"
+      " for spatially structured populations",
+          param_file_name, cur_line);
+      exit(EXIT_FAILURE);
+    }
+    else if (strcmp(line->words[0], "SELECTION_SCHEME") == 0) {
+      if (strncmp(line->words[1], "lin", 3) == 0) {
+        if (line->nb_words != 3) {
+          printf("ERROR in param file \"%s\" on line %" PRId32
+          " : selection pressure parameter is missing.\n",
+              param_file_name, cur_line);
+          exit(EXIT_FAILURE);
+        }
+        sel->set_selection_scheme(RANK_LINEAR);
+        sel->set_selection_pressure(atof(line->words[2]));
+      }
+      else if (strncmp(line->words[1], "exp", 3) == 0) {
+        if (line->nb_words != 3) {
+          printf("ERROR in param file \"%s\" on line %" PRId32
+          " : selection pressure parameter is missing.\n",
+              param_file_name, cur_line);
+          exit(EXIT_FAILURE);
+        }
+        sel->set_selection_scheme(RANK_EXPONENTIAL);
+        sel->set_selection_pressure(atof(line->words[2]));
+      }
+      else if (strncmp(line->words[1], "fitness", 7) == 0) {
+        if (line->nb_words != 3) {
+          printf("ERROR in param file \"%s\" on line %" PRId32
+          " : selection pressure parameter is missing.\n",
+              param_file_name, cur_line);
+          exit(EXIT_FAILURE);
+        }
+        sel->set_selection_scheme(FITNESS_PROPORTIONATE);
+        sel->set_selection_pressure(atof(line->words[2]));
+      }
+      else if (strcmp(line->words[1], "fittest") == 0) {
+        sel->set_selection_scheme(FITTEST);
+      }
+      else {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+        " : unknown selection scheme \"%s\".\n",
+            param_file_name, cur_line, line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+    }
+    else if (strcmp(line->words[0], "SELECTION_PRESSURE") == 0) {
+      printf(
+          "WARNING: SELECTION_PRESSURE keyword is outdated, you should\n"
+          "specify a value for selection pressure using SELECTION_SCHEME\n");
+      sel->set_selection_pressure(atof(line->words[1]));
+      printf("\tChange of selection pressure to %f\n", atof(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "POINT_MUTATION_RATE") == 0) {
+      double point_mutation_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_point_mutation_rate(point_mutation_rate);
+      printf("\tChange of overall point mutation rate to %f\n",
+             point_mutation_rate);
+    }
+    else if (strcmp(line->words[0], "SMALL_INSERTION_RATE") == 0) {
+      double small_insertion_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_small_insertion_rate(small_insertion_rate);
+      printf("\tChange of overall small insertion rate to %f\n",
+             small_insertion_rate);
+    }
+    else if (strcmp(line->words[0], "SMALL_DELETION_RATE") == 0) {
+      double small_deletion_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_small_deletion_rate(small_deletion_rate);
+      printf("\tChange of overall small deletion rate to %f\n",
+             small_deletion_rate);
+    }
+    else if (strcmp(line->words[0], "MAX_INDEL_SIZE") == 0) {
+      int16_t max_indel_size = atol(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_max_indel_size(max_indel_size);
+      printf("\tChange of overall maximum indel size to %d\n", max_indel_size);
+    }
+    else if (strcmp(line->words[0], "DUPLICATION_RATE") == 0) {
+      double duplication_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_duplication_rate(duplication_rate);
+      printf("\tChange of overall duplication rate to %f\n", duplication_rate);
+    }
+    else if (strcmp(line->words[0], "DELETION_RATE") == 0) {
+      double deletion_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_deletion_rate(deletion_rate);
+      printf("\tChange of overall deletion rate to %f\n", deletion_rate);
+    }
+    else if (strcmp(line->words[0], "TRANSLOCATION_RATE") == 0) {
+      double translocation_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_translocation_rate(translocation_rate);
+      printf("\tChange of overall translocation rate to %f\n",
+             translocation_rate);
+    }
+    else if (strcmp(line->words[0], "INVERSION_RATE") == 0) {
+      double inversion_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_inversion_rate(inversion_rate);
+      printf("\tChange of overall inversion to %f\n", inversion_rate);
+    }
+    else if (strcmp(line->words[0], "TRANSFER_INS_RATE") == 0) {
+      double transfer_ins_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_HT_ins_rate(transfer_ins_rate);
+      exp_manager->set_HT_ins_rate(transfer_ins_rate);
+      printf("\tChange of overall transfer insertion rate to %f\n",
+             transfer_ins_rate);
+    }
+    else if (strcmp(line->words[0], "TRANSFER_REPL_RATE") == 0) {
+      double transfer_repl_rate = atof(line->words[1]);
+      for (auto& indiv: exp_manager->indivs())
+        indiv->set_HT_repl_rate(transfer_repl_rate);
+      exp_manager->set_HT_repl_rate(transfer_repl_rate);
+      printf("\tChange of overall transfer replacement rate to %f\n",
+             transfer_repl_rate);
+    }
+    else if ((strcmp(line->words[0], "ENV_ADD_GAUSSIAN") == 0) ||
+             (strcmp(line->words[0], "ENV_GAUSSIAN") == 0)) {
+      // TODO <dpa> adapt to new organization
+//      printf("%s:%d: error: ENV_ADD_GAUSSIAN has to be adapted to the new organization.\n", __FILE__, __LINE__);
+//      exit(EXIT_FAILURE);
+
+      new_gaussians.emplace_back(atof(line->words[1]),
+                                 atof(line->words[2]),
+                                 atof(line->words[3]));
+      printf("\tAdding a gaussian with %f, %f, %f \n",
+             atof(line->words[1]), atof(line->words[2]), atof(line->words[3]));
+      phen_target_change = true;
+    }
+    else if (strcmp(line->words[0], "ENV_ADD_POINT") == 0) {
+      // custom_points
+      printf("%s:%d: error: Custom points_ management has been removed.\n",
+             __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+    }
+    else if (strcmp(line->words[0], "ENV_VARIATION") == 0) {
+      // TODO <dpa> adapt to new organization
+//      printf("%s:%d: error: ENV_VARIATION has to be adapted to the new organization.\n", __FILE__, __LINE__);
+//      exit(EXIT_FAILURE);
+
+      static bool env_var_already_set = false;
+      if (env_var_already_set) {
+        printf("%s:%d: ERROR in param file : duplicate entry for %s.\n",
+               __FILE__, __LINE__, line->words[0]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_already_set = true;
+
+      if (strcmp(line->words[1], "none") == 0) {
+        assert(line->nb_words == 2);
+        exp_manager->world()->phenotypic_target_handler()->set_var_method(
+            NO_VAR);
+        printf("\tNo more environmental variation\n");
+      }
+      else if (strcmp(line->words[1], "autoregressive_mean_variation") == 0) {
+        assert(line->nb_words == 5);
+        auto pt_handler = exp_manager->world()->phenotypic_target_handler();
+        pt_handler->set_var_method(AUTOREGRESSIVE_MEAN_VAR);
+        pt_handler->set_var_sigma_tau(atof(line->words[2]),
+                                      atol(line->words[3]));
+        pt_handler->set_var_prng(
+            std::make_shared<JumpingMT>(atoi(line->words[4])));
+        printf(
+            "\tChange of environmental variation to a autoregressive mean variation with sigma=%f, tau=%ld and seed=%d\n",
+            atof(line->words[2]), atol(line->words[3]), atoi(line->words[4]));
+      }
+      else if (strcmp(line->words[1], "autoregressive_height_variation") == 0) {
+        assert(line->nb_words == 5);
+        auto pt_handler = exp_manager->world()->phenotypic_target_handler();
+        pt_handler->set_var_method(AUTOREGRESSIVE_HEIGHT_VAR);
+        pt_handler->set_var_sigma_tau(atof(line->words[2]),
+                                      atol(line->words[3]));
+        pt_handler->set_var_prng(
+            std::make_shared<JumpingMT>(atoi(line->words[4])));
+        printf(
+            "\tChange of environmental variation to a autoregressive height variation with sigma=%f, tau=%ld and seed=%d\n",
+            atof(line->words[2]), atol(line->words[3]), atoi(line->words[4]));
+      }
+      else if (strcmp(line->words[1], "add_local_gaussians") == 0) {
+        assert(line->nb_words == 3);
+        auto pt_handler = exp_manager->world()->phenotypic_target_handler();
+        pt_handler->set_var_method(LOCAL_GAUSSIANS_VAR);
+        pt_handler->set_var_prng(
+            std::make_shared<JumpingMT>(atoi(line->words[2])));
+        printf(
+            "\tChange of environmental variation to a local gaussians variation with seed=%d\n",
+            atoi(line->words[2]));
+      }
+      else {
+        Utils::ExitWithUsrMsg("unknown environment variation method");
+      }
+    }
+    else if (strcmp(line->words[0], "SECRETION_CONTRIB_TO_FITNESS") == 0) {
+      exp_manager->exp_s()->set_secretion_contrib_to_fitness(
+          atof(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "SECRETION_COST") == 0) {
+      exp_manager->exp_s()->set_secretion_cost(atof(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "PLASMID_MINIMAL_LENGTH") == 0) {
+      if (not exp_manager->with_plasmids()) {
+        printf(
+            "ERROR: option PLASMID_MINIMAL_LENGTH has no sense because there are no plasmids in this population.\n");
+        exit(EXIT_FAILURE);
+      }
+      int32_t plasmid_minimal_length = atoi(line->words[1]);
+      for (const auto& indiv: exp_manager->indivs()) {
+        if (indiv->genetic_unit(1).seq_length() < plasmid_minimal_length) {
+          printf(
+              "ERROR: there is one genetic unit with a smaller length than the new minimum.\n");
+          exit(EXIT_FAILURE);
+        }
+        indiv->genetic_unit_nonconst(1).set_min_gu_length(
+            plasmid_minimal_length);
+      }
+    }
+    else if (strcmp(line->words[0], "PLASMID_MAXIMAL_LENGTH") == 0) {
+      if (!exp_manager->with_plasmids()) {
+        printf(
+            "ERROR: option PLASMID_MAXIMAL_LENGTH has no sense because there are no plasmids in this population.\n");
+        exit(EXIT_FAILURE);
+      }
+      int32_t plasmid_maximal_length = atoi(line->words[1]);
+      for (const auto& indiv: exp_manager->indivs()) {
+        if (indiv->genetic_unit_nonconst(1).seq_length() >
+            plasmid_maximal_length) {
+          printf(
+              "ERROR: there is one genetic unit with a higher length than the new maximum.\n");
+          exit(EXIT_FAILURE);
+        }
+        indiv->genetic_unit_nonconst(1).set_max_gu_length(
+            plasmid_maximal_length);
+      }
+    }
+    else if (strcmp(line->words[0], "CHROMOSOME_MINIMAL_LENGTH") == 0) {
+      int32_t chromosome_minimal_length = atoi(line->words[1]);
+      for (const auto& indiv: exp_manager->indivs()) {
+        if (indiv->genetic_unit_nonconst(0).seq_length() <
+            chromosome_minimal_length) {
+          printf(
+              "ERROR: there is one genetic unit with a smaller length than the new minimum.\n");
+          exit(EXIT_FAILURE);
+        }
+        indiv->genetic_unit_nonconst(0).set_min_gu_length(
+            chromosome_minimal_length);
+      }
+    }
+    else if (strcmp(line->words[0], "CHROMOSOME_MAXIMAL_LENGTH") == 0) {
+      int32_t chromosome_maximal_length = atoi(line->words[1]);
+      for (const auto& indiv: exp_manager->indivs()) {
+        if (indiv->genetic_unit_nonconst(0).seq_length() >
+            chromosome_maximal_length) {
+          printf(
+              "ERROR: there is one genetic unit with a higher length than the new maximum.\n");
+          exit(EXIT_FAILURE);
+        }
+        indiv->genetic_unit_nonconst(0).set_max_gu_length(
+            chromosome_maximal_length);
+      }
+    }
+    else if (strcmp(line->words[0], "SEED") == 0) {
+      int32_t seed = atoi(line->words[1]);
+
+      // Change prngs
+      #if __cplusplus == 201103L
+        sel->set_prng(make_unique<JumpingMT>(seed));
+        world->set_prng(make_unique<JumpingMT>(seed));
+      #else
+        sel->set_prng(std::make_unique<JumpingMT>(seed));
+        world->set_prng(std::make_unique<JumpingMT>(seed));
+      #endif
+
+      printf("\tChange of the seed to %d in selection and world \n",
+             atoi(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "MUT_SEED") == 0) {
+      int32_t mut_seed = atoi(line->words[1]);
+
+      // Change mutation prng
+      world->set_mut_prng(std::make_shared<JumpingMT>(mut_seed));
+      for (int16_t x = 0; x < world->width(); x++) {
+        for (int16_t y = 0; y < world->height(); y++) {
+          world->grid(x, y)->set_mut_prng(
+              std::make_shared<JumpingMT>(world->mut_prng()->random(1000000)));
+          world->grid(x, y)->individual()->set_mut_prng(
+              world->grid(x, y)->mut_prng());
+        }
+      }
+      printf("\tChange of the seed to %d in mutations \n",
+             atoi(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "STOCH_SEED") == 0) {
+      int32_t stoch_seed = atoi(line->words[1]);
+
+      // Change stochasticity prng
+      world->set_stoch_prng(std::make_shared<JumpingMT>(stoch_seed));
+      for (int16_t x = 0; x < world->width(); x++) {
+        for (int16_t y = 0; y < world->height(); y++) {
+          world->grid(x, y)->set_stoch_prng(std::make_shared<JumpingMT>(
+              world->stoch_prng()->random(1000000)));
+          world->grid(x, y)->individual()->set_stoch_prng(
+              world->grid(x, y)->stoch_prng());
+        }
+      }
+      printf("\tChange of the seed to %d in individuals' stochasticity \n",
+             atoi(line->words[1]));
+    }
+    else if (strcmp(line->words[0], "CLONE_BEST") == 0) {
+      exp_manager->FillGridWithClones(*(exp_manager->best_indiv()));
+      printf("\tChange of the population for a population with %" PRId32
+      " individuals, all clones of the best one\n",
+          exp_manager->nb_indivs());
+    }
+    // TODO: re-enable these options
+    // else if (strcmp(line->words[0], "CREATE_3_SUBPOPULATIONS_BASED_ON_NON_CODING_BASES") == 0)
+    // {
+    //   change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, SUBPOPULATIONS_BASED_ON_NON_CODING_BASES);
+    //   printf("\tChange of the population for a population with %" PRId32 " individuals in 3 equal subpopulations (A: clones of the previous best individual, B: clones of the previous best individual without any non coding bases, C: clones of the previous best individual with twice non bases\n",pop->nb_indivs());
+    //   printf("WARNING: lineage will not work properly if called with \n");
+    //   printf("         a begin generation anterior to this modification \n");
+    // }
+    // else if (strcmp(line->words[0], "REMOVE_NON_CODING_BASES_BEST") == 0)
+    // {
+    //   change_based_on_non_coding_bases_of_best_individual(pop, exp_manager, REMOVE_NON_CODING_BASES_BEST_IND);
+    //   printf("\tChange of the population for a population with %" PRId32 " clones of the best individual ancestor without any non coding bases\n",pop->nb_indivs());
+    //   printf("WARNING: lineage will not work properly if called with \n");
+    //   printf("         a begin generation anterior to this modification \n");
+    // }
+    // else if (strcmp(line->words[0], "REMOVE_NON_CODING_BASES_POP") == 0)
+    // {
+    //   change_based_on_non_coding_bases_in_population(pop, exp_manager,  REMOVE_NON_CODING_BASES_POPULATION);
+    //   printf("\tChange of the population for a population with %" PRId32 " individuals without any non coding bases\n",pop->nb_indivs());
+    //   printf("WARNING: lineage will not work properly if called with \n");
+    //   printf("         a begin generation anterior to this modification \n");
+    // }
+    // else if (strcmp(line->words[0], "DOUBLE_NON_CODING_BASES_BEST") == 0)
+    // {
+    //   change_based_on_non_coding_bases_of_best_individual(pop, exp_manager,  DOUBLE_NON_CODING_BASES_BEST_IND);
+    //   printf("\tChange of the population for a population with %" PRId32 " clones of the best individual ancestor with twice the non coding bases number \n",pop->nb_indivs());
+    //   printf("WARNING: lineage will not work properly if called with \n");
+    //   printf("         a begin generation anterior to this modification \n");
+    // }
+    // else if (strcmp(line->words[0], "DOUBLE_NON_CODING_BASES_POP") == 0)
+    // {
+    //   change_based_on_non_coding_bases_in_population(pop, exp_manager, DOUBLE_NON_CODING_BASES_POPULATION);
+    //   printf("\tChange of the population for a population with %" PRId32 " individuals with twice the non coding bases number\n",pop->nb_indivs());
+    //   printf("WARNING: lineage will not work properly if called with \n");
+    //   printf("         a begin generation anterior to this modification \n");
+    // }
+    else {
+      printf("%s:%d: error: the change %s is not implemented yet \n", __FILE__,
+             __LINE__, line->words[0]);
+      exit(EXIT_FAILURE);
     }
 
+    delete line;
+  }
+  fclose(param_file);
 
   printf("OK\n");
 
-
- 
-  if (env_hasbeenmodified)
-    {
-      env->build();
-      pop->evaluate_individuals(env);
-      pop->sort_individuals();
+  if (phen_target_change) {
+    // The current version doesn't allow for phenotypic variation nor for
+    // different phenotypic targets among the grid
+    if (not exp_manager->world()->phenotypic_target_shared()) {
+      Utils::ExitWithUsrMsg("sorry, aevol_modify has not yet been implemented "
+                                "for per grid-cell phenotypic target");
     }
+    auto phenotypicTargetHandler =
+        exp_manager->world()->phenotypic_target_handler();
+    phenotypicTargetHandler->set_gaussians(new_gaussians);
+    phenotypicTargetHandler->BuildPhenotypicTarget();
+  }
 
- 
   // 9) Save the modified experiment
-  
- 
-  if (take_care_of_the_tree)
-    {
-      printf("Save the modified replication reports into tree...\t");
-      tree->fill_tree_with_cur_gener();
-
-#ifdef __REGUL
-      sprintf( tree_file_name,"tree/tree_%06"PRId32".rae", num_gener ); 
-#else
-      sprintf( tree_file_name,"tree/tree_%06"PRId32".ae", num_gener ); 
-#endif
-      gzFile tree_file = gzopen( tree_file_name, "w" );
-      tree->write_to_tree_file(tree_file);
-      gzclose( tree_file );
-      printf("OK\n");
+  if (start_to_record_tree) {
+    if (!set_tree_step) {
+      printf("WARNING: you modifed parameter RECORD_TREE without specifying "
+                 "TREE_STEP in the same parameter modification file. TREE_STEP will "
+                 "be set to its default value even if you previously gave another "
+                 "value.\n");
     }
+    exp_manager->output_m()->init_tree(exp_manager, tree_step);
+  }
+
+  if (take_care_of_the_tree) {
+    printf("Save the modified replication reports into tree...\t");
+
+    #ifdef __REGUL
+      sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", timestep);
+    #else
+      sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", timestep);
+    #endif
+    gzFile tree_file = gzopen(tree_file_name, "w");
+    tree->write_to_tree_file(tree_file);
+    gzclose(tree_file);
+    printf("OK\n");
+  }
   printf("Save the modified experiment into backup...\t");
-  exp_manager->write_setup_files();
-  exp_manager->save();
+  exp_manager->WriteSetupFiles();
+  exp_manager->WriteDynamicFiles();
   printf("OK\n");
-   
 
   delete exp_manager;
 }
@@ -550,325 +645,243 @@ int main( int argc, char* argv[] )
 
 /*!
   \brief Get a line in a file and format it
-  
+
   \param param_file file with param in which a line is reading
   \return line (pointer)
-  
-  \see format_line(f_line* formated_line, char* line, bool* line_is_interpretable )
+
+  \see format_line(ParameterLine* formatted_line, char* line,
+                   bool* line_is_interpretable)
 */
-f_line* get_line( FILE* param_file )
-{
+ParameterLine* get_line(FILE* param_file) {
   char line[255];
-  f_line* formated_line = new f_line();
+  ParameterLine* formatted_line = new ParameterLine();
 
-  bool found_interpretable_line = false; 
+  bool found_interpretable_line = false;
 
-  while ( !feof( param_file ) && !found_interpretable_line )
-    {
-      if ( !fgets( line, 255, param_file ) )
-        {
-          delete formated_line;
-          return NULL;
-        }
-      format_line( formated_line, line, &found_interpretable_line );
-    }
-
-  if ( found_interpretable_line )
-    {
-      return formated_line;
-    }
-  else
-    {
-      delete formated_line;
-      return NULL;
+  while (!feof(param_file) && !found_interpretable_line) {
+    if (!fgets(line, 255, param_file)) {
+      delete formatted_line;
+      return nullptr;
     }
+    format_line(formatted_line, line, &found_interpretable_line);
+  }
+
+  if (found_interpretable_line) {
+    return formatted_line;
+  }
+  else {
+    delete formatted_line;
+    return nullptr;
+  }
 }
 
 /*!
   \brief Format a line by parsing it and the words inside
-  
-  \param formated_line the resulted formated line
+
+  \param formatted_line the resulted formatted line
   \param line original line in char*
   \param line_is_interpretable boolean with about the possible intrepretation of the line
 */
-void format_line( f_line* formated_line, char* line, bool* line_is_interpretable )
-{
+void format_line(ParameterLine* formatted_line, char* line,
+                 bool* line_is_interpretable) {
   int16_t i = 0;
   int16_t j;
 
   // Parse line
-  while ( line[i] != '\n' && line[i] != '\0' && line[i] != '\r' )
-    {
-      j = 0;
-    
-      // Flush white spaces and tabs
-      while ( line[i] == ' ' || line[i] == 0x09 ) i++; // 0x09 is the ASCII code for TAB
-    
-      // Check comments
-      if ( line[i] == '#' ) break;
-
-      // If we got this far, there is content in the line
-      *line_is_interpretable = true;
-
-      // Parse word
-      while ( line[i] != ' '  && line[i] != '\n' && line[i] != '\0' && line[i] != '\r' )
-        {
-          formated_line->words[formated_line->nb_words][j++] = line[i++];
-        }
-
-      // Add '\0' at end of word if it's not empty (line ending with space or tab)
-      if ( j != 0 )
-        {
-          formated_line->words[formated_line->nb_words++][j] = '\0';
-        }
-    }
-}
-
-
-
+  while (line[i] != '\n' && line[i] != '\0' && line[i] != '\r') {
+    j = 0;
 
+    // Flush white spaces and tabs
+    while (line[i] == ' ' || line[i] == 0x09)
+      i++; // 0x09 is the ASCII code for TAB
 
+    // Check comments
+    if (line[i] == '#') break;
 
+    // If we got this far, there is content in the line
+    *line_is_interpretable = true;
 
-void change_by_cloning_best(ae_population* pop, ae_exp_manager* exp_m)
-{
-  int32_t population_size = pop->get_nb_indivs();
-  ae_individual* best_indiv = exp_m->get_indiv_by_rank( population_size );
-
-  ae_list<ae_individual*>*  new_population  = new ae_list<ae_individual*>();
-  for ( int32_t i = 0 ; i < population_size ; i++ )
-    {
-      new_population->add(create_clone( best_indiv, i ));
+    // Parse word
+    while (line[i] != ' ' && line[i] != '\n' && line[i] != '\0' &&
+           line[i] != '\r') {
+      formatted_line->words[formatted_line->nb_words][j++] = line[i++];
     }
-  
-  pop->replace_population( new_population );
 
-  // If the population is spatially structured, set each individual's position
-  if ( exp_m->is_spatially_structured() )
-    {
-      int16_t x = 0, y = 0;
-      int16_t x_max = exp_m->get_grid_width();
-      int16_t y_max = exp_m->get_grid_height();
-      ae_grid_cell* grid_cell = NULL;
-      
-      ae_list_node<ae_individual*>* indiv_node = pop->get_indivs()->get_first();
-      ae_individual*  indiv = NULL;
-    
-      while ( indiv_node != NULL )
-        {
-          indiv = indiv_node->get_obj();  
-          grid_cell = exp_m->get_grid_cell( x, y );
-          grid_cell->set_individual( indiv );
-          x++;
-          if (x == x_max) 
-            {
-              x = 0;
-              y++;
-            }
-          indiv_node = indiv_node->get_next();
-        }
+    // Add '\0' at end of word if it's not empty (line ending with space or tab)
+    if (j != 0) {
+      formatted_line->words[formatted_line->nb_words++][j] = '\0';
     }
-
-  pop->evaluate_individuals( exp_m->get_env() );
-  pop->sort_individuals();
-
+  }
 }
 
 
 
-/*!
-  \brief Change in the population based on non coding bases on the best individual. 3 types of changes
-  
-  SUBPOPULATIONS_BASED_ON_NON_CODING_BASES:
-  Create the 3 subpopulations in the population. The definition of 3 subpopulations is based on non coding bases.
-    
-  The subpopulation are clonal and based on the ancestor of best individual of pop at begin.
-  The individuals in first subpopulation are clones of the best individual. 
-  The individuals in second subpopulation are clones of the best individual without any bases that are not in coding RNA.  
-  The individuals in third subpopulation are clones of the best individual with addition of bases that are not in coding RNA to double them.
-    
-  pop is changed into the new population with the 3 subpopulations
-    
-  REMOVE_NON_CODING_BASES_BEST_IND: 
-  The individuals of the new population are clones of the best individual but without any bases that are not in coding RNA.  
-    
-  DOUBLE_NON_CODING_BASES_BEST_IND:
-  The individuals of the new population are clones of the best individual but with addition of bases that are not in coding RNA to double them.
-    
-  \param pop population to change
-  \param exp_m global exp_manager
-  \param type type of change in the population
-*/
-void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ae_exp_manager* exp_m, population_change_type type)
-{
-  if(type == SUBPOPULATIONS_BASED_ON_NON_CODING_BASES || type == REMOVE_NON_CODING_BASES_BEST_IND || type == DOUBLE_NON_CODING_BASES_BEST_IND)
-    {
-      // 1) Compute the population size
-      int32_t subpopulation_size = (int)floor(pop->get_nb_indivs()/3);
-  
-      // 2) Get the best individual
-      ae_individual* best_indiv = exp_m->get_indiv_by_rank( pop->get_nb_indivs() );
-
-    
-      // 3) Create the new population 
-
-   
-      ae_list<ae_individual*>*  new_generation  = new ae_list<ae_individual*>();
-
-      ae_individual* indiv = create_clone(best_indiv, -1);
-            
-      ae_individual* only_coding_indiv = create_clone( best_indiv, -1 ); //one individual being the clone of the chosen individual but without any non coding bases
-      only_coding_indiv->remove_non_coding_bases();
-    
-      ae_individual* twice_non_coding_indiv = create_clone( best_indiv, -1 ); //one individual being the clone of the chosen individual but without any non coding bases
-      twice_non_coding_indiv->double_non_coding_bases();
-    
-    
-      int32_t* probe_A = new int32_t[5];
-      int32_t* probe_B = new int32_t[5];
-      int32_t* probe_C = new int32_t[5];
-      for( int32_t i = 0 ; i<5; i++)
-        {
-          probe_A[i] = 1;
-          probe_B[i] = 10;
-          probe_C[i] = 100;
-        }
-      indiv->set_int_probes(probe_A);
-      only_coding_indiv->set_int_probes(probe_B);
-      twice_non_coding_indiv->set_int_probes(probe_C);
-    
-      double* probe_double_A = new double[5];
-      double* probe_double_B = new double[5];
-      double* probe_double_C = new double[5];
-      for( int32_t i = 0 ; i<5; i++)
-        {
-          probe_double_A[i] = 1;
-          probe_double_B[i] = 10;
-          probe_double_C[i] = 100;
-        }
-      indiv->set_double_probes(probe_double_A);
-      only_coding_indiv->set_double_probes(probe_double_B);
-      twice_non_coding_indiv->set_double_probes(probe_double_C);
-      
-
-      switch(type)
-        {
-        case SUBPOPULATIONS_BASED_ON_NON_CODING_BASES:
-          {
-            int32_t  index_new_indiv = 0;
-            for ( int32_t i = 0 ; i < subpopulation_size ; i++ ) // clones of the 3 individuals
-              {
-                new_generation->add(create_clone( indiv, index_new_indiv++ ));
-                new_generation->add(create_clone( only_coding_indiv, index_new_indiv++ ));
-                new_generation->add(create_clone( twice_non_coding_indiv, index_new_indiv++ ));
-              }
-            break;
-          }
-        case REMOVE_NON_CODING_BASES_BEST_IND:
-          {
-            for ( int32_t i = 0 ; i < pop->get_nb_indivs() ; i++ )
-              {
-                new_generation->add(create_clone( only_coding_indiv, i ));
-              }
-            break;
-          }
-        case DOUBLE_NON_CODING_BASES_BEST_IND:
-          {
-            for ( int32_t i = 0 ; i < pop->get_nb_indivs() ; i++ )
-              {
-                new_generation->add(create_clone( twice_non_coding_indiv, i ));
-              }
-            break;
-          }
-        default:
-          {
-            fprintf(stderr, "%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type );
-            exit( EXIT_FAILURE );
-            break;
-          }
-        }
-      
-      //  4) Replace the current population by the new one
-      pop->get_indivs()->erase( true );
-      assert( pop->get_indivs()->is_empty() );
-      pop->replace_population( new_generation );
-    
-    
-
-      // TODO
-      // If the population is spatially structured, set each individual's position
-      // There will be a problem however for the "3 subpopulations" type of change,
-      // if the population size has changed (which is likely given that we do not 
-      // generally used population size that are multiple of 3)
-
-      pop->evaluate_individuals( exp_m->get_env() );
-      pop->sort_individuals();
-    }
-  else
-    {
-      printf( "%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type );
-      exit( EXIT_FAILURE );
-    }
-}
 
-/*!
-  \brief Change in the population based on non coding bases. 2 types of changes
-  
-  REMOVE_NON_CODING_BASES_POPULATION:
-  The individual of the new population are the individuals without any bases that are not in coding RNA.
-    
-  DOUBLE_NON_CODING_BASES_POPULATION:
-  The individual of the new population are the individuals with addition of bases that are not in coding RNA to double them.
-    
-  \param pop population to change
-  \param exp_m global exp_manager
-  \param type type of change in the population
-*/
-void change_based_on_non_coding_bases_in_population(ae_population* pop, ae_exp_manager* exp_m, population_change_type type)
-{
-  if(type == REMOVE_NON_CODING_BASES_POPULATION || type == DOUBLE_NON_CODING_BASES_POPULATION)
-    {
-      ae_list_node<ae_individual*>*   indiv_node = pop->get_indivs()->get_first();
-      ae_individual*  indiv           = NULL;
-      for ( int32_t i = 0 ; i < pop->get_nb_indivs() ; i++ )
-        {
-          indiv = indiv_node->get_obj();
-          if(type ==  REMOVE_NON_CODING_BASES_POPULATION)
-            {
-              indiv->remove_non_coding_bases();
-            }
-          else
-            {
-              indiv->double_non_coding_bases();
-            }
-          indiv_node = indiv_node->get_next();
-        }
-    }
-  else
-    {
-      printf( "%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type );
-      exit( EXIT_FAILURE );
-    }
-}
 
-/*!
-  \brief Create of clone of an ae_individual 
-  
-  \param dolly original individual that would be cloned
-  \param id index of the clone in the population
-  \return clone of dolly
-*/
-ae_individual* create_clone( ae_individual* dolly, int32_t id )
-{
-  ae_individual* indiv;
-  
-  indiv = new ae_individual( *dolly, true );
-  
-  indiv->set_id( id );
-  //printf( "metabolic error of the clonal individual : %f (%"PRId32" gene(s), %"PRId32" non coding bases)\n",
-  //        indiv->get_dist_to_target_by_feature(METABOLISM), indiv->get_protein_list()->get_nb_elts(), indiv->get_nb_bases_in_0_coding_RNA());
-  return indiv;
-}
+
+// /*!
+//   \brief Change in the population based on non coding bases on the best individual. 3 types of changes
+
+//   SUBPOPULATIONS_BASED_ON_NON_CODING_BASES:
+//   Create the 3 subpopulations in the population. The definition of 3 subpopulations is based on non coding bases.
+
+//   The subpopulation are clonal and based on the ancestor of best individual of pop at begin.
+//   The individuals in first subpopulation are clones of the best individual.
+//   The individuals in second subpopulation are clones of the best individual without any bases that are not in coding RNA.
+//   The individuals in third subpopulation are clones of the best individual with addition of bases that are not in coding RNA to double them.
+
+//   pop is changed into the new population with the 3 subpopulations
+
+//   REMOVE_NON_CODING_BASES_BEST_IND:
+//   The individuals of the new population are clones of the best individual but without any bases that are not in coding RNA.
+
+//   DOUBLE_NON_CODING_BASES_BEST_IND:
+//   The individuals of the new population are clones of the best individual but with addition of bases that are not in coding RNA to double them.
+
+//   \param pop population to change
+//   \param exp_m global exp_manager
+//   \param type type of change in the population
+// */
+// void change_based_on_non_coding_bases_of_best_individual(ae_population* pop, ExpManager* exp_m, population_change_type type)
+// {
+//   if(type == SUBPOPULATIONS_BASED_ON_NON_CODING_BASES || type == REMOVE_NON_CODING_BASES_BEST_IND || type == DOUBLE_NON_CODING_BASES_BEST_IND)
+//     {
+//       // 1) Compute the population size
+//       int32_t subpopulation_size = (int)floor(pop->nb_indivs()/3);
+
+//       // 2) Get the best individual
+//       ae_individual* best_indiv = exp_m->best_indiv();
+
+
+//       // 3) Create the new population
+
+
+//       std::list<ae_individual*> new_generation;
+
+//       ae_individual* indiv = create_clone(best_indiv, -1);
+
+//       ae_individual* only_coding_indiv = create_clone(best_indiv, -1); //one individual being the clone of the chosen individual but without any non coding bases
+//       only_coding_indiv->remove_non_coding_bases();
+
+//       ae_individual* twice_non_coding_indiv = create_clone(best_indiv, -1); //one individual being the clone of the chosen individual but without any non coding bases
+//       twice_non_coding_indiv->double_non_coding_bases();
+
+
+//       int32_t* probe_A = new int32_t[5];
+//       int32_t* probe_B = new int32_t[5];
+//       int32_t* probe_C = new int32_t[5];
+//       for(int32_t i = 0 ; i<5; i++)
+//         {
+//           probe_A[i] = 1;
+//           probe_B[i] = 10;
+//           probe_C[i] = 100;
+//         }
+//       indiv->set_int_probes(probe_A);
+//       only_coding_indiv->set_int_probes(probe_B);
+//       twice_non_coding_indiv->set_int_probes(probe_C);
+
+//       double* probe_double_A = new double[5];
+//       double* probe_double_B = new double[5];
+//       double* probe_double_C = new double[5];
+//       for(int32_t i = 0 ; i<5; i++)
+//         {
+//           probe_double_A[i] = 1;
+//           probe_double_B[i] = 10;
+//           probe_double_C[i] = 100;
+//         }
+//       indiv->set_double_probes(probe_double_A);
+//       only_coding_indiv->set_double_probes(probe_double_B);
+//       twice_non_coding_indiv->set_double_probes(probe_double_C);
+
+
+//       switch(type)
+//         {
+//         case SUBPOPULATIONS_BASED_ON_NON_CODING_BASES:
+//           {
+//             int32_t  index_new_indiv = 0;
+//             for (int32_t i = 0 ; i < subpopulation_size ; i++) // clones of the 3 individuals
+//               {
+//                 new_generation.push_back(create_clone(indiv, index_new_indiv++));
+//                 new_generation.push_back(create_clone(only_coding_indiv, index_new_indiv++));
+//                 new_generation.push_back(create_clone(twice_non_coding_indiv, index_new_indiv++));
+//               }
+//             break;
+//           }
+//         case REMOVE_NON_CODING_BASES_BEST_IND:
+//           {
+//             for (int32_t i = 0 ; i < pop->nb_indivs() ; i++)
+//               {
+//                 new_generation.push_back(create_clone(only_coding_indiv, i));
+//               }
+//             break;
+//           }
+//         case DOUBLE_NON_CODING_BASES_BEST_IND:
+//           {
+//             for (int32_t i = 0 ; i < pop->nb_indivs() ; i++)
+//               {
+//                 new_generation.push_back(create_clone(twice_non_coding_indiv, i));
+//               }
+//             break;
+//           }
+//         default:
+//           {
+//             fprintf(stderr, "%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type);
+//             exit(EXIT_FAILURE);
+//             break;
+//           }
+//         }
+
+//       //  4) Replace the current population by the new one
+//       //     -> Useless since it is done by replace_population.
+//       pop->replace_population(std::move(new_generation));
+
+
+
+//       // TODO
+//       // If the population is spatially structured, set each individual's position
+//       // There will be a problem however for the "3 subpopulations" type of change,
+//       // if the population size has changed (which is likely given that we do not
+//       // generally used population size that are multiple of 3)
+
+//       pop->evaluate_individuals(exp_m->env());
+//       pop->sort_individuals();
+//     }
+//   else
+//     {
+//       printf("%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type);
+//       exit(EXIT_FAILURE);
+//     }
+// }
+
+// /*!
+//   \brief Change in the population based on non coding bases. 2 types of changes
+
+//   REMOVE_NON_CODING_BASES_POPULATION:
+//   The individual of the new population are the individuals without any bases that are not in coding RNA.
+
+//   DOUBLE_NON_CODING_BASES_POPULATION:
+//   The individual of the new population are the individuals with addition of bases that are not in coding RNA to double them.
+
+//   \param pop population to change
+//   \param exp_m global exp_manager
+//   \param type type of change in the population
+// */
+// void change_based_on_non_coding_bases_in_population(ae_population* pop, ExpManager* exp_m, population_change_type type)
+// {
+//   if(type == REMOVE_NON_CODING_BASES_POPULATION || type == DOUBLE_NON_CODING_BASES_POPULATION)
+//     {
+//       for (auto& indiv: pop->indivs())
+//         if (type == REMOVE_NON_CODING_BASES_POPULATION)
+//           indiv->remove_non_coding_bases();
+//         else
+//           indiv->double_non_coding_bases();
+//     }
+//   else
+//     {
+//       printf("%s:%d: error: wrong population_change_type %d\n", __FILE__, __LINE__, type);
+//       exit(EXIT_FAILURE);
+//     }
+// }
 
 
 
@@ -877,44 +890,99 @@ ae_individual* create_clone( ae_individual* dolly, int32_t id )
 
 
 /*!
-  \brief 
-  
+  \brief
+
 */
-void print_help( char* prog_path ) 
-{
+void print_help(char* prog_path) {
   // Get the program file-name in prog_name (strip prog_path of the path)
   char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( (prog_name = strrchr( prog_path, '/' )) ) prog_name++;
-  else prog_name = prog_path;
-  
-  printf( "******************************************************************************\n" );
-  printf( "*                                                                            *\n" );
-  printf( "*                        aevol - Artificial Evolution                        *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "******************************************************************************\n" );
-  printf( "\n" );
-  printf( "%s: modify an experiment as specified in param_file.\n", prog_name );
-  printf( "\n" );
-  printf( "Usage : %s -h or --help\n", prog_name );
-  printf( "   or : %s -V or --version\n", prog_name );
-  printf( "   or : %s -g GENER [-f param_file]\n", prog_name );
-  printf( "\nOptions\n" );
-  printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-  printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-  printf( "  -g, --gener GENER\n\tspecify generation number\n\n" );
-  printf( "  -f, --file param_file\n\tspecify parameter file (default: param.in)\n");
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s: modify an experiment as specified in PARAM_FILE.\n", prog_name);
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP] [-f PARAM_FILE]\n", prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n"
+             "\tprint this help, then exit\n");
+  printf("  -V, --version\n"
+             "\tprint version number, then exit\n");
+  printf("  -t, --timestep TIMESTEP\n"
+             "\tspecify timestep\n");
+  printf("  -f, --file PARAM_FILE\n"
+             "\tspecify parameter file (default: param.in)\n");
 }
 
-/*!
-  \brief 
-  
-*/
-void print_version( void ) 
-{
-  printf( "aevol %s\n", VERSION );
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char* options_list = "hf:t:V";
+  static struct option long_options_list[] = {
+      {"help",      no_argument,       nullptr, 'h'},
+      {"version",   no_argument,       nullptr, 'V'},
+      {"file",      required_argument, nullptr, 'f'},
+      {"timestep",  required_argument, nullptr, 't'},
+      {0, 0, 0, 0}
+  };
+
+  // Get actual values of the CLI options
+  int option;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               nullptr)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 'f' : {
+        if (strcmp(optarg, "") == 0) {
+          printf("%s: error: Option -f or --file : missing argument.\n",
+                 argv[0]);
+          exit(EXIT_FAILURE);
+        }
+
+        param_file_name = optarg;
+        break;
+      }
+      case 't' : {
+        timestep = atoi(optarg);
+        break;
+      }
+      default : {
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+
+  // If param file name wasn't provided, use default
+  if (param_file_name == nullptr) {
+    param_file_name = new char[strlen(DEFAULT_PARAM_FILE_NAME) + 1];
+    sprintf(param_file_name, "%s", DEFAULT_PARAM_FILE_NAME);
+  }
+
+  // If timestep wasn't provided, use default
+  if (timestep == -1) {
+    timestep = OutputManager::last_gener();
+  }
 }
diff --git a/src/aevol_propagate.cpp b/src/aevol_propagate.cpp
index 5522d4d..92bc835 100644
--- a/src/aevol_propagate.cpp
+++ b/src/aevol_propagate.cpp
@@ -3,393 +3,257 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
- 
 const char* DEFAULT_PARAM_FILE_NAME = "param.in";
 
-
-// =================================================================
-//                              Libraries
-// =================================================================
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 #include <err.h>
 #include <errno.h>
 #include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/stat.h>
 
+#include <limits>
 
+// TODO(dpa) will be merged into C++17, remove dependency when possible
+#include <boost/filesystem.hpp>
 
+#if __cplusplus == 201103L
+  #include "make_unique.h"
+#endif
 
-// =================================================================
-//                            Project Files
-// =================================================================
 #ifdef __X11
-  #include <ae_exp_manager_X11.h>
+  #include "ExpManager_X11.h"
 #else
-  #include <ae_exp_manager.h>
+  #include "ExpManager.h"
 #endif
-#include <param_loader.h>
 
+#include "ParamLoader.h"
 
+using namespace aevol;
 
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help( char* prog_path );
-void print_version( void );
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
 
+// Command-line option variables
+static int64_t timestep = -1;
+static char* input_dir = nullptr;
+static char* output_dir = nullptr;
+static bool keep_prng_states = false;
+static bool verbose = false;
 
 
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
 
+  // If output directory doesn't exist, create it
+  struct stat stat_buf;
+  if ((stat(output_dir, &stat_buf) == -1) && (errno == ENOENT)) {
+    if (not boost::filesystem::create_directories(output_dir)) {
+      err(EXIT_FAILURE, output_dir, errno);
+    }
+  }
 
-int main( int argc, char* argv[] )
-{
-  // 1) Initialize command-line option variables with default values
-  int32_t num_gener      = -1;
-  int32_t generalseed    = -1;
-  int32_t selseed        = -1;
-  int32_t mutseed        = -1;
-  int32_t stochseed      = -1;
-  int32_t envvarseed     = -1;
-  int32_t envnoiseseed   = -1;
+  // =================================================================
+  //                    Load the model experiment
+  // =================================================================
+  #ifndef __NO_X
+  ExpManager* exp_manager = new ExpManager_X11();
+  #else
+  ExpManager* exp_manager = new ExpManager();
+  #endif
 
-  char* input_dir   = NULL;
-  char* output_dir  = NULL;
-  bool  verbose     = false;
-  
-  // 2) Define allowed options
-  const char * options_list = "g:hi:o:vVS:s:m:t:e:n:";
+  exp_manager->load(input_dir, timestep, verbose, false);
+
+  if (not keep_prng_states) {
+    auto max = std::numeric_limits<int32_t>::max();
+
+    #if __cplusplus == 201103L
+      auto prng = make_unique<JumpingMT>(time(nullptr));
+
+      exp_manager->sel()->set_prng(
+          make_unique<JumpingMT>(prng->random(max)));
+      exp_manager->world()->set_prng(
+          make_unique<JumpingMT>(prng->random(max)));
+    #else
+      auto prng = std::make_unique<JumpingMT>(time(nullptr));
+
+      exp_manager->sel()->set_prng(
+          std::make_unique<JumpingMT>(prng->random(max)));
+      exp_manager->world()->set_prng(
+          std::make_unique<JumpingMT>(prng->random(max)));
+    #endif
+
+    exp_manager->world()->set_mut_prng(
+        std::make_shared<JumpingMT>(prng->random(max)));
+    exp_manager->world()->set_stoch_prng(
+        std::make_shared<JumpingMT>(prng->random(max)));
+
+    for (int16_t x = 0; x < exp_manager->world()->width(); x++) {
+      for (int16_t y = 0; y < exp_manager->world()->height(); y++) {
+        exp_manager->world()->grid(x, y)->set_mut_prng(
+            std::make_shared<JumpingMT>(
+                exp_manager->world()->mut_prng()->random(max)));
+        exp_manager->world()->grid(x, y)->individual()->set_mut_prng(
+            exp_manager->world()->grid(x, y)->mut_prng());
+
+        exp_manager->world()->grid(x, y)->set_stoch_prng(
+            std::make_shared<JumpingMT>(
+                exp_manager->world()->stoch_prng()->random(max)));
+        exp_manager->world()->grid(x, y)->individual()->set_stoch_prng(
+            exp_manager->world()->grid(x, y)->stoch_prng());
+      }
+    }
+
+    exp_manager->world()->set_phen_target_prngs(
+        std::make_shared<JumpingMT>(prng->random(max)),
+        std::make_shared<JumpingMT>(prng->random(max)));
+  }
+
+  exp_manager->Propagate(output_dir);
+}
+
+
+/*!
+  \brief print help and exist
+
+*/
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s:\n", prog_name);
+  printf("\tCreate a fresh copy of the experiment as it was at the given timestep.\n");
+  printf("\tThe timestep number of the copy will be reset to 0.\n");
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP] [-K] [-o OUTDIR] [-v]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -t, --timestep TIMESTEP\n");
+  printf("\tspecify timestep to propagate\n");
+  printf("  -K, --keep-prng-st\n\tdo not alter prng states\n");
+//  printf("  -i, --in INDIR\n"
+//             "\tspecify input directory (default \".\")\n");
+  printf("  -o, --out OUTDIR\n"
+             "\tspecify output directory (default \"./output\")\n");
+  printf("  -v, --verbose\n\tbe verbose\n");
+}
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char* options_list = "hVt:o:v";
   static struct option long_options_list[] = {
-    { "gener",    required_argument,  NULL, 'g' },
-    { "help",     no_argument,        NULL, 'h' },
-    { "in",       required_argument,  NULL, 'i' },
-    { "out",      required_argument,  NULL, 'o' },
-    { "verbose",  no_argument,        NULL, 'v' },
-    { "version",  no_argument,        NULL, 'V' },
-    { "general-seed",     required_argument,  NULL, 'S' },
-    { "sel-seed",     required_argument,  NULL, 's' },
-    { "mut-seed",     required_argument,  NULL, 'm' },
-    { "stoch-seed",     required_argument,  NULL, 't' },
-    { "env-var-seed",    required_argument,  NULL, 'e' },
-    { "env-noise-seed",    required_argument,  NULL, 'n' },
-    { 0, 0, 0, 0 }
+      {"help",           no_argument,       nullptr, 'h'},
+      {"version",        no_argument,       nullptr, 'V'},
+      {"timestep",       required_argument, nullptr, 't'},
+      {"keep-prng-st",   no_argument,       nullptr, 'K'},
+//      {"in",             required_argument, nullptr, 'i'},
+      {"out",            required_argument, nullptr, 'o'},
+      {"verbose",        no_argument,       nullptr, 'v'},
+      {0, 0, 0, 0}
   };
-      
-  // 3) Get actual values of the command-line options
+
+  // Get actual values of the CLI options
   int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 ) 
-  {
-    switch ( option ) 
-    {
-    case 'h' :
-      {
-        print_help( argv[0] );
-        exit( EXIT_SUCCESS );
-      }
-    case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-    case 'g' :
-      {
-        num_gener = atoi( optarg );
-        break;
-      }
-    case 'S' :
-      {
-        generalseed = atoi( optarg );
-        break;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               nullptr)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
       }
-   case 's' :
-      {
-        selseed = atoi( optarg );
-        break;
-      }
-    case 'm' :
-      {
-        mutseed = atoi( optarg );
-        break;
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
       }
-    case 't' :
-      {
-        stochseed = atoi( optarg );
+      case 't' : {
+        timestep = atoi(optarg);
         break;
       }
-    case 'e' :
-      {
-        envvarseed = atoi( optarg );
+      case 'K' : {
+        keep_prng_states = true;
         break;
       }
-    case 'n' :
-      {
-        envnoiseseed = atoi( optarg );
+//      case 'i' : {
+//        input_dir = new char[strlen(optarg) + 1];
+//        strcpy(input_dir, optarg);
+//        break;
+//      }
+      case 'o' : {
+        output_dir = new char[strlen(optarg) + 1];
+        strcpy(output_dir, optarg);
         break;
       }
-    case 'i' :
-      {
-        input_dir = new char[strlen(optarg)+1];
-        strcpy( input_dir, optarg );
-        break;
-      }
-    case 'o' :
-      {
-        output_dir = new char[strlen(optarg)+1];
-        strcpy( output_dir, optarg );
-        break;
-      }
-    case 'v' :
-      {
+      case 'v' : {
         verbose = true;
         break;
       }
-    default :
-      {
+      default : {
         // An error message is printed in getopt_long, we just need to exit
-        exit( EXIT_FAILURE );
+        exit(EXIT_FAILURE);
       }
     }
   }
 
-  if ( (generalseed != -1) && ( (selseed != -1)||(mutseed!=-1)||(stochseed!=-1)||(envvarseed!=-1)||(envnoiseseed!=-1) ) )
-    {
-      fprintf(stderr, "Error: if you specify a general seed with -S or --seed, you should not specify additional seeds.\n");
-      exit( EXIT_FAILURE );
-    }
-
-  
-  // 4) Set undefined command line parameters to default values
-  if ( input_dir == NULL )
-  {
+  // If input directory wasn't provided, use default
+  if (input_dir == nullptr) {
     input_dir = new char[255];
-    sprintf( input_dir, "%s", "." );
+    sprintf(input_dir, "%s", ".");
   }
-  if ( output_dir == NULL )
-  {
+  // If output directory wasn't provided, use default
+  if (output_dir == nullptr) {
     output_dir = new char[255];
-    sprintf( output_dir, "%s", "output" );
+    sprintf(output_dir, "%s", "output");
   }
-  if ( num_gener == -1 )
-  {
-    // Set num_gener to the content of the LAST_GENER file if it exists.
-    // If it doesn't, print help and exit
-    char lg_filename[300];
-    sprintf(lg_filename, "%s/%s", input_dir, LAST_GENER_FNAME);
-    FILE* lg_file = fopen( lg_filename, "r" );
-    if ( lg_file != NULL )
-    {
-      fscanf( lg_file, "%"PRId32"\n", &num_gener );
-      fclose( lg_file );
-    }
-    else
-    {
-      printf( "aevol_propagate: no generation number provided.\n" );
-      print_help( argv[0] );
-      exit( EXIT_FAILURE );
-    }
-  }
-  
-  
-  // 5) Check whether the output directory is missing
-  struct stat stat_buf;
-  if ( (stat( output_dir, &stat_buf ) == -1) && (errno == ENOENT) )
-  {
-    // printf( "Directory \"%s\" does not exist. Create it ? [Y/n]\n", output_dir );
-    // char answer = getchar();
-    // while ( answer != 'y' and answer != 'n' and answer != '\n' )
-    // {
-    //   printf( "Please answer by 'y' or 'n'. Create output directory ? [Y/n]\n" );
-    //   while( answer != '\n' && answer != EOF) answer = getchar(); // "flush" stdin
-    //   answer = getchar();
-    // }
-    // char flush = answer;
-    // while( flush != '\n' && flush != EOF) flush = getchar(); // "flush" stdin
-    // if ( answer == '\n' ) answer = 'y';
-    
-    // if ( answer == 'n' ) exit( EXIT_SUCCESS );
-    
-    if ( mkdir( output_dir, 0755 ) )
-    {
-      err( EXIT_FAILURE, output_dir, errno );
-    }
-  }
-  
-  
-  
-  // =================================================================
-  //                    Load the model experiment
-  // =================================================================
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-  
-  exp_manager->load( input_dir, num_gener, false, verbose, false );
-
-  if (generalseed != -1)
-    {
-      ae_jumping_mt * prng = new ae_jumping_mt( generalseed );
-      
-      selseed      = prng->random( 1000000 );
-      mutseed      = prng->random( 1000000 );
-      stochseed    = prng->random( 1000000 );
-      envvarseed   = prng->random( 1000000 );
-      envnoiseseed = prng->random( 1000000 );
-
-      ae_jumping_mt * selprng           = new ae_jumping_mt( selseed );
-      ae_jumping_mt * mutprng           = new ae_jumping_mt( mutseed );
-      ae_jumping_mt * stochprng         = new ae_jumping_mt( stochseed );
-      ae_jumping_mt * envvarprng        = new ae_jumping_mt( envvarseed );
-      ae_jumping_mt * envnoiseprng      = new ae_jumping_mt( envnoiseseed );
-
-      exp_manager->get_sel()->set_prng( selprng ); 
-      exp_manager->get_pop()->set_mut_prng( mutprng );
-      exp_manager->get_pop()->set_stoch_prng( stochprng );
-      exp_manager->get_env()->set_var_prng( envvarprng );
-      exp_manager->get_env()->set_noise_prng( envnoiseprng );
-
-      if (exp_manager->is_spatially_structured())
-        {
-          int32_t spatialstructseed = prng->random( 1000000 );
-          ae_jumping_mt * spatialstructprng = new ae_jumping_mt( spatialstructseed );
-          exp_manager->get_spatial_structure()->set_prng(spatialstructprng);
-        }      
-      
-      delete prng;
-    }
-  else
-    {
-      if ( selseed != -1 )
-        {
-          ae_jumping_mt * selprng  = new ae_jumping_mt( selseed );
-          if (exp_manager->is_spatially_structured())
-            {
-              int32_t spatialstructseed = selprng->random( 1000000 );
-              ae_jumping_mt * spatialstructprng = new ae_jumping_mt( spatialstructseed );
-              exp_manager->get_spatial_structure()->set_prng(spatialstructprng);
-            }   
-          exp_manager->get_sel()->set_prng( selprng ); 
-        }
-
-      if ( mutseed != -1 )
-        {
-          ae_jumping_mt * mutprng = new ae_jumping_mt( mutseed );
-          exp_manager->get_pop()->set_mut_prng( mutprng );
-        }
-
-      if ( stochseed != -1 )
-        {
-          ae_jumping_mt * stochprng = new ae_jumping_mt( stochseed );
-          exp_manager->get_pop()->set_stoch_prng( stochprng );
-        }
-
-      if ( envvarseed != -1 )
-        {
-          ae_jumping_mt * envvarprng = new ae_jumping_mt( envvarseed );
-          exp_manager->get_env()->set_var_prng( envvarprng );
-        }
-
-      if ( envnoiseseed != -1 )
-        {
-          ae_jumping_mt * envnoiseprng = new ae_jumping_mt( envnoiseseed );
-          exp_manager->get_env()->set_noise_prng( envnoiseprng );
-        }
-    }
-
-
-  exp_manager->save_copy( output_dir, 0 );
-}
-
-
-
-
-
 
-
-/*!
-  \brief 
-  
-*/
-void print_help( char* prog_path ) 
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( ( prog_name = strrchr( prog_path, '/' ) ) ) prog_name++;
-  else prog_name = prog_path;
-  
-  printf( "******************************************************************************\n" );
-  printf( "*                                                                            *\n" );
-  printf( "*                        aevol - Artificial Evolution                        *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "******************************************************************************\n" );
-  printf( "\n" );
-  printf( "%s:\n", prog_name );
-  printf( "\tCreate a fresh copy of the experiment as it was at the given generation.\n" );
-  printf( "\tThe generation number of the copy will be reset to 0.\n" );
-  printf( "\n" );
-  printf( "Usage : %s -h or --help\n", prog_name );
-  printf( "   or : %s -V or --version\n", prog_name );
-  printf( "   or : %s [-v] [-g GENER] [-i INDIR] [-o OUTDIR] [-S GENERALSEED]\n", prog_name );
-  printf( "   or : %s [-v] [-g GENER] [-i INDIR] [-o OUTDIR] [-s SELSEED] [-m MUTSEED] [-t STOCHSEED] [-e ENVVARSEED] [-n ENVNOISESEED] ]\n", prog_name );
-  printf( "\nOptions\n" );
-  printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-  printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-  printf( "  -v, --verbose\n\tbe verbose\n\n" );
-  printf( "  -g, --gener GENER\n\tspecify generation number\n" );
-  printf( "\t(default: that contained in file last_gener.txt, if any)\n\n" );
-  printf( "  -i, --in INDIR\n\tspecify input directory (default \".\")\n\n" );
-  printf( "  -o, --out OUTDIR\n\tspecify output directory (default \"./output\")\n\n" );
-  printf( "  -S, --general-seed GENERALSEED\n\tspecify an integer to be used as a seed for random numbers.\n" );
-  printf( "\tIf you use %s repeatedly to initialize several simulations, you should specify a different\n", prog_name );
-  printf( "\tseed for each simulation, otherwise all simulations will yield exactly the same results.\n" );
-  printf( "\tIf you specify this general seed, random drawings will be different for all random processes\n" );
-  printf( "\tenabled in your simulations (mutations, stochastic gene expression, selection, migration, \n" ),
-  printf( "\tenvironmental variation, environmental noise). To change the random drawings for a specific\n" );
-  printf( "\trandom process only, do not use -S but the options below.\n" );
-  printf( "  -s, --sel-seed SELSEED\n\tspecify an integer as a seed for random numbers needed for selection\n" );
-  printf( "\tand migration (if spatial structure is enabled).\n" );
-  printf( "  -m, --mut-seed MUTSEED\n\tspecify an integer as a seed for random numbers needed for mutations\n" );
-  printf( "  -t, --stoch-seed STOCHSEED\n\tspecify an integer as a seed for random numbers needed for \n" );
-  printf( "\tstochastic gene expression.\n" );
-  printf( "  -e, --env-var-seed ENVVARSEED\n\tspecify an integer as a seed for random numbers needed for \n" );
-  printf( "\tenvironmental variation.\n" );
-  printf( "  -n, --env-noise-seed ENVNOISESEED\n\tspecify an integer as a seed for random numbers needed for \n" );
-  printf( "\tenvironmental noise.\n" );
-}
-
-/*!
-  \brief 
-  
-*/
-void print_version( void ) 
-{
-	printf( "aevol %s\n", VERSION );
+  // If timestep wasn't provided, use default
+  if (timestep == -1) {
+    timestep = OutputManager::last_gener();
+  }
 }
diff --git a/src/aevol_run.cpp b/src/aevol_run.cpp
index d94efc6..4c5b63f 100644
--- a/src/aevol_run.cpp
+++ b/src/aevol_run.cpp
@@ -3,331 +3,290 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
+//
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cerrno>
+#include <cinttypes>
+#include <cstdlib>
+#include <cstdio>
+#include <csignal>
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <errno.h>
-#include <inttypes.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <signal.h>
 #include <sys/stat.h>
+#include <getopt.h>
 
+#ifdef _OPENMP
+  #include <omp.h>
+#endif
 
-
-// =================================================================
-//                            Project Files
-// =================================================================
 #ifdef __X11
-  #include <ae_exp_manager_X11.h>
+  #include "ExpManager_X11.h"
 #else
-  #include <ae_exp_manager.h>
+  #include "ExpManager.h"
 #endif
 
-#include <ae_macros.h>
-
-
-
+#include "macros.h"
 
+using namespace aevol;
 
 #ifndef __NO_X
-void catch_usr1( int sig_num );
+  void catch_usr1(int sig_num);
 #endif
 
-#ifdef __IN2P3
-void catch_usr1( int sig_num );
-void catch_xcpu( int sig_num );
-#endif
-
-void print_help( char* prog_path );
-void print_version( void );
-
-static ae_exp_manager* exp_manager = NULL;
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
 
+// Command-line option variables
+// static bool pause_on_startup = false;
+static bool verbose = false;
+static int64_t t0 = -1;
+static int64_t t_end = -1;
+static int64_t nb_steps = -1;
+#ifndef __NO_X
+  static bool show_display_on_startup = true;
+#endif
+static bool run_in_parallel = false;
 
+// Other file-scope variables
+static ExpManager* exp_manager = nullptr;
 
 
-int main( int argc, char* argv[] )
-{
+int main(int argc, char* argv[]) {
   // Set handlers for signals to be caught
   #ifndef __NO_X
-    signal( SIGUSR1, catch_usr1 );
+    signal(SIGUSR1, catch_usr1);
   #endif
 
-  #ifdef __IN2P3
-    signal( SIGUSR1, catch_usr1 );
-    signal( SIGXCPU, catch_xcpu );
-  #endif  
-  
-  
   // Print warning for debug mode
   #ifdef DEBUG
-    printf( "aevol is being run in DEBUG mode\n" );
-  #endif
-  
- 
-  
-  // =========================================================================
-  //                           Get command-line options
-  // =========================================================================
-  // 1) Initialize command-line option variables with default values
-  // 2) Define allowed options
-  // 3) Get actual values of the command-line options
-  // 4) Check the consistancy of the command-line options
-  // 5) Set file names according to options
-  // =========================================================================
-  
-  // -------------------------------------------------------------------------
-  // 1) Initialize command-line option variables with default values
-  // -------------------------------------------------------------------------
-  bool use_text_files   = false;
-  bool pause_on_startup = false;
-  bool verbose          = false;
-  
-  int32_t num_gener = 0;
-  int32_t nb_gener  = 1000;
-  
-  #ifndef __NO_X
-    bool show_display_on_startup = true;
+    printf("aevol is being run in DEBUG mode\n");
   #endif
-  
-  
-  // -------------------------------------------------------------------------
-  // 2) Define allowed options
-  // -------------------------------------------------------------------------
-  const char * options_list = "hn:r:tvVwx";
-  static struct option long_options_list[] = {
-    { "help",     no_argument,        NULL, 'h' },
-    { "nbgener",  required_argument,  NULL, 'n' }, // Number of generations to be run
-    { "resume",   required_argument,  NULL, 'r' }, // Resume from generation X
-    { "text",     no_argument,        NULL, 't' }, // Use text files instead of gzipped binary files
-    { "verbose",  no_argument,        NULL, 'v' }, // Be verbose
-    { "version",  no_argument,        NULL, 'V' },
-    { "wait",     no_argument,        NULL, 'w' }, // Pause after loading
-    { "noX",      no_argument,        NULL, 'x' }, // Don't display X outputs on start
-    { 0, 0, 0, 0 }
-  };
-  
-  
-  // -------------------------------------------------------------------------
-  // 3) Get actual values of the command-line options
-  // -------------------------------------------------------------------------
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 ) 
-  {
-    switch ( option ) 
-    {
-      case 'h' :
-      {
-        print_help( argv[0] );
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'n' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -n or --nbgener : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-        
-        nb_gener = atoi( optarg );
-        
-        break;
-      }
-      case 'r' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -r or --resume : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-        
-        num_gener = atol( optarg );
-		  
-        break;      
-      }
-      case 't' :
-      {
-        use_text_files = true;
-        printf( "%s: error: Option -t or --text not yet implemented.\n", argv[0] );
-        exit( EXIT_FAILURE );
-        
-        break;
-      }
-      case 'v' :
-      {
-        verbose = true;
-        
-        break;
-      }
-      case 'w' :
-      {
-        pause_on_startup = true;
-        
-        break;
-      }
-      case 'x' :
-      {
-        #ifdef __NO_X
-          printf( "%s: error: Program was compiled with __NO_X option, no visualisation available.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        #else
-          show_display_on_startup = false;
-        #endif
-        
-        break;
-      }
-      default :
-      {
-        // An error message is printed in getopt_long, we just need to exit
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-  
-  
+
+  interpret_cmd_line_options(argc, argv);
+
   // =================================================================
   //                          Load the simulation
   // =================================================================
   #ifndef __NO_X
-    exp_manager = new ae_exp_manager_X11();
+    exp_manager = new ExpManager_X11();
   #else
-    exp_manager = new ae_exp_manager();
+    exp_manager = new ExpManager();
   #endif
-  
-  exp_manager->load( num_gener, false, verbose );
-  exp_manager->set_nb_gener( nb_gener );
-  
- 
 
-  // Make a numbered copy of each static input file (dynamic files are saved elsewhere)
+  exp_manager->load(t0, verbose, true);
+  exp_manager->set_t_end(t_end);
+
+
+
+  // Make a numbered copy of each static input file
+  // (dynamic files are saved elsewhere)
   // TODO (?)
 
   #ifndef __NO_X
-    if ( show_display_on_startup )
-    {
-      ((ae_exp_manager_X11*) exp_manager)->toggle_display_on_off();
+    if (show_display_on_startup) {
+      ((ExpManager_X11*) exp_manager)->toggle_display_on_off();
     }
   #endif
-  
-  
+
+
   // =================================================================
   //                         Run the simulation
   // =================================================================
   exp_manager->run_evolution();
-  
-  
+
+
   delete exp_manager;
   //~ return EXIT_SUCCESS;
 }
 
 
 #ifndef __NO_X
-void catch_usr1( int sig_num )
-{
-  signal( SIGUSR1, catch_usr1 );
-  
-  printf( "display on/off\n" );
-  if ( exp_manager != NULL )
-  {
-    ((ae_exp_manager_X11*) exp_manager)->toggle_display_on_off();
+  void catch_usr1(int sig_num) {
+    signal(SIGUSR1, catch_usr1);
+
+    printf("display on/off\n");
+    if (exp_manager != nullptr) {
+      ((ExpManager_X11*) exp_manager)->toggle_display_on_off();
+    }
   }
-}
 #endif
 
-#ifdef __IN2P3
-void catch_usr1( int sig_num )
-{
-  //system( "./make_big_backup.py" );
-  exit( EXIT_FAILURE );
-}
 
-void catch_xcpu( int sig_num )
-{
-  //system( "./make_big_backup.py" );
-  exit( EXIT_FAILURE );
+/*!
+  \brief
+
+*/
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+	printf("******************************************************************************\n");
+	printf("*                                                                            *\n");
+	printf("*                        aevol - Artificial Evolution                        *\n");
+	printf("*                                                                            *\n");
+	printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+	printf("*                                                                            *\n");
+	printf("******************************************************************************\n");
+  printf("\n");
+	printf("%s: run an aevol simulation.\n", prog_name);
+  printf("\n");
+	printf("Usage : %s -h or --help\n", prog_name);
+	printf("   or : %s -V or --version\n", prog_name);
+	printf("   or : %s [-b TIMESTEP] [-e TIMESTEP|-n NB_TIMESTEPS] [-p NB_THREADS] [-vwx]\n",
+         prog_name);
+	printf("\nOptions\n");
+	printf("  -h, --help\n\tprint this help, then exit\n");
+	printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -b, --begin TIMESTEP\n");
+  printf("\tspecify time t0 to resume simulation at (default read in last_gener.txt)\n");
+  printf("  -e, --end TIMESTEP\n");
+  printf("\tspecify time of the end of the simulation\n");
+  printf("  -n, --nb-timesteps NB_TIMESTEPS\n");
+  printf("\tspecify number of timesteps to be simulated (default 1000)\n");
+  printf("  -p, --parallel NB_THREADS\n");
+  printf("\trun on NB_THREADS threads (use -1 for system default)\n");
+  printf("  -v, --verbose\n\tbe verbose\n");
+  printf("  -w, --wait\n\tpause after loading\n");
+  printf("  -x, --noX\n\tdon't display X outputs upon start\n");
+  printf("\tsend SIGUSR1 to switch X output on/off\n");
 }
-#endif
 
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char* options_list = "hVb:e:n:vwxp:";
+  static struct option long_options_list[] = {
+      {"help",          no_argument,       nullptr, 'h'},
+      {"version",       no_argument,       nullptr, 'V'},
+      {"begin",         required_argument, nullptr, 'b'},
+      {"end",           required_argument, nullptr, 'e'},
+      {"nb-timesteps",  required_argument, nullptr, 'n'},
+      {"verbose",       no_argument,       nullptr, 'v'},
+      {"wait",          no_argument,       nullptr, 'w'},
+      {"noX",           no_argument,       nullptr, 'x'},
+      {"parallel",      required_argument, nullptr, 'p'},
+      {0, 0, 0, 0}
+  };
 
+  // Get actual values of the CLI options
+  int option;
+  while ((option =
+              getopt_long(argc, argv, options_list, long_options_list, nullptr))
+         != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 'b' : {
+        t0 = atol(optarg);
+        break;
+      }
+      case 'e' : {
+        if (nb_steps != -1) {
+          Utils::ExitWithUsrMsg("use either option -n or -e, not both");
+        }
 
+        t_end = atol(optarg);
+        break;
+      }
+      case 'n' : {
+        if (t_end != -1) {
+          Utils::ExitWithUsrMsg("use either option -n or -e, not both");
+        }
 
+        nb_steps = atol(optarg);
+        break;
+      }
+      case 'v' : {
+        verbose = true;
+        break;
+      }
+      case 'w' : {
+        // pause_on_startup = true;
+        break;
+      }
+      case 'x' : {
+        #ifdef __NO_X
+        printf("%s: error: Program was compiled with __NO_X option, "
+                 "no visualisation available.\n", argv[0]);
+          exit(EXIT_FAILURE);
+        #else
+        show_display_on_startup = false;
+        #endif
 
+        break;
+      }
+      case 'p' : {
+        #ifdef _OPENMP
+        run_in_parallel = true;
+          if (atoi(optarg) > 0) {
+            omp_set_num_threads(atoi(optarg));
+          }
+        #endif
+        break;
+      }
+      default : {
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
 
+  // If t0 wasn't provided, use default
+  if (t0 < 0) {
+    t0 = OutputManager::last_gener();
+  }
 
-/*!
-  \brief 
-  
-*/
-void print_help( char* prog_path ) 
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( ( prog_name = strrchr( prog_path, '/' )) ) prog_name++;
-  else prog_name = prog_path;
-  
-	printf( "******************************************************************************\n" );
-	printf( "*                                                                            *\n" );
-	printf( "*                        aevol - Artificial Evolution                        *\n" );
-	printf( "*                                                                            *\n" );
-	printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-	printf( "*                                                                            *\n" );
-	printf( "******************************************************************************\n" );
-  printf( "\n" );
-	printf( "%s: run an aevol simulation.\n", prog_name );
-  printf( "\n" );
-	printf( "Usage : %s -h or --help\n", prog_name );
-	printf( "   or : %s -V or --version\n", prog_name );
-	printf( "   or : %s [-r GENER] [-n NB_GENER] [-tvwx]\n", prog_name );
-	printf( "\nOptions\n" );
-	printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-	printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-  printf( "  -r, --resume GENER\n\tspecify generation to resume simulation at (default 0)\n\n" );
-  printf( "  -n, --nbgener NB_GENER\n\tspecify number of generations to be run (default 1000)\n\n" );
-  printf( "  -t, --text\n\tuse text files instead of binary files when possible\n\n" );
-	printf( "  -v, --verbose\n\tbe verbose\n\n" );
-  printf( "  -w, --wait\n\tpause after loading\n\n" );
-  printf( "  -x, --noX\n\tdon't display X outputs upon start\n\tsend SIGUSR1 to switch X output on/off\n" );
-}
+  // If t_end_ wasn't provided, set it according to nb_steps or use default
+  // (run for 1000 timesteps)
+  if (t_end < 0) {
+    if (nb_steps >= 0) {
+      t_end = t0 + nb_steps;
+    }
+    else {
+      t_end = t0 + 1000;
+    }
+  }
 
-/*!
-  \brief 
-  
-*/
-void print_version( void ) 
-{
-	printf( "aevol %s\n", VERSION );
+  // It the user didn't ask for a parallel run, set number of threads to 1
+  #ifdef _OPENMP
+  if (not run_in_parallel) {
+      omp_set_num_threads(1);
+    }
+  #endif
 }
diff --git a/src/libaevol/AbstractFuzzy.cpp b/src/libaevol/AbstractFuzzy.cpp
new file mode 100644
index 0000000..ae65b39
--- /dev/null
+++ b/src/libaevol/AbstractFuzzy.cpp
@@ -0,0 +1,5 @@
+//
+// Created by arrouan on 30/07/15.
+//
+
+#include "AbstractFuzzy.h"
diff --git a/src/libaevol/AbstractFuzzy.h b/src/libaevol/AbstractFuzzy.h
new file mode 100644
index 0000000..1013085
--- /dev/null
+++ b/src/libaevol/AbstractFuzzy.h
@@ -0,0 +1,83 @@
+//
+// Created by arrouan on 30/07/15.
+//
+
+#ifndef AEVOL_ABSTRACTFUZZY_H
+#define AEVOL_ABSTRACTFUZZY_H
+
+
+#include <list>
+
+#include "macros.h"
+#include "Point.h"
+
+namespace aevol {
+
+class AbstractFuzzy
+{
+ public:
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+//  AbstractFuzzy() {};
+//  AbstractFuzzy(const AbstractFuzzy& f) {};
+//  AbstractFuzzy(const gzFile backup) {};
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~AbstractFuzzy() {};
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup) const = 0;
+  virtual void load(gzFile backup) = 0;
+  virtual void reset() = 0;
+  virtual void simplify() = 0;
+  virtual void add_triangle(double mean, double width, double height)  = 0;
+  virtual void add(const AbstractFuzzy& f)  = 0;
+  virtual void sub(const AbstractFuzzy& f) = 0;
+  virtual void add_point(double x, double y) = 0;
+
+  /// `clipping_direction` is only used for `clip` function's keyword.
+  enum clipping_direction: bool {min, max};
+  virtual void clip(clipping_direction direction, double bound) = 0;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+
+  virtual double get_geometric_area() const = 0;
+  virtual double get_geometric_area(double start_segment, double end_segment) const = 0;
+
+  virtual bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const = 0;
+
+  virtual void print() const = 0;
+
+  virtual void clear() = 0;
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+ protected:
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+
+};
+
+} // namespace aevol
+
+
+#endif //AEVOL_ABSTRACTFUZZY_H
diff --git a/src/libaevol/ae_phenotype.cpp b/src/libaevol/AeTime.cpp
similarity index 66%
copy from src/libaevol/ae_phenotype.cpp
copy to src/libaevol/AeTime.cpp
index 958b8ff..2680a95 100644
--- a/src/libaevol/ae_phenotype.cpp
+++ b/src/libaevol/AeTime.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -36,67 +36,30 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_phenotype.h>
-#include <ae_individual.h>
+#include "AeTime.h"
 
+namespace aevol {
 
 
 
-//##############################################################################
-//                                                                             #
-//                              Class ae_phenotype                             #
-//                                                                             #
-//##############################################################################
+// ############################################################################
+//
+//                                  Class AeTime
+//
+// ############################################################################
 
 // =================================================================
 //                    Definition of static attributes
 // =================================================================
+int64_t AeTime::time_ = 0;
 
 // =================================================================
 //                             Constructors
 // =================================================================
-ae_phenotype::ae_phenotype( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = NULL;
-}
-
-ae_phenotype::ae_phenotype( ae_individual* indiv, const ae_phenotype &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set( model )
-#elif defined __X11
-  ae_fuzzy_set_X11( model )
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
-}
-
-ae_phenotype::ae_phenotype( ae_individual* indiv ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
-}
 
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_phenotype::~ae_phenotype( void )
-{
-}
 
 // =================================================================
 //                            Public Methods
@@ -105,3 +68,12 @@ ae_phenotype::~ae_phenotype( void )
 // =================================================================
 //                           Protected Methods
 // =================================================================
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+int64_t time() {
+  return AeTime::time();
+}
+
+} // namespace aevol
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/AeTime.h
similarity index 61%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/AeTime.h
index fdb64b7..e424405 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/AeTime.h
@@ -3,124 +3,127 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
 
 
+#ifndef AEVOL_TIME_H_
+#define AEVOL_TIME_H_
+
 
 // =================================================================
-//                            Project Files
+//                              Includes
 // =================================================================
-#include <ae_object.h>
-
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
 
 
 
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
 
 
-class ae_dump : public ae_object
-{  
+/**
+ * The time_ value represents the step that is currently being computed
+ *
+ * e.g. when creating generation 1 from generation 0, time_ == 1
+ */
+class AeTime {
  public :
-  
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  AeTime() = delete; //< Default ctor
+  AeTime(const AeTime &) = delete; //< Copy ctor
+  AeTime(AeTime &&) = delete; //< Move ctor
+
   // =================================================================
   //                             Destructors
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+  virtual ~AeTime() = delete;
+
+  // =================================================================
+  //                        Accessors: getters
   // =================================================================
-  //                              Accessors
+  static inline int64_t time() {return time_;}
+
   // =================================================================
-  
+  //                        Accessors: setters
+  // =================================================================
+  static inline void set_time(int64_t t) { time_ = t;}
+
+  // =================================================================
+  //                              Operators
+  // =================================================================
+
   // =================================================================
   //                            Public Methods
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  static inline void plusplus() { time_++;}
+
   // =================================================================
   //                           Public Attributes
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
+
+
+
+
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  static int64_t time_;
 };
 
 
 // =====================================================================
-//                          Accessors' definitions
+//                           Getters' definitions
+// =====================================================================
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+
+// =====================================================================
+//                          Operators' definitions
 // =====================================================================
 
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+
+int64_t time();
+
+} // namespace aevol
+
+#endif // AEVOL_TIME_H_
diff --git a/src/libaevol/Alignment.cpp b/src/libaevol/Alignment.cpp
new file mode 100644
index 0000000..ac15b6e
--- /dev/null
+++ b/src/libaevol/Alignment.cpp
@@ -0,0 +1,316 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "Alignment.h"
+#include "Utils.h"
+#include "Individual.h"
+
+namespace aevol {
+
+
+// ############################################################################
+//
+//                                Class Alignment
+//
+// ############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+
+// =================================================================
+//                             Destructors
+// =================================================================
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+VisAVis* Alignment::search_alignment_direct(const Dna* chrom_1,
+                                            const int32_t seed_1,
+                                            const Dna* chrom_2,
+                                            const int32_t seed_2,
+                                            const int16_t needed_score) {
+  VisAVis* best_alignment = NULL;
+
+  int16_t nb_diags = 2 * chrom_1->indiv()->align_max_shift() + 1;
+  VisAVis* cur_vav = NULL;
+
+  // TODO <david.parsons at inria.fr>: As VisAVis now contains its score, we
+  // should adapt the code to make it more integrated
+  int16_t cur_score;
+
+  // Zone 1 (Index on the chromosome)
+  // First base in working zone 1
+  int32_t w_zone_1_first =
+      seed_1 - chrom_1->indiv()->align_w_zone_h_len();
+  // Last  base in working zone 1
+  int32_t w_zone_1_last =
+      seed_1 + chrom_1->indiv()->align_w_zone_h_len();
+  // First base in extended zone 1
+  int32_t x_zone_1_first =
+      w_zone_1_first - chrom_1->indiv()->align_max_shift();
+
+  // Zone 2 (Index on the chromosome)
+  // First base in working zone 2
+  int32_t w_zone_2_first =
+      seed_2 - chrom_2->indiv()->align_w_zone_h_len();
+  // Last  base in working zone 2
+  int32_t w_zone_2_last =
+      seed_2 + chrom_2->indiv()->align_w_zone_h_len();
+
+  // This doesn't represent any point of interest
+  // in the sequence but will spare some calculation
+  int32_t w_zone_2_shifted_first =
+      w_zone_2_first + chrom_2->indiv()->align_max_shift();
+
+
+  // Parse diagonals
+  for (int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++) {
+    // Initialize cur_vav according to the diagonal we are on
+    if (cur_diag < chrom_1->indiv()->align_max_shift()) {
+      cur_vav = new VisAVis(chrom_1, chrom_2,
+                            x_zone_1_first + cur_diag, w_zone_2_first, DIRECT);
+    }
+    else if (cur_diag > chrom_1->indiv()->align_max_shift()) {
+      cur_vav = new VisAVis(chrom_1, chrom_2,
+                            w_zone_1_first, w_zone_2_shifted_first - cur_diag,
+                            DIRECT);
+    }
+    else { // Central diagonal
+      cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_first,
+                            DIRECT);
+    }
+
+    // A sequence against itself is not an alignment
+    if (chrom_1 == chrom_2 &&
+        Utils::mod(cur_vav->i_1_, chrom_1->length()) ==
+            Utils::mod(cur_vav->i_2_, chrom_2->length())) {
+      delete cur_vav;
+      continue;
+    }
+
+    cur_score = 0;
+
+    // Parse current diagonal
+    while (cur_vav->i_1_ <= w_zone_1_last || cur_vav->i_2_ <= w_zone_2_last) {
+      // Re-initialize score and potential alignment starting point if
+      // score <= 0
+      if (cur_score <= 0) {
+        cur_score = 0;
+        if (best_alignment != NULL) {
+          best_alignment->copy(cur_vav);
+        }
+        else {
+          best_alignment = new VisAVis(*cur_vav);
+        }
+      }
+
+      // Update Score
+      if (cur_vav->match()) {
+        cur_score += chrom_1->indiv()->align_match_bonus();
+
+        // Check whether score is high enough to rearrange
+        if (cur_score >= needed_score) {
+          delete cur_vav;
+          best_alignment->check_indices();
+
+          best_alignment->score_ = cur_score;
+          return best_alignment;
+        }
+      }
+      else {
+        cur_score -= chrom_1->indiv()->align_mismatch_cost();
+      }
+
+      // Step forward
+      cur_vav->step_fwd();
+    }
+
+    delete cur_vav;
+  }
+
+
+  if (best_alignment != NULL) {
+    delete best_alignment;
+  }
+
+  return NULL; // Didn't find any alignment with sufficient score.
+}
+
+
+VisAVis* Alignment::search_alignment_indirect(const Dna* chrom_1,
+                                              const int32_t seed_1,
+                                              const Dna* chrom_2,
+                                              const int32_t seed_2,
+                                              const int16_t needed_score) {
+  VisAVis * best_alignment = NULL;
+
+  int16_t nb_diags = 2 * chrom_1->indiv()->align_max_shift() + 1;
+  int16_t cur_score;
+  VisAVis * cur_vav = NULL;
+
+  // Zone 1 (Indice on the chromosome)
+  // First base in working zone 1
+  int32_t w_zone_1_first =
+      seed_1 - chrom_1->indiv()->align_w_zone_h_len();
+  // Last  base in working zone 1
+  int32_t w_zone_1_last =
+      seed_1 + chrom_1->indiv()->align_w_zone_h_len();
+  // First base in extended zone 1
+  int32_t x_zone_1_first =
+      w_zone_1_first - chrom_1->indiv()->align_max_shift();
+
+  // Zone 2 (Indice on the chromosome)
+  // ********** WARNING **********
+  // Because we are reading backwards, every read is shifted by -1.
+  //
+  //    0 1 2 3 4 5 6 7 8 9
+  //    |_|_|_|_|_|_|_|_|_|_|   On this sequence, if you consider index 5,
+  //                            the nucleotide you need to consider
+  //                            for a backwards read is seq[4], NOT seq[5].
+  //
+  // This is managed by class VisAVis.
+  //
+  //    a b c d e f g h i j       Creating a new VisAVis(F, 5, LAGGING);
+  //    |_|_|_|_|_|_|_|_|_|_|     and then asking: my_vis_a_vis->match() will
+  //    | | | | | | | | | | |     compare seq1[F] and seq2[4]
+  //      9 8 7 6 5 4 3 2 1 0     (i.e. its "real" vis_a_vis).
+  //                              my_vis_a_vis->match() returns true
+  //                              if (seq1[F] == complementary(seq2[4]))
+  //
+  // In this example and with a align_w_zone_h_len of 2 and a max_shift of 1,
+  // the working_zone and extended_zone will be defined by
+  // w_zone_1_first = d   // (f-2)
+  // w_zone_1_last  = h   // (f+2)
+  // x_zone_1_first = c   // (f-2-1)
+  // w_zone_2_first = 7   // The "real" vis_a_vis for d (5+2)
+  // w_zone_2_last  = 3   // The "real" vis_a_vis for h (5-2)
+  // w_zone_2_shifted_first = 4 // (5-1).
+  //
+  // It is worth noting that the working zone is defined as follows:
+  //
+  //    d e f g h       Hence, while 'd' and 'h' do correspond to the zone's
+  //    |_|_|_|_|_|     first and last nucleotides' indices,
+  //    | | | | | |     '7' and '3' are indeed shifted and it seems they don't
+  //      6 5 4 3 2     correspond to anything. I should have coded the limits
+  //                    (i.e. 'd' and 'i' + '7' and '2') in the first place...
+  //
+  //
+
+  // First base in working zone 2
+  int32_t w_zone_2_first =
+      seed_2 + chrom_2->indiv()->align_w_zone_h_len();
+  // Last  base in working zone 2
+  int32_t w_zone_2_last =
+      seed_2 - chrom_2->indiv()->align_w_zone_h_len();
+
+  // This doesn't represent any interesting point
+  // in the sequence but will spare some calculation
+  int32_t w_zone_2_shifted_first =
+      w_zone_2_first - chrom_2->indiv()->align_max_shift();
+
+
+  // Parse diagonals
+  for (int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++) {
+    // Initialize cur_vav according to the diagonal we are on
+    if (cur_diag < chrom_1->indiv()->align_max_shift()) {
+      cur_vav = new VisAVis(chrom_1, chrom_2,
+                            x_zone_1_first + cur_diag, w_zone_2_first,
+                            INDIRECT);
+    }
+    else if (cur_diag > chrom_1->indiv()->align_max_shift()) {
+      cur_vav = new VisAVis(chrom_1, chrom_2,
+                            w_zone_1_first, w_zone_2_shifted_first + cur_diag,
+                            INDIRECT);
+    }
+    else { // Central diagonal
+      cur_vav = new VisAVis(chrom_1, chrom_2, w_zone_1_first, w_zone_2_first,
+                            INDIRECT);
+    }
+
+    cur_score = 0;
+
+
+    // Parse diagonal
+    while (cur_vav->i_1_ <= w_zone_1_last || cur_vav->i_2_ >= w_zone_2_last) {
+      // Re-initialize score and potential alignment starting point if
+      // score <= 0
+      if (cur_score <= 0) {
+        cur_score = 0;
+        if (best_alignment != NULL) {
+          best_alignment->copy(cur_vav);
+        }
+        else {
+          best_alignment = new VisAVis(*cur_vav);
+        }
+      }
+
+      // Update Score
+      if (cur_vav->match()) {
+        cur_score += chrom_1->indiv()->align_match_bonus();
+
+        // Check whether score is high enough to rearrange
+        if (cur_score >= needed_score) {
+          delete cur_vav;
+          best_alignment->check_indices();
+
+          best_alignment->score_ = cur_score;
+          return best_alignment;
+        }
+      }
+      else {
+        cur_score -= chrom_1->indiv()->align_mismatch_cost();
+      }
+
+      // Step forward
+      cur_vav->step_fwd();
+    }
+
+    delete cur_vav;
+  }
+
+
+  if (best_alignment != NULL) {
+    delete best_alignment;
+  }
+
+  return NULL; // Didn't find any alignment with sufficient score.
+}
+
+} // namespace aevol
+// =================================================================
+//                           Protected Methods
+// =================================================================
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/Alignment.h
similarity index 59%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/Alignment.h
index fdb64b7..5ffbaa2 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/Alignment.h
@@ -3,116 +3,120 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
 
 
+#ifndef AEVOL_ALIGNMENT_H_
+#define AEVOL_ALIGNMENT_H_
+
 
 // =================================================================
-//                            Project Files
+//                              Includes
 // =================================================================
-#include <ae_object.h>
-
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
+#include "VisAVis.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
+class Dna;
+
 
 
 
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
 
 
-class ae_dump : public ae_object
-{  
+class Alignment {
  public :
-  
+
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  Alignment() = delete;
+  Alignment(const Alignment&) = delete;
+
   // =================================================================
   //                             Destructors
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+
   // =================================================================
   //                              Accessors
   // =================================================================
-  
+
   // =================================================================
   //                            Public Methods
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  static VisAVis* search_alignment_direct(const Dna * chrom1,
+                                          const int32_t seed1,
+                                          const Dna* chrom2,
+                                          const int32_t seed2,
+                                          int16_t needed_score);
+  static VisAVis* search_alignment_indirect(const Dna* chrom1,
+                                            const int32_t seed1,
+                                            const Dna* chrom2,
+                                            const int32_t seed2,
+                                            int16_t needed_score);
+
   // =================================================================
   //                           Public Attributes
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
+
+  static bool with_alignments;
+
+  static AlignmentFunctionShape align_fun_shape;
+
+  static double  align_sigm_lambda;
+  static int16_t align_sigm_mean;
+  static int16_t align_lin_min;
+  static int16_t align_lin_max;
+
+  // Maximum shift of one seq on the other
+  static int16_t align_max_shift;
+  // Work zone half length
+  static int16_t align_w_zone_h_len;
+  // Corresponding residues match bonus
+  static int16_t align_match_bonus;
+  // Corresponding residues mismatch cost
+  static int16_t align_mismatch_cost;
+
+
+
+
+
+ protected :
+
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
 };
 
 
@@ -123,4 +127,7 @@ class ae_dump : public ae_object
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+
+} // namespace aevol
+
+#endif // AEVOL_ALIGNMENT_H_
diff --git a/src/libaevol/ae_vis_a_vis.cpp b/src/libaevol/Codon.cpp
similarity index 59%
rename from src/libaevol/ae_vis_a_vis.cpp
rename to src/libaevol/Codon.cpp
index 344e480..ae52134 100644
--- a/src/libaevol/ae_vis_a_vis.cpp
+++ b/src/libaevol/Codon.cpp
@@ -3,49 +3,48 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
 
 // =================================================================
-//                              Libraries
+//                              Includes
 // =================================================================
+#include "Codon.h"
 
+#include <cmath>
 
+#include "Utils.h"
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_vis_a_vis.h>
+namespace aevol {
 
 
 
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_vis_a_vis                             #
-//                                                                             #
-//##############################################################################
+// ############################################################################
+//
+//                                Class Codon
+//
+// ############################################################################
 
 // =================================================================
 //                    Definition of static attributes
@@ -54,46 +53,56 @@
 // =================================================================
 //                             Constructors
 // =================================================================
-ae_vis_a_vis::ae_vis_a_vis( const ae_dna* chrom_1, const ae_dna* chrom_2, int32_t i_1, int32_t i_2, ae_sense sense /*= DIRECT*/ )
-{
-  _chrom_1  = chrom_1;
-  _chrom_2  = chrom_2;
-  _i_1      = i_1;
-  _i_2      = i_2;
-  _sense    = sense;
-  _score    = 0;
+Codon::Codon() {
+  value_ = -1;
 }
 
-ae_vis_a_vis::ae_vis_a_vis( const ae_vis_a_vis & orig )
-{
-  _chrom_1  = orig._chrom_1;
-  _chrom_2  = orig._chrom_2;
-  _i_1      = orig._i_1;
-  _i_2      = orig._i_2;
-  _sense    = orig._sense;
-  _score    = orig._score;
+Codon::Codon(const Codon &model) {
+  value_ = model.value_;
 }
 
-//~ ae_vis_a_vis::ae_vis_a_vis( const ae_vis_a_vis * orig )
-//~ {
-  //~ _chrom_1  = orig->_chrom_1;
-  //~ _chrom_2  = orig->_chrom_2;
-  //~ _i_1      = orig->_i_1;
-  //~ _i_2      = orig->_i_2;
-  //~ _sense    = orig->_sense;
-//~ }
+Codon::Codon(int8_t value) {
+  value_ = value;
+}
+
+Codon::Codon(Dna * dna, Strand strand, int32_t index) {
+  const char* gen = dna->data();
+  int32_t     len = dna->length();
+
+  value_ = 0;
+
+  if (strand == LEADING) {
+    for (int8_t i = 0 ; i < CODON_SIZE ; i++) {
+      if (gen[Utils::mod((index+i), len)] == '1') {
+        value_ += 1 << (CODON_SIZE - i - 1);
+      }
+    }
+  }
+  else { // (strand == LAGGING)
+    for (int8_t i = 0 ; i < CODON_SIZE ; i++) {
+      if (gen[Utils::mod((index-i), len)] != '1') {
+        value_ += 1 << (CODON_SIZE - i - 1);
+      }
+    }
+  }
+}
+
+Codon::Codon(gzFile backup_file) {
+  gzread(backup_file, &value_, sizeof(value_));
+}
 
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_vis_a_vis::~ae_vis_a_vis( void )
-{
-}
+Codon::~Codon() = default;
 
 // =================================================================
 //                            Public Methods
 // =================================================================
-
+void Codon::save(gzFile backup_file) {
+  gzwrite(backup_file, &value_, sizeof(value_));
+}
 // =================================================================
 //                           Protected Methods
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/Codon.h
similarity index 61%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/Codon.h
index fdb64b7..3da525f 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/Codon.h
@@ -3,119 +3,87 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
 
+#ifndef AEVOL_CODON_H_
+#define AEVOL_CODON_H_
 
 // =================================================================
-//                            Project Files
+//                              Includes
 // =================================================================
-#include <ae_object.h>
-
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
+#include "Dna.h"
+#include "macros.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
-
-
-
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
 
-
-class ae_dump : public ae_object
-{  
+class Codon {
  public :
-  
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  Codon();
+  explicit Codon(const Codon &model);
+  explicit Codon(int8_t value);
+  Codon(Dna* genome, Strand strand, int32_t index);
+  explicit Codon(gzFile backup_file);
+
   // =================================================================
   //                             Destructors
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+  virtual ~Codon();
+
   // =================================================================
   //                              Accessors
   // =================================================================
-  
+  int8_t value() { return value_; }
+
   // =================================================================
   //                            Public Methods
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  bool is_start() { return value_ == CODON_START; }
+  bool is_stop() { return value_ == CODON_STOP; }
+  Codon* copy() { return new Codon(value_); } // TODO(dpa) use copy ctor instead!
+  void save(gzFile backup_file);
+
+ protected :
   // =================================================================
-  //                           Public Attributes
+  //                           Protected Methods
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
 
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  int8_t value_;
 };
 
-
 // =====================================================================
 //                          Accessors' definitions
 // =====================================================================
@@ -123,4 +91,6 @@ class ae_dump : public ae_object
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+
+} // namespace aevol
+#endif // AEVOL_CODON_H_
diff --git a/src/libaevol/ae_phenotype.cpp b/src/libaevol/Deletion.cpp
similarity index 51%
copy from src/libaevol/ae_phenotype.cpp
copy to src/libaevol/Deletion.cpp
index 958b8ff..62be0be 100644
--- a/src/libaevol/ae_phenotype.cpp
+++ b/src/libaevol/Deletion.cpp
@@ -3,105 +3,80 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_phenotype.h>
-#include <ae_individual.h>
-
-
+//
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Deletion.h"
 
-//##############################################################################
-//                                                                             #
-//                              Class ae_phenotype                             #
-//                                                                             #
-//##############################################################################
+namespace aevol {
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_phenotype::ae_phenotype( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = NULL;
+// ============================================================================
+//                                Constructors
+// ============================================================================
+Deletion::Deletion(int32_t pos1, int32_t pos2, int32_t length,
+                   int16_t align_score) :
+    pos1_(pos1), pos2_(pos2),
+    length_(length), align_score_(align_score) {
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv, const ae_phenotype &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set( model )
-#elif defined __X11
-  ae_fuzzy_set_X11( model )
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Deletion::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = DEL;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos1_, sizeof(pos1_));
+  gzwrite(backup_file, &pos2_, sizeof(pos2_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, &align_score_, sizeof(align_score_));
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+void Deletion::load(gzFile backup_file) {
+  gzread(backup_file, &pos1_, sizeof(pos1_));
+  gzread(backup_file, &pos2_, sizeof(pos2_));
+  gzread(backup_file, &length_, sizeof(length_));
+  gzread(backup_file, &align_score_, sizeof(align_score_));
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_phenotype::~ae_phenotype( void )
-{
-}
+void Deletion::generic_description_string(char* str) const {
+  // TODO <david.parsons at inria.fr> Use snprintf to avoid buffer overflow
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos1(), pos2(), -1, -1, -1,
+          align_score(), -1, length_, -1);
+  }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/Deletion.h b/src/libaevol/Deletion.h
new file mode 100644
index 0000000..e89104d
--- /dev/null
+++ b/src/libaevol/Deletion.h
@@ -0,0 +1,102 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_DELETION_H_
+#define AEVOL_DELETION_H_
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Rearrangement.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class Deletion : public Rearrangement {
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Deletion() = default; //< Default ctor
+  Deletion(const Deletion&) = default; //< Copy ctor
+  Deletion(Deletion&&) = delete; //< Move ctor
+  Deletion(int32_t pos1, int32_t pos2,
+           int32_t length, int16_t align_score = -1);
+
+  virtual Mutation* Clone() const override {return new Deletion(*this);}
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Deletion() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  Deletion& operator=(const Deletion& other) = default;
+
+  /// Move assignment
+  Deletion& operator=(Deletion&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {return DEL;}
+
+  int32_t pos1() const { return pos1_; }
+  int32_t pos2() const { return pos2_; }
+  int32_t length() const { return length_; }
+  int16_t align_score() const { return align_score_; }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos1_, pos2_;
+  int32_t length_;
+  int16_t align_score_ = -1;
+};
+
+} // namespace aevol
+#endif // AEVOL_DELETION_H_
diff --git a/src/libaevol/Dna.cpp b/src/libaevol/Dna.cpp
new file mode 100644
index 0000000..75ce32a
--- /dev/null
+++ b/src/libaevol/Dna.cpp
@@ -0,0 +1,3293 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "Dna.h"
+
+#include <cinttypes>
+#include <cstdio>
+#include <cmath>
+
+#include <list>
+#include <vector>
+#include <algorithm>
+
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "GeneticUnit.h"
+#include "Individual.h"
+#include "Rna.h"
+#include "Utils.h"
+#include "VisAVis.h"
+#include "Alignment.h"
+#include "Mutation.h"
+#include "PointMutation.h"
+#include "SmallInsertion.h"
+#include "SmallDeletion.h"
+#include "Duplication.h"
+#include "Deletion.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "InsertionHT.h"
+#include "ReplacementHT.h"
+
+namespace aevol {
+
+// ###########################################################################
+//
+//                                 Class Dna
+//
+// ###########################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+/**
+ * Create a random dna sequence of length <length> belonging to <gen_unit>.
+ */
+Dna::Dna(GeneticUnit* gen_unit,
+         int32_t length,
+         std::shared_ptr<JumpingMT> prng) :
+    ae_string(length, prng) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+/**
+ * Create a new piece of dna identical to the model but belonging to <gen_unit>
+ */
+Dna::Dna(GeneticUnit* gen_unit, const Dna& model) :
+    ae_string(model) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+/**
+ * Create a new piece of dna identical to the parent's but belonging to
+ * <gen_unit>
+ */
+Dna::Dna(GeneticUnit* gen_unit, Dna* const parent_dna) :
+    ae_string(parent_dna->data_, parent_dna->length_) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+/**
+ * Create a new piece of dna with sequence <seq> (of length <length>).
+ * WARNING : <seq> will be used directly as the new dna sequence (it will not
+ *           be copied), which means the caller must not delete it.
+ */
+// TODO(dpa) make seq a rvalue ref and set it to NULL ?
+Dna::Dna(GeneticUnit* gen_unit, char* seq, int32_t length) :
+    ae_string(seq, length, true) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+/**
+ * Load a piece of dna from <backup_file>
+ */
+Dna::Dna(GeneticUnit* gen_unit, gzFile backup_file) :
+    ae_string(backup_file) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+/**
+ * Create a dna sequence from a text file
+ */
+Dna::Dna(GeneticUnit* gen_unit, char* organism_file_name) :
+    ae_string(organism_file_name) {
+  gen_unit_ = gen_unit;
+  exp_m_ = gen_unit->exp_m();
+  indiv_ = gen_unit->indiv();
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Dna::~Dna() = default;
+
+// =================================================================
+//                         Non inline Accessors
+// =================================================================
+char* Dna::subsequence(int32_t from, int32_t to, Strand strand) const {
+  char* subseq = NULL;
+
+  from = Utils::mod(from, length_);
+  to = Utils::mod(to, length_);
+
+  if (strand == LEADING) {
+    if (from < to) {
+      subseq = new char[to - from + 1];
+      subseq[to - from] = '\0';
+      strncpy(subseq, &(data_[from]), to - from);
+    }
+    else {
+      subseq = new char[length_ - from + to + 1];
+      subseq[length_ - from + to] = '\0';
+      strncpy(subseq, &(data_[from]), length_ - from);
+      strncpy(&subseq[length_ - from], data_, to);
+    }
+  }
+  else { // if (strand == LAGGING)
+    if (from > to) {
+      subseq = new char[from - to + 1];
+      subseq[from - to] = '\0';
+
+      for (int32_t i = 0; i < from - to; i++) {
+        subseq[i] = (data_[from - 1 - i] == '1') ? '0' : '1';
+      }
+    }
+    else {
+      subseq = new char[from + length_ - to + 1];
+      subseq[from + length_ - to] = '\0';
+
+      for (int32_t i = 0; i < from; i++) {
+        subseq[i] = (data_[from - 1 - i] == '1') ? '0' : '1';
+      }
+      for (int32_t i = 0; i < length_ - to; i++) {
+        subseq[from + i] = (data_[length_ - 1 - i] == '1') ? '0' : '1';
+      }
+    }
+  }
+
+  return subseq;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+/// Perform mutations and record how many of them occurred
+int32_t Dna::perform_mutations(int32_t parent_id) {
+  int32_t nb_events = 0;
+
+  if (indiv_->with_HT())
+    nb_events += do_transfer(parent_id);
+
+  if (indiv_->with_alignments())
+    nb_events += do_rearrangements_with_align();
+  else
+    nb_events += do_rearrangements();
+
+  nb_events += do_small_mutations();
+
+  return nb_events;
+}
+
+int32_t Dna::do_small_mutations() {
+  // ==============================================================
+  //  1. Compute how many rearrangements this genome will undertake
+  // ==============================================================
+  //
+  // Given the rate p (by nucl.) of insertion - for instance -, the number of
+  // insertions we perform on the genome follows a binomial law B(n,p), with
+  // n = genome length.
+
+  int32_t nb_swi = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->point_mutation_rate());
+  int32_t nb_ins = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->small_insertion_rate());
+  int32_t nb_del = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->small_deletion_rate());
+  int32_t nb_mut = nb_swi + nb_ins + nb_del;
+
+  // ====================================================
+  //  2. Perform those small mutations in a random order
+  // ====================================================
+  //
+  // We put the 'nb_small_mutations_' mutation events in an "urn".
+  // Then we repeat a random drawing of one mutation event in this urn,
+  // without replacement, until no mutation event is left in the urn.
+  // Here is the "urn" we use at the beginning:
+  //
+  //     -----------------------------------------------------------
+  //    | swi | swi | swi | ins | ins | ins | del | del | del | del |
+  //     -----------------------------------------------------------
+  //                      ^                 ^                       ^
+  //                  nb_swi             nb_swi                   nb_swi
+  //                                    +nb_ins                  +nb_ins
+  //                                                             +nb_del
+  //
+  // Random draw of one mutation = random draw of one position in this "urn".
+  // Given this position, we know what kind of mutation we have drawn.
+
+
+  int32_t random_value;
+  Mutation* mut = nullptr;
+
+  for (int32_t i = nb_mut; i >= 1; i--) {
+    random_value = indiv_->mut_prng_->random(i);
+
+    if (random_value < nb_swi) {
+      mut = do_switch();
+      nb_swi--;  // updating the urn (no replacement!)...
+    }
+    else if (random_value < nb_swi + nb_ins) {
+      mut = do_small_insertion();
+      nb_ins--;
+    }
+    else { // (random_value >= nb_swi + nb_ins) => del
+      mut = do_small_deletion();
+      nb_del--;
+    }
+
+    // Record mutation in tree
+    if (mut != NULL) {
+      indiv_->notifyObservers(MUTATION, mut);
+      delete mut;
+    }
+  }
+
+  return nb_mut;
+}
+
+int32_t Dna::do_rearrangements() {
+  // ==============================================================
+  //  1. Compute how many rearrangements this genome will undertake
+  // ==============================================================
+  //
+  // Given the rate p (by nucl.) of duplication - for instance -, the number of
+  // duplications we perform on the genome follows a binomial law B(n, p), with
+  // n = genome length.
+  int32_t nb_dupl = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->duplication_rate());
+  int32_t nb_del = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->deletion_rate());
+  int32_t nb_trans = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->translocation_rate());
+  int32_t nb_inv = indiv_->mut_prng_->
+      binomial_random(length_, indiv_->inversion_rate());
+  int32_t nb_rear = nb_dupl + nb_del + nb_trans + nb_inv;
+
+  // ===================================================
+  //  2. Perform those rearrangements in a random order
+  // ===================================================
+  //
+  // We put the nb_rea rearrangements in an "urn". Then we repeat a random draw
+  // of one rearrangement in this urn, without replacement, until no rearrange-
+  // -ment is left in the urn. Here is the "urn" we use at the beginning:
+  //
+  //     ----------------------------------------------------------------
+  //    | Dupl | Dupl | Del  Del | Del | Trans | Trans | Inv | Inv | Inv |
+  //     ----------------------------------------------------------------
+  //                  ^                ^               ^                 ^
+  //               nb_dupl          nb_dupl         nb_dupl           nb_dupl
+  //                               +nb_del         +nb_del           +nb_del
+  //                                               +nb_trans         +nb_trans
+  //                                                                 +nb_inv
+  //
+  // Random draw of one rearrangement = random draw of one position in this urn.
+  // Given this position, we know what kind of rearrangement we have drawn.
+
+  int32_t random_value;
+  Mutation* mut = nullptr;
+
+  for (int32_t i = nb_rear; i >= 1; i--) {
+    random_value = indiv_->mut_prng_->random(i);
+
+    if (random_value < nb_dupl) {
+      mut = do_duplication();
+      nb_dupl--;  // Updating the urn (no replacement!)...
+    }
+    else if (random_value < nb_dupl + nb_del) {
+      mut = do_deletion();
+      nb_del--;
+    }
+    else if (random_value < nb_dupl + nb_del + nb_trans) {
+      mut = do_translocation();
+      nb_trans--;
+    }
+    else {
+      mut = do_inversion();
+      nb_inv--;
+    }
+
+    // Record rearrangement in tree
+    if (mut != NULL) {
+      indiv_->notifyObservers(MUTATION, mut);
+      delete mut;
+    }
+  }
+  return nb_rear;
+}
+
+int32_t Dna::do_rearrangements_with_align() {
+  // Whether we look for a direct or indirect alignment
+  bool direct_sense;
+  // Determines the type of rearrangement that will be done if an alignment
+  // is found
+  double rand1 = 0.0;
+  // Minimum alignment score needed to recombine (stochastic)
+  int16_t needed_score;
+  // Points defining the sequences between which we will look for an alignment
+  int32_t seed1, seed2;
+
+  // Indiv's Time To Live
+  double ttl = 1.0;
+  // Number of pairs of sequences we will try to align
+  int32_t nb_pairs;
+  // Keep trace of the original length of the genome
+  int32_t genome_size = length_;
+  int32_t nb_rearr = 0;
+
+  Mutation* mut = nullptr;
+  VisAVis* alignment = NULL;
+
+  /////////////////////////////////////////////////////////////////////////////
+  // For each pair of points to be tested
+  // (i.e. while the organism is still "alive"),
+  // 1) Draw a random sense (direct or indirect).
+  // 2) Determine the minimum alignment score needed for a rear to occur.
+  // 3) Test the existence of an alignment with a high enough score.
+  // 4) If such an alignment was found, determine the type of rear to be
+  //    performed and proceed (WARNING : translocations require another
+  //    alignment to be found between the sequence to be translocated and
+  //    the rest of the chromosome).
+  // 5) If there was a change in the chromosome's length, update the
+  //    individual's TTL and nb_pairs according to new genome size.
+  // 6) If there was a rearrangement, we either save its record in the tree or
+  //    delete it.
+  /////////////////////////////////////////////////////////////////////////////
+  nb_pairs = static_cast<int32_t>(
+      ceil(ttl * length_ * indiv_->neighbourhood_rate()));
+  for (; nb_pairs > 0; nb_pairs--) {
+    /////////////////////////////////////////////////
+    // 1) Draw a random sense (direct or indirect) //
+    /////////////////////////////////////////////////
+    // Determine whether we look for a direct or indirect alignment
+    direct_sense = (indiv_->mut_prng_->random() < 0.5);
+    // Determine the type of rearrangement to be done. This is an
+    // anticipation on step 4) for optimization purpose (save computation
+    // time if the type of rear is "none"
+    rand1 = indiv_->mut_prng_->random();
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // 2) Determine the minimum alignment score needed for a rearrangement
+    // to occur
+    ///////////////////////////////////////////////////////////////////////////
+    if (indiv_->align_fun_shape() == LINEAR) {
+      needed_score = static_cast<int16_t>(
+          ceil(indiv_->align_lin_min() +
+               indiv_->mut_prng_->random() *
+               (indiv_->align_lin_max() -
+                indiv_->align_lin_min())));
+    }
+    else {
+      // I want the probability of rearrangement for an alignment of score
+      // <score> to be prob = 1 / (1 + exp(-(score-mean)/lambda))
+      // The score needed for a rearrangement to take place with a given random
+      // drawing is hence needed_score = ceil(-lambda * log(1/rand - 1) + mean)
+      needed_score = static_cast<int16_t>(
+          ceil(-indiv_->align_sigm_lambda() *
+               log(1 / indiv_->mut_prng_->random() - 1) +
+               indiv_->align_sigm_mean()));
+      if (needed_score < 0) needed_score = 0;
+
+      //~ <DEBUG>
+      //~ FILE* tmp_file = fopen("scores.out", "a");
+      //~ fprintf(tmp_file, "%"PRId16"\n", needed_score);
+      //~ fclose(tmp_file);
+      //~ </DEBUG>
+    }
+
+    // Determine where to look for an alignment (draw seeds)
+    seed1 = indiv_->mut_prng_->random(length_);
+    seed2 = indiv_->mut_prng_->random(length_);
+
+
+    if (direct_sense) {
+      if (rand1 >= indiv_->duplication_proportion() +
+                   indiv_->deletion_proportion() +
+                   indiv_->translocation_proportion()) {
+        // rand1 corresponds to "no rearrangement" => Nothing to do
+        continue;
+      }
+
+      ////////////////////////////////////////////////////////////////////
+      // 3) Test the existence of an alignment with a high enough score //
+      ////////////////////////////////////////////////////////////////////
+      alignment = Alignment::search_alignment_direct(this, seed1,
+                                                     this, seed2,
+                                                     needed_score);
+
+      if (alignment == NULL) {
+        // No alignment found
+        continue;
+      }
+
+      //~ printf("direct   needed_score : %"PRId32"\n", needed_score);
+
+      ////////////////////////////////////////////////////////////////////////
+      // 4) Determine the type of rearrangement to be performed and proceed //
+      ////////////////////////////////////////////////////////////////////////
+      if (rand1 < indiv_->duplication_proportion()) {
+        // Remember the length of the segment to be duplicated and of the
+        // genome before the duplication
+        int32_t segment_length = Utils::mod(alignment->i_2() -
+                                            alignment->i_1(),
+                                            length_);
+        int32_t gu_size_before = length_;
+        int32_t gu_size_after = gu_size_before + segment_length;
+        int32_t genome_size_before = indiv_->amount_of_dna();
+        int32_t genome_size_after = genome_size_before + segment_length;
+
+        if ((genome_size_after > indiv_->max_genome_length()) ||
+            (gu_size_after > gen_unit_->max_gu_length())) {
+          if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+            // Write an entry in the barrier log file
+            fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+                    "%" PRId64 " %" PRId32 " DUPLICATION %" PRId32 " %" PRId32
+                        " %" PRId32 " %" PRId32 "\n",
+                    AeTime::time(), indiv_->id(), segment_length, 0,
+                    gu_size_before, genome_size_before);
+          }
+        }
+        else {
+          // Perform in situ (tandem) DUPLICATION
+          do_duplication(alignment->i_1(),
+                         alignment->i_2(),
+                         alignment->i_2());
+
+          // Report the duplication
+          mut = new Duplication(alignment->i_1(),
+                                alignment->i_2(),
+                                alignment->i_2(),
+                                segment_length, needed_score);
+	  nb_rearr++;
+          // Write a line in rearrangement logfile
+          if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+            fprintf(exp_m_->output_m()->log(LOG_REAR),
+                    "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                        " %" PRId16 "\n",
+                    AeTime::time(), indiv_->id(), int8_t(DUPL),
+                    segment_length, genome_size_before, needed_score);
+          }
+        }
+      }
+      else if (rand1 < indiv_->duplication_proportion() +
+                       indiv_->deletion_proportion()) {
+        // Remember the length of the segment to be duplicated and of the
+        // genome before the deletion
+        int32_t segment_length = Utils::mod(alignment->i_2() -
+                                            alignment->i_1() - 1,
+                                            length_) + 1;
+        int32_t gu_size_before = length_;
+        int32_t gu_size_after = gu_size_before - segment_length;
+        int32_t genome_size_before = indiv_->amount_of_dna();
+        int32_t genome_size_after = genome_size_before - length_;
+
+        if ((genome_size_after < indiv_->min_genome_length()) ||
+            (gu_size_after < gen_unit_->min_gu_length())) {
+          if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+            // Write an entry in the barrier log file
+            fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+                    "%" PRId64 " %" PRId32 " DELETION %" PRId32 " %" PRId32
+                        " %" PRId32 " %" PRId32 "\n",
+                    AeTime::time(), indiv_->id(), segment_length, 0,
+                    gu_size_before, genome_size_before);
+          }
+        }
+        else {
+          // Perform DELETION
+          do_deletion(alignment->i_1(), alignment->i_2());
+
+          // Report the deletion
+          mut = new Deletion(alignment->i_1(),
+                             alignment->i_2(),
+                             segment_length, needed_score);
+	  nb_rearr++;
+
+          // Write a line in rearrangement logfile
+          if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+            fprintf(exp_m_->output_m()->log(LOG_REAR),
+                    "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                        " %" PRId16 "\n",
+                    AeTime::time(), indiv_->id(), int8_t(DEL),
+                    segment_length, genome_size_before, needed_score);
+          }
+        }
+      }
+      else {
+        assert(rand1 < indiv_->duplication_proportion() +
+                       indiv_->deletion_proportion() +
+                       indiv_->translocation_proportion());
+
+        // Perform TRANSLOCATION
+        // Make sure the segment to be translocated doesn't contain OriC
+        // TODO(dpa) is that still necessary?
+        if (alignment->i_1() > alignment->i_2()) {
+          alignment->swap();
+        }
+
+        // Remember the length of the segment to be translocated
+        int32_t segment_length =
+            Utils::mod(alignment->i_2() - alignment->i_1(), length_);
+
+        // Extract the segment to be translocated
+        GeneticUnit* translocated_segment =
+            extract_into_new_GU(alignment->i_1(), alignment->i_2());
+
+        // Look for an alignment between the segment to be translocated and
+        // the rest of the genome
+        bool direct_sense;
+        int16_t needed_score_2;
+        VisAVis* alignment_2 = NULL;
+        int32_t seed1, seed2;
+        nb_pairs = static_cast<int32_t>(
+            ceil(ttl * length_ * indiv_->neighbourhood_rate()));
+        for (; nb_pairs > 0; nb_pairs--) {
+          direct_sense = (indiv_->mut_prng_->random() < 0.5);
+
+          if (indiv_->align_fun_shape() == LINEAR) {
+            needed_score_2 = static_cast<int16_t>(
+                ceil(indiv_->align_lin_min() +
+                     indiv_->mut_prng_->random() *
+                     (indiv_->align_lin_max() -
+                      indiv_->align_lin_min())));
+          }
+          else {
+            needed_score_2 = static_cast<int16_t>(
+                ceil(-indiv_->align_sigm_lambda() *
+                     log(1 / indiv_->mut_prng_->random() - 1) +
+                     indiv_->align_sigm_mean()));
+            if (needed_score_2 < 0) needed_score_2 = 0;
+          }
+
+          seed1 = indiv_->mut_prng_->random(length_);
+          seed2 = indiv_->mut_prng_->random(segment_length);
+
+          if (direct_sense) {
+            alignment_2 = Alignment::search_alignment_direct(
+                this, seed1,
+                translocated_segment->dna(), seed2,
+                needed_score_2);
+          }
+          else { // if indirect
+            alignment_2 = Alignment::search_alignment_indirect(
+                this, seed1,
+                translocated_segment->dna(), seed2,
+                needed_score_2);
+          }
+
+          if (alignment_2 != NULL) {
+            //~ printf("transloc needed_score : %"PRId32"\n", needed_score_2);
+            break;
+          }
+        }
+
+
+        // If an alignment was found between the segment to be translocated
+        // and the rest of the genome, proceed to the translocation.
+        // Else, replace the extracted segment at its former position
+        // (cancel the translocation event).
+        if (alignment_2 != NULL) {
+          // Proceed to the translocation
+          insert_GU(translocated_segment,
+                    alignment_2->i_1(), alignment_2->i_2(),
+                    (alignment_2->sense() == INDIRECT));
+
+          // Report the translocation
+          mut = new Translocation(alignment->i_1(),
+                                  alignment->i_2(),
+                                  alignment_2->i_1(),
+                                  alignment_2->i_2(),
+                                  segment_length,
+                                  (alignment_2->sense() == INDIRECT),
+                                  needed_score, needed_score_2);
+	  nb_rearr++;
+
+          // Write a line in rearrangement logfile
+          if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+            fprintf(exp_m_->output_m()->log(LOG_REAR),
+                    "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                        " %" PRId16 "\n",
+                    AeTime::time(), indiv_->id(), int8_t(TRANS),
+                    segment_length, length_, needed_score_2);
+          }
+          delete alignment_2;
+        }
+        else {
+          // Cancel the translocation
+          // (re-place the extracted segment at its former position)
+          insert_GU(translocated_segment, alignment->i_1(), 0, false);
+        }
+
+        delete translocated_segment;
+      }
+
+      delete alignment;
+    }
+    else { // if indirect
+      if (rand1 >= indiv_->inversion_proportion()) {
+        // rand1 corresponds to no rearrangement => Nothing to do
+        continue;
+      }
+
+      //~ printf("indirect needed_score : %"PRId32"\n", needed_score);
+
+      ////////////////////////////////////////////////////////////////////
+      // 3) Test the existence of an alignment with a high enough score //
+      ////////////////////////////////////////////////////////////////////
+      alignment = Alignment::search_alignment_indirect(this, seed1,
+                                                       this, seed2,
+                                                       needed_score);
+
+      if (alignment == NULL) {
+        // No alignment found
+        continue;
+      }
+
+      /////////////////////////////
+      // 4) Proceed to inversion //
+      /////////////////////////////
+      // Make sure the segment to be inverted doesn't contain OriC
+      if (alignment->i_1() > alignment->i_2()) {
+        alignment->swap();
+      }
+
+      // Remember the length of the segment to be duplicated
+      int32_t segment_length = Utils::mod(alignment->i_2() -
+                                          alignment->i_1(),
+                                          length_);
+
+      // Proceed
+      do_inversion(alignment->i_1(), alignment->i_2());
+
+      // Report the inversion
+      mut = new Inversion(alignment->i_1(),
+                          alignment->i_2(),
+                          segment_length, needed_score);
+      nb_rearr++;
+      // Write a line in rearrangement logfile
+      if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+        fprintf(exp_m_->output_m()->log(LOG_REAR),
+                "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                    " %" PRId16 "\n",
+                AeTime::time(), indiv_->id(), int8_t(INV),
+                segment_length, length_, needed_score);
+      }
+
+      delete alignment;
+    }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // 5) If there was a change in the chromosome's length,
+    //    update the individual's TTL and nb_pairs according to new genome size
+    ///////////////////////////////////////////////////////////////////////////
+    if (genome_size != length_) {
+      ttl = (static_cast<double>(nb_pairs - 1)) /
+            (static_cast<double>(genome_size)) /
+            indiv_->neighbourhood_rate();
+      genome_size = length_;
+      nb_pairs = static_cast<int32_t>(
+                     ceil(ttl * length_ * indiv_->neighbourhood_rate())) + 1;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // 6) If there was a rearrangement, we either save its record in the tree
+    //    or delete it.
+    ///////////////////////////////////////////////////////////////////////////
+    if (mut != NULL) {
+      indiv_->notifyObservers(MUTATION, mut);
+      delete mut;
+    }
+  }
+  return nb_rearr;
+}
+
+int32_t Dna::do_transfer(int32_t parent_id) {
+  Mutation* mut = nullptr;
+  int32_t nb_transfer = 0;
+
+  if (indiv_->mut_prng()->random() < indiv_->HT_ins_rate()) {
+    mut = do_ins_HT(parent_id);
+    if (mut != nullptr) {
+      indiv_->notifyObservers(MUTATION, mut);
+      nb_transfer++;
+      delete mut;
+    }
+  }
+
+  if (indiv_->mut_prng()->random() < indiv_->HT_repl_rate()) {
+    mut = do_repl_HT(parent_id);
+    if (mut != nullptr) {
+      indiv_->notifyObservers(MUTATION, mut);
+      nb_transfer++;
+      delete mut;
+    }
+  }
+  return nb_transfer;
+}
+
+PointMutation* Dna::do_switch() {
+  PointMutation* mut = nullptr;
+
+  int32_t pos = indiv_->mut_prng_->random(length_);
+
+  if (do_switch(pos)) {
+    // Report the mutation
+    mut = new PointMutation(pos);
+  }
+
+  return mut;
+}
+
+SmallInsertion* Dna::do_small_insertion() {
+  SmallInsertion* mut = nullptr;
+
+  // Determine the position and size of the small insertion
+  int32_t pos = indiv_->mut_prng_->random(length_);
+  int16_t nb_insert;
+  if (indiv_->max_indel_size() == 1) {
+    nb_insert = 1;
+  }
+  else {
+    nb_insert = 1 + indiv_->mut_prng_->random(indiv_->max_indel_size());
+    // <nb_insert> must be in [1 ; max_indel_size]
+  }
+
+  // Check that the insertion won't throw the genome size over the limit
+  if ((indiv_->amount_of_dna() + nb_insert >
+       indiv_->max_genome_length()) ||
+      (length_ + nb_insert > gen_unit_->max_gu_length())) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " S_INS %" PRId32 " %" PRId32 " %" PRId32
+                  " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), nb_insert, 0, length_,
+              indiv_->amount_of_dna());
+    }
+
+    return NULL;
+  }
+
+  // Prepare the sequence to be inserted
+  char* inserted_seq = new char[nb_insert + 1];
+  char inserted_char;
+  for (int16_t j = 0; j < nb_insert; j++) {
+    inserted_char = static_cast<char>('0' + indiv_->mut_prng_->random(NB_BASE));
+    inserted_seq[j] = inserted_char;
+  }
+  inserted_seq[nb_insert] = '\0';
+
+  // Proceed to the insertion and report it
+  if (do_small_insertion(pos, nb_insert, inserted_seq)) {
+    // Report the insertion
+    mut = new SmallInsertion(pos, nb_insert, inserted_seq);
+  }
+
+  // Delete the sequence
+  delete[] inserted_seq;
+
+  return mut;
+}
+
+SmallDeletion* Dna::do_small_deletion() {
+  SmallDeletion* mut = nullptr;
+
+  // Determine the position and size of the small deletion
+  int32_t pos = indiv_->mut_prng_->random(length_);
+  int16_t nb_del;
+  if (indiv_->max_indel_size() == 1) {
+    nb_del = 1;
+  }
+  else {
+    nb_del = 1 + indiv_->mut_prng_->random(indiv_->max_indel_size());
+    // <nb_del> must be in [1 ; max_indel_size]
+  }
+
+  // Check that the insertion will shrink neither the genome nor the GU size
+  // under their respective limit
+  if ((indiv_->amount_of_dna() - nb_del <
+       indiv_->min_genome_length()) ||
+      (length_ - nb_del < gen_unit_->min_gu_length())) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " S_DEL %" PRId32 " %" PRId32
+                  " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), nb_del, 0, length_,
+              indiv_->amount_of_dna());
+    }
+
+    return nullptr;
+  }
+
+  if (do_small_deletion(pos, nb_del)) {
+    mut = new SmallDeletion(pos, nb_del);
+  }
+
+  return mut;
+}
+
+bool Dna::do_switch(int32_t pos) {
+  // Perform the mutation
+  if (data_[pos] == '0') data_[pos] = '1';
+  else data_[pos] = '0';
+
+  // Remove promoters containing the switched base
+  gen_unit_->remove_promoters_around(pos, Utils::mod(pos + 1, length_));
+
+  // Look for potential new promoters containing the switched base
+  if (length_ >= PROM_SIZE)
+    gen_unit_->look_for_new_promoters_around(pos, Utils::mod(pos + 1, length_));
+
+  return true;
+}
+
+bool Dna::do_small_insertion(int32_t pos, int16_t nb_insert, char* seq) {
+  // Check genome size limit
+  assert(length_ + nb_insert <= gen_unit_->max_gu_length());
+  assert(indiv_->amount_of_dna() + nb_insert <=
+         indiv_->max_genome_length());
+
+  // Remove the promoters that will be broken
+  gen_unit_->remove_promoters_around(pos);
+
+  // Insert the sequence
+  insert(pos, seq, nb_insert);
+
+  // Look for new promoters
+  if (length_ >= PROM_SIZE) {
+    if (length_ - nb_insert < PROM_SIZE) {
+      // Special case where the genome was smaller than a promoter before the
+      // insertion and greater than (or as big as) a promoter after the
+      // insertion.
+      // In that case, we must look for new promoters thoroughly on the whole
+      // genome using locate_promoters
+      gen_unit_->locate_promoters();
+    }
+    else {
+      gen_unit_->move_all_promoters_after(pos, nb_insert);
+      gen_unit_->look_for_new_promoters_around(pos, Utils::mod(pos + nb_insert,
+                                                               length_));
+    }
+  }
+
+  return true;
+}
+
+bool Dna::do_small_deletion(int32_t pos, int16_t nb_del) {
+  // Check genome size limit
+  assert(length_ - nb_del >= gen_unit_->min_gu_length());
+  assert(indiv_->amount_of_dna() - nb_del >=
+         indiv_->min_genome_length());
+
+  // Remove promoters containing at least one nucleotide from the sequence to
+  // delete
+  gen_unit_->remove_promoters_around(pos, Utils::mod(pos + nb_del, length_));
+
+  // Do the deletion and update promoter list
+  if (pos + nb_del <= length_) { // the deletion does not contain the origin of
+    // replication
+    // Do the deletion
+    remove(pos, pos + nb_del);
+
+    // Update promoter list
+    if (length_ >= PROM_SIZE) {
+      gen_unit_->move_all_promoters_after(pos, -nb_del);
+      gen_unit_->look_for_new_promoters_around(Utils::mod(pos, length_));
+    }
+  }
+  else { // the deletion contains the origin of replication
+    // Do the deletion
+    int32_t nb_del_at_pos_0 = nb_del - length_ + pos;
+    remove(pos, length_);
+    remove(0, nb_del_at_pos_0);
+    pos -= nb_del_at_pos_0;
+
+    // Update promoter list
+    if (length_ >= PROM_SIZE) {
+      gen_unit_->move_all_promoters_after(0, -nb_del_at_pos_0);
+      gen_unit_->look_for_new_promoters_around(0);
+    }
+  }
+
+  return true;
+}
+
+Duplication* Dna::do_duplication() {
+  Duplication* mut = nullptr;
+
+  int32_t pos_1, pos_2, pos_3;
+  pos_1 = indiv_->mut_prng_->random(length_);
+  pos_2 = indiv_->mut_prng_->random(length_);
+  pos_3 = indiv_->mut_prng_->random(length_);
+
+  // Remember the length of the segment to be duplicated and of the former
+  // genome
+  int32_t segment_length = Utils::mod(pos_2 - pos_1 - 1, length_) + 1;
+  int32_t gu_size_before = length_;
+  int32_t gu_size_after = gu_size_before + segment_length;
+  int32_t genome_size_before = indiv_->amount_of_dna();
+  int32_t genome_size_after = genome_size_before + segment_length;
+  if ((gu_size_after > gen_unit_->max_gu_length()) ||
+      (genome_size_after > indiv_->max_genome_length())) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " DUPLICATION %" PRId32 " %" PRId32
+                  " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), segment_length, 0,
+              gu_size_before, genome_size_before);
+    }
+  }
+  else {
+    // Perform the duplication
+    do_duplication(pos_1, pos_2, pos_3);
+
+    // Report the duplication
+    mut = new Duplication(pos_1, pos_2, pos_3, segment_length);
+
+    // Write a line in rearrangement logfile
+    if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+      fprintf(exp_m_->output_m()->log(LOG_REAR),
+              "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), int8_t(DUPL),
+              segment_length, genome_size_before);
+    }
+  }
+
+  return mut;
+}
+
+Deletion* Dna::do_deletion() {
+  Deletion* mut = nullptr;
+
+  int32_t pos_1, pos_2;
+  pos_1 = indiv_->mut_prng_->random(length_);
+  pos_2 = indiv_->mut_prng_->random(length_);
+
+  // Remember the length of the segment to be deleted and of the genome
+  // before the deletion
+  int32_t segment_length = Utils::mod(pos_2 - pos_1 - 1, length_) + 1;
+  int32_t gu_size_before = length_;
+  int32_t gu_size_after = gu_size_before - segment_length;
+  int32_t genome_size_before = indiv_->amount_of_dna();
+  int32_t genome_size_after = genome_size_before - segment_length;
+
+
+  if ((gu_size_after < gen_unit_->min_gu_length()) ||
+      (genome_size_after < indiv_->min_genome_length())) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " DELETION %" PRId32 " %" PRId32
+                  " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), segment_length, 0,
+              gu_size_before, genome_size_before);
+    }
+  }
+  else {
+    // Perform the deletion
+    do_deletion(pos_1, pos_2);
+
+    // Report the deletion
+    mut = new Deletion(pos_1, pos_2, segment_length);
+
+    // Write a line in rearrangement logfile
+    if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+      fprintf(exp_m_->output_m()->log(LOG_REAR),
+              "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), int8_t(DEL), segment_length,
+              genome_size_before);
+    }
+  }
+
+  return mut;
+}
+
+Translocation* Dna::do_translocation() {
+  Translocation* mut = nullptr;
+
+  int32_t pos_1, pos_2, pos_3, pos_4;
+  int32_t segment_length;
+  bool invert;
+
+  if (indiv_->allow_plasmids()) {
+    // -----------------------------------------------------------------
+    // WARNING : This is only valid when there is only 1 plasmid allowed
+    // -----------------------------------------------------------------
+    int32_t pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel;
+
+    Individual* indiv = indiv_;
+    const GeneticUnit* chromosome = &indiv->genetic_unit_list().front();
+    const GeneticUnit* plasmid =
+        &*std::next(indiv->genetic_unit_list().begin());
+    int32_t chrom_length = chromosome->dna()->length();
+    int32_t total_amount_of_dna = indiv->amount_of_dna();
+
+    // 1) What sequence are we translocating?
+    pos_1_rel = indiv_->mut_prng_->random(length_);
+    pos_2_rel = indiv_->mut_prng_->random(length_);
+
+    int32_t segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_);
+
+    pos_3_rel =
+        Utils::mod(pos_1_rel + indiv_->mut_prng_->random(segment_length),
+                   length_);
+
+    if (gen_unit_ == chromosome) {
+      pos_1 = pos_1_rel;
+      pos_2 = pos_2_rel;
+      pos_3 = pos_3_rel;
+    }
+    else { // (gen_unit_ == plasmid)
+      pos_1 = pos_1_rel + chrom_length;
+      pos_2 = pos_2_rel + chrom_length;
+      pos_3 = pos_3_rel + chrom_length;
+    }
+
+
+    // 2) Where are we translocating it?
+    pos_4 = indiv_->mut_prng_->random(total_amount_of_dna - segment_length);
+
+    if (gen_unit_ == chromosome) {
+      if (pos_1 <= pos_2) {
+        if (pos_4 >= pos_1) {
+          pos_4 += segment_length;
+        }
+      }
+      else {
+        if (pos_4 >= chrom_length - segment_length) {
+          pos_4 += segment_length;
+        }
+        else {
+          pos_4 += pos_2;
+        }
+      }
+      if (pos_4 >= chrom_length) {
+        pos_4_rel = pos_4 - chrom_length;
+      }
+      else {
+        pos_4_rel = pos_4;
+      }
+    }
+    else { // (gen_unit_ == plasmid)
+      if (pos_1 <= pos_2) {
+        if (pos_4 >= pos_1) {
+          pos_4 += segment_length;
+        }
+      }
+      else {
+        if (pos_4 >= chrom_length) {
+          pos_4 += pos_2_rel;
+        }
+      }
+
+      if (pos_4 >= chrom_length) {
+        pos_4_rel = pos_4 - chrom_length;
+      }
+      else {
+        pos_4_rel = pos_4;
+      }
+    }
+
+    invert = (indiv_->mut_prng_->random(2) == 0);
+
+
+    // If inter GU translocation
+    if ((gen_unit_ == chromosome && pos_4 >= chrom_length) ||
+        (gen_unit_ == plasmid && pos_4 < chrom_length)) {
+      if (do_inter_GU_translocation(pos_1_rel, pos_2_rel,
+                                    pos_3_rel, pos_4_rel, invert)) {
+        // Report the translocation
+        mut = new Translocation(pos_1_rel, pos_2_rel,
+                                pos_3_rel, pos_4_rel,
+                                segment_length, invert);
+
+        // Write a line in rearrangement logfile
+        if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+          fprintf(exp_m_->output_m()->log(LOG_REAR),
+                  "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                      "\n",
+                  AeTime::time(), indiv_->id(), int8_t(TRANS),
+                  segment_length, length_);
+        }
+      }
+    }
+    else {
+      if (do_translocation(pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel,
+                           invert)) { // NOLINT(whitespace/braces)
+        mut = new Translocation(pos_1_rel, pos_2_rel,
+                                pos_3_rel, pos_4_rel,
+                                segment_length, invert);
+
+        // Write a line in rearrangement logfile
+        if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+          fprintf(exp_m_->output_m()->log(LOG_REAR),
+                  "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32
+                      "\n",
+                  AeTime::time(), indiv_->id(), int8_t(TRANS),
+                  segment_length, length_);
+        }
+      }
+    }
+  }
+  else { // (! ae_common::params->allow_plasmids())
+    pos_1 = indiv_->mut_prng_->random(length_);
+    pos_2 = indiv_->mut_prng_->random(length_);
+    if (pos_1 == pos_2) return NULL;
+
+    // As it is commented in do_translocation(int32_t pos_1, int32_t pos_2,
+    // int32_t pos_3, int32_t pos_4, bool invert), translocating segment
+    // [pos_1, pos_2] is the same as translocating segment [pos_2, pos_1]
+    // Since OriC must be at position 0, we will always translocate segment
+    // [pos_1, pos_2] with pos_1 < pos_2
+    if (pos_1 > pos_2) Utils::exchange(pos_1, pos_2);
+
+    segment_length = pos_2 - pos_1;
+
+    // Generate a position between pos_1 and pos_2
+    pos_3 = pos_1 + indiv_->mut_prng_->random(segment_length);
+
+    // Generate a position that is NOT between pos_1 and pos_2
+    pos_4 = indiv_->mut_prng_->random(length_ - segment_length);
+    if (pos_4 >= pos_1) pos_4 += segment_length;
+
+    invert = (indiv_->mut_prng_->random(2) == 0);
+
+    if (do_translocation(pos_1, pos_2, pos_3, pos_4, invert)) {
+      // Report the translocation
+      mut = new Translocation(pos_1, pos_2, pos_3, pos_4,
+                              segment_length, invert);
+
+      // Write a line in rearrangement logfile
+      if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+        fprintf(exp_m_->output_m()->log(LOG_REAR),
+                "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n",
+                AeTime::time(), indiv_->id(), int8_t(TRANS),
+                segment_length, length_);
+      }
+    }
+  }
+
+  return mut;
+}
+
+Inversion* Dna::do_inversion() {
+  Inversion* mut = nullptr;
+
+  int32_t pos_1, pos_2;
+  int32_t segment_length;
+  pos_1 = indiv_->mut_prng_->random(length_);
+  pos_2 = indiv_->mut_prng_->random(length_);
+
+  if (pos_1 == pos_2) return NULL; // Invert everything <=> Invert nothing!
+
+  // Invert the segment that don't contain OriC
+  if (pos_1 > pos_2) Utils::exchange(pos_1, pos_2);
+
+  segment_length = pos_2 - pos_1;
+
+  if (do_inversion(pos_1, pos_2)) {
+    // Report the inversion
+    mut = new Inversion(pos_1, pos_2, segment_length);
+
+    // Write a line in rearrangement logfile
+    if (exp_m_->output_m()->is_logged(LOG_REAR)) {
+      fprintf(exp_m_->output_m()->log(LOG_REAR),
+              "%" PRId64 " %" PRId32 " %" PRId8 " %" PRId32 " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), int8_t(INV),
+              segment_length, length_);
+    }
+  }
+
+  return mut;
+}
+
+Mutation* Dna::do_insertion(const char* seq_to_insert,
+                            int32_t seq_length /*= -1*/) {
+  Mutation* mut = nullptr;
+
+  Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
+
+//  // Compute seq_length if not known
+//  if (seq_length == -1) {
+//    seq_length = strlen(seq_to_insert);
+//  }
+//
+//  // Where to insert the sequence
+//  int32_t pos = indiv_->mut_prng_->random(length_);
+//
+//  if (do_insertion(pos, seq_to_insert, seq_length)) {
+//    // Report the insertion
+//    mut = new Mutation();
+//    mut->report_insertion(pos, seq_length, seq_to_insert);
+//  }
+
+  return mut;
+}
+
+
+bool Dna::do_duplication(int32_t pos_1, int32_t pos_2, int32_t pos_3) {
+// Duplicate segment [pos_1; pos_2[ and insert the duplicate before pos_3
+  char* duplicate_segment = NULL;
+  int32_t seg_length;
+
+  if (pos_1 < pos_2) {
+    //
+    //       pos_1         pos_2                   -> 0-
+    //         |             |                   -       -
+    // 0--------------------------------->      -         -
+    //         ===============                  -         - pos_1
+    //           tmp (copy)                      -       -
+    //                                             -----      |
+    //                                             pos_2    <-'
+    //
+
+    seg_length = pos_2 - pos_1;
+    duplicate_segment = new char[seg_length + 1];
+    memcpy(duplicate_segment, &data_[pos_1], seg_length);
+    duplicate_segment[seg_length] = '\0';
+  }
+  else { // if (pos_1 >= pos_2)
+    // The segment to duplicate includes the origin of replication.
+    // The copying process will be done in two steps.
+    //
+    //                                            ,->
+    //    pos_2                 pos_1            |      -> 0-
+    //      |                     |                   -       - pos_2
+    // 0--------------------------------->     pos_1 -         -
+    // ======                     =======            -         -
+    //  tmp2                        tmp1              -       -
+    //                                                  -----
+    //
+    //
+
+    int32_t tmp1_len = length_ - pos_1;
+    int32_t tmp2_len = pos_2;
+    seg_length = tmp1_len + tmp2_len;
+    duplicate_segment = new char[seg_length + 1];
+    memcpy(duplicate_segment, &data_[pos_1], tmp1_len);     // Copy tmp1
+    memcpy(&duplicate_segment[tmp1_len], data_, tmp2_len);  // Copy tmp2
+    duplicate_segment[seg_length] = '\0';
+  }
+
+  // Create a copy of the promoters beared by the segment to be duplicated
+  // (they will be inserted in the individual's RNA list later)
+  Promoters2Strands duplicated_promoters = {{},
+                                            {}};
+  gen_unit_->duplicate_promoters_included_in(pos_1, pos_2,
+                                             duplicated_promoters);
+
+  gen_unit_->remove_promoters_around(pos_3);
+
+  insert(pos_3, duplicate_segment, seg_length);
+
+  if (length_ >= PROM_SIZE) {
+    if (length_ - seg_length < PROM_SIZE) {
+      // Special case where the genome was smaller than a promoter before
+      // the insertion and greater than (or as big as) a promoter after the
+      // insertion.
+      // In that case, we must look for new promoters thoroughly on the whole
+      // genome using locate_promoters
+      gen_unit_->locate_promoters();
+    }
+    else {
+      gen_unit_->move_all_promoters_after(pos_3, seg_length);
+
+      gen_unit_->insert_promoters_at(duplicated_promoters, pos_3);
+
+      gen_unit_->look_for_new_promoters_around(pos_3);
+      gen_unit_->look_for_new_promoters_around(pos_3 + seg_length);
+    }
+  }
+
+
+  delete[] duplicate_segment;
+
+  return true;
+}
+
+bool Dna::do_deletion(int32_t pos_1, int32_t pos_2) {
+// Delete segment going from pos_1 (included) to pos_2 (excluded)
+  if (pos_1 < pos_2) {
+    //
+    //       pos_1         pos_2                   -> 0-
+    //         |             |                   -       -
+    // 0--------------------------------->      -         -
+    //         ===============                  -         - pos_1
+    //           tmp (copy)                      -       -
+    //                                             -----      |
+    //                                             pos_2    <-'
+    //
+
+    int32_t segment_length = pos_2 - pos_1;
+
+    // Remove promoters containing at least one nucleotide from the sequence
+    // to delete
+    gen_unit_->remove_promoters_around(pos_1, pos_2);
+
+    // Delete the sequence between pos_1 and pos_2
+    remove(pos_1, pos_2);
+
+    // Update promoter list
+    if (length_ >= PROM_SIZE) {
+      gen_unit_->move_all_promoters_after(pos_1, -segment_length);
+
+      gen_unit_->look_for_new_promoters_around(pos_1);
+    }
+  }
+  else { // if (pos_1 >= pos_2)
+    // The segment to delete includes the origin of replication.
+    // The deletion process will be done in two steps.
+    //
+    //                                            ,->
+    //    pos_2                 pos_1            |      -> 0-
+    //      |                     |                   -       - pos_2
+    // 0--------------------------------->     pos_1 -         -
+    // =====                      =======            -         -
+    //  tmp2                        tmp1              -       -
+    //                                                  -----
+    //
+    //
+
+    // int32_t segment_length = length_ + pos_2 - pos_1; //useless variable
+
+    // Remove promoters containing at least one nucleotide from the sequence
+    // to delete
+    gen_unit_->remove_promoters_around(pos_1, pos_2);
+
+    // Delete the sequence between pos_1 and pos_2
+    remove(pos_1, length_); // delete tmp1 from genome
+    remove(0, pos_2);       // delete tmp2 from genome
+
+    // Update promoter list
+    if (length_ >= PROM_SIZE) {
+      gen_unit_->move_all_promoters_after(0, -pos_2);
+
+      gen_unit_->look_for_new_promoters_around(0);
+    }
+  }
+
+  return true;
+}
+
+bool Dna::do_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3,
+                           int32_t pos_4, bool invert) {
+  // Provided that OriC must be at position 0
+  //
+  //    1) Note that in Case 1 (without inversion), whichever position
+  //       comes first, translocating segment [pos_1->pos_2] to pos_4
+  //       through pos_3 is always equivalent to rearrange the sequences from
+  //       an ABCDE order to ADCBE
+  //    2) In Case 2, depending on which position comes first, we may have the
+  //       following rearrangements :
+  //       (ABCDE => ADB'C'E) or (ABCDE => AC'D'BE)
+  //       where X' stands for "inverted X"
+  //
+  //  Case 1 : Without inversion
+  //
+  //         A      B        C       D       E
+  //      |----->=======[>=======>-------[>-------|
+  //          pos_1   pos_3    pos_2   pos_4
+  //                         |
+  //                         V
+  //         A      D        C       B        E
+  //      |----->-------[>=======>=======[>-------|
+  //
+  //
+  //         A      B        C       D       E
+  //      |=====>-------[>------->=======[>=======|
+  //          pos_2   pos_4    pos_1   pos_3
+  //                         |
+  //                         V
+  //         A      D        C       B        E
+  //      |=====>=======[>------->-------[>=======|
+  //
+  //
+  //         A      B        C       D       E
+  //      |====[>========>-------[>------->=======|
+  //          pos_3    pos_2    pos_4   pos_1
+  //                         |
+  //                         V
+  //         A       D       C        B        E
+  //      |=====[>------->-------[>=======[>=======|
+  //
+  //
+  //         A      B        C       D       E
+  //      |----[>-------->=======[>=======>-------|
+  //          pos_4    pos_1    pos_3   pos_2
+  //                         |
+  //                         V
+  //         A       D       C        B        E
+  //      |-----[>=======>=======[>-------[>-------|
+  //
+  //  Case 2 : With inversion
+  //
+  //    Case 2.A
+  //
+  //         A      B        C       D        E
+  //      |----->=======[>=======>-------<]-------|
+  //          pos_1   pos_3    pos_2   pos_4
+  //                         |
+  //                         V
+  //         A      D        B'      C'       E
+  //      |----->-------<]=======<=======<]-------|
+  //
+  //
+  //         A      B        C       D       E
+  //      |=====>-------[>------->=======<]=======|
+  //          pos_2   pos_4    pos_1   pos_3
+  //                         |
+  //                         V
+  //         A      D        B'      C'       E
+  //      |=====>=======<]-------<-------<]=======|
+  //
+  //    Case 2.B
+  //
+  //         A      B        C       D       E
+  //      |====[>========>-------<]------->=======|
+  //          pos_3    pos_2    pos_4   pos_1
+  //                         |
+  //                         V
+  //         A       C'      D'       B       E
+  //      |=====[>-------<-------[>=======>=======|
+  //
+  //
+  //         A      B        C       D       E
+  //      |----<]-------->=======[>=======>-------|
+  //          pos_4    pos_1    pos_3   pos_2
+  //                         |
+  //                         V
+  //         A       C'      D'       B       E
+  //      |-----<]=======>=======<]------->-------|
+
+
+
+  // Determine which position comes first and do the corresponding rearrangement
+  // TODO(dpa) use min from std
+  int32_t pos_min = Utils::min(pos_1,
+                               Utils::min(pos_2, Utils::min(pos_3, pos_4)));
+
+  if (not invert) {
+    if (pos_min == pos_1) {
+      ABCDE_to_ADCBE(pos_1, pos_3, pos_2, pos_4);
+    }
+    else if (pos_min == pos_2) {
+      ABCDE_to_ADCBE(pos_2, pos_4, pos_1, pos_3);
+    }
+    else if (pos_min == pos_3) {
+      ABCDE_to_ADCBE(pos_3, pos_2, pos_4, pos_1);
+    }
+    else { // if (pos_min == pos_4)
+      ABCDE_to_ADCBE(pos_4, pos_1, pos_3, pos_2);
+    }
+  }
+  else { // invert
+    if (pos_min == pos_1) {
+      ABCDE_to_ADBpCpE(pos_1, pos_3, pos_2, pos_4);
+    }
+    else if (pos_min == pos_2) {
+      ABCDE_to_ADBpCpE(pos_2, pos_4, pos_1, pos_3);
+    }
+    else if (pos_min == pos_3) {
+      ABCDE_to_ACpDpBE(pos_3, pos_2, pos_4, pos_1);
+    }
+    else { // if (pos_min == pos_4)
+      ABCDE_to_ACpDpBE(pos_4, pos_1, pos_3, pos_2);
+    }
+  }
+
+  return true;
+}
+
+bool Dna::do_inter_GU_translocation(int32_t pos_1_rel, int32_t pos_2_rel,
+                                    int32_t pos_3_rel, int32_t pos_4_rel,
+                                    bool invert) {
+  // TODO(???) check GU lengths according to positions and size limit
+  int32_t segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_);
+
+  if (pos_1_rel == pos_2_rel) { // TODO(???) shouldn't that raise an error?
+    return false;
+  }
+
+  // Do not allow translocation if it would decrease the size of the origin
+  // GU below a given threshold
+  if ((length_ - segment_length) < gen_unit_->min_gu_length()) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " TRANS %" PRId32 " %" PRId32 " %" PRId32
+                  " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), segment_length, 0, length_,
+              indiv_->amount_of_dna());
+    }
+    return false;
+  }
+
+  //
+  const GeneticUnit& chromosome = indiv_->genetic_unit(0);
+  const GeneticUnit& plasmid = indiv_->genetic_unit(1);
+  // TODO(vld) (2015-02-23): check if this == is sound
+  const GeneticUnit& destination_GU = (gen_unit_ == &chromosome) ?
+                                      plasmid :
+                                      chromosome;
+
+  int32_t dest_gu_size_before = destination_GU.seq_length();
+
+  // Do not allow translocation if it would increase the size of the receiving
+  // GU above a given threshold
+  if (dest_gu_size_before + segment_length >
+      destination_GU.max_gu_length()) {
+    if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+      // Write an entry in the barrier log file
+      fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+              "%" PRId64 " %" PRId32 " TRANS %" PRId32 " %" PRId32 " %" PRId32
+                  " %" PRId32 "\n",
+              AeTime::time(), indiv_->id(), segment_length, 0,
+              dest_gu_size_before, indiv_->amount_of_dna());
+    }
+    return false;
+  }
+
+  // Provided that OriC must be at position 0
+  //
+  //   Case 1: inter_GU_ABCDE_to_ACDBE
+  //
+  //         A    B     C        D     E
+  //      |---->=====>----|    |----[>----|
+  //          p1r   p2r            p4r
+  //                      |
+  //                      V
+  //        A    C          D     B     E
+  //      |---->----|     |----[>====[>----|
+  //          p1r             p4r   p4r+(p2r-p1r)
+  //
+  //
+  //   Case 2: inter_GU_ABCDE_to_BDCAE
+  //
+  //         A    B     C        D     E
+  //      |====>----->====|    |----[>----|
+  //          p2r   p1r             p4r
+  //                      |
+  //                      V
+  //          B               D     C     A   E
+  //       |-----|         |----[>====[>====>----|
+  //                           p4r    |
+  //                             p4r+(length_-p1r)
+  //                                        |
+  //                              p4r+(length_-(p1r-p2r))
+
+  // Determine which position comes first and do the corresponding rearrangement
+  // int32_t pos_min = Utils::min(pos_1, pos_2);
+
+  if (not invert) {
+    if (pos_1_rel < pos_2_rel) {
+      segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_);
+      inter_GU_ABCDE_to_ACDBE(pos_1_rel, pos_2_rel, pos_4_rel);
+    }
+    else {
+      segment_length = Utils::mod(pos_1_rel - pos_2_rel, length_);
+      inter_GU_ABCDE_to_BDCAE(pos_2_rel, pos_1_rel, pos_4_rel);
+    }
+  }
+  else { // invert
+    if (pos_1_rel < pos_2_rel) {
+      segment_length = Utils::mod(pos_2_rel - pos_1_rel, length_);
+      do_inversion(pos_1_rel, pos_2_rel);
+      inter_GU_ABCDE_to_ACDBE(pos_1_rel, pos_2_rel, pos_4_rel);
+    }
+    else { // pos_1_rel > pos_2_rel
+      segment_length = Utils::mod(pos_1_rel - pos_2_rel, length_);
+      if (pos_2_rel != 0) {
+        do_inversion(0, pos_2_rel);
+      }
+      if (pos_1_rel != length_) {
+        do_inversion(pos_1_rel, length_);
+      }
+      inter_GU_ABCDE_to_BDCAE(pos_2_rel, pos_1_rel, pos_4_rel);
+    }
+  }
+
+  return true;
+}
+
+bool Dna::do_inversion(int32_t pos_1, int32_t pos_2) {
+// Invert segment going from pos_1 (included) to pos_2 (excluded)
+// Exemple : sequence 011101001100 => 110011010001
+  if (pos_1 == pos_2) return false; // Invert everything <=> Invert nothing!
+  assert(pos_1 < pos_2);
+
+  //
+  //       pos_1         pos_2                   -> 0-
+  //         |             |                   -       -
+  // 0--------------------------------->      -         -
+  //         ===============                  -         - pos_1
+  //           tmp (copy)                      -       -
+  //                                             -----      |
+  //                                             pos_2    <-'
+  //
+
+  int32_t seg_length = pos_2 - pos_1;
+
+  // Create the inverted sequence
+  char* inverted_segment = NULL;
+  inverted_segment = new char[seg_length + 1];
+
+  // #pragma simd
+  // #pragma distribute_point
+
+  // for (int32_t i = 0, j = pos_2 - 1; i < seg_length; i = i + 4, j = j - 4) {
+  //   if (data_[j] == '0') inverted_segment[i] = '1';
+  //   else inverted_segment[i] = '0';
+  //   if (data_[j - 1] == '0') inverted_segment[i + 1] = '1';
+  //   else inverted_segment[i + 1] = '0';
+  //   if (data_[j - 2] == '0') inverted_segment[i + 2] = '1';
+  //   else inverted_segment[i + 2] = '0';
+  //   if (data_[j - 3] == '0') inverted_segment[i + 3] = '1';
+  //   else inverted_segment[i + 3] = '0';
+  // }
+  for (int32_t i = 0, j = pos_2 - 1; i < seg_length; i++, j--) {
+    if (data_[j] == '0') inverted_segment[i] = '1';
+    else inverted_segment[i] = '0';
+  }
+  inverted_segment[seg_length] = '\0';
+
+  // Remove promoters that included a breakpoint
+  gen_unit_->remove_promoters_around(pos_1);
+  gen_unit_->remove_promoters_around(pos_2);
+
+  // Invert the sequence
+  replace(pos_1, inverted_segment, seg_length);
+
+  // Update promoter list
+  if (length_ >= PROM_SIZE) {
+    gen_unit_->invert_promoters_included_in(pos_1, pos_2);
+
+    gen_unit_->look_for_new_promoters_around(pos_1);
+    gen_unit_->look_for_new_promoters_around(pos_2);
+  }
+
+  delete[] inverted_segment;
+
+  return true;
+}
+
+bool Dna::do_insertion(int32_t pos, const char* seq_to_insert,
+                       int32_t seq_length) {
+  // Remove the promoters that will be broken
+  gen_unit_->remove_promoters_around(pos);
+
+  // Insert the sequence
+  insert(pos, seq_to_insert, seq_length);
+
+  // Look for new promoters
+  if (length_ >= PROM_SIZE) {
+    gen_unit_->move_all_promoters_after(pos, seq_length);
+    gen_unit_->look_for_new_promoters_around(pos, pos + seq_length);
+  }
+
+  return true;
+}
+
+
+Mutation* Dna::do_ins_HT(int32_t parent_id) {
+  Mutation* mut = nullptr;
+
+  // TODO(dpa) disabled
+//  int32_t nb_indivs = exp_m_->pop()->nb_indivs();
+//
+//  // Insertion transfer
+//  // Requirements:
+//  //    * A circular exogenote => an alignment on the donor chromosome
+//  //    * An alignment between the exogenote and the endogenote
+//
+//  // 1) Draw a random donor (uniform drawing).
+//  // We use the rank because indivs are sorted by rank (1 for the worst,
+//  // POP_SIZE for the best).
+//  Individual * donor = NULL;
+//  do {
+//    donor = exp_m_->pop()->
+//        indiv_by_rank(exp_m_->sel()->prng()->random(nb_indivs) +
+//                              1);
+//  }
+//  while (donor->id() == parent_id);
+//
+//  // 2) Look for an alignment within the donor genome
+//  VisAVis* alignment_1   = NULL;
+//  Dna* donor_dna = donor->genetic_unit(0).dna();
+//  int32_t nb_pairs_1 =
+//      static_cast<int32_t>(
+//          ceil(donor_dna->length() * indiv_->neighbourhood_rate()));
+//
+//  alignment_1 = donor_dna->search_alignment(donor_dna, nb_pairs_1, DIRECT);
+//
+//    if (alignment_1 != NULL) {
+//      // 3) Make a copy of the sequence to be transferred (the exogenote)
+//      GeneticUnit* exogenote =
+//          donor_dna->copy_into_new_GU(alignment_1->i_1(),
+//                                      alignment_1->i_2());
+//
+//      // 4) Look for an alignments between the exogenote and the endogenote
+//      VisAVis* alignment_2 = NULL;
+//      int32_t nb_pairs_2 = static_cast<int32_t>(
+//          ceil(length() * indiv_->neighbourhood_rate()));
+//
+//      alignment_2 =
+//          exogenote->dna()->search_alignment(this, nb_pairs_2,
+//                                                 BOTH_SENSES);
+//
+//      if (alignment_2 != NULL) {
+//        int32_t gu_length_before = length_;
+//        int32_t gu_length_after =
+//            gu_length_before + exogenote->dna()->length();
+//        int32_t genome_length_before = indiv_->amount_of_dna();
+//        int32_t genome_length_after =
+//            genome_length_before + exogenote->dna()->length();
+//
+//        if ((genome_length_after > indiv_->max_genome_length()) ||
+//            (gu_length_after > gen_unit_->max_gu_length())) {
+//          if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+//            // Write an entry in the barrier log file
+//            fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+//                "%" PRId64 " %" PRId32 " INS_TRANSFER %" PRId32 " %" PRId32
+//                " %" PRId32 " %" PRId32 "\n",
+//                AeTime::time(),
+//                indiv_->id(),
+//                exogenote->dna()->length(),
+//                0,
+//                gu_length_before,
+//                genome_length_before);
+//          }
+//        }
+//        else {
+//          insert_GU(exogenote,
+//              alignment_2->i_2(), alignment_2->i_1(),
+//              (alignment_2->sense() == INDIRECT));
+//          //~ fprintf(logfile, "RESULT:\n%s\n\n\n", new_indiv_dna->data());
+//          //~ fflush(logfile);
+//
+//          // Write a line in transfer logfile
+//          if (exp_m_->output_m()->is_logged(LOG_TRANSFER)) {
+//            fprintf(exp_m_->output_m()->log(LOG_TRANSFER),
+//                    "%" PRId64 " %" PRId32 " %" PRId32 " 0 %" PRId32
+//                    " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+//                    " %" PRId32 " %" PRId16 " %" PRId32 " %" PRId32
+//                    " %" PRId16 "\n",
+//                    AeTime::time(),
+//                    indiv_->id(),
+//                    donor->id(),
+//                    exogenote->dna()->length(),
+//                    0,
+//                    genome_length_before,
+//                    length(),
+//                    alignment_1->i_1(),
+//                    alignment_1->i_2(),
+//                    alignment_1->score(),
+//                    alignment_2->i_1(),
+//                    alignment_2->i_2(),
+//                    alignment_2->score());
+//          }
+//
+//          #ifdef BIG_DEBUG
+//            ae_common::sim->logs()->flush();
+//            indiv_->assert_promoters();
+//            indiv_->assert_promoters_order();
+//          #endif
+//
+//          if (exp_m_->output_m()->record_tree() &&
+//              exp_m_->output_m()->tree_mode() == NORMAL) {
+//            char* donor_seq;
+//            if (alignment_2->sense() == DIRECT) {
+//              donor_seq = exogenote->dna()->
+//                  subsequence(alignment_2->i_1(),
+//                                  alignment_2->i_1(), LEADING);
+//            }
+//            else {
+//              donor_seq = exogenote->dna()->
+//                  subsequence(alignment_2->i_1(),
+//                                  alignment_2->i_1(), LAGGING);
+//            }
+//            // Report the transfer
+//            mut = new Mutation();
+//            mut->report_ins_HT(alignment_1->i_1(), alignment_1->i_2(),
+//                               alignment_2->i_1(), alignment_2->i_2(),
+//                               exogenote->dna()->length(),
+//                               alignment_1->score(),
+//                               alignment_2->score(),
+//                               donor->id(),
+//                               alignment_2->sense(),
+//                               donor_seq);
+//            delete [] donor_seq;
+//          }
+//        }
+//
+//        delete alignment_2;
+//      }
+//
+//      delete exogenote;
+//      delete alignment_1;
+//    }
+
+  return mut;
+}
+
+Mutation* Dna::do_repl_HT(int32_t parent_id) {
+  Mutation* mut = nullptr;
+
+  // TODO(dpa) disabled
+//  int32_t nb_indivs = exp_m_->pop()->nb_indivs();
+//
+//  // Replacement transfer
+//  // Requirements:
+//  //   * 2 distinct alignments between the (linear) exogenote and the
+//  //     endogenote
+//
+//  // 1) Draw a random donor (uniform drawing).
+//  // We use the rank because indivs are sorted by rank (1 for the worst,
+//  // POP_SIZE for the best).
+//  Individual * donor = NULL;
+//  do {
+//    donor = exp_m_->pop()->
+//        indiv_by_rank(exp_m_->sel()->prng()->random(nb_indivs)
+//            + 1);
+//  }
+//  while (donor->id() == parent_id);
+//
+//  // 2) Look for an alignment between the parent genome and the donor genome
+//  VisAVis* alignment_1   = NULL;
+//  VisAVis* alignment_2   = NULL;
+//  Dna* donor_dna = donor->genetic_unit(0).dna();
+//  AlignmentSense sense = (exp_m_->sel()->prng()->random() < 0.5) ?
+//                         DIRECT : INDIRECT;
+//  int32_t nb_pairs_1 = static_cast<int32_t>(
+//      ceil(length() * indiv_->neighbourhood_rate()));
+//  int32_t nb_pairs_2 = static_cast<int32_t>(
+//      ceil(length() * indiv_->neighbourhood_rate()));
+//  int8_t search_sense = 0;
+//
+//  alignment_1 = search_alignment(donor_dna, nb_pairs_1, sense);
+//  if (alignment_1 != NULL) {
+//    if (exp_m_->repl_HT_with_close_points()) {
+//      alignment_2 =
+//          search_alignment_around_positions(donor_dna,
+//                                            alignment_1->i_1(),
+//                                            alignment_1->i_2(),
+//                                            alignment_1->sense(),
+//                                            search_sense);
+//      if (alignment_2 != NULL &&
+//          alignment_2->i_1() == alignment_1->i_1()) {
+//        delete alignment_2;
+//        alignment_2 = NULL;
+//      }
+//      if (alignment_2 != NULL) {
+//        // If the second alignment is found upstream of the first alignment,
+//        // they are inverse to facilitate
+//        if (search_sense == -1) {
+//          VisAVis* tmp_alignment = new VisAVis(*alignment_1);
+//          alignment_1->copy(alignment_2);
+//          alignment_2->copy(tmp_alignment);
+//          delete tmp_alignment;
+//        }
+//      }
+//    }
+//    else {
+//      // Look for a second alignement between the parent and the donor
+//      // (must be different from alignment_1)
+//      while (alignment_2 == NULL && nb_pairs_2 > 0) {
+//        alignment_2 = search_alignment(donor_dna, nb_pairs_2, sense);
+//
+//        // Forbid the replacement of the whole genome of the parent
+//        if (alignment_2 != NULL &&
+//            alignment_2->i_1() == alignment_1->i_1()) {
+//          delete alignment_2;
+//          alignment_2 = NULL;
+//        }
+//      }
+//    }
+//
+//    // If both alignments were found, proceed to the transfer
+//    if (alignment_2 != NULL) {
+//      int32_t gu_length_before  = length_;
+//      int32_t exogenote_length =
+//          Utils::mod(alignment_2->i_2() - alignment_1->i_2() - 1,
+//                     donor_dna->length()) + 1;
+//      int32_t replaced_seq_length =
+//          Utils::mod(alignment_2->i_1() - alignment_1->i_1() - 1,
+//                     gu_length_before) + 1;
+//      int32_t gu_length_after =
+//          gu_length_before - replaced_seq_length + exogenote_length;
+//
+//      int32_t genome_length_before = indiv_->amount_of_dna();
+//      int32_t genome_length_after =
+//          genome_length_before - replaced_seq_length + exogenote_length;
+//
+//      if (genome_length_after < indiv_->min_genome_length() ||
+//          genome_length_after > indiv_->max_genome_length() ||
+//          gu_length_after < gen_unit_->min_gu_length() ||
+//          gu_length_after > gen_unit_->max_gu_length()) {
+//        if (exp_m_->output_m()->is_logged(LOG_BARRIER)) {
+//          // Write an entry in the barrier log file
+//          fprintf(exp_m_->output_m()->log(LOG_BARRIER),
+//              "%" PRId64 " %" PRId32 " REPL_TRANSFER %" PRId32 " %" PRId32
+//              " %" PRId32 " %" PRId32 "\n",
+//              AeTime::time(),
+//              indiv_->id(),
+//              exogenote_length,
+//              replaced_seq_length,
+//              gu_length_before,
+//              genome_length_before);
+//        }
+//      }
+//      else {
+//        // 3) Make a copy of the sequence to be transferred (the exogenote)
+//        GeneticUnit* exogenote = NULL;
+//        if (sense == DIRECT) {
+//          exogenote = donor_dna->copy_into_new_GU(alignment_1->i_2(),
+//                                                  alignment_2->i_2());
+//        }
+//        else {
+//          exogenote = donor_dna->copy_into_new_GU(alignment_2->i_2(),
+//                                                  alignment_1->i_2());
+//        }
+//
+//        char* alignment1_parent_dna = nullptr;
+//        char* alignment2_parent_dna = nullptr;
+//        char* alignment1_donor_dna  = nullptr;
+//        char* alignment2_donor_dna  = nullptr;
+//        if (exp_m_->output_m()->is_logged(LOG_TRANSFER) == true) {
+//          if (sense  == DIRECT) {
+//            alignment1_parent_dna =
+//                subsequence(alignment_1->i_1(),
+//                                alignment_1->i_1() +
+//                                    2 * indiv_->align_w_zone_h_len() +
+//                                    indiv_->align_max_shift(), LEADING);
+//            alignment2_parent_dna =
+//                subsequence(alignment_2->i_1(),
+//                                alignment_2->i_1() +
+//                                    2 * indiv_->align_w_zone_h_len() +
+//                                    indiv_->align_max_shift(), LEADING);
+//            alignment1_donor_dna =
+//                donor_dna->subsequence(
+//                    alignment_1->i_2(),
+//                    alignment_1->i_2() +
+//                        2 * indiv_->align_w_zone_h_len() +
+//                        indiv_->align_max_shift(), LEADING);
+//            alignment2_donor_dna =
+//                donor_dna->subsequence(
+//                    alignment_2->i_2(),
+//                    alignment_2->i_2() +
+//                        2 * indiv_->align_w_zone_h_len() +
+//                        indiv_->align_max_shift(), LEADING);
+//          }
+//          else {
+//            alignment1_parent_dna =
+//                subsequence(alignment_1->i_1(),
+//                                alignment_1->i_1() +
+//                                    2 * indiv_->align_w_zone_h_len() +
+//                                    indiv_->align_max_shift(), LEADING);
+//            alignment2_parent_dna =
+//                subsequence(alignment_2->i_1(),
+//                                alignment_2->i_1() +
+//                                    2 * indiv_->align_w_zone_h_len() +
+//                                    indiv_->align_max_shift(), LEADING);
+//            alignment1_donor_dna =
+//                donor_dna->subsequence(
+//                    alignment_1->i_2(),
+//                    alignment_1->i_2() -
+//                        2 * indiv_->align_w_zone_h_len() -
+//                        indiv_->align_max_shift(), LAGGING);
+//            alignment2_donor_dna =
+//                donor_dna->subsequence(
+//                    alignment_2->i_2(),
+//                    alignment_2->i_2() -
+//                        2 * indiv_->align_w_zone_h_len() -
+//                        indiv_->align_max_shift(), LAGGING);
+//          }
+//        }
+//
+//        // Delete the sequence to be replaced
+//        do_deletion(alignment_1->i_1(), alignment_2->i_1());
+//        if (alignment_1->i_1() < alignment_2->i_1()) {
+//          insert_GU(exogenote, alignment_1->i_1(), 0, sense == INDIRECT);
+//        }
+//        else {
+//          insert_GU(exogenote, 0, 0, sense == INDIRECT);
+//        }
+//
+//        // Write a line in transfer logfile
+//        if (exp_m_->output_m()->is_logged(LOG_TRANSFER)) {
+//          fprintf(exp_m_->output_m()->log(LOG_TRANSFER),
+//              "%" PRId64 " %" PRId32 " %" PRId32 " 1 %" PRId32 " %" PRId32
+//              " %" PRId32 " %" PRId32 " %" PRId16 " %" PRId32 " %" PRId32
+//              " %" PRId16 " %" PRId32 " %" PRId32 " %" PRId16
+//              " %" PRId16 "\n",
+//              AeTime::time(),
+//              indiv_->id(),
+//              donor->id(),
+//              exogenote->dna()->length(),
+//              replaced_seq_length,
+//              genome_length_before,
+//              length(),
+//              (int16_t) alignment_1->sense(),
+//              alignment_1->i_1(),
+//              alignment_1->i_2(),
+//              alignment_1->score(),
+//              alignment_2->i_1(),
+//              alignment_2->i_2(),
+//              alignment_2->score() ,
+//              (int16_t) search_sense);
+//
+//        fprintf(exp_m_->output_m()->log(LOG_TRANSFER),
+//            "\tAlignment 1:\n\t\t%s\n\t\t%s\n"
+//            "\tAlignment 2:\n\t\t%s\n\t\t%s\n",
+//            alignment1_parent_dna, alignment1_donor_dna,
+//            alignment2_parent_dna, alignment2_donor_dna);
+//
+//            delete [] alignment1_parent_dna;
+//            delete [] alignment2_parent_dna;
+//            delete [] alignment1_donor_dna;
+//            delete [] alignment2_donor_dna;
+//        }
+//
+//        if (exp_m_->output_m()->record_tree() &&
+//            exp_m_->output_m()->tree_mode() == NORMAL) {
+//          // Report the transfer
+//          char* donor_seq;
+//          if (alignment_2->sense() == DIRECT) {
+//            donor_seq = exogenote->dna()->
+//                subsequence(0, exogenote->dna()->length(), LEADING);
+//          }
+//          else {
+//            donor_seq = exogenote->dna()->
+//                subsequence(0, exogenote->dna()->length(), LAGGING);
+//          }
+//          mut = new Mutation();
+//          mut->report_repl_HT(alignment_1->i_1(), alignment_1->i_2(),
+//                              alignment_2->i_1(), alignment_2->i_2(),
+//                              replaced_seq_length,
+//                              exogenote->dna()->length(),
+//                              alignment_1->score(),
+//                              alignment_2->score(),
+//                              donor->id(),
+//                              alignment_2->sense(),
+//                              donor_seq);
+//          delete [] donor_seq;
+//        }
+//
+//        delete exogenote;
+//      }
+//      delete alignment_2;
+//    }
+//    delete alignment_1;
+//  }
+  return mut;
+}
+
+bool Dna::do_ins_HT(int32_t pos, const char* seq_to_insert,
+                    int32_t seq_length) { // NOLINT(whitespace/braces)
+  // Remove the promoters that will be broken
+  gen_unit_->remove_promoters_around(pos);
+
+  // Insert the sequence
+  insert(pos, seq_to_insert, seq_length);
+
+  // Look for new promoters
+  if (length_ >= PROM_SIZE) {
+    gen_unit_->move_all_promoters_after(pos, seq_length);
+    gen_unit_->look_for_new_promoters_around(pos, pos + seq_length);
+  }
+
+  return true;
+}
+
+bool Dna::do_repl_HT(int32_t pos1, int32_t pos2, const char* seq_to_insert,
+                     int32_t seq_length) {
+  // Remove the promoters that will be broken
+  gen_unit_->remove_promoters_around(pos1);
+
+  // Delete the replaced segment
+  do_deletion(pos1, pos2);
+
+  // Insert the sequence
+  int32_t insertion_position;
+  if (pos1 < pos2) {
+    insertion_position = pos1;
+  }
+  else {
+    insertion_position = 0;
+  }
+  insert(insertion_position, seq_to_insert, seq_length);
+
+  // Look for new promoters
+  if (length_ >= PROM_SIZE) {
+    gen_unit_->move_all_promoters_after(insertion_position, seq_length);
+    gen_unit_->look_for_new_promoters_around(insertion_position,
+                                             insertion_position + seq_length);
+  }
+
+  return true;
+}
+
+void Dna::undergo_this_mutation(const Mutation& mut) {
+  switch (mut.mut_type()) {
+    case SWITCH :
+      do_switch(dynamic_cast<const PointMutation&>(mut).pos());
+      break;
+    case S_INS : {
+      const auto& s_ins = dynamic_cast<const SmallInsertion&>(mut);
+      do_small_insertion(s_ins.pos(), s_ins.length(), s_ins.seq());
+      break;
+    }
+    case S_DEL : {
+      const auto& s_del = dynamic_cast<const SmallDeletion&>(mut);
+      do_small_deletion(s_del.pos(), s_del.length());
+      break;
+    }
+    case DUPL : {
+      const auto& dupl = dynamic_cast<const Duplication&>(mut);
+      do_duplication(dupl.pos1(), dupl.pos2(), dupl.pos3());
+      break;
+    }
+    case DEL : {
+      const auto& del = dynamic_cast<const Deletion&>(mut);
+      do_deletion(del.pos1(), del.pos2());
+      break;
+    }
+    case TRANS : {
+      const auto& trans = dynamic_cast<const Translocation&>(mut);
+      do_translocation(trans.pos1(), trans.pos2(), trans.pos3(), trans.pos4(),
+                       trans.invert());
+      break;
+    }
+    case INV : {
+      const auto& inv = dynamic_cast<const Inversion&>(mut);
+      do_inversion(inv.pos1(), inv.pos2());
+      break;
+    }
+    case INS_HT : {
+      const auto& ins_ht = dynamic_cast<const InsertionHT&>(mut);
+      do_ins_HT(ins_ht.receiver_pos(), ins_ht.seq(), ins_ht.length());
+      break;
+    }
+    case REPL_HT : {
+      const auto& repl_ht = dynamic_cast<const ReplacementHT&>(mut);
+      do_repl_HT(repl_ht.receiver_pos1(), repl_ht.receiver_pos2(),
+                 repl_ht.seq(), repl_ht.length());
+      break;
+    }
+    default :
+      fprintf(stderr, "ERROR, invalid mutation type in file %s:%d\n",
+              __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+      break;
+  }
+}
+
+void Dna::compute_statistical_data() {
+// ****************************************************************************
+//                            WARNING     Deprecated
+// ****************************************************************************
+  assert(false);
+}
+
+#ifndef __REGUL
+
+void Dna::set_GU(std::vector<std::list < Rna>>
+
+rna_list,
+const GeneticUnit* GU
+) {
+for (
+
+auto& strand : { LEADING, LAGGING }
+
+)
+for (
+auto& rna :
+rna_list[strand])
+rna.
+set_genetic_unit(GU);
+}
+#else
+void Dna::set_GU(std::vector<std::list<Rna_R>> rna_list, const GeneticUnit* GU) {
+  for (auto& strand: {LEADING, LAGGING})
+    for (auto& rna: rna_list[strand])
+      rna.set_genetic_unit(GU);
+}
+#endif
+
+GeneticUnit* Dna::extract_into_new_GU(int32_t pos_1, int32_t pos_2) {
+  assert(pos_1 < pos_2);
+  int32_t seq_length = pos_2 - pos_1;
+
+  // =============== Remove/Extract promoters from old sequence ===============
+  // Remove promoters around breakpoints
+  gen_unit_->remove_promoters_around(pos_1);
+  gen_unit_->remove_promoters_around(pos_2);
+
+  // Remove promoters belonging to the sequence (to be extracted) from the
+  // "old" GU and put them in a stand-alone promoter list (with indices
+  // ranging from 0 to seq_length-1)
+  Promoters2Strands proms_GU_1 = {{},
+                                  {}};
+  gen_unit_->extract_promoters_included_in(pos_1, pos_2, proms_GU_1);
+  GeneticUnit::shift_promoters(proms_GU_1, -pos_1, length_);
+
+  // ==================== Manage sequences ====================
+  // Copy the sequence in a stand-alone char* (size must be multiple of
+  // BLOCK_SIZE)
+  int32_t length_GU_1 = seq_length;
+  char* sequence_GU_1 = new char[nb_blocks(length_GU_1) * BLOCK_SIZE];
+  memcpy(sequence_GU_1, &data_[pos_1], length_GU_1 * sizeof(char));
+  sequence_GU_1[length_GU_1] = '\0';
+
+  // Remove the sequence from the "old" GU
+  int32_t length_GU_0 = length_ - seq_length;
+  char* sequence_GU_0 = new char[nb_blocks(length_GU_0) * BLOCK_SIZE];
+  memcpy(sequence_GU_0, data_, pos_1 * sizeof(char));
+  memcpy(&sequence_GU_0[pos_1], &data_[pos_2],
+         (length_ - pos_2) * sizeof(char));
+  sequence_GU_0[length_GU_0] = '\0';
+
+  set_data(sequence_GU_0, length_GU_0);
+
+  // ==================== Create the new genetic unit ====================
+  GeneticUnit* GU_1 =
+      new GeneticUnit(indiv_, sequence_GU_1, length_GU_1, proms_GU_1);
+
+  // ==================== Update promoter lists ====================
+  // Shift the position of the promoters of the "old" GU
+  gen_unit_->move_all_promoters_after(pos_1, -seq_length);
+
+  // Look for new promoters around breakpoints
+  gen_unit_->look_for_new_promoters_around(pos_1);
+  GU_1->look_for_new_promoters_around(0);
+
+  return GU_1;
+}
+
+
+/*!
+  \brief Copy the sequence going from pos_1 (included) to pos_2 (excluded)
+  into a new standalone genetic unit.
+
+  The new genetic unit's list of promoter is up-to-date.
+  if (pos_1 == pos_2), the whole genome is copied
+*/
+GeneticUnit* Dna::copy_into_new_GU(int32_t pos_1, int32_t pos_2) const {
+  int32_t seq_length = Utils::mod(pos_2 - pos_1, length_);
+  if (seq_length == 0) seq_length = length_;
+
+  // ==================== Copy promoters from old sequence ====================
+  // Copy the promoters belonging to the sequence to be copied from the "old"
+  // GU into a stand-alone promoter list (with indices ranging from 0 to
+  // seq_length - 1)
+  Promoters2Strands proms_new_GU = {{},
+                                    {}};
+  gen_unit_->copy_promoters_included_in(pos_1, pos_2, proms_new_GU);
+  GeneticUnit::shift_promoters(proms_new_GU, -pos_1, length_);
+
+
+  // ==================== Manage sequences ====================
+  // Copy the sequence in a stand-alone char* (size must be multiple of
+  // BLOCK_SIZE)
+  int32_t length_new_GU = seq_length;
+  char* sequence_new_GU = new char[nb_blocks(length_new_GU) * BLOCK_SIZE];
+  if (pos_1 < pos_2) {
+    memcpy(sequence_new_GU, &data_[pos_1], length_new_GU * sizeof(char));
+  }
+  else {
+    memcpy(sequence_new_GU, &data_[pos_1], (length_ - pos_1) * sizeof(char));
+    memcpy(&sequence_new_GU[length_ - pos_1], &data_[0], pos_2 * sizeof(char));
+  }
+  sequence_new_GU[length_new_GU] = '\0';
+
+
+  // ==================== Create the new genetic unit ====================
+  GeneticUnit* new_GU =
+      new GeneticUnit(indiv_, sequence_new_GU, length_new_GU, proms_new_GU);
+
+  // ==================== Update new GU promoter list ====================
+  // Look for new promoters around breakpoints
+  new_GU->look_for_new_promoters_around(0);
+
+  return new_GU;
+}
+
+/**
+ * \brief Insert the genetic unit GU_to_insert at pos_B, through pos_D.
+ *
+ * Sequence is inverted if invert == true
+ *
+ *
+ * GU to insert: segments C and D, breakpoint pos_D.
+ * Current GU:   segments A and B, breakpoint pos_B.
+
+  \verbatim
+  If invert is false, the insertion will render ADCB
+           A        B                  C        D
+       |-------[>-------|     +     |=====[>========|
+             pos_B                      pos_D
+                              |
+                              V
+                   A       D       C        B
+               |-------[>=====|========[>-------|
+
+  If invert is true, the insertion will render ACpDpB
+  with Cp (resp. Dp) = inverted C (resp. D).
+
+           A        B                  C        D
+       |-------[>-------|     +     |=====<]========|
+             pos_B                      pos_D
+                              |
+                              V
+                   A       Cp     Dp        B
+               |-------[>=====|========[>-------|
+
+  \endverbatim
+
+  Sequence from GU_to_insert is untouched but its list of promoters is emptied
+*/
+void Dna::insert_GU(GeneticUnit* GU_to_insert, int32_t pos_B, int32_t pos_D,
+                    bool invert) {
+  // Compute segment lengths
+  const char* GUti_data = GU_to_insert->dna()->data();
+  int32_t len_A = pos_B;
+  int32_t len_B = length_ - pos_B;
+  int32_t len_C = pos_D;
+  int32_t len_D = GU_to_insert->dna()->length() - pos_D;
+  int32_t len_AB = length_;
+  int32_t len_CD = GU_to_insert->dna()->length();
+  int32_t len_ABCD = len_AB + len_CD;
+
+
+  // ==================== Insert the sequence ====================
+  // Create new genome
+  char* new_seq = new char[BLOCK_SIZE * nb_blocks(len_ABCD)];
+
+  // Insert A
+  memcpy(new_seq, data_, len_A * sizeof(char));
+
+  // Insert C and D (inverted?)
+  if (invert) {
+    // Build Cp and Dp
+    char* seq_Cp = new char[pos_D + 1];
+    for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) {
+      if (GUti_data[j] == '0') seq_Cp[i] = '1';
+      else seq_Cp[i] = '0';
+    }
+    seq_Cp[len_C] = '\0';
+
+    char* seq_Dp = new char[len_D + 1];
+    for (int32_t i = 0, j = len_CD - 1; i < len_D; i++, j--) {
+      if (GUti_data[j] == '0') seq_Dp[i] = '1';
+      else seq_Dp[i] = '0';
+    }
+    seq_Dp[len_D] = '\0';
+
+    // Insert Cp and DP
+    // TODO(???) Maybe we should construct Cp and Dp directly at their rightful
+    // place...
+    memcpy(&new_seq[len_A], seq_Cp, len_C * sizeof(char));
+    memcpy(&new_seq[len_A + len_C], seq_Dp, len_D * sizeof(char));
+
+    delete[] seq_Cp;
+    delete[] seq_Dp;
+  }
+  else { // if (invert == false)
+    // Insert D and C
+    memcpy(&new_seq[len_A], &GUti_data[pos_D], len_D * sizeof(char));
+    memcpy(&new_seq[len_A + len_D], GUti_data, len_C * sizeof(char));
+  }
+
+  // Insert B
+  memcpy(&new_seq[len_A + len_C + len_D], &data_[pos_B], len_B * sizeof(char));
+  new_seq[len_ABCD] = '\0';
+
+
+  // Remove promoters that are astride segments A and B : breakpoint pos_B
+  gen_unit_->remove_promoters_around(pos_B);
+
+
+  set_data(new_seq, len_ABCD);
+
+
+
+
+  // ==================== Manage promoters ====================
+  // Remove promoters that are astride segments C and D : breakpoint pos_D
+  GU_to_insert->remove_promoters_around(pos_D);
+
+  // Shift the position of the promoters of segment B
+  gen_unit_->move_all_promoters_after(pos_B, len_CD);
+
+  // Extract promoters of segments C and D.
+  // NOTE : We want ALL THE PROMOTERS to be transfered, not only those that
+  //        are completely included in segment C or D. Hence, we will use
+  //        extract_promoters_starting_between() instead of
+  //        extract_promoters_included_in().
+  // NOTE : Once removed the promoters starting on sequence D, the remaining
+  //        is precisely the promoters starting on sequence C (and they are
+  //        at their rightful position). We can hence directly use the list
+  //        of promoters from GU_to_insert.
+  Promoters2Strands proms_C = {{},
+                               {}};
+  Promoters2Strands proms_D = {{},
+                               {}};
+
+  if (pos_D != 0) {
+    // TODO(???) : Manage this in the different functions? with a parameter
+    // WholeGenomeEventHandling ?
+    GU_to_insert->extract_promoters_starting_between(0, pos_D, proms_C);
+  }
+  GU_to_insert->extract_promoters_starting_between(pos_D, len_CD, proms_D);
+  assert(GU_to_insert->rna_list()[LEADING].empty());
+  assert(GU_to_insert->rna_list()[LAGGING].empty());
+  GeneticUnit::shift_promoters(proms_D, -len_C, len_D);
+
+  if (invert) {
+    //~ printf("+++++++++++++++++++++++++++++++++++++\n");
+    //~ GeneticUnit::print_rnas(proms_C);
+    //~ GeneticUnit::print_rnas(proms_D);
+    //~ printf("//////////////////////////////////////\n");
+
+    GeneticUnit::invert_promoters(proms_C, len_C);
+    GeneticUnit::invert_promoters(proms_D, len_D);
+
+    //~ GeneticUnit::print_rnas(proms_C);
+    //~ GeneticUnit::print_rnas(proms_D);
+    //~ printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+    gen_unit_->insert_promoters_at(proms_C, len_A);
+    gen_unit_->insert_promoters_at(proms_D, len_A + len_C);
+  }
+  else { // if (invert == false)
+    gen_unit_->insert_promoters_at(proms_D, len_A);
+    gen_unit_->insert_promoters_at(proms_C, len_A + len_D);
+  }
+
+  // Look for new promoters around breakpoints
+  gen_unit_->look_for_new_promoters_around(pos_B);
+  gen_unit_->look_for_new_promoters_around(pos_B + len_CD);
+
+  gen_unit_->take_ownership_of_all_rnas();
+}
+
+
+/**
+ * \brief Looks for an alignment between this and chrom2 in the given sense
+ * with max nb_pairs trials. nb_pairs is updated accordingly
+ *
+ * Performs local alignment searches between this and chrom2 around randomly
+ * drawn pairs of points.
+ * The minimum score will be generated according to align_fun_shape and
+ * associated parameters for each pair of points.
+ * The parameter nb_pairs will be updated according to how many trials
+ * were necessary for an alignment to be found.
+ *
+ * The sense of the searched alignment can be either DIRECT, INDIRECT or
+ * BOTH_SENSE.
+ * In the latter case, the sense will be randomly drawn (uniformly between
+ * DIRECT and INDIRECT) for each pair of points.
+ */
+VisAVis* Dna::search_alignment(Dna* chrom2, int32_t& nb_pairs,
+                               AlignmentSense sense) {
+  VisAVis* alignment = NULL;
+  // Which sense (direct or indirect)
+  AlignmentSense cur_sense = sense;
+  // Minimum alignement score needed to recombine (stochastic)
+  int16_t needed_score;
+
+  for (; nb_pairs > 0; nb_pairs--) {
+    ///////////////////////////////////////
+    //  1) Draw random sense (if needed) //
+    ///////////////////////////////////////
+    if (sense == BOTH_SENSES) {
+      cur_sense = (indiv_->mut_prng_->random() < 0.5) ? DIRECT : INDIRECT;
+    }
+
+    /////////////////////////////////////////////////////
+    // 2) Determine the minimum alignment score needed //
+    /////////////////////////////////////////////////////
+    if (indiv_->align_fun_shape() == LINEAR) {
+      needed_score = static_cast<int16_t>(
+          ceil(indiv_->align_lin_min() +
+               indiv_->mut_prng_->random() *
+               (indiv_->align_lin_max() -
+                indiv_->align_lin_min())));
+    }
+    else {
+      // I want the probability of rearrangement for an alignment of score
+      // <score> to be prob = 1 / (1 + exp(-(score-mean_score)/lambda))
+      // The score needed for a rearrangement to take place with a given
+      // random drawing is hence
+      // needed_score = ceil(-lambda * log(1/rand - 1) + mean)
+      needed_score = static_cast<int16_t>(
+          ceil(-indiv_->align_sigm_lambda() *
+               log(1 / indiv_->mut_prng_->random() - 1) +
+               indiv_->align_sigm_mean()));
+      if (needed_score < 0) needed_score = 0;
+    }
+
+    ///////////////////////////////////////////////////////////////
+    // 3) Determine where to look for an alignement (draw seeds) //
+    ///////////////////////////////////////////////////////////////
+    int32_t seed1 = indiv_->mut_prng_->random(length_);
+    int32_t seed2 = indiv_->mut_prng_->random(chrom2->length());
+
+    ////////////////////////////////////////////////////////////////////
+    // 3) Test the existence of an alignment with a high enough score //
+    ////////////////////////////////////////////////////////////////////
+    if (cur_sense == DIRECT) {
+      alignment = Alignment::search_alignment_direct(this, seed1,
+                                                     chrom2, seed2,
+                                                     needed_score);
+      if (alignment != NULL) {
+        return alignment;
+      }
+    }
+    else { // if (cur_sense = INDIRECT)
+      alignment = Alignment::search_alignment_indirect(this, seed1,
+                                                       chrom2, seed2,
+                                                       needed_score);
+      if (alignment != NULL) {
+        return alignment;
+      }
+    }
+  }
+
+  return NULL;
+}
+
+/**
+ * \brief Looks for an alignment between this and chrom2 in the given sense
+ *  around the given positions
+ *
+ *  Performs local alignment searches between this and chrom2 around the given
+ *  positions
+ *  The minimum score will be generated according to align_fun_shape and
+ *  associated parameters for each pair of points.
+ *  The parameter nb_pairs will be updated according to how many trials were
+ *  necessary for an alignment to be found.
+ *
+ *  The sense of the searched alignment can be either DIRECT, INDIRECT or
+ *  BOTH_SENSE.
+ *  In the latter case, the sense will be randomly drawn (uniformly between
+ *  DIRECT and INDIRECT) for each pair of points.
+ */
+VisAVis* Dna::search_alignment_around_positions(Dna* chrom2,
+                                                int32_t chrom1_pos_1,
+                                                int32_t chrom2_pos_1,
+                                                AlignmentSense sense,
+                                                int8_t& search_sense) {
+  VisAVis* alignment = NULL;
+  VisAVis* tmp_alignment = NULL;
+  // Which sense (direct or indirect)
+  AlignmentSense cur_sense = sense;
+  // Minimum alignement score needed to recombine (stochastic)
+  int16_t needed_score;
+  int32_t chrom1_pos_for_research;
+  int32_t chrom2_pos_for_research;
+  int32_t size_between_two_alignments = 3 * indiv_->align_w_zone_h_len();
+
+  ///////////////////////////////////////
+  //  1) Draw random sense (if needed) //
+  ///////////////////////////////////////
+  if (sense == BOTH_SENSES) {
+    printf("WARNING : Alignment could not be searched in both senses "
+               "in %s:%d\n", __FILE__, __LINE__);
+    return (NULL);
+  }
+
+  /////////////////////////////////////////////////////
+  // 2) Determine the minimum alignment score needed //
+  /////////////////////////////////////////////////////
+  if (indiv_->align_fun_shape() == LINEAR) {
+    needed_score = static_cast<int16_t>(
+        ceil(indiv_->align_lin_min() +
+             indiv_->mut_prng_->random() *
+             (indiv_->align_lin_max() -
+              indiv_->align_lin_min())));
+  }
+  else {
+    // I want the probability of rearrangement for an alignment of score
+    // <score> to be prob = 1 / (1 + exp(-(score-mean_score)/lambda))
+    // The score needed for a rearrangement to take place with a given
+    // random drawing is hence
+    // needed_score = ceil(-lambda * log(1/rand - 1) + mean)
+    needed_score = static_cast<int16_t>(
+        ceil(-indiv_->align_sigm_lambda() *
+             log(1 / indiv_->mut_prng_->random() - 1) +
+             indiv_->align_sigm_mean()));
+    if (needed_score < 0) needed_score = 0;
+  }
+
+  /////////////////////////////////////////////////////////
+  // 3) Determine the sense by which the research begins //
+  /////////////////////////////////////////////////////////
+  int16_t first_research_sense = (indiv_->mut_prng_->random() < 0.5) ? 1 : -1;
+  int16_t second_research_sense = -1 * first_research_sense;
+
+  /////////////////////////////////////////////////////////////////////////////
+  // 4) Test the first sense for the existence of an alignment with a high
+  //    enough score
+  /////////////////////////////////////////////////////////////////////////////
+  chrom1_pos_for_research = chrom1_pos_1;
+  chrom2_pos_for_research = chrom2_pos_1;
+  int16_t i = 0;
+
+  while (indiv_->mut_prng_->random() < 1 - exp_m_->repl_HT_detach_rate()) {
+    chrom1_pos_for_research =
+        Utils::mod(chrom1_pos_for_research +
+                   first_research_sense * size_between_two_alignments,
+                   this->length());
+    if (cur_sense == DIRECT) {
+      chrom2_pos_for_research =
+          Utils::mod(chrom2_pos_for_research +
+                     first_research_sense * size_between_two_alignments,
+                     chrom2->length());
+      tmp_alignment =
+          Alignment::search_alignment_direct(this, chrom1_pos_for_research,
+                                             chrom2, chrom2_pos_for_research,
+                                             needed_score);
+    }
+    else { // if (cur_sense = INDIRECT)
+      chrom2_pos_for_research =
+          Utils::mod(chrom2_pos_for_research -
+                     first_research_sense * size_between_two_alignments,
+                     chrom2->length());
+      tmp_alignment =
+          Alignment::search_alignment_indirect(this, chrom1_pos_for_research,
+                                               chrom2, chrom2_pos_for_research,
+                                               needed_score);
+    }
+
+    if (tmp_alignment == NULL) {
+      if (alignment != NULL) {
+        search_sense = first_research_sense;
+        return alignment;
+      }
+      else {
+        break;
+      }
+    }
+    else {
+      if (alignment != NULL) {
+        alignment->copy(tmp_alignment);
+      }
+      else {
+        alignment = new VisAVis(*tmp_alignment);
+      }
+      delete tmp_alignment;
+      chrom1_pos_for_research = alignment->i_1();
+      chrom2_pos_for_research = alignment->i_2();
+    }
+    i++;
+  }
+
+  if (alignment != NULL) {
+    search_sense = first_research_sense;
+    return alignment;
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+  // 5) Test the second sense for the existence of an alignment with a high
+  //    enough score
+  /////////////////////////////////////////////////////////////////////////////
+  alignment = NULL;
+  chrom1_pos_for_research = chrom1_pos_1;
+  chrom2_pos_for_research = chrom2_pos_1;
+  i = 0;
+  while (indiv_->mut_prng_->random() < 1 - exp_m_->repl_HT_detach_rate()) {
+    chrom1_pos_for_research =
+        Utils::mod(chrom1_pos_for_research +
+                   second_research_sense * size_between_two_alignments,
+                   this->length());
+    if (cur_sense == DIRECT) {
+      chrom2_pos_for_research =
+          Utils::mod(chrom2_pos_for_research +
+                     second_research_sense * size_between_two_alignments,
+                     chrom2->length());
+      tmp_alignment =
+          Alignment::search_alignment_direct(this, chrom1_pos_for_research,
+                                             chrom2, chrom2_pos_for_research,
+                                             needed_score);
+    }
+    else { // if (cur_sense = INDIRECT)
+      chrom2_pos_for_research =
+          Utils::mod(chrom2_pos_for_research -
+                     second_research_sense * size_between_two_alignments,
+                     chrom2->length());
+      tmp_alignment =
+          Alignment::search_alignment_indirect(this, chrom1_pos_for_research,
+                                               chrom2, chrom2_pos_for_research,
+                                               needed_score);
+    }
+
+    if (tmp_alignment == NULL) {
+      if (alignment != NULL) {
+        search_sense = second_research_sense;
+        return alignment;
+      }
+      else {
+        break;
+      }
+    }
+    else {
+      if (alignment != NULL) {
+        alignment->copy(tmp_alignment);
+      }
+      else {
+        alignment = new VisAVis(*tmp_alignment);
+      }
+      delete tmp_alignment;
+      chrom1_pos_for_research = alignment->i_1();
+      chrom2_pos_for_research = alignment->i_2();
+    }
+    i++;
+  }
+  if (alignment != NULL) {
+    search_sense = second_research_sense;
+    return alignment;
+  }
+
+  return NULL;
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+/**
+ * Extract the sequence going from pos_1 (included) to pos_2 (excluded)
+ * into a new standalone genetic unit.
+ * Promoter lists are created / updated accordingly
+ */
+void Dna::ABCDE_to_ADCBE(int32_t pos_B, int32_t pos_C, int32_t pos_D,
+                         int32_t pos_E) {
+  // Rearrange the sequence from ABCDE to ADCBE (complex translocation
+  // of segment defined between positions pos_B and pos_D)
+  //
+  // Segments are identified by pos_x values as shown below.
+  //
+  // TODO(dpa) CHECK THIS !!!
+  // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF???
+  //
+  //         A      B        C       D       E
+  //      |----->=======[>=======>-------[>-------|        =>
+  //          pos_B   pos_C    pos_D   pos_E
+  //
+  //                         |
+  //                         V
+  //
+  //         A      D        C       B        E
+  //      |----->-------[>=======>=======[>-------|
+  // Check points' order and range
+  assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D &&
+         pos_E <= length_);
+
+  // Compute segment lengths
+  int32_t len_A = pos_B;
+  int32_t len_B = pos_C - pos_B;
+  int32_t len_C = pos_D - pos_C;
+  int32_t len_D = pos_E - pos_D;
+  int32_t len_E = length_ - pos_E;
+  int32_t len_AD = len_A + len_D;
+  int32_t len_ADC = len_AD + len_C;
+  int32_t len_ADCB = len_ADC + len_B;
+
+  // Create new sequence
+  char* new_genome = new char[nb_blocks_ * BLOCK_SIZE];
+
+  memcpy(new_genome, data_, len_A * sizeof(char));
+  memcpy(&new_genome[len_A], &data_[pos_D], len_D * sizeof(char));
+  memcpy(&new_genome[len_AD], &data_[pos_C], len_C * sizeof(char));
+  memcpy(&new_genome[len_ADC], &data_[pos_B], len_B * sizeof(char));
+  memcpy(&new_genome[len_ADCB], &data_[pos_E], len_E * sizeof(char));
+  new_genome[length_] = '\0';
+
+  // Replace sequence
+  // NB : The size of the genome doesn't change. Therefore, we don't nee
+  // to update length_ and nb_blocks_
+  delete[] data_;
+  data_ = new_genome;
+
+
+  // ========== Update promoter list ==========
+  if (length_ >= PROM_SIZE) {
+    // Remove promoters that include a breakpoint
+    gen_unit_->remove_promoters_around(pos_B);
+    gen_unit_->remove_promoters_around(pos_C);
+    gen_unit_->remove_promoters_around(pos_D);
+    gen_unit_->remove_promoters_around(pos_E);
+
+    // Create temporary lists for promoters to move and/or invert
+    Promoters2Strands promoters_B = {{},
+                                     {}};
+    Promoters2Strands promoters_C = {{},
+                                     {}};
+    Promoters2Strands promoters_D = {{},
+                                     {}};
+
+    // Extract promoters that are totally included in each segment to be moved
+    // and shift them to their new positions
+    if (len_B >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B);
+      GeneticUnit::shift_promoters(promoters_B, len_D + len_C,
+                                   gen_unit_->dna()->length());
+    }
+    if (len_C >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C);
+      GeneticUnit::shift_promoters(promoters_C, len_D - len_B,
+                                   gen_unit_->dna()->length());
+    }
+    if (len_D >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D);
+      GeneticUnit::shift_promoters(promoters_D, -len_B - len_C,
+                                   gen_unit_->dna()->length());
+    }
+
+    // Reinsert the shifted promoters
+    gen_unit_->insert_promoters(promoters_B);
+    gen_unit_->insert_promoters(promoters_C);
+    gen_unit_->insert_promoters(promoters_D);
+
+    // 5) Look for new promoters including a breakpoint
+    gen_unit_->look_for_new_promoters_around(len_A);
+    gen_unit_->look_for_new_promoters_around(len_AD);
+    gen_unit_->look_for_new_promoters_around(len_ADC);
+    gen_unit_->look_for_new_promoters_around(len_ADCB);
+  }
+}
+
+void Dna::ABCDE_to_ADBpCpE(int32_t pos_B, int32_t pos_C, int32_t pos_D,
+                           int32_t pos_E) {
+  // Rearrange the sequence from ABCDE to ADBpCpE (complex translocation
+  // with inversion of segment defined between positions pos_B and pos_D)
+  // Bp (resp Cp) stands for inverted B (resp C)
+  //
+  // Segments are identified by pos_x values as shown below.
+  //
+  // TODO(dpa) CHECK THIS !!!
+  // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF???
+  //
+  //         A      B        C       D        E
+  //      |----->=======[>=======>-------<]-------|
+  //          pos_B   pos_C    pos_D   pos_E
+  //
+  //                         |
+  //                         V
+  //
+  //         A      D        Bp      Cp       E
+  //      |----->-------<]=======<=======<]-------|
+
+
+  // Check points' order and range
+  assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D &&
+                                                           pos_E <= length_);
+
+  // Compute segment lengths
+  int32_t len_A = pos_B;
+  int32_t len_B = pos_C - pos_B;
+  int32_t len_C = pos_D - pos_C;
+  int32_t len_D = pos_E - pos_D;
+  int32_t len_E = length_ - pos_E;
+  int32_t len_AD = len_A + len_D;
+  int32_t len_ADB = len_AD + len_B;
+  int32_t len_ADBC = len_ADB + len_C;
+
+  // Create new sequence
+  char* new_genome = new char[nb_blocks_ * BLOCK_SIZE];
+
+  // Copy segments A and D
+  memcpy(new_genome, data_, len_A * sizeof(char));
+  memcpy(&new_genome[len_A], &data_[pos_D], len_D * sizeof(char));
+
+
+  // Build Bp and put it in the new genome
+  char* inverted_segment = new char[len_B + 1];
+
+//#pragma simd
+//#pragma distribute_point
+  for (int32_t i = 0, j = pos_C - 1; i < len_B; i++, j--) {
+    if (data_[j] == '0') inverted_segment[i] = '1';
+    else inverted_segment[i] = '0';
+  }
+  inverted_segment[len_B] = '\0';
+
+  memcpy(&new_genome[len_AD], inverted_segment, len_B * sizeof(char));
+
+  delete[] inverted_segment;
+
+
+  // Build Cp and put it in the new genome
+  inverted_segment = new char[len_C + 1];
+
+//#pragma simd
+//#pragma distribute_point
+  for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) {
+    if (data_[j] == '0') inverted_segment[i] = '1';
+    else inverted_segment[i] = '0';
+  }
+  inverted_segment[len_C] = '\0';
+
+  memcpy(&new_genome[len_ADB], inverted_segment, len_C * sizeof(char));
+
+  delete[] inverted_segment;
+
+  // Copy segment E into the new genome
+  memcpy(&new_genome[len_ADBC], &data_[pos_E], len_E * sizeof(char));
+  new_genome[length_] = '\0';
+
+
+  // Replace sequence
+  delete[] data_;
+  data_ = new_genome;
+
+
+  // ========== Update promoter list ==========
+  if (length_ >= PROM_SIZE) {
+    // Remove promoters that include a breakpoint
+    gen_unit_->remove_promoters_around(pos_B);
+    gen_unit_->remove_promoters_around(pos_C);
+    gen_unit_->remove_promoters_around(pos_D);
+    gen_unit_->remove_promoters_around(pos_E);
+
+    // Create temporary lists for promoters to move and/or invert
+    Promoters2Strands promoters_B = {{},
+                                     {}};
+    Promoters2Strands promoters_C = {{},
+                                     {}};
+    Promoters2Strands promoters_D = {{},
+                                     {}};
+
+    // 2) Extract promoters that are totally included in each segment to be
+    //    moved (B, C and D)
+    if (len_B >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B);
+    }
+    if (len_C >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C);
+    }
+    if (len_D >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D);
+    }
+
+    // 3a) Invert promoters of segments B and C
+    GeneticUnit::invert_promoters(promoters_B, pos_B, pos_C);
+    GeneticUnit::invert_promoters(promoters_C, pos_C, pos_D);
+
+    // 3b) Shift these promoters positions
+    GeneticUnit::shift_promoters(promoters_B, len_D,
+                                 gen_unit_->dna()->length());
+    GeneticUnit::shift_promoters(promoters_C, len_D,
+                                 gen_unit_->dna()->length());
+    GeneticUnit::shift_promoters(promoters_D, -len_B - len_C,
+                                 gen_unit_->dna()->length());
+
+    // 4) Reinsert the shifted promoters
+    gen_unit_->insert_promoters(promoters_C);
+    gen_unit_->insert_promoters(promoters_B);
+    gen_unit_->insert_promoters(promoters_D);
+
+    // 5) Look for new promoters including a breakpoint
+    gen_unit_->look_for_new_promoters_around(len_A);
+    gen_unit_->look_for_new_promoters_around(len_AD);
+    gen_unit_->look_for_new_promoters_around(len_ADB);
+    gen_unit_->look_for_new_promoters_around(len_ADBC);
+  }
+}
+
+void Dna::ABCDE_to_ACpDpBE(int32_t pos_B, int32_t pos_C, int32_t pos_D,
+                           int32_t pos_E) {
+  // Rearrange the sequence from ABCDE to ACpDpBE (complex translocation with
+  // inversion of segment defined between positions pos_C and pos_E)
+  // Cp (resp Dp) stands for inverted C (resp D)
+  //
+  // Segments are identified by pos_x values as shown below.
+  //
+  // TODO(dpa) CHECK THIS !!!
+  // WARNING : Segment D includes nucleotide at pos_E // NOTE : WTF???
+  //
+  //         A      B        C       D       E
+  //      |----<]-------->=======[>=======>-------|
+  //          pos_B    pos_C    pos_D   pos_E
+  //
+  //                         |
+  //                         V
+  //
+  //          A       C'      D'       B       E
+  //       |-----<]=======>=======<]------->-------|
+
+
+  // Check points' order and range
+  assert(pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D &&
+                                                           pos_E <= length_);
+
+  // Compute segment lengths
+  int32_t len_A = pos_B;
+  int32_t len_B = pos_C - pos_B;
+  int32_t len_C = pos_D - pos_C;
+  int32_t len_D = pos_E - pos_D;
+  int32_t len_E = length_ - pos_E;
+  int32_t len_AC = len_A + len_C;
+  int32_t len_ACD = len_AC + len_D;
+  int32_t len_ACDB = len_ACD + len_B;
+
+  // Create new sequence
+  char* new_genome = new char[nb_blocks_ * BLOCK_SIZE];
+
+  // Copy segment A
+  memcpy(new_genome, data_, len_A * sizeof(char));
+
+
+  // Build Cp and put it in the new genome
+  char* inverted_segment = new char[len_C + 1];
+
+#pragma simd
+#pragma distribute_point
+  for (int32_t i = 0, j = pos_D - 1; i < len_C; i++, j--) {
+    if (data_[j] == '0') inverted_segment[i] = '1';
+    else inverted_segment[i] = '0';
+  }
+  inverted_segment[len_C] = '\0';
+
+  memcpy(&new_genome[len_A], inverted_segment, len_C * sizeof(char));
+
+  delete[] inverted_segment;
+
+
+  // Build Dp and put it in the new genome
+  inverted_segment = new char[len_D + 1];
+
+#pragma simd
+#pragma distribute_point
+  for (int32_t i = 0, j = pos_E - 1; i < len_D; i++, j--) {
+    if (data_[j] == '0') inverted_segment[i] = '1';
+    else inverted_segment[i] = '0';
+  }
+  inverted_segment[len_D] = '\0';
+
+  memcpy(&new_genome[len_AC], inverted_segment, len_D * sizeof(char));
+
+  delete[] inverted_segment;
+
+  // Copy segments B and E
+  memcpy(&new_genome[len_ACD], &data_[pos_B], len_B * sizeof(char));
+  memcpy(&new_genome[len_ACDB], &data_[pos_E], len_E * sizeof(char));
+  new_genome[length_] = '\0';
+
+
+  // Replace sequence
+  delete[] data_;
+  data_ = new_genome;
+
+
+  // ========== Update promoter list ==========
+  // 1) Remove promoters that include a breakpoint
+  // 2) Extract promoters that are totally included in each segment to be
+  //    moved (B, C and D)
+  // 3) Shift (and invert when needed) these promoters positions
+  // 4) Reinsert the shifted promoters
+  // 5) Look for new promoters including a breakpoint
+  if (length_ >= PROM_SIZE) {
+    // 1) Remove promoters that include a breakpoint
+    gen_unit_->remove_promoters_around(pos_B);
+    gen_unit_->remove_promoters_around(pos_C);
+    gen_unit_->remove_promoters_around(pos_D);
+    gen_unit_->remove_promoters_around(pos_E);
+
+    // Create temporary lists for promoters to move and/or invert
+    Promoters2Strands promoters_B = {{},
+                                     {}};
+    Promoters2Strands promoters_C = {{},
+                                     {}};
+    Promoters2Strands promoters_D = {{},
+                                     {}};
+
+    // 2) Extract promoters that are totally included in each segment to be
+    //    moved (B, C and D)
+    if (len_B >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B);
+    }
+    if (len_C >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_C, pos_D, promoters_C);
+    }
+    if (len_D >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_D, pos_E, promoters_D);
+    }
+
+    // 3a) Invert promoters of segments C and D
+    GeneticUnit::invert_promoters(promoters_C, pos_C, pos_D);
+    GeneticUnit::invert_promoters(promoters_D, pos_D, pos_E);
+
+    // 3b) Shift these promoters positions
+    GeneticUnit::shift_promoters(promoters_B, len_C + len_D,
+                                 gen_unit_->dna()->length());
+    GeneticUnit::shift_promoters(promoters_C, -len_B,
+                                 gen_unit_->dna()->length());
+    GeneticUnit::shift_promoters(promoters_D, -len_B,
+                                 gen_unit_->dna()->length());
+
+    // 4) Reinsert the shifted promoters
+    gen_unit_->insert_promoters(promoters_B);
+    gen_unit_->insert_promoters(promoters_D);
+    gen_unit_->insert_promoters(promoters_C);
+
+    // 5) Look for new promoters including a breakpoint
+    gen_unit_->look_for_new_promoters_around(len_A);
+    gen_unit_->look_for_new_promoters_around(len_AC);
+    gen_unit_->look_for_new_promoters_around(len_ACD);
+    gen_unit_->look_for_new_promoters_around(len_ACDB);
+  }
+}
+
+void Dna::inter_GU_ABCDE_to_ACDBE(int32_t pos_B, int32_t pos_C, int32_t pos_E) {
+  // Check points' order and range
+  assert((pos_B >= 0 && pos_C >= pos_B) && (pos_E >= 0));
+
+  if (pos_B != pos_C) {
+    // Useful values
+    Individual* indiv = indiv_;
+    GeneticUnit& chromosome = indiv->genetic_unit_nonconst(0);
+    GeneticUnit& plasmid = indiv->genetic_unit_nonconst(1);
+    GeneticUnit& destination_GU = (gen_unit_ == &chromosome) ?
+                                  plasmid : chromosome;
+
+    // Compute segment lengths
+    int32_t len_A = pos_B;
+    int32_t len_B = pos_C - pos_B;
+    int32_t len_C = length_ - pos_C;
+    int32_t len_D = pos_E;
+    int32_t len_E = destination_GU.dna()->length() - pos_E;
+    int32_t len_AC = len_A + len_C;
+    int32_t len_DB = len_D + len_B;
+    int32_t len_DBE = len_DB + len_E;
+
+
+    // Create the new sequence of this genetic unit
+    int32_t tmp = ae_string::nb_blocks(len_AC);
+    char* new_sequence_this = new char[tmp * BLOCK_SIZE];
+
+    memcpy(new_sequence_this, data_, len_A * sizeof(char));
+    memcpy(&new_sequence_this[len_A], &data_[pos_C], len_C * sizeof(char));
+    new_sequence_this[len_AC] = '\0';
+
+    // Create the new sequence of the destination genetic unit
+    tmp = ae_string::nb_blocks(len_DBE) * BLOCK_SIZE;
+    char* new_sequence_dest = new char[tmp];
+    const char* dest_GU_former_seq = destination_GU.dna()->data();
+
+    memcpy(new_sequence_dest, dest_GU_former_seq, len_D * sizeof(char));
+    memcpy(&new_sequence_dest[len_D], &data_[pos_B], len_B * sizeof(char));
+    memcpy(&new_sequence_dest[len_DB], &dest_GU_former_seq[pos_E],
+           len_E * sizeof(char));
+    new_sequence_dest[len_DBE] = '\0';
+
+
+
+    // ========== Update promoter list ==========
+    // 1) Remove promoters that include a breakpoint
+    // 2) Extract promoters that are totally included in each segment to be
+    //    moved (B, C and E)
+    // NB : Sequences have to be updated at this stage in order to have the
+    // correct lengths when managing new promoter positions
+    // ........
+    // 3) Shift these promoters positions
+    // 4) Reinsert the shifted promoters
+    // 5) Look for new promoters including a breakpoint
+
+
+    // 1) Remove promoters that include a breakpoint
+    gen_unit_->remove_promoters_around(pos_B);
+    gen_unit_->remove_promoters_around(pos_C);
+    destination_GU.remove_promoters_around(pos_E);
+
+    // Create temporary lists for promoters to move and/or invert
+    Promoters2Strands promoters_B = {{},
+                                     {}};
+
+    // 2) Extract promoters that are totally included in each segment to be
+    // moved (B, C and E)
+    if (len_B >= PROM_SIZE) {
+      gen_unit_->extract_promoters_included_in(pos_B, pos_C, promoters_B);
+    }
+
+    // ========== Replace sequences ==========
+    set_data(new_sequence_this, len_AC);
+    destination_GU.dna()->set_data(new_sequence_dest, len_DBE);
+
+    // 3) Shift these promoters positions
+    GeneticUnit::shift_promoters(promoters_B, len_D - len_A,
+                                 destination_GU.dna()->length());
+
+    // Reassign promoters to their new genetic unit
+    for (auto& strand : {LEADING, LAGGING})
+      for (auto& rna : promoters_B[strand])
+        rna.set_genetic_unit(&destination_GU);
+
+    // Shift the promoters of sequences C and E
+    gen_unit_->move_all_promoters_after(pos_C, -len_B);
+    destination_GU.move_all_promoters_after(pos_E, len_B);
+
+    // 4) Reinsert the shifted promoters
+    destination_GU.insert_promoters(promoters_B);
+
+    // 5) Look for new promoters including a breakpoint
+    gen_unit_->look_for_new_promoters_around(0);
+    gen_unit_->look_for_new_promoters_around(len_A);
+    destination_GU.look_for_new_promoters_around(0);
+    destination_GU.look_for_new_promoters_around(len_D);
+    destination_GU.look_for_new_promoters_around(len_DB);
+  }
+}
+
+void Dna::inter_GU_ABCDE_to_BDCAE(int32_t pos_B, int32_t pos_C, int32_t pos_E) {
+  // Check points' order and range
+  assert((pos_B >= 0 && pos_C >= pos_B) && (pos_E >= 0));
+
+  // Compute segment lengths
+  int32_t len_A = pos_B;
+  int32_t len_B = pos_C - pos_B;
+  int32_t len_C = length_ - pos_C;
+  //~ int32_t len_ABC = length_;
+  int32_t len_DA = len_A + pos_E;
+
+  inter_GU_ABCDE_to_ACDBE(0, pos_B, pos_E);
+  inter_GU_ABCDE_to_ACDBE(len_B, (len_B + len_C), len_DA);
+}
+
+}// namespace aevol
diff --git a/src/libaevol/Dna.h b/src/libaevol/Dna.h
new file mode 100644
index 0000000..3eaee84
--- /dev/null
+++ b/src/libaevol/Dna.h
@@ -0,0 +1,201 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_DNA_H_
+#define AEVOL_DNA_H_
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cinttypes>
+#include <cstdlib>
+
+#include <list>
+#include <vector>
+#include <memory>
+
+#include <zlib.h>
+
+#include "ae_enums.h"
+#include "Mutation.h"
+#include "PointMutation.h"
+#include "SmallInsertion.h"
+#include "SmallDeletion.h"
+#include "Duplication.h"
+#include "Deletion.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "ae_string.h"
+#include "JumpingMT.h"
+
+namespace aevol {
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+class Individual;
+class GeneticUnit;
+class VisAVis;
+class Rna;
+class Rna_R;
+
+class Dna : public ae_string {
+ public :
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  Dna() = delete;
+  Dna(const Dna &) = delete;
+  Dna(GeneticUnit* gen_unit,
+         int32_t length,
+         std::shared_ptr<JumpingMT> prng);
+  Dna(GeneticUnit* gen_unit, const Dna &model);
+  Dna(GeneticUnit* gen_unit, Dna * const parent_dna);
+  Dna(GeneticUnit* gen_unit, char* seq, int32_t length);
+  Dna(GeneticUnit* gen_unit, gzFile backup_file);
+  Dna(GeneticUnit* gen_unit, char* organism_file_name);
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~Dna();
+
+  // =================================================================
+  //                              Accessors
+  // =================================================================
+  GeneticUnit* genetic_unit() const { return gen_unit_; }
+  Individual* indiv() const { return indiv_; }
+
+  // WARNING : creates a new char[...] (up to you to delete it!)
+  char* subsequence(int32_t from, int32_t to, Strand strand) const;
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  // Perform all the mutations (local mutations, rearrangements and transfer)
+  int32_t perform_mutations(int32_t parent_id);
+
+  // Perform all the local mutations (point mutations and indels)
+  int32_t do_small_mutations();
+
+  // Perform all the chromosomal rearrangements (duplications, deletions,
+  // translocations and inversions)
+  int32_t do_rearrangements();
+  int32_t do_rearrangements_with_align();
+
+  // Perform all transfer (with insertion and with replacement)
+  int32_t do_transfer(int32_t parent_id);
+
+  // Perform a single local mutation at a random position
+  PointMutation* do_switch();
+  SmallInsertion* do_small_insertion();
+  SmallDeletion* do_small_deletion();
+
+  // Perform a single local mutation at a specified position
+  // (useful to replay the evolution)
+  bool do_switch(int32_t pos);
+  bool do_small_insertion(int32_t pos, int16_t nb_insert, char * seq);
+  bool do_small_deletion(int32_t pos, int16_t nb_del);
+
+  // Perform a single rearrangement at random positions
+  Duplication* do_duplication();
+  Deletion* do_deletion();
+  Translocation* do_translocation();
+  Mutation* do_inter_GU_translocation();
+  Inversion* do_inversion();
+  Mutation* do_insertion(const char* seq_to_insert, int32_t seq_length = -1);
+
+  // Perform a single rearrangement at specified positions
+  bool do_duplication(int32_t pos_1, int32_t pos_2, int32_t pos_3);
+  bool do_deletion(int32_t pos_1, int32_t pos_2);
+  bool do_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3,
+                        int32_t pos_4, bool invert);
+  bool do_inter_GU_translocation(int32_t pos_1, int32_t pos_2, int32_t pos_3,
+                                 int32_t pos_4, bool invert);
+  bool do_inversion(int32_t pos_1, int32_t pos_2);
+  bool do_insertion(int32_t pos, const char* seq_to_insert, int32_t seq_length);
+
+  // Perform transfer with the search of alignments
+  Mutation* do_ins_HT(int32_t parent_id);
+  Mutation* do_repl_HT(int32_t parent_id);
+
+  // Perform a single transfer at specified positions
+  bool do_ins_HT(int32_t pos, const char* seq_to_insert, int32_t seq_length);
+  bool do_repl_HT(int32_t pos1, int32_t pos2,
+                  const char* seq_to_insert, int32_t seq_length);
+
+  GeneticUnit*  extract_into_new_GU(int32_t pos_1, int32_t pos_2);
+  GeneticUnit*  copy_into_new_GU(int32_t pos_1, int32_t pos_2) const;
+  void insert_GU(GeneticUnit* GU_to_insert, int32_t pos_B, int32_t pos_D,
+                 bool invert);
+
+  VisAVis* search_alignment(Dna* chrom2, int32_t& nb_pairs,
+                            AlignmentSense sense);
+  VisAVis* search_alignment_around_positions(
+      Dna* chrom2, int32_t chrom1_pos_1, int32_t chrom1_pos_2,
+      AlignmentSense sense, int8_t& search_sense);
+
+  // Undergo a specific mutation
+  // useful when we replay the evolution
+  void undergo_this_mutation(const Mutation& mut);
+
+  void compute_statistical_data();
+
+  #ifndef __REGUL
+  static void set_GU(std::vector<std::list<Rna>> rna_list, const GeneticUnit* GU);
+  #else
+  static void set_GU(std::vector<std::list<Rna_R>> rna_list, const GeneticUnit* GU);
+  #endif
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  void ABCDE_to_ADCBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E);
+  void ABCDE_to_ADBpCpE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E);
+  void ABCDE_to_ACpDpBE(int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E);
+  void inter_GU_ABCDE_to_ACDBE(int32_t pos_B, int32_t pos_C, int32_t pos_E);
+  void inter_GU_ABCDE_to_BDCAE(int32_t pos_B, int32_t pos_C, int32_t pos_E);
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  ExpManager* exp_m_;
+  Individual* indiv_;
+  GeneticUnit* gen_unit_; // Genetic unit which the dna sequence belongs to
+};
+
+// =====================================================================
+//                          Accessors definitions
+// =====================================================================
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+
+} // namespace aevol
+#endif // AEVOL_DNA_H_
diff --git a/src/libaevol/DnaReplicationReport.cpp b/src/libaevol/DnaReplicationReport.cpp
new file mode 100644
index 0000000..a76574c
--- /dev/null
+++ b/src/libaevol/DnaReplicationReport.cpp
@@ -0,0 +1,327 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#include <cinttypes>
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include "DnaReplicationReport.h"
+#include "InsertionHT.h"
+#include "ReplacementHT.h"
+
+#include "Mutation.h"
+#include "Duplication.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "Deletion.h"
+#include "SmallDeletion.h"
+#include "PointMutation.h"
+#include "SmallInsertion.h"
+
+namespace aevol {
+
+DnaReplicationReport::DnaReplicationReport(const DnaReplicationReport& other) {
+  for (auto& ht : other.ht_)
+    add_HT(ht->Clone());
+  for (auto& rear : other.rearrangements_)
+    add_rear(rear->Clone());
+  for (auto& mut : other.mutations_)
+    add_local_mut(mut->Clone());
+}
+
+int32_t DnaReplicationReport::nb(MutationType t)  const {
+  switch (t) {
+    case S_MUT:
+      assert(mutations_.size() ==
+             static_cast<size_t>(nb_mut_[SWITCH] +
+                                 nb_mut_[S_INS] +
+                                 nb_mut_[S_DEL]));
+      return mutations_.size();
+    case REARR:
+      assert(rearrangements_.size() ==
+             static_cast<size_t>(nb_mut_[DUPL] +
+                                 nb_mut_[DEL] +
+                                 nb_mut_[TRANS] +
+                                 nb_mut_[INV]));
+      return rearrangements_.size();
+    case H_T:
+      assert(ht_.size() ==
+             static_cast<size_t>(nb_mut_[INS_HT] +
+                                 nb_mut_[REPL_HT]));
+      return ht_.size();
+    case INDEL:
+      return nb_mut_[S_INS] + nb_mut_[S_DEL];
+    default: // Simple mutation type.
+      return nb_mut_[t];
+  };
+}
+
+void DnaReplicationReport::add_mut(Mutation* mut) {
+  if (mut->is_local_mut()) {
+    add_local_mut(mut);
+  }
+  else if (mut->is_rear()) {
+    add_rear(mut);
+  }
+  else if (mut->is_ht()) {
+    add_HT(mut);
+  }
+}
+
+void DnaReplicationReport::add_local_mut(Mutation* mut) {
+  assert(mut->is_local_mut());
+  std::unique_ptr<const LocalMutation> cmut = nullptr;
+  switch(mut->mut_type()) {
+    case SWITCH:
+#if __cplusplus == 201103L
+      cmut = make_unique<const PointMutation>(static_cast<PointMutation&>(*mut));
+#else
+      cmut = std::make_unique<const PointMutation>(static_cast<PointMutation&>(*mut));
+#endif
+      break;
+    case S_DEL:
+#if __cplusplus == 201103L
+      cmut = make_unique<const SmallDeletion>(static_cast<SmallDeletion&>(*mut));
+#else
+      cmut = std::make_unique<const SmallDeletion>(static_cast<SmallDeletion&>(*mut));
+#endif
+      break;
+    case S_INS:
+#if __cplusplus == 201103L
+      cmut = make_unique<const SmallInsertion>(static_cast<SmallInsertion&>(*mut));
+#else
+      cmut = std::make_unique<const SmallInsertion>(static_cast<SmallInsertion&>(*mut));
+#endif
+      break;
+    default:
+#if __cplusplus == 201103L
+      cmut = make_unique<const SmallInsertion>(static_cast<SmallInsertion&>(*mut));
+#else
+      cmut = std::make_unique<const SmallInsertion>(static_cast<SmallInsertion&>(*mut));
+#endif
+      break;
+  }
+  mutations_.push_back(std::move(cmut));
+  nb_mut_[mut->mut_type()]++;
+}
+
+void DnaReplicationReport::add_rear(Mutation* mut) {
+  assert(mut->is_rear());
+
+  std::unique_ptr<const Rearrangement> cmut = nullptr;
+  switch(mut->mut_type()) {
+    case DUPL:
+#if __cplusplus == 201103L
+      cmut = make_unique<const Duplication>(static_cast<Duplication&>(*mut));
+#else
+      cmut = std::make_unique<const Duplication>(static_cast<Duplication&>(*mut));
+#endif
+      break;
+    case DEL:
+#if __cplusplus == 201103L
+      cmut = make_unique<const Deletion>(static_cast<Deletion&>(*mut));
+#else
+      cmut = std::make_unique<const Deletion>(static_cast<Deletion&>(*mut));
+#endif
+      break;
+    case TRANS:
+#if __cplusplus == 201103L
+      cmut = make_unique<const Translocation>(static_cast<Translocation&>(*mut));
+#else
+      cmut = std::make_unique<const Translocation>(static_cast<Translocation&>(*mut));
+#endif
+      break;
+    case INV:
+#if __cplusplus == 201103L
+      cmut = make_unique<const Inversion>(static_cast<Inversion&>(*mut));
+#else
+      cmut = std::make_unique<const Inversion>(static_cast<Inversion&>(*mut));
+#endif
+      break;
+    default:
+#if __cplusplus == 201103L
+      cmut = make_unique<const Inversion>(static_cast<Inversion&>(*mut));
+#else
+      cmut = std::make_unique<const Inversion>(static_cast<Inversion&>(*mut));
+#endif
+      break;
+  }
+  rearrangements_.push_back(std::move(cmut));
+  nb_mut_[mut->mut_type()]++;
+}
+
+void DnaReplicationReport::add_HT(Mutation* mut) {
+  assert(mut->is_ht());
+
+  std::unique_ptr<const HorizontalTransfer> cmut = nullptr;
+  switch(mut->mut_type()) {
+    case INS_HT:
+#if __cplusplus == 201103L
+      cmut = make_unique<const InsertionHT>(static_cast<InsertionHT&>(*mut));
+#else
+      cmut = std::make_unique<const InsertionHT>(static_cast<InsertionHT&>(*mut));
+#endif
+      break;
+    case REPL_HT:
+#if __cplusplus == 201103L
+      cmut = make_unique<const ReplacementHT>(static_cast<ReplacementHT&>(*mut));
+#else
+      cmut = std::make_unique<const ReplacementHT>(static_cast<ReplacementHT&>(*mut));
+#endif
+      break;
+    default:
+#if __cplusplus == 201103L
+      cmut = make_unique<const ReplacementHT>(static_cast<ReplacementHT&>(*mut));
+#else
+      cmut = std::make_unique<const ReplacementHT>(static_cast<ReplacementHT&>(*mut));
+#endif
+      break;
+  }
+  ht_.push_back(std::move(cmut));
+  nb_mut_[mut->mut_type()]++;
+}
+
+
+/// Useful when we inspect a tree file
+/// because stats are not saved in the file.
+void DnaReplicationReport::compute_stats()
+{
+  nb_mut_[SWITCH] = 0;
+  nb_mut_[S_INS]  = 0;
+  nb_mut_[S_DEL]  = 0;
+  nb_mut_[DUPL]   = 0;
+  nb_mut_[DEL]    = 0;
+  nb_mut_[TRANS]  = 0;
+  nb_mut_[INV]    = 0;
+  nb_mut_[INS_HT] = 0;
+  nb_mut_[REPL_HT]= 0;
+
+  for (const auto& ht : ht_) {
+    assert(ht->mut_type() == INS_HT or
+           ht->mut_type() == REPL_HT);
+    nb_mut_[ht->mut_type()]++;
+  }
+
+  for (const auto& rear : rearrangements_) {
+    assert(rear->mut_type() == DUPL or
+           rear->mut_type() == DEL or
+           rear->mut_type() == TRANS or
+           rear->mut_type() == INV);
+    nb_mut_[rear->mut_type()]++;
+  }
+
+  for (const auto& mut : mutations_) {
+    assert(mut->mut_type() == SWITCH or
+           mut->mut_type() == S_INS or
+           mut->mut_type() == S_DEL);
+    nb_mut_[mut->mut_type()]++;
+  }
+}
+
+void DnaReplicationReport::write_to_tree_file(gzFile tree_file) const {
+  // Write the mutations and rearrangements undergone during replication
+  // Store HT
+  int32_t nb_HT = nb(H_T);
+  gzwrite(tree_file, &nb_HT, sizeof(nb_HT));
+  for (const auto& ht : ht_) {
+    switch(ht->mut_type()) {
+      case INS_HT:
+        ht->save(tree_file);
+        break;
+      case REPL_HT:
+        ht->save(tree_file);
+        break;
+      default:
+        ht->save(tree_file);
+        break;
+    }
+  }
+
+
+  // Store rearrangements
+  int32_t nb_rears = nb(REARR);
+  gzwrite(tree_file, &nb_rears, sizeof(nb_rears));
+  for (const auto& rear : rearrangements_) {
+    switch(rear->mut_type()) {
+      case DUPL:
+        rear->save(tree_file);
+        break;
+      case DEL:
+        rear->save(tree_file);
+        break;
+      case TRANS:
+        rear->save(tree_file);
+        break;
+      case INV:
+        rear->save(tree_file);
+        break;
+      default:
+        rear->save(tree_file);
+        break;
+    }
+  }
+
+  // Store mutations
+  int32_t nb_muts = nb(S_MUT);
+  gzwrite(tree_file, &nb_muts, sizeof(nb_muts));
+  for (const auto& mut : mutations_)
+    switch(mut->mut_type()) {
+      case SWITCH:
+        mut->save(tree_file);
+        break;
+      case S_DEL:
+        mut->save(tree_file);
+        break;
+      case S_INS:
+        mut->save(tree_file);
+        break;
+      default:
+        mut->save(tree_file);
+        break;
+    }
+}
+
+void DnaReplicationReport::read_from_tree_file(gzFile tree_file) {
+  int32_t nb_rears, nb_muts, nb_HT;
+
+  gzread(tree_file, &nb_HT, sizeof(nb_HT));
+  for (int i = 0 ; i < nb_HT ; i++)
+    add_HT(Mutation::Load(tree_file));
+
+  gzread(tree_file, &nb_rears, sizeof(nb_rears));
+  for (int i = 0 ; i < nb_rears ; i++)
+    add_rear(Mutation::Load(tree_file));
+
+  gzread(tree_file, &nb_muts, sizeof(nb_muts));
+  for(int i = 0 ; i < nb_muts ; i++)
+    add_mut(Mutation::Load(tree_file));
+}
+} // namespace aevol
diff --git a/src/libaevol/DnaReplicationReport.h b/src/libaevol/DnaReplicationReport.h
new file mode 100644
index 0000000..309a15b
--- /dev/null
+++ b/src/libaevol/DnaReplicationReport.h
@@ -0,0 +1,99 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_DNA_REPLICATION_REPORT_H_
+#define AEVOL_DNA_REPLICATION_REPORT_H_
+
+#include <list>
+#include <memory>
+
+#include "Mutation.h"
+#include "LocalMutation.h"
+#include "HorizontalTransfer.h"
+#include "Rearrangement.h"
+
+namespace aevol {
+
+class Dna;
+
+class DnaReplicationReport {
+  friend class Dna;
+
+ public :
+
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  DnaReplicationReport() = default;
+  DnaReplicationReport(const DnaReplicationReport&);
+  DnaReplicationReport(DnaReplicationReport&&) = delete;
+
+  // =================================================================
+  //                             Destructor
+  // =================================================================
+  ~DnaReplicationReport() = default;
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  DnaReplicationReport& operator=(const DnaReplicationReport& other) = delete;
+  /// Move assignment
+  DnaReplicationReport& operator=(DnaReplicationReport&& other) = delete;
+
+  // Accessors
+  const std::list<std::unique_ptr<const LocalMutation>>& mutations() const {
+    return mutations_;
+  };
+  const std::list<std::unique_ptr<const Rearrangement>>& rearrangements() const {
+    return rearrangements_;
+  };
+  const std::list<std::unique_ptr<const HorizontalTransfer>>& HT() const {
+    return ht_;
+  };
+  int32_t nb(MutationType t) const;
+
+  // Public Methods
+  void compute_stats();  // useful when we inspect a tree file
+  void add_mut(Mutation* mut);
+  void add_local_mut(Mutation* mut);
+  void add_rear(Mutation* mut);
+  void add_HT(Mutation* mut);
+
+  void write_to_tree_file(gzFile tree_file) const;
+  void read_from_tree_file(gzFile tree_file);
+
+ protected :
+  /// Lists of mutations, rearrangements and undergone
+  std::list<std::unique_ptr<const LocalMutation>> mutations_;
+  std::list<std::unique_ptr<const Rearrangement>> rearrangements_;
+  std::list<std::unique_ptr<const HorizontalTransfer>> ht_;
+  // Number of mutations/rearrangements/HT of each (simple) type undergone
+  int32_t nb_mut_[10] = {0,0,0,0,0,0,0,0,0,0};
+};
+
+} // namespace aevol
+#endif // AEVOL_DNA_REPLICATION_REPORT_H_
diff --git a/src/libaevol/Dump.cpp b/src/libaevol/Dump.cpp
new file mode 100644
index 0000000..51db080
--- /dev/null
+++ b/src/libaevol/Dump.cpp
@@ -0,0 +1,242 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <stdio.h>
+#include <sys/stat.h>
+#include <err.h>
+#include <errno.h>
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Dump.h"
+#include "ExpManager.h"
+#include "Individual.h"
+#include "GeneticUnit.h"
+#ifdef __REGUL
+  #include "raevol/Protein_R.h"
+#endif
+
+namespace aevol {
+
+
+
+
+
+//##############################################################################
+//                                                                             #
+//                                Class Dump                                #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Dump::Dump(ExpManager * exp_m)
+{
+  exp_m_ = exp_m;
+  int status;
+  status = mkdir("stats/dump/", 0755);
+  if ((status == -1) && (errno != EEXIST))
+  {
+    err(EXIT_FAILURE, "stats/dump/");
+  }
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+
+const char* DUMP_FORMAT = "\t%d\t%d\t%f\n";
+
+void Dump::write_current_generation_dump()
+{
+  //  printf("Begin dump\n");
+  write_fitness_total();
+  write_secretion_present();
+  write_fitness_metabolic();
+  write_secreted_amount();
+  write_individual_probes();
+  //  printf("End dump\n");
+}
+
+void Dump::write_fitness_total()
+{
+  sprintf(filename_buffer,
+      "stats/dump/fitness_total_" TIMESTEP_FORMAT ".out",
+      AeTime::time());
+  current_file = fopen(filename_buffer, "w+");
+  double** map = exp_m_->world()->total_fitness_grid();
+  fprintf(current_file, "#\tX\tY\tfitness_total(X, Y)\n");
+
+  for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++)
+    {
+      fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]);
+    }
+    fprintf(current_file, "\n");
+  }
+  fflush(current_file);
+  fclose(current_file);
+
+  // Has been allocated in World::total_fitness_grid()
+  for (int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    delete [] map[x];
+  }
+  delete [] map;
+}
+
+void Dump::write_secreted_amount()
+{
+  sprintf(filename_buffer,
+      "stats/dump/secreted_amount_" TIMESTEP_FORMAT ".out",
+      AeTime::time()) ;
+  current_file = fopen(filename_buffer, "w+");
+
+  double** map = exp_m_->world()->secreted_amount_grid();
+  fprintf(current_file, "#\tX\tY\tsecreted_amount(X, Y)\n");
+  for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++)
+    {
+      fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]);
+    }
+    fprintf(current_file, "\n");
+  }
+  fflush(current_file);
+  fclose(current_file);
+  for (int16_t x = 0; x < exp_m_->grid_width() ; x++)
+  {
+    delete [] map[x];
+  }
+  delete [] map;
+}
+
+void Dump::write_fitness_metabolic()
+{
+  sprintf(filename_buffer,
+      "stats/dump/fitness_metabolic_" TIMESTEP_FORMAT ".out",
+      AeTime::time());
+  current_file = fopen(filename_buffer, "w+");
+
+  double** map = exp_m_->world()->metabolic_fitness_grid();
+  fprintf(current_file, "#\tX\tY\tfitness_metabolic(X, Y)\n");
+  for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++)
+    {
+      fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]);
+    }
+    fprintf(current_file, "\n");
+  }
+  fflush(current_file);
+  fclose(current_file);
+  for (int16_t x = 0; x < exp_m_->grid_width() ; x++)
+  {
+    delete [] map[x];
+  }
+  delete [] map;
+}
+
+void Dump::write_secretion_present()
+{
+  sprintf(filename_buffer,
+      "stats/dump/secretion_present_" TIMESTEP_FORMAT ".out",
+      AeTime::time());
+  current_file = fopen(filename_buffer, "w+");
+
+  double** map = exp_m_->world()->secretion_present_grid();
+  fprintf(current_file, "#\tX\tY\tsecretion_present(X, Y)\n");
+  for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++)
+      fprintf(current_file, DUMP_FORMAT, x, y, map [x][y]);
+    fprintf(current_file, "\n");
+  }
+  fflush(current_file);
+  fclose(current_file);
+  for (int16_t x = 0; x < exp_m_->grid_width() ; x++)
+  {
+    delete [] map[x];
+  }
+  delete [] map;
+}
+
+/*!
+  \brief Write the probes (5 int and 5 double) of each individual at a given generation
+*/
+void Dump::write_individual_probes()
+{
+  sprintf(filename_buffer,
+      "stats/dump/individual_probes_" TIMESTEP_FORMAT ".out",
+      AeTime::time());
+  current_file = fopen(filename_buffer, "w");
+
+  fprintf(current_file, "Id\tInt_Probe_1\tInt_Probe_2\tInt_Probe_3\tInt_Probe_4\tInt_Probe_5\tDouble_Probe_1\tDouble_Probe_2\tDouble_Probe_3\tDouble_Probe_4\tDouble_Probe_5\n");
+
+  for(int16_t x = 0 ; x < exp_m_->grid_width() ; x++)
+  {
+    for(int16_t y = 0 ; y < exp_m_->grid_height() ; y++)
+    {
+      fprintf(current_file, "%" PRId32,
+          exp_m_->world()->indiv_at(x,y)->id());
+      int32_t* int_probes =
+          exp_m_->world()->indiv_at(x,y)->int_probes();
+      double* double_probes =
+          exp_m_->world()->indiv_at(x,y)->double_probes();
+      for(int16_t i=0; i<5; i++)
+        fprintf(current_file, "\t%" PRId32, int_probes[i]);
+      for(int16_t i=0; i<5; i++)
+        fprintf(current_file, "\t%f", double_probes[i]);
+      fprintf(current_file, "\n");
+    }
+  }
+  fflush(current_file);
+  fclose(current_file);
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/Dump.h
similarity index 63%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/Dump.h
index fdb64b7..b776965 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/Dump.h
@@ -3,118 +3,95 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
 
+#ifndef AEVOL_DUMP_H_
+#define AEVOL_DUMP_H_
 
 // =================================================================
-//                            Project Files
+//                              Libraries
 // =================================================================
-#include <ae_object.h>
-
-
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
+class ExpManager;
 
+constexpr int32_t AE_DUMP_FILENAME_BUFSIZE_ = 256;
 
-
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
-
-
-class ae_dump : public ae_object
-{  
- public :
-  
+class Dump
+{
+ public:
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  Dump(ExpManager* exp_m);
+
   // =================================================================
   //                             Destructors
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+  virtual ~Dump() {}
+
   // =================================================================
   //                              Accessors
   // =================================================================
-  
+
   // =================================================================
   //                            Public Methods
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  void write_current_generation_dump();
+  void write_fitness_total();
+  void write_secretion_present();
+  void write_fitness_metabolic();
+  void write_secreted_amount();
+  void write_individual_probes();
+
   // =================================================================
   //                           Public Attributes
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-};
+ protected:
+  FILE* current_file;
+  char  filename_buffer[AE_DUMP_FILENAME_BUFSIZE_];
 
+  // =================================================================
+  //                         Forbidden Constructors
+  // =================================================================
+  Dump(const Dump &model) = delete;
+
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  ExpManager* exp_m_;
+};
 
 // =====================================================================
 //                          Accessors' definitions
@@ -123,4 +100,7 @@ class ae_dump : public ae_object
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+
+} // namespace aevol
+
+#endif // AEVOL_DUMP_H_
diff --git a/src/libaevol/f_line.cpp b/src/libaevol/Duplication.cpp
similarity index 53%
copy from src/libaevol/f_line.cpp
copy to src/libaevol/Duplication.cpp
index 710c0a4..8659d2f 100644
--- a/src/libaevol/f_line.cpp
+++ b/src/libaevol/Duplication.cpp
@@ -3,74 +3,76 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-//##############################################################################
-//                                                                             #
-//                             Class f_line                                    #
-//                                                                             #
-//##############################################################################
-
-
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
+//
+// ****************************************************************************
 
-f_line::f_line( void )
-{
-  nb_words = 0;
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Duplication.h"
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Duplication::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = DUPL;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos1_, sizeof(pos1_));
+  gzwrite(backup_file, &pos2_, sizeof(pos2_));
+  gzwrite(backup_file, &pos3_, sizeof(pos3_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, &align_score_, sizeof(align_score_));
 }
 
+void Duplication::load(gzFile backup_file) {
+  gzread(backup_file, &pos1_, sizeof(pos1_));
+  gzread(backup_file, &pos2_, sizeof(pos2_));
+  gzread(backup_file, &pos3_, sizeof(pos3_));
+  gzread(backup_file, &length_, sizeof(length_));
+  gzread(backup_file, &align_score_, sizeof(align_score_));
+}
 
-// =================================================================
-//                             Destructors
-// =================================================================
+void Duplication::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos1(), pos2(), pos3(), -1, -1,
+          align_score(), -1, length_, -1);
+}
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/Duplication.h b/src/libaevol/Duplication.h
new file mode 100644
index 0000000..4fdc495
--- /dev/null
+++ b/src/libaevol/Duplication.h
@@ -0,0 +1,104 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_DUPLICATION_H_
+#define AEVOL_DUPLICATION_H_
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "Rearrangement.h"
+#include "sys/types.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class Duplication : public Rearrangement {
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Duplication() = default; //< Default ctor
+  Duplication(const Duplication&) = default; //< Copy ctor
+  Duplication(Duplication&&) = delete; //< Move ctor
+  Duplication(int32_t pos1, int32_t pos2, int32_t pos3, int32_t length, int16_t align_score = -1) :
+               pos1_{pos1},  pos2_{pos2},  pos3_{pos3},length_{length}, align_score_{align_score} {}
+
+  virtual Mutation* Clone() const override { return new Duplication(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Duplication() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  Duplication& operator=(const Duplication& other) = default;
+
+  /// Move assignment
+  Duplication& operator=(Duplication&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override { return DUPL; };
+  int32_t pos1() const { return pos1_; }
+  int32_t pos2() const { return pos2_; }
+  int32_t pos3() const { return pos3_; }
+  int32_t length() const { return length_; }
+  int16_t align_score() const { return align_score_; }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos1_, pos2_, pos3_;
+  int32_t length_;
+  int16_t align_score_ = -1;
+};
+
+} // namespace aevol
+#endif //AEVOL_DUPLICATION_H_
diff --git a/src/libaevol/ExpManager.cpp b/src/libaevol/ExpManager.cpp
new file mode 100644
index 0000000..79c68f9
--- /dev/null
+++ b/src/libaevol/ExpManager.cpp
@@ -0,0 +1,676 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <err.h>
+#include <cerrno>
+#include <sys/stat.h>
+
+#include <list>
+#include <iostream>
+
+#include <zlib.h>
+
+#include "ExpManager.h"
+#include "Individual.h"
+
+#ifdef __REGUL
+#include "raevol/Individual_R.h"
+#endif
+
+#ifdef __TRACING__
+#include "ae_logger.h"
+#include<chrono>
+
+using namespace std::chrono;
+
+unordered_map<int,unordered_multiset<string>> ae_logger::logMap;
+string ae_logger::logFile = "logger_csv.log";
+mutex ae_logger::loggerMtx;
+#endif
+
+using std::cout;
+using std::endl;
+
+
+namespace aevol {
+//##############################################################################
+//                                                                             #
+//                               Class ExpManager                              #
+//                                                                             #
+//##############################################################################
+
+// ===========================================================================
+//                        Definition of static attributes
+// ===========================================================================
+
+// ===========================================================================
+//                                 Constructors
+// ===========================================================================
+ExpManager::ExpManager() {
+  // ------------------------------------------------------ Experimental setup
+  exp_s_ = new ExpSetup(this);
+
+  // ------------------------------------------------------------------- World
+  world_ = nullptr;
+
+  // ---------------------------------------------------------- Output manager
+  output_m_ = new OutputManager(this);
+
+
+  // -------------------------------- Timestep up to which we want to simulate
+  t_end_ = 0;
+
+
+  // ------------------------------------------------------------- Quit signal
+  quit_signal_received_ = false;
+}
+
+// ===========================================================================
+//                                  Destructor
+// ===========================================================================
+ExpManager::~ExpManager() noexcept
+{
+  delete exp_s_;
+  delete output_m_;
+  delete world_;
+}
+
+// ===========================================================================
+//                                   Algorithms
+// ===========================================================================
+
+// ===========================================================================
+//                                 Public Methods
+// ===========================================================================
+void ExpManager::InitializeWorld(int16_t grid_width,
+                                     int16_t grid_height,
+                                     std::shared_ptr<JumpingMT> prng,
+                                     std::shared_ptr<JumpingMT> mut_prng,
+                                     std::shared_ptr<JumpingMT> stoch_prng,
+                                     Habitat& habitat,
+                                     bool share_phenotypic_target)
+{
+  world_ = new World();
+  world_->set_prng(prng);
+  world_->set_mut_prng(mut_prng);
+  world_->set_stoch_prng(stoch_prng);
+  world_->InitGrid(grid_width, grid_height, habitat, share_phenotypic_target);
+}
+
+/*!
+  \brief Save the experiment
+*/
+void ExpManager::Save() const
+{
+  WriteSetupFiles();
+  output_m_->write_current_generation_outputs();
+}
+
+/*!
+  \brief Save all the static data (the data that is constant throughout
+  a simulation)
+
+  Save
+    * The experimental setup
+    * The output profile
+
+  These are written in the current directory in gzipped binary files
+  as well as plain text files
+  This data should be saved once and for all when the experiment is created.
+  There is no need to save this data in the middle of a simulation since it
+  is constant throughout the experiment.
+
+  \see load(int64_t t0,
+            char* exp_setup_file_name,
+            char* out_prof_file_name,
+            char* pop_file_name,
+            char* sel_file_name,
+            char* world_file_name,
+            bool verbose)
+  \see WriteDynamicFiles()
+*/
+void ExpManager::WriteSetupFiles() const
+{
+  // 1) Create missing directories
+  create_missing_directories();
+
+  // 2) Open setup files (experimental setup and output profile)
+  gzFile exp_s_file, out_p_file;
+  open_setup_files(exp_s_file, out_p_file, AeTime::time(), "w");
+
+  // 4) Write setup data
+  exp_s_->write_setup_file(exp_s_file);
+  output_m_->WriteSetupFile(out_p_file);
+
+  // 5) Close setup files
+  close_setup_files(exp_s_file, out_p_file);
+}
+
+/*!
+  \brief Save all the dynamic data (the data that changes over the simulation)
+
+  Save the state of
+    * The population
+    * The world
+    * The PRNG (random generator) used for the selection
+
+  These are written in the current directory in gzipped binary files
+  whose names are appended with the current generation number.
+
+  WARNING: The experimental setup and output profile are *not* saved. These
+  should be saved once and for all when the experiment is created.
+
+  \see load(int64_t t0,
+            char* exp_setup_file_name,
+            char* out_prof_file_name,
+            char* pop_file_name,
+            char* sel_file_name,
+            char* world_file_name,
+            bool verbose)
+  \see WriteSetupFiles()
+*/
+void ExpManager::WriteDynamicFiles() const
+{
+  // Create missing directories
+  create_missing_directories();
+
+  // Open backup files
+  gzFile sel_file, world_file;
+  open_backup_files(sel_file, world_file, AeTime::time(), "w");
+
+  // Save experiment
+  sel()->save(sel_file);
+  world_->save(world_file);
+
+  // Close backup files
+  close_backup_files(sel_file, world_file);
+}
+
+/*!
+  \brief Saves a complete copy of the experiment at the provided location.
+
+  Save both the setup (constant) and the backup (dynamic) files to the <dir>
+  directory. Dynamic file names will be appended with the <num_gener>
+
+  Static files (saved both as gzipped binary and plain text)
+    * The experimental setup
+    * The output profile
+
+  Dynamic files (saved as gzipped binary)
+    * The world
+    * The PRNG (random generator) used for the selection
+
+  \see load(int32_t first_gener,
+             char* exp_setup_file_name,
+             char* out_prof_file_name,
+             char* pop_file_name,
+             char* sel_file_name,
+             char* world_file_name,
+             bool verbose)
+  \see WriteSetupFiles()
+  \see WriteDynamicFiles()
+*/
+void ExpManager::Propagate(char* outdir) const {
+  // Reset timestep
+  int64_t propagated_timestep = AeTime::time();
+  int64_t timestep = 0;
+  AeTime::set_time(timestep);
+
+  // Create missing directories
+  create_missing_directories(outdir);
+
+  // Open setup files and backup files
+  gzFile exp_s_file, out_p_file, sel_file, world_file;
+  open_setup_files(exp_s_file, out_p_file, timestep, "w", outdir);
+  open_backup_files(sel_file, world_file, timestep, "w", outdir);
+
+  // Write setup data
+  exp_s_->write_setup_file(exp_s_file);
+  output_m_->WriteSetupFile(out_p_file);
+
+  // Write the state of selection and world into the backups
+  sel()->save(sel_file);
+  world_->save(world_file);
+
+  // Close setup and backup files
+  close_setup_files(exp_s_file, out_p_file);
+  close_backup_files(sel_file, world_file);
+
+  // Copy stats
+  output_m_->PropagateStats(outdir, propagated_timestep);
+
+  // Write last gener file
+  output_m_->WriteLastGenerFile(outdir);
+}
+
+void ExpManager::step_to_next_generation() {
+  // TODO <david.parsons at inria.fr> Apply phenotypic target variation and noise
+  world_->ApplyHabitatVariation();
+
+  // Take a step in time
+  AeTime::plusplus();
+
+  // Create the corresponding new generation
+  exp_s_->step_to_next_generation();
+
+  // Write statistical data and store phylogenetic data (tree)
+  output_m_->write_current_generation_outputs();
+}
+
+/*!
+  \brief Load an experiment with the provided files
+ */
+// TODO <david.parsons at inria.fr> check verbose (what does it do ?, is it consistent ?)
+void ExpManager::load(gzFile& exp_s_file,
+                      gzFile& exp_backup_file,
+                      gzFile& world_file,
+                      gzFile& out_p_file,
+                      bool verbose,
+                      bool to_be_run /*  = true */) {
+  // ---------------------------------------- Retrieve experimental setup data
+  printf("  Loading experimental setup...");
+  fflush(stdout);
+  exp_s_->load(exp_s_file, exp_backup_file, verbose);
+  printf(" OK\n");
+
+  if (FuzzyFactory::fuzzyFactory == NULL)
+    FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s_);
+
+
+  // ---------------------------------------------------------- Retrieve world
+  printf("  Loading world...");
+  fflush(stdout);
+  world_ = new World();
+  world_->load(world_file, this);
+  printf(" OK\n");
+
+  // --------------------------------------------- Retrieve output profile data
+  printf("  Loading output profile...");
+  fflush(stdout);
+  output_m_->load(out_p_file, verbose, to_be_run);
+  printf(" OK\n");
+
+  // -------------------------------------------- Link world and output profile
+  if (record_tree()) {
+    // TODO(dpa) Document this !!!
+    sel()->addObserver(tree(), NEW_INDIV);
+    sel()->addObserver(tree(), END_GENERATION);
+  }
+
+  // --------------------------------------------------- Recompute unsaved data
+  world_->evaluate_individuals();
+}
+
+
+/*!
+  \brief Load an experiment with default files from a given directory
+ */
+// TODO <david.parsons at inria.fr> check verbose (what does it do ?, is it consistent ?)
+void ExpManager::load(const char* dir,
+    int64_t t0, bool verbose, bool to_be_run /*  = true */) {
+  AeTime::set_time(t0);
+
+  // -------------------------------------------------------------------------
+  // Open setup files and backup files
+  // -------------------------------------------------------------------------
+  gzFile exp_s_file, out_p_file;
+  gzFile exp_backup_file, world_file;
+  open_setup_files(exp_s_file, out_p_file, t0, "r", dir);
+  open_backup_files(exp_backup_file, world_file, t0, "r", dir);
+
+
+  // -------------------------------------------------------------------------
+  // Load data from backup and parameter files
+  // -------------------------------------------------------------------------
+  load(exp_s_file, exp_backup_file,
+       world_file, out_p_file, verbose, to_be_run);
+
+
+  // -------------------------------------------------------------------------
+  // Close setup and backup files
+  // -------------------------------------------------------------------------
+  close_setup_files(exp_s_file, out_p_file);
+  close_backup_files(exp_backup_file, world_file);
+
+
+  if (FuzzyFactory::fuzzyFactory == NULL)
+    FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s_);
+  /*printf("Factory flavor %d : %d\n",
+         exp_s_->get_fuzzy_flavor(),
+         FuzzyFactory::fuzzyFactory->get_fuzzy_flavor());*/
+}
+
+
+/**
+ * \brief Load an experiment with the provided constitutive files
+ */
+// TODO <david.parsons at inria.fr> check verbose (what does it do ?, is it consistent ?)
+void ExpManager::load(int64_t t0,
+                          char* exp_setup_file_name,
+                          char* exp_backup_file_name,
+                          char* world_file_name,
+                          char* out_prof_file_name,
+                          bool verbose /*= false*/,
+                          bool to_be_run /*= true*/)
+{
+  AeTime::set_time(t0);
+
+  // ---------------------------------------------------------------------------
+  // Open files and check them
+  // ---------------------------------------------------------------------------
+  gzFile exp_setup_file = gzopen(exp_setup_file_name, "r");
+  gzFile out_prof_file = gzopen(out_prof_file_name, "r");
+  gzFile exp_backup_file = gzopen(exp_backup_file_name, "r");
+  gzFile world_file  = gzopen(world_file_name, "r");
+
+
+  if (exp_setup_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_setup_file_name);
+    exit(EXIT_FAILURE);
+  }
+  if (out_prof_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, out_prof_file_name);
+    exit(EXIT_FAILURE);
+  }
+  if (exp_backup_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_backup_file_name);
+    exit(EXIT_FAILURE);
+  }
+  if (world_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, world_file_name);
+    exit(EXIT_FAILURE);
+  }
+
+
+  // ---------------------------------------------------------------------------
+  // Actually load data
+  // ---------------------------------------------------------------------------
+  load(exp_setup_file, exp_backup_file, world_file, out_prof_file,
+       verbose, to_be_run);
+
+
+  // ---------------------------------------------------------------------------
+  // Close setup and backup files
+  // ---------------------------------------------------------------------------
+  gzclose(exp_setup_file);
+  gzclose(exp_backup_file);
+  gzclose(world_file);
+  gzclose(out_prof_file);
+}
+
+/**
+ * Run the simulation
+ */
+void ExpManager::run_evolution()
+{
+  // We are running a simulation.
+  // Save the setup files to keep track of the setup history
+  WriteSetupFiles();
+
+#ifdef __TRACING__
+  ae_logger::init("logger_csv.log");
+  /*printf("Launching TRACING...\n");*/
+#else
+  /*printf("Launching NOT TRACING...\n");*/
+#endif
+
+#ifdef __TRACING__
+  high_resolution_clock::time_point t_t1 = high_resolution_clock::now();
+  high_resolution_clock::time_point t_t2,t1,t2;
+#endif
+
+  if (exp_s_->first_regul())
+    if (AeTime::time() < 10000 || AeTime::time() > 20000)
+      regul_or_not_ = true;
+    else
+      regul_or_not_ = false;
+  else
+    if (AeTime::time() < 10000 || AeTime::time() > 20000)
+      regul_or_not_ = false;
+    else
+      regul_or_not_ = true;
+
+  // For each generation
+  while (true) { // termination condition is into the loop
+    printf("============================== %" PRId64 " ==============================\n",
+           AeTime::time());
+    printf("  Best individual's distance to target (metabolic) : %f\n",
+           best_indiv()->dist_to_target_by_feature(METABOLISM));
+
+   if (AeTime::time() >= t_end_ or quit_signal_received())
+      break;
+
+#ifdef __X11
+    display();
+#endif
+#ifdef __TRACING__
+    t1 = high_resolution_clock::now();
+#endif
+
+    // Take one step in the evolutionary loop
+    if (AeTime::time() == 10000 || AeTime::time() == 20000)
+      regul_or_not_ = !regul_or_not_;
+    step_to_next_generation();
+
+#ifdef __TRACING__
+    t2 = high_resolution_clock::now();
+    auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();
+    ae_logger::addLog(SELECTION,duration);
+    ae_logger::flush(AeTime::get_time());
+#endif
+  }
+
+#ifdef __TRACING__
+  t_t2 = high_resolution_clock::now();
+  auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t_t2 - t_t1 ).count();
+  ae_logger::addLog(TOTAL,duration);
+  ae_logger::flush(AeTime::get_time());
+#endif
+
+  output_m_->flush();
+  printf("================================================================\n");
+  printf("  The run is finished. \n");
+  printf("  Printing the final best individual into " BEST_LAST_ORG_FNAME "\n");
+  FILE* org_file = fopen(BEST_LAST_ORG_FNAME, "w");
+  fputs(best_indiv()->genetic_unit_sequence(0), org_file);
+  fclose(org_file);
+}
+
+void ExpManager::update_best()
+{
+  world_->update_best();
+}
+
+// ===========================================================================
+//                                Protected Methods
+// ===========================================================================
+void ExpManager::create_missing_directories(const char* dir /*= "."*/) const
+{
+  char cur_dir_name[255];
+  int status;
+
+  // Base directory
+  status = mkdir(dir, 0755);
+  if ((status == -1) && (errno != EEXIST))
+  {
+    err(EXIT_FAILURE, cur_dir_name, errno);
+  }
+
+  // Experimental setup
+  sprintf(cur_dir_name, "%s/" EXP_S_DIR, dir);
+  status = mkdir(cur_dir_name, 0755);
+  if ((status == -1) && (errno != EEXIST))
+  {
+    err(EXIT_FAILURE, cur_dir_name, errno);
+  }
+  // Output profile
+  sprintf(cur_dir_name, "%s/" OUT_P_DIR, dir);
+  status = mkdir(cur_dir_name, 0755);
+  if ((status == -1) && (errno != EEXIST))
+  {
+    err(EXIT_FAILURE, cur_dir_name, errno);
+  }
+  // World
+  sprintf(cur_dir_name, "%s/" WORLD_DIR, dir);
+  status = mkdir(cur_dir_name, 0755);
+  if (status == -1 && errno != EEXIST)
+  {
+    err(EXIT_FAILURE, cur_dir_name, errno);
+  }
+  // Stats
+  sprintf(cur_dir_name, "%s/" STATS_DIR, dir);
+  status = mkdir(cur_dir_name, 0755);
+  if (status == -1 && errno != EEXIST)
+  {
+    err(EXIT_FAILURE, cur_dir_name, errno);
+  }
+}
+
+void ExpManager::open_backup_files(gzFile& exp_backup_file,
+                                       gzFile& world_file,
+                                       int64_t t,
+                                       const char mode[3],
+                                       const char* dir /*= "."*/) const
+{
+  assert(strcmp(mode, "w") == 0 or strcmp(mode, "r") == 0);
+
+  // -------------------------------------------------------------------------
+  // Generate backup file names for mandatory files.
+  // -------------------------------------------------------------------------
+  char exp_backup_file_name[255];
+  char world_file_name[255];
+
+  sprintf(exp_backup_file_name, "%s/" EXP_S_FNAME_FORMAT, dir, t);
+  sprintf(world_file_name, "%s/" WORLD_FNAME_FORMAT, dir, t);
+
+
+  // -------------------------------------------------------------------------
+  // Open backup files
+  // -------------------------------------------------------------------------
+  exp_backup_file = gzopen(exp_backup_file_name, mode);
+  world_file = gzopen(world_file_name, mode);
+
+
+  // -------------------------------------------------------------------------
+  // Check that files were correctly opened
+  // -------------------------------------------------------------------------
+  if (exp_backup_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n",
+            __FILE__, __LINE__, exp_backup_file_name);
+    exit(EXIT_FAILURE);
+  }
+  if (world_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n",
+            __FILE__, __LINE__, world_file_name);
+    exit(EXIT_FAILURE);
+  }
+}
+
+void ExpManager::close_backup_files(gzFile& exp_backup_file,
+                                        gzFile& world_file) const
+{
+  gzclose(exp_backup_file);
+  gzclose(world_file);
+}
+
+void ExpManager::open_setup_files(
+    gzFile& exp_s_file,
+    gzFile& out_p_file,
+    int64_t t,
+    const char mode[3],
+    const char* dir /*= "."*/) const
+{
+  // 1) Generate setup file names
+  char exp_s_file_name[255];
+  char out_p_file_name[255];
+
+  sprintf(exp_s_file_name, "%s/" EXP_S_CONST_FNAME_FORMAT, dir);
+  sprintf(out_p_file_name, "%s/" OUT_P_FNAME_FORMAT, dir);
+
+  // 2) Open backup files
+  exp_s_file = gzopen(exp_s_file_name, mode);
+  out_p_file = gzopen(out_p_file_name, mode);
+
+  // 3) Check that files were correctly opened
+  if (exp_s_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n",
+            __FILE__, __LINE__, exp_s_file_name);
+    exit(EXIT_FAILURE);
+  }
+  if (out_p_file == Z_NULL)
+  {
+    printf("%s:%d: error: could not open backup file %s\n",
+            __FILE__, __LINE__, out_p_file_name);
+    exit(EXIT_FAILURE);
+  }
+}
+
+void ExpManager::close_setup_files(gzFile& exp_s_file,
+                                       gzFile& out_p_file) const
+{
+  gzclose(exp_s_file);
+  gzclose(out_p_file);
+}
+
+// ===========================================================================
+//                               Non inline accessors
+// ===========================================================================
+Individual* ExpManager::indiv_by_id(int32_t id) const {
+  return world_->indiv_by_id(id);
+}
+
+Individual* ExpManager::indiv_by_rank(int32_t rank) const {
+  return world_->indiv_by_id(rank);
+}
+
+/**
+ * Returns a list of all the individuals with their replication report
+ */
+std::list<std::pair<Individual*, ReplicationReport*>>
+    ExpManager::indivs_annotated() const {
+  std::list<std::pair<Individual*, ReplicationReport*>> annotated_list;
+  for (const auto& indiv : indivs()) {
+    annotated_list.emplace_back(indiv, tree() ?
+        tree()->report_by_index(AeTime::time(), indiv->id()) : nullptr);
+  }
+  return annotated_list;
+}
+
+
+} // namespace aevol
diff --git a/src/libaevol/ExpManager.h b/src/libaevol/ExpManager.h
new file mode 100644
index 0000000..67469e7
--- /dev/null
+++ b/src/libaevol/ExpManager.h
@@ -0,0 +1,239 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// =================================================================
+//                              Includes
+// =================================================================
+#ifndef AEVOL_EXP_MANAGER_H_
+#define AEVOL_EXP_MANAGER_H_
+
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+#include <list>
+
+#include "AeTime.h"
+#include "JumpingMT.h"
+#include "ExpSetup.h"
+#include "OutputManager.h"
+#include "World.h"
+#include "Observer.h"
+#include "ObservableEvent.h"
+
+namespace aevol {
+// =================================================================
+//                          Class declarations
+// =================================================================
+
+/// Allows for high-level experiment management. (This is Aevol's top-level class.)
+///
+/// An experiment manager allows one to... manage an experiment.
+/// It owns a population and an experimental_setup that can be loaded from a
+/// pair of aevol binary files (pop and exp_setup)
+class ExpManager : public Observer {
+ public:
+  // =======================================================================
+  //                                Constructors
+  // =======================================================================
+  ExpManager();
+
+  // =======================================================================
+  //                                Destructors
+  // =======================================================================
+  virtual ~ExpManager();
+
+  // =======================================================================
+  //                                 Algorithms
+  // =======================================================================
+
+  // =======================================================================
+  //                           Accessors: getters
+  // =======================================================================
+  ExpSetup* exp_s() const { return exp_s_; }
+  Selection* sel() const { return exp_s()->sel(); }
+  OutputManager* output_m() const { return output_m_; }
+  bool quit_signal_received() const { return quit_signal_received_; }
+  double selection_pressure() const { return sel()->selection_pressure(); }
+
+  // Spatial structure
+  World* world() const { return world_; }
+  int16_t grid_width() const { return world()->width(); }
+  int16_t grid_height() const { return world()->height(); }
+  GridCell*** grid() const { return world()->grid(); }
+
+  // Global settings
+  double repl_HT_detach_rate() const { return exp_s()->repl_HT_detach_rate(); }
+
+  // The ability to own a plasmid is a property of the individuals (allow_plasmids_) because it is used during mutations.
+  // However, the experimental setup's member variable with_plasmids_ indicates whether plasmids are used
+  // because the replication and loading/writting processes need this information.
+  // For now when plasmids are used each individual has one and only one plasmid (so these variables should always be
+  // equal), this may change in the future, though.
+  // Member variable with_plasmids_HT_ has been removed because the ability to transfer is evolvable and may thus depend
+  // on the plasmid itself
+
+  bool with_plasmids() const { return exp_s()->with_plasmids(); }
+  double prob_plasmid_HT() const { return exp_s()->prob_plasmid_HT(); }
+  double tune_donor_ability() const { return exp_s()->tune_donor_ability(); }
+  double tune_recipient_ability() const { return exp_s()->tune_recipient_ability(); }
+  bool swap_GUs() const { return exp_s()->swap_GUs(); }
+  bool with_secretion() const { return exp_s()->with_secretion(); }
+  double secretion_contrib_to_fitness() const { return exp_s()->secretion_contrib_to_fitness(); }
+  double secretion_cost() const { return exp_s()->secretion_cost(); }
+
+  // Accessors to population stuff
+  std::list<Individual*> indivs() const { return world()->indivs(); }
+  std::list<std::pair<Individual*, ReplicationReport*>> indivs_annotated()
+      const;
+  int32_t nb_indivs() const { return world()->nb_indivs(); }
+  Individual* best_indiv() const { return world()->best_indiv(); }
+  Individual* indiv_by_id(int32_t id) const;
+  Individual* indiv_by_rank(int32_t rank) const;
+
+  // Accessors to output manager stuff
+  int64_t backup_step() const { return output_m()->backup_step(); }
+  bool record_tree() const { return output_m()->record_tree(); }
+  int32_t tree_step() const { return static_cast<int32_t>(output_m()->tree_step()); }
+  Tree* tree() const { return output_m()->tree(); }
+
+  bool regul_or_not() const { return regul_or_not_; }
+
+  // =======================================================================
+  //                          Accessors: setters
+  // =======================================================================
+  void set_t_end(int64_t t_end) { t_end_ = t_end; }
+  void set_HT_ins_rate(double HT_ins_rate) {
+    exp_s_->set_HT_ins_rate(HT_ins_rate);
+  }
+  void set_HT_repl_rate(double HT_repl_rate) {
+    exp_s_->set_HT_repl_rate(HT_repl_rate);
+  }
+
+  // =======================================================================
+  //                                 Operators
+  // =======================================================================
+
+  // =======================================================================
+  //                               Public Methods
+  // =======================================================================
+  void InitializeWorld(int16_t grid_width,
+                       int16_t grid_height,
+                       std::shared_ptr<JumpingMT> prng,
+                       std::shared_ptr<JumpingMT> mut_prng,
+                       std::shared_ptr<JumpingMT> stoch_prng,
+                       Habitat& habitat,
+                       bool share_phenotypic_target);
+  void Save() const;
+  void WriteSetupFiles() const;
+  void WriteDynamicFiles() const;
+  void Propagate(char* outdir) const;
+  void load(int64_t first_gener, bool verbose = false, bool to_be_run = true) {
+    load(".", first_gener, verbose, to_be_run);
+  }
+  void load(const char* dir, int64_t t0,
+            bool verbose = false, bool to_be_run = true);
+  /// Load an experiment with default files from the current directory
+  void load(int64_t t0, char* exp_s_file, char* exp_backup_file,
+            char* sp_struct_file, char* out_p_file,
+            bool verbose = false, bool to_be_run = true);
+  void run_evolution();
+  virtual void display() {
+  }
+  void update_best();
+  void FillGridWithClones(Individual& dolly) {
+    world_->FillGridWithClones(dolly);
+  }
+  void update(Observable& o, ObservableEvent e, void* arg) override {
+  }
+
+ protected:
+  // =======================================================================
+  //                              Protected Methods
+  // =======================================================================
+  void step_to_next_generation();
+
+  void load(gzFile& exp_s_file,
+            gzFile& exp_backup_file,
+            gzFile& sp_struct_file,
+            gzFile& out_p_file,
+            bool verbose = false,
+            bool to_be_run = true);
+  void create_missing_directories(const char* dir = ".") const;
+  void open_backup_files(gzFile& sel_file,
+                         gzFile& sp_struct_file,
+                         int64_t t,
+                         const char mode[3],
+                         const char* dir = ".") const;
+  void close_backup_files(gzFile& sel_file,
+                          gzFile& sp_struct_file) const;
+  void open_setup_files(gzFile& exp_s_gzfile,
+                        gzFile& out_p_gzfile,
+                        int64_t t,
+                        const char mode[3],
+                        const char* dir = ".") const;
+  void close_setup_files(gzFile& exp_s_gzfile, gzFile& out_p_gzfile) const;
+
+  // =======================================================================
+  //                             Protected Attributes
+  // =======================================================================
+  /// Experimental setup
+  ExpSetup* exp_s_;
+
+  /// Spatial structure
+  World* world_;
+
+  /// Output manager
+  OutputManager* output_m_;
+
+  /// Time step up to which we want to simulate
+  int64_t t_end_;
+
+  /// Should the simulation be stopped? Set to true when ctrl-Q is received.
+  /// Will cause the simulation to be ended after the current time step is completed.
+  bool quit_signal_received_;
+
+  bool regul_or_not_;
+};
+
+// ===========================================================================
+//                             Getters' definitions
+// ===========================================================================
+
+// ===========================================================================
+//                             Setters' definitions
+// ===========================================================================
+
+// ===========================================================================
+//                            Operators' definitions
+// ===========================================================================
+
+// ===========================================================================
+//                         Inline methods' definition
+// ===========================================================================
+
+} // namespace aevol
+#endif // AEVOL_EXP_MANAGER_H_
diff --git a/src/libaevol/ExpManager_X11.cpp b/src/libaevol/ExpManager_X11.cpp
new file mode 100644
index 0000000..ee39220
--- /dev/null
+++ b/src/libaevol/ExpManager_X11.cpp
@@ -0,0 +1,1257 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+
+#include <list>
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "ExpManager_X11.h"
+#include "World.h"
+#include "Point.h"
+
+#include "X11Window.h"
+#include "Fuzzy.h"
+#include "HybridFuzzy.h"
+
+#ifdef __REGUL
+#include "raevol/Individual_R_X11.h"
+#include "HybridFuzzy.h"
+
+#else
+#include "Individual_X11.h"
+#endif
+
+namespace aevol {
+
+
+// XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent()
+// with this Predicate function as a work-around (ClientMessage events
+// are needed in order to catch "WM_DELETE_WINDOW")
+static Bool AlwaysTruePredicate (Display*, XEvent*, char*) { return True; }
+
+
+
+//##############################################################################
+//                                                                             #
+//                          Class ExpManager_X11                           #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+#ifdef __REGUL
+#define NB_WIN INT32_C(9) // Number of windows that can be showed => CDS, RNA, phenotype, ...
+#else
+#define NB_WIN INT32_C(9) // Number of windows that can be showed => CDS, RNA, phenotype, ...
+#endif
+
+// =================================================================
+//                             Constructors
+// =================================================================
+ExpManager_X11::ExpManager_X11() : ExpManager()
+{
+  // Basic initializations
+  win_ = NULL;
+  win_size_ = NULL;
+  win_pos_ = NULL;
+  win_name_ = NULL;
+
+  display_on_ = false;
+  handle_display_on_off_ = false;
+
+  // Initialize XLib stuff
+  display_ = XOpenDisplay(NULL);
+  if (display_ == NULL)
+  {
+    printf("ERROR:\tCould not open connection to X server.\n");
+    printf("\tIf you are using aevol through SSH, you may use ssh -X.\n");
+    exit(EXIT_FAILURE);
+  }
+  screen_ = XDefaultScreen(display_);
+  atoms_ = new Atom[2];
+  atoms_[0] = XInternAtom(display_, "WM_DELETE_WINDOW", False);
+  atoms_[1] = XInternAtom(display_, "WM_PROTOCOLS", False);
+  set_codes();
+}
+
+// =================================================================
+//                             Destructor
+// =================================================================
+ExpManager_X11::~ExpManager_X11()
+{
+  delete [] key_codes_;
+  delete [] atoms_;
+
+  for (int8_t i = 0 ; i < NB_WIN ; i++)
+  {
+    if (win_ != NULL)
+    {
+      if (win_[i] != NULL) delete win_[i];
+    }
+    if (win_size_ != NULL)
+    {
+      if (win_size_[i] != NULL) delete [] win_size_[i];
+    }
+    if (win_pos_ != NULL)
+    {
+      if (win_pos_[i] != NULL) delete [] win_pos_[i];
+    }
+  }
+  if (win_ != NULL) delete [] win_;
+
+  XCloseDisplay(display_);
+
+  if (win_name_ != NULL) delete [] win_name_;
+  if (win_size_ != NULL) delete [] win_size_;
+  if (win_pos_ != NULL) delete [] win_pos_;
+
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void ExpManager_X11::display()
+{
+  // ---------------------
+  // 1) Handle user events
+  // ---------------------
+  if (display_on_) handle_events();
+
+
+
+  // --------------------------------------------------
+  // 2) Handle signal that toggle the display on or off
+  // --------------------------------------------------
+  if (handle_display_on_off_)
+  {
+    handle_display_on_off_ = false;
+
+    if (display_on_)
+    // Display was "on", close all windows
+    // (after saving their current size and position)
+    {
+      for (int8_t num_win = 0 ; num_win < NB_WIN ; num_win++)
+      {
+        if (win_[num_win] != NULL)
+        {
+          // 1) Save current window position and size
+          Window aWindow; // Unused
+          int x_return, y_return;
+          int dest_x_return, dest_y_return;
+          unsigned int border_width_return, depth_return; // Unused
+          XGetGeometry(display_, win_[num_win]->window(), &aWindow,
+              &x_return, &y_return,
+              &win_size_[num_win][0], &win_size_[num_win][1],
+              &border_width_return, &depth_return);
+          XTranslateCoordinates(display_, win_[num_win]->window(),
+              DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow);
+
+          win_pos_[num_win][0] = dest_x_return - x_return;
+          win_pos_[num_win][1] = dest_y_return - y_return;
+          // 2) Delete window
+          delete win_[num_win];
+          win_[num_win] = NULL;
+        }
+      }
+
+      XFlush(display_);
+      delete win_;
+      win_ = NULL;
+
+      display_on_ = false;
+    }
+    else // Display was "off", open windows
+    {
+      show_window_ |= 1;
+      new_show_window_ = show_window_;
+
+      // If it's the first time the display is switched on, initialize it.
+      if (win_ == NULL) initialize();
+
+      for (int8_t i = 0 ; i < NB_WIN ; i++)
+      {
+        if (show_window(i))
+        {
+          win_[i] = new X11Window(display_, screen_, atoms_,
+              win_pos_[i][0], win_pos_[i][1],
+              win_size_[i][0], win_size_[i][1], win_name_[i]);
+        }
+      }
+
+      display_on_ = true;
+    }
+  }
+
+  // ----------
+  // 3) Display
+  // ----------
+  if (display_on_)
+  {
+    for (int8_t i = 0 ; i < NB_WIN ; i++)
+    {
+      if (show_window(i))
+      {
+        if (new_show_window(i))
+        {
+          draw_window(i);
+        }
+        else
+        {
+          refresh_window(i);
+        }
+      }
+    }
+
+    // Refresh all windows
+    XFlush(display_);
+  }
+}
+
+void ExpManager_X11::handle_events()
+{
+  XEvent event;
+  int8_t win_number;
+
+
+  // XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent()
+  // with the custom AlwaysTruePredicate function as a work-around (ClientMessage
+  // events are needed in order to catch "WM_DELETE_WINDOW")
+  int iCurrEvent    = 0;
+  int iIgnoreNoise  = 0;
+  while(XCheckIfEvent(display_, &event, AlwaysTruePredicate, 0))
+  {
+    iCurrEvent ++;
+    win_number = identify_window(event.xany.window);
+
+    if(win_number == -1) continue;
+    // We discard this event because it occurred on a destroyed window
+    // (e.g. the user pressed F3 and then moved or resized the window,
+    // before the window was destroyed)
+
+    switch(event.type)
+    {
+      case ConfigureNotify :
+      {
+        win_[win_number]->resize(event.xconfigure.width, event.xconfigure.height);
+        //~ win_[win_number]->repos(event.xconfigure.x, event.xconfigure.y);
+
+        // Mark window as having to be entirely redrawn
+        new_show_window_ |= 1 << win_number;
+        break;
+      }
+      case MapNotify :
+      {
+        draw_window(win_number);
+        break;
+      }
+      case Expose:
+      {
+        if(iCurrEvent > iIgnoreNoise)
+        {
+          draw_window(win_number);
+          iIgnoreNoise = iCurrEvent + XQLength(display_);
+        }
+        break;
+      }
+      case ClientMessage :
+      {
+        if (((Atom) event.xclient.data.l[0]) == atoms_[0]) // The user closed the window by clicking on the cross
+        {
+          // 1) Save current window position and size
+          Window aWindow; // Unused
+          int x_return, y_return;
+          int dest_x_return, dest_y_return;
+          unsigned int border_width_return, depth_return; // Unused
+          XGetGeometry(display_, win_[win_number]->window(), &aWindow, &x_return, &y_return,
+                        &win_size_[win_number][0], &win_size_[win_number][1], &border_width_return, &depth_return);
+          XTranslateCoordinates(display_, win_[win_number]->window(), DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow);
+
+          win_pos_[win_number][0] = dest_x_return - x_return;
+          win_pos_[win_number][1] = dest_y_return - y_return;
+
+          // 2) Delete window and mark as "not to be shown"
+          delete win_[win_number];
+          win_[win_number] = NULL;
+          show_window_ &= ~(1 << win_number);
+
+          // 3) If it was the main that was closed, turn display off.
+          if (win_number == 0)
+          {
+            handle_display_on_off_ = true;
+          }
+        }
+        break;
+      }
+      case KeyPress :
+      {
+        // Not sure a switch would work on any platform => use ifs instead
+        if (event.xkey.keycode == key_codes_[KEY_F1] ||
+             event.xkey.keycode == key_codes_[KEY_F2] ||
+             event.xkey.keycode == key_codes_[KEY_F3] ||
+             event.xkey.keycode == key_codes_[KEY_F4] ||
+             event.xkey.keycode == key_codes_[KEY_F5] ||
+             event.xkey.keycode == key_codes_[KEY_F6])
+        {
+          int8_t num_win;
+
+          // Not sure a switch would work on any platform => use ifs instead
+          if (event.xkey.keycode == key_codes_[KEY_F1]) num_win = 1;
+          else if (event.xkey.keycode == key_codes_[KEY_F2]) num_win = 2;
+          else if (event.xkey.keycode == key_codes_[KEY_F3]) num_win = 3;
+          else if (event.xkey.keycode == key_codes_[KEY_F4]) num_win = 4;
+          else if (event.xkey.keycode == key_codes_[KEY_F5]) num_win = 5;
+          else  num_win = 6; // case where (event.xkey.keycode == key_codes_[KEY_F6])
+
+          if (show_window(num_win))
+          {
+            // 1) Save current window position and size
+            Window aWindow; // Unused
+            int x_return, y_return;
+            int dest_x_return, dest_y_return;
+            unsigned int border_width_return, depth_return; // Unused
+            XGetGeometry(display_, win_[num_win]->window(), &aWindow, &x_return, &y_return,
+                          &win_size_[num_win][0], &win_size_[num_win][1], &border_width_return, &depth_return);
+            XTranslateCoordinates(display_, win_[num_win]->window(), DefaultRootWindow(display_), 0, 0, &dest_x_return, &dest_y_return, &aWindow);
+
+            win_pos_[num_win][0] = dest_x_return - x_return;
+            win_pos_[num_win][1] = dest_y_return - y_return;
+
+            // 2) Delete window and mark as "not to be shown"
+            delete win_[num_win];
+            win_[num_win] = NULL;
+            show_window_ &= ~(1 << num_win);
+          }
+          else
+          {
+            win_[num_win] = new X11Window(display_, screen_, atoms_, win_pos_[num_win][0], win_pos_[num_win][1],
+                                                win_size_[num_win][0], win_size_[num_win][1], win_name_[num_win]);
+            new_show_window_ |= 1 << num_win;
+            show_window_ |= new_show_window_;
+            draw_window(num_win);
+          }
+        }
+        else if (event.xkey.keycode == key_codes_[KEY_P])
+        {
+          printf(" P A U S E D \n");
+          bool pause_key  = false;
+          while (! pause_key)
+          {
+            if (XCheckIfEvent(display_, &event, AlwaysTruePredicate, 0))
+            {
+              if (event.xkey.keycode == key_codes_[KEY_P])
+              {
+                pause_key = true;
+              }
+            }
+          }
+        }
+        else if ((event.xkey.state & ControlMask) && (event.xkey.keycode == key_codes_[KEY_Q]))
+        {
+          printf(" Q U I T   R E Q U E S T E D\n");
+          quit_signal_received_ = true;
+          // We do not exit here, because it is cleaner to let the main program
+          // interpret the signal and call the destructor of the simulation.
+          // This ensures that the connection to the X server will be closed
+          // in a clean way, which is much better if we want to run other
+          // X applications afterwards!
+        }
+
+        break;
+      }
+      default :
+      {
+        // printf("event not handled \n");
+        break;
+      }
+    }
+  }
+}
+
+void ExpManager_X11::toggle_display_on_off()
+{
+  // Mark action to be done
+  handle_display_on_off_ = true;
+}
+
+
+
+void ExpManager_X11::display(X11Window * win,
+    const AbstractFuzzy& fuzz,
+    color_map color,
+    bool fill /*= false*/,
+    bool bold /*= false*/)
+{
+  double y_min = Y_MIN - 0.1 * Y_MAX; // Yields a bottom margin
+  double y_max = Y_MAX * 1.1;         // Yields a top margin
+  double delta_x = X_MAX - X_MIN;
+  double delta_y = y_max - y_min;
+
+  int16_t cur_x;
+  int16_t cur_y;
+  int16_t next_x;
+  int16_t next_y;
+
+  if (exp_s_->get_fuzzy_flavor() == 0) {
+    const Fuzzy fuzzy = (Fuzzy&)(fuzz);
+    for (list<Point>::const_iterator p = fuzzy.points().begin();
+         p != prev(fuzzy.points().end()); ++p) {
+      list<Point>::const_iterator q = next(p);
+
+      // Display segment [p, q]
+      cur_x = ((p->x - X_MIN) / delta_x) * win->width();
+      cur_y = (1 - ((p->y - y_min) / delta_y)) * win->height();
+      next_x = ((q->x - X_MIN) / delta_x) * win->width();
+      next_y = (1 - ((q->y - y_min) / delta_y)) * win->height();
+
+      if (fill) {
+        char* fill_color;
+        for (int16_t i = cur_x; i < next_x; i++) {
+          fill_color = X11Window::color(
+              ((double) i / win->width()) * (X_MAX - X_MIN));
+          win->draw_line(i, (1 - ((0 - y_min) / delta_y)) * win->height(),
+                         i, cur_y + (((i - cur_x) * (next_y - cur_y)) /
+                                     (next_x - cur_x)), fill_color);
+          delete[] fill_color;
+        }
+      }
+      win->draw_line(cur_x, cur_y, next_x, next_y, color, bold);
+    }
+  } else {
+    const HybridFuzzy fuzzy = (HybridFuzzy&)(fuzz);
+    double hi,hi1;
+
+    for (int i = 0; i < fuzzy.get_pheno_size() - 1; i++) {
+      hi= (((double)i) / fuzzy.get_pheno_size());
+      hi1= (((double)i+1) / fuzzy.get_pheno_size());
+      // Display segment [cur_point, next_point]
+      cur_x   = (      (hi -  X_MIN) / delta_x  ) * win->width();
+      cur_y   = ( 1 - ((fuzzy.points()[i] -  y_min) / delta_y) ) * win->height();
+      next_x  = (      ((hi1) - X_MIN) / delta_x  ) * win->width();
+      next_y  = ( 1 - ((fuzzy.points()[i+1] - y_min) / delta_y) ) * win->height();
+
+      if (fuzzy.points()[i] >= 0 && fuzzy.points()[i+1] >= 0) {
+        win->draw_line( cur_x, cur_y, next_x, next_y, color, bold );
+
+        if ( fill )
+        {
+          char* fill_color;
+          for ( int16_t i = cur_x ; i < next_x ; i++ )
+          {
+            fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) );
+            win->draw_line( i, ( 1 - ((0 -  y_min) / delta_y) ) * win->height(),
+                            i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)) , fill_color );
+
+            delete [] fill_color;
+          }
+        }
+      } else if (fuzzy.points()[i] < 0 && fuzzy.points()[i+1] < 0) {
+        win->draw_line( cur_x, cur_y, next_x, next_y, color, bold );
+
+        if ( fill )
+        {
+          char* fill_color;
+          for ( int16_t i = cur_x ; i < next_x ; i++ )
+          {
+            fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) );
+            win->draw_line( i, ( 1 - ((0 -  y_min) / delta_y) ) * win->height(),
+                            i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)) , fill_color );
+
+            delete [] fill_color;
+          }
+        }
+      } else {
+        double p1 = (fuzzy.points()[i+1] - fuzzy.points()[i]) / (hi1 - hi);
+        double d1 = fuzzy.points()[i] - (p1 * hi);
+
+        double x_at_0 = 0;
+        if (fuzzy.points()[i] == 0.0) x_at_0 = hi;
+        else if (fuzzy.points()[i+1] == 0.0) x_at_0 = hi1;
+        else x_at_0 = ( (- d1) / p1 );
+
+        win->draw_line( cur_x, cur_y, x_at_0, 0, color, bold );
+
+        if ( fill )
+        {
+          char* fill_color;
+          for ( int16_t i = cur_x ; i < x_at_0 ; i++ )
+          {
+            fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) );
+            win->draw_line( i, ( 1 - ((0 -  y_min) / delta_y) ) * win->height(),
+                            i, cur_y + (((i - cur_x) * (0 - cur_y)) / (x_at_0 - cur_x)) , fill_color );
+            delete [] fill_color;
+          }
+        }
+
+        win->draw_line( x_at_0, 0, next_x, next_y, color, bold );
+
+        if ( fill )
+        {
+          char* fill_color;
+          for ( int16_t i = x_at_0 ; i < next_x ; i++ )
+          {
+            fill_color = X11Window::color( ((double)i / win->width()) * (X_MAX - X_MIN) );
+            win->draw_line( i, ( 1 - ((0 -  y_min) / delta_y) ) * win->height(),
+                            i, 0 + (((i - x_at_0) * (next_y - 0)) / (next_x - x_at_0)) , fill_color );
+            delete [] fill_color;
+          }
+        }
+      }
+    }
+  }
+}
+
+
+void ExpManager_X11::display_3D(X11Window * win,
+                             const AbstractFuzzy& fuzz, color_map color, int x0 , int y0, bool fill /*= false*/ )
+{
+  double y_min = Y_MIN - 0.1 * Y_MAX; // Yields a bottom margin
+  double y_max = Y_MAX * 1.1;         // Yields a top margin
+  double delta_x = X_MAX - X_MIN;
+  double delta_y = y_max - y_min;
+
+  int16_t cur_x;
+  int16_t cur_y;
+  int16_t next_x;
+  int16_t next_y;
+
+  if (exp_s_->get_fuzzy_flavor() == 0) {
+    const Fuzzy fuzzy = (Fuzzy&)(fuzz);
+    for (list<Point>::const_iterator p = fuzzy.points().begin();
+         p != prev(fuzzy.points().end()); ++p) {
+      list<Point>::const_iterator q = next(p);
+
+      // Display segment [p, q]
+      cur_x = ((p->x - X_MIN) / delta_x) * win->width();
+      cur_y = (1 - ((p->y - y_min) / delta_y)) * win->height();
+      next_x = ((q->x - X_MIN) / delta_x) * win->width();
+      next_y = (1 - ((q->y - y_min) / delta_y)) * win->height();
+
+      if (fill) {
+        char* fill_color;
+        for (int16_t i = cur_x; i < next_x; i++) {
+          fill_color = X11Window::color(
+              ((double) i / win->width()) * (X_MAX - X_MIN));
+          win->draw_line(i + x0, (1 - ((0 - y_min) / delta_y)) * win->height(),
+                         i + x0, y0 + cur_y + (((i - cur_x) * (next_y - cur_y)) /
+                                     (next_x - cur_x)), fill_color);
+          delete[] fill_color;
+        }
+      }
+      win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color);
+    }
+  } else {
+    //  ae_list_node* node        = _points->get_first();
+    //  ae_point_2d*  cur_point   = NULL;
+    //  ae_point_2d*  next_point  = NULL;
+
+
+    double hi;
+    double hi1;
+    const HybridFuzzy fuzzy = (HybridFuzzy&)(fuzz);
+    int pheno_size = fuzzy.get_pheno_size();
+
+    for (int j = 0; j < (pheno_size - 1); j++) {
+      hi = (((double) j) / pheno_size);
+      hi1 = (((double) j + 1) / pheno_size);
+      // Display segment [cur_point, next_point]
+      cur_x = ((hi - X_MIN) / delta_x) * win->width();
+      cur_y = (1 - ((fuzzy.points()[j] - y_min) / delta_y)) * win->height();
+      next_x = (((hi1) - X_MIN) / delta_x) * win->width();
+      next_y = (1 - ((fuzzy.points()[j + 1] - y_min) / delta_y)) * win->height();
+
+
+      /*if (fill) printf("Indiv ");
+      else printf("Env ");
+      printf("Curve seg %f %f %f %f\n",hi,hi1,fuzzy.points()[j],fuzzy.points()[j+1]);
+      */
+      if (fuzzy.points()[j] >= 0 && fuzzy.points()[j + 1] >= 0) {
+        if (fill) {
+          char* fill_color;
+          for (int16_t i = cur_x; i < next_x; i++) {
+            fill_color = X11Window::color(
+                ((double) i / win->width()) * (X_MAX - X_MIN));
+
+            win->draw_line(i + x0,
+                           (1 - ((0 - y_min) / delta_y)) * win->height() +
+                           y0,
+                           i + x0, y0 + cur_y +
+                                        (((i - cur_x) * (next_y - cur_y)) /
+                                         (next_x - cur_x)), fill_color);
+            delete[] fill_color;
+          }
+        }
+
+        win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color);
+      } else if (fuzzy.points()[j] < 0 && fuzzy.points()[j + 1] < 0) {
+        if (fill) {
+          char* fill_color;
+          for (int16_t i = cur_x; i < next_x; i++) {
+            fill_color = X11Window::color(
+                ((double) i / win->width()) * (X_MAX - X_MIN));
+            win->draw_line(i + x0,
+                           (1 - ((0 - y_min) / delta_y)) * win->height() +
+                           y0,
+                           i + x0, y0 + cur_y +
+                                        (((i - cur_x) * (next_y - cur_y)) /
+                                         (next_x - cur_x)), fill_color);
+            delete[] fill_color;
+          }
+        }
+
+        win->draw_line(cur_x + x0, cur_y + y0, next_x + x0, next_y + y0, color);
+      } else {
+        double p1 = (fuzzy.points()[j + 1] - fuzzy.points()[j]) / (hi1 - hi);
+        double d1 = fuzzy.points()[j] - (p1 * hi);
+
+        double x_at_0 = 0;
+        if (fuzzy.points()[j] == 0.0) x_at_0 = hi;
+        else if (fuzzy.points()[j + 1] == 0.0) x_at_0 = hi1;
+        else x_at_0 = ((-d1) / p1);
+
+        if (fill) {
+          char* fill_color;
+          for (int16_t i = cur_x; i < x_at_0; i++) {
+            fill_color = X11Window::color(
+                ((double) i / win->width()) * (X_MAX - X_MIN));
+            win->draw_line(i + x0,
+                           (1 - ((0 - y_min) / delta_y)) * win->height() +
+                           y0,
+                           i + x0, y0 + cur_y + (((i - cur_x) * (0 - cur_y)) /
+                                                 (x_at_0 - cur_x)), fill_color);
+            delete[] fill_color;
+          }
+        }
+
+        win->draw_line(cur_x + x0, cur_y + y0, x_at_0 + x0, y0, color);
+
+        if (fill) {
+          char* fill_color;
+          for (int16_t i = x_at_0; i < next_x; i++) {
+            fill_color = X11Window::color(
+                ((double) i / win->width()) * (X_MAX - X_MIN));
+            win->draw_line(i + x0,
+                           (1 - ((0 - y_min) / delta_y)) * win->height() +
+                           y0,
+                           i + x0, y0 + 0 + (((i - x_at_0) * (next_y - 0)) /
+                                             (next_x - x_at_0)), fill_color);
+            delete[] fill_color;
+          }
+        }
+
+        win->draw_line(x_at_0 + x0, y0, next_x + x0, next_y + y0, color);
+      }
+    }
+  }
+}
+
+// Display a grid of values
+void ExpManager_X11::display_grid(X11Window * win, double** cell_grid)
+{
+  // printf("display grid\n");
+  char t[40];
+  constexpr int nb_colors = 50;
+
+  sprintf(t, "Generation = %" PRId64, AeTime::time());
+  win->draw_string(15, 15, t);
+
+
+  const int grid_width_ = grid_width();
+  const int grid_height_ = grid_height();
+
+  int nb_slots_in_a_row = (int) grid_height_;
+  int slot_width = 200/nb_slots_in_a_row;
+  int x1 = 50 + 50 + slot_width/2;
+  int y1 = 75 + 50 + slot_width/2;
+
+  // create the colormap colors to be used for grid plotting
+  int cell_size = 5;
+
+  // draw the color scale for fitness
+  int y_step_size = grid_height_ *cell_size/nb_colors;
+  for (int i = 0; i  < nb_colors; i++)
+  {
+    win->fill_rectangle(x1 - 30, y1 - 80 + y_step_size * i,
+                         cell_size * 5, y_step_size,
+                         col_map_[nb_colors-1-i]);
+  }
+
+  // find min/max of the matrix
+  double grid_max = 0;
+  double grid_min = 1000000;
+  for (int x = 0 ; x < grid_width_; x++)
+  {
+    for (int y = 0 ; y < grid_height_; y++)
+    {
+       if (cell_grid[x][y] > grid_max) {grid_max = cell_grid[x][y];}
+       if (cell_grid[x][y] < grid_min) {grid_min = cell_grid[x][y];}
+     }
+  }
+  double col_sec_interval = (grid_max - grid_min) / nb_colors;
+
+  char scale_txt[40];
+  sprintf(scale_txt,"%.2e", grid_max);
+  win->draw_string(x1-80, y1-80,scale_txt);
+  sprintf(scale_txt,"%.2e", grid_min);
+  win->draw_string(x1-80, y1-80+ grid_height_ *cell_size,scale_txt);
+
+  for (int x = 0; x < grid_width_; x++)
+  {
+    for (int y = 0; y < grid_height_; y++)
+    {
+      char * col_string;
+      // calculate the color
+      int new_col;
+      if (col_sec_interval == 0)
+      {
+        new_col = 0;
+      }
+      else
+      {
+        // We have to take care of the limit case when
+        // (cell_grid[x][y] == grid_max) which would yield (new_col == nb_colors)
+        // which is out of bounds
+        new_col = std::min(
+            static_cast<int>(floor((cell_grid[x][y] - grid_min) /
+                                       col_sec_interval)),
+            nb_colors -1);
+      }
+      col_string = col_map_[new_col];
+
+      // draw a colored rectangle for each cell
+      win->fill_rectangle(x1 + 50 + x*cell_size, y1 - 80 + y*cell_size, cell_size, cell_size, col_string);
+    }
+  }
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void ExpManager_X11::initialize(bool with_grid /*= false*/, bool with_plasmids /*= false*/)
+{
+  // Initialize window structures
+  win_ = new X11Window * [NB_WIN];
+  win_size_ = new unsigned int* [NB_WIN];
+  win_pos_ = new int* [NB_WIN];
+
+  for (int8_t i = 0 ; i < NB_WIN ; i++)
+  {
+    win_[i] = NULL;
+
+    // Default values
+    win_size_[i] = new unsigned int[2];
+    win_size_[i][0] = 300;
+    win_size_[i][1] = 300;
+    win_pos_[i] = new int[2];
+    win_pos_[i][0]  = 0;
+    win_pos_[i][1]  = 0;
+  }
+
+  // Set phenotype window width
+  win_size_[1][0] = 600;
+
+  // Set CDS and RNA window width
+  if (with_plasmids)
+  {
+    win_size_[2][0] = 600;
+    win_size_[3][0] = 600;
+  }
+
+  // Set initial positions if screen is large enough
+  if (with_plasmids && with_grid)
+  {
+    //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650)
+    {
+      win_pos_[0][0]  = 0;
+      win_pos_[0][1]  = 0;
+      win_pos_[1][0]  = 300;
+      win_pos_[1][1]  = 0;
+      win_pos_[2][0]  = 0;
+      win_pos_[2][1]  = 350;
+      win_pos_[3][0]  = 0;
+      win_pos_[3][1]  = 700;
+    }
+  }
+  else if (with_plasmids)
+  {
+    //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650)
+    {
+      win_pos_[0][0]  = 0;
+      win_pos_[0][1]  = 0;
+      win_pos_[1][0]  = 300;
+      win_pos_[1][1]  = 0;
+      win_pos_[2][0]  = 0;
+      win_pos_[2][1]  = 350;
+      win_pos_[3][0]  = 0;
+      win_pos_[3][1]  = 700;
+    }
+  }
+  else if (with_grid)
+  {
+    //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650)
+    {
+      win_pos_[0][0]  = 0;
+      win_pos_[0][1]  = 0;
+      win_pos_[1][0]  = 300;
+      win_pos_[1][1]  = 0;
+      win_pos_[2][0]  = 0;
+      win_pos_[2][1]  = 350;
+      win_pos_[3][0]  = 300;
+      win_pos_[3][1]  = 350;
+    }
+  }
+  else // (! with_plasmids && ! with_grid)
+  {
+    //if (XDisplayWidth(display_, screen_) >= 900 && XDisplayHeight(display_, screen_) >= 650)
+    {
+      win_pos_[0][0]  = 0;
+      win_pos_[0][1]  = 0;
+      win_pos_[1][0]  = 300;
+      win_pos_[1][1]  = 0;
+      win_pos_[2][0]  = 0;
+      win_pos_[2][1]  = 350;
+      win_pos_[3][0]  = 300;
+      win_pos_[3][1]  = 350;
+    }
+  }
+
+
+  // Visible windows at the beginning of the run
+
+  if (with_grid)
+  {
+    #ifdef __REGUL
+    show_window_  = 0x01FF;
+    #else
+    show_window_  = 0x007F; // hex for bin 1111111  => show first 7 windows
+    #endif
+  }
+  else
+  {
+    #ifdef __REGUL
+    show_window_  = 0x01E3;
+    #else
+    show_window_  = 0x000F;   // hex for bin 1111   => show first 4 windows
+    #endif
+  }
+  new_show_window_ = show_window_;
+
+
+  win_name_ = new char*[NB_WIN];
+  if (with_grid)  win_name_[0] = (char*) "Population grid";
+  else              win_name_[0] = (char*) "Population";
+
+  win_name_[1] = (char*) "Phenotypic profile";
+  win_name_[2] = (char*) "Genes";
+  win_name_[3] = (char*) "RNAs";
+  win_name_[4] = (char*) "Secreted compound present";
+  win_name_[5] = (char*) "Metabolic fitness";
+  win_name_[6] = (char*) "Current secretion";
+  win_name_[7] = (char*) "Regulation network";
+  win_name_[8] = (char*) "Protein concentrations";
+
+  compute_colormap();
+}
+
+int8_t ExpManager_X11::identify_window(Window winID)
+{
+  for (int8_t i = 0 ; i < NB_WIN ; i++)
+  {
+    if (win_[i] != NULL)
+    {
+      if (win_[i]->window() == winID) return i;
+    }
+  }
+
+  return -1;
+}
+
+void ExpManager_X11::draw_window(int8_t win_number)
+{
+  if (win_[win_number] == NULL)
+  {
+    fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n");
+    return;
+  }
+
+  X11Window * cur_win = win_[win_number];
+
+  switch (win_number)
+  {
+    case 0:
+    {
+      break;
+    }
+
+    case 1:
+    {
+      cur_win->blacken();
+
+      // Display colour bar
+      char* color;
+      for (int16_t i = 0 ; i < cur_win->width() ; i++)
+      {
+        color = X11Window::color(((double)i / cur_win->width()) * (X_MAX - X_MIN));
+        //~ cur_win->draw_line(i, 0, i, cur_win->height() / 20, color);
+        cur_win->draw_line(i, cur_win->height() * 19 / 20, i, cur_win->height(), color);
+        delete [] color;
+      }
+
+      break;
+    }
+
+    case 2:
+    {
+      break;
+    }
+
+    case 3:
+    {
+      break;
+    }
+
+    // Amount of secreted compound present at each grid location
+    case 4:
+    {
+      break;
+    }
+
+    // Metabolic fitness  grid
+    case 5:
+    {
+      break;
+    }
+
+    // Current secretion (how much is secreted by each organism)
+    case 6:
+    {
+      break;
+    }
+#ifdef __REGUL
+    case 7:
+    {
+      break;
+    }
+    case 8:
+    {
+      break;
+    }
+#endif
+  }
+
+  refresh_window(win_number);
+  new_show_window_ &= ~(1 << win_number);
+
+  XFlush(display_);
+}
+
+void ExpManager_X11::refresh_window(int8_t win_number) {
+  if (win_[win_number] == NULL)
+  {
+    fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n");
+    return;
+  }
+
+  X11Window * cur_win = win_[win_number];
+
+  switch (win_number)
+  {
+    // Main window (population)
+    case 0 :
+    {
+      cur_win->blacken();
+
+      double** grid = world()->total_fitness_grid();
+      display_grid(cur_win, grid);
+
+      // Has been allocated in ae_spatial_structure::total_fitness_grid()
+      for (int16_t x = 0 ; x < grid_width() ; x++)
+      {
+        delete [] grid[x];
+      }
+      delete [] grid;
+      break;
+    }
+
+    // Display phenotypes and phenotypic target
+    case 1 :
+    {
+      // Blacken all the window except the colour bar
+      cur_win->fill_rectangle(0, 0, cur_win->width(), cur_win->height() * 19 / 20, BLACK);
+
+      // Get phenotypic target shorthand
+      const PhenotypicTarget& phenotypic_target = best_indiv()->phenotypic_target();
+
+      // Mark all the non-metabolic segments (paint them in grey)
+      if (phenotypic_target.nb_segments() > 1)
+      {
+        PhenotypicSegment ** segments = phenotypic_target.segments();
+
+        for (size_t i = 0 ; i < static_cast<size_t>(phenotypic_target.nb_segments()) ; i++) {
+          if (segments[i]->feature != METABOLISM)
+          {
+            if (segments[i]->feature == NEUTRAL)
+            {
+              cur_win->fill_rectangle(cur_win->width() * segments[i]->start / (X_MAX-X_MIN), 0.0,
+                                        cur_win->width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN),
+                                        cur_win->height() * 19 / 20, DARKER_GREY);
+            }
+            else
+            {
+              cur_win->fill_rectangle(cur_win->width() * segments[i]->start / (X_MAX-X_MIN), 0.0,
+                                        cur_win->width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN),
+                                        cur_win->height() * 19 / 20, GREY);
+            }
+          }
+        }
+      }
+
+      // Display all the phenotypes (blue)
+      for (const auto& indiv: indivs())
+      {
+        #ifndef __REGUL
+        display(cur_win, *(indiv->phenotype()), BLUE);
+        if (indiv->allow_plasmids())
+        {
+          display(cur_win, *(indiv->genetic_unit(0).phenotypic_contribution()), YELLOW);
+          display(cur_win, *(indiv->genetic_unit(1).phenotypic_contribution()), GREEN);
+        }
+        #else
+        /*Individual_R_X11* indiv_r = dynamic_cast<Individual_R_X11*>(indiv);
+
+        display(cur_win, *(indiv_r->get_phenotype()), BLUE);
+        if (indiv_r->get_allow_plasmids())
+        {
+          display(cur_win, *(indiv_r->get_genetic_unit(0).get_phenotypic_contribution()), YELLOW);
+          display(cur_win, *(indiv_r->get_genetic_unit(1).get_phenotypic_contribution()), GREEN);
+        }*/
+        #endif
+      }
+
+      // Display best indiv's phenotype (white)
+      #ifndef __REGUL
+      display(cur_win, *(best_indiv()->phenotype()), WHITE, true);
+      display(cur_win, *(phenotypic_target.fuzzy()), RED, false, true);
+      #else
+      Individual_R_X11* indiv_r = dynamic_cast<Individual_R_X11*>(best_indiv());
+
+      indiv_r->display_phenotype(cur_win, dynamic_cast<const Habitat_R&>(best_indiv()->grid_cell()->habitat()));
+      //display_3D(cur_win, *(indiv_r->get_phenotype()), WHITE, true);
+      #endif
+
+      // Display phenotypic target (red)
+
+    }
+    break;
+
+    // Display genes
+    case 2 :
+    {
+      cur_win->blacken();
+
+      Individual_X11 * indiv = dynamic_cast<Individual_X11 *>(best_indiv());
+      indiv->display_cdss(cur_win);
+    }
+    break;
+
+    // Display RNAs
+    case 3 :
+    {
+      cur_win->blacken();
+
+      Individual_X11 * indiv = dynamic_cast<Individual_X11 *>(best_indiv());
+      indiv->display_rnas(cur_win);
+    }
+    break;
+
+    // Display the amount of secreted compound present at each location
+    case 4 :
+    {
+      cur_win->blacken();
+
+      display_grid(cur_win, world()->secretion_present_grid());
+    }
+    break;
+
+    // Display the metabolic fitness grid
+    case 5 :
+    {
+      cur_win->blacken();
+
+      display_grid(cur_win, world()->metabolic_fitness_grid());
+    }
+    break;
+
+    // display current secretion (how much is secreted by each organism)
+    case 6:
+    {
+      cur_win->blacken();
+
+      display_grid(cur_win, world()->secreted_amount_grid());
+    }
+    break;
+#ifdef __REGUL
+    case 7:
+    {
+      cur_win->blacken();
+      dynamic_cast<Individual_R_X11*>(best_indiv())->display_regulation( cur_win );
+      break;
+    }
+    case 8:
+    {
+      cur_win->blacken();
+      dynamic_cast<Individual_R_X11*>(best_indiv())->display_concentrations( cur_win );
+      break;
+    }
+#endif
+  }
+
+  XFlush(display_);
+}
+
+void ExpManager_X11::set_codes() {
+  key_codes_ = new KeyCode[50];
+  assert(key_codes_);
+
+  key_codes_[KEY_ESCAPE]  = XKeysymToKeycode(display_, XK_Escape);
+  key_codes_[KEY_F1]      = XKeysymToKeycode(display_, XK_F1);
+  key_codes_[KEY_F2]      = XKeysymToKeycode(display_, XK_F2);
+  key_codes_[KEY_F3]      = XKeysymToKeycode(display_, XK_F3);
+  key_codes_[KEY_F4]      = XKeysymToKeycode(display_, XK_F4);
+  key_codes_[KEY_F5]      = XKeysymToKeycode(display_, XK_F5);
+  key_codes_[KEY_F6]      = XKeysymToKeycode(display_, XK_F6);
+  key_codes_[KEY_F7]      = XKeysymToKeycode(display_, XK_F7);
+  key_codes_[KEY_F8]      = XKeysymToKeycode(display_, XK_F8);
+  key_codes_[KEY_F9]      = XKeysymToKeycode(display_, XK_F9);
+  key_codes_[KEY_F10]     = XKeysymToKeycode(display_, XK_F10);
+  key_codes_[KEY_F11]     = XKeysymToKeycode(display_, XK_F11);
+  key_codes_[KEY_F12]     = XKeysymToKeycode(display_, XK_F12);
+  key_codes_[KEY_A]       = XKeysymToKeycode(display_, XK_A);
+  key_codes_[KEY_Q]       = XKeysymToKeycode(display_, XK_Q);
+  key_codes_[KEY_W]       = XKeysymToKeycode(display_, XK_W);
+  key_codes_[KEY_Z]       = XKeysymToKeycode(display_, XK_Z);
+  key_codes_[KEY_S]       = XKeysymToKeycode(display_, XK_S);
+  key_codes_[KEY_X]       = XKeysymToKeycode(display_, XK_X);
+  key_codes_[KEY_E]       = XKeysymToKeycode(display_, XK_E);
+  key_codes_[KEY_D]       = XKeysymToKeycode(display_, XK_D);
+  key_codes_[KEY_C]       = XKeysymToKeycode(display_, XK_C);
+  key_codes_[KEY_R]       = XKeysymToKeycode(display_, XK_R);
+  key_codes_[KEY_F]       = XKeysymToKeycode(display_, XK_F);
+  key_codes_[KEY_V]       = XKeysymToKeycode(display_, XK_V);
+  key_codes_[KEY_T]       = XKeysymToKeycode(display_, XK_T);
+  key_codes_[KEY_G]       = XKeysymToKeycode(display_, XK_G);
+  key_codes_[KEY_B]       = XKeysymToKeycode(display_, XK_B);
+  key_codes_[KEY_Y]       = XKeysymToKeycode(display_, XK_Y);
+  key_codes_[KEY_H]       = XKeysymToKeycode(display_, XK_H);
+  key_codes_[KEY_N]       = XKeysymToKeycode(display_, XK_N);
+  key_codes_[KEY_U]       = XKeysymToKeycode(display_, XK_U);
+  key_codes_[KEY_J]       = XKeysymToKeycode(display_, XK_J);
+  key_codes_[KEY_I]       = XKeysymToKeycode(display_, XK_I);
+  key_codes_[KEY_K]       = XKeysymToKeycode(display_, XK_K);
+  key_codes_[KEY_O]       = XKeysymToKeycode(display_, XK_O);
+  key_codes_[KEY_L]       = XKeysymToKeycode(display_, XK_L);
+  key_codes_[KEY_P]       = XKeysymToKeycode(display_, XK_P);
+  key_codes_[KEY_M]       = XKeysymToKeycode(display_, XK_M);
+  key_codes_[KEY_1]       = XKeysymToKeycode(display_, XK_1);
+  key_codes_[KEY_2]       = XKeysymToKeycode(display_, XK_2);
+  key_codes_[KEY_3]       = XKeysymToKeycode(display_, XK_3);
+  key_codes_[KEY_4]       = XKeysymToKeycode(display_, XK_4);
+  key_codes_[KEY_5]       = XKeysymToKeycode(display_, XK_5);
+  key_codes_[KEY_6]       = XKeysymToKeycode(display_, XK_6);
+  key_codes_[KEY_7]       = XKeysymToKeycode(display_, XK_7);
+  key_codes_[KEY_8]       = XKeysymToKeycode(display_, XK_8);
+  key_codes_[KEY_9]       = XKeysymToKeycode(display_, XK_9);
+}
+
+void ExpManager_X11::compute_colormap() {
+  col_map_ = {
+    (char*)"RGBi:0.0/0.0/1.0",
+    (char*)"RGBi:0.0/0.025/1.0",
+    (char*)"RGBi:0.0/0.05/1.0",
+    (char*)"RGBi:0.0/0.10/1.0",
+    (char*)"RGBi:0.0/0.15/1.0",
+    (char*)"RGBi:0.0/0.2/1.0",
+    (char*)"RGBi:0.0/0.25/1.0",
+    (char*)"RGBi:0.0/0.3/1.0",
+    (char*)"RGBi:0.0/0.35/1.0",
+    (char*)"RGBi:0.0/0.4/1.0",
+    (char*)"RGBi:0.0/0.45/1.0",
+    (char*)"RGBi:0.0/0.5/1.0",
+    (char*)"RGBi:0.0/0.55/1.0",
+    (char*)"RGBi:0.0/0.6/1.0",
+    (char*)"RGBi:0.0/0.65/1.0",
+    (char*)"RGBi:0.0/0.7/1.0",
+    (char*)"RGBi:0.0/0.75/1.0",
+    (char*)"RGBi:0.0/0.8/1.0",
+    (char*)"RGBi:0.0/0.85/1.0",
+    (char*)"RGBi:0.0/0.9/1.0",
+    (char*)"RGBi:0.0/1.0/1.0",
+    (char*)"RGBi:0.0/1.0/0.9",
+    (char*)"RGBi:0.0/1.0/0.8",
+    (char*)"RGBi:0.0/1.0/0.7",
+    (char*)"RGBi:0.0/1.0/0.6",
+    (char*)"RGBi:0.0/1.0/0.5",
+    (char*)"RGBi:0.0/1.0/0.4",
+    (char*)"RGBi:0.0/1.0/0.3",
+    (char*)"RGBi:0.0/1.0/0.2",
+    (char*)"RGBi:0.0/1.0/0.1",
+    (char*)"RGBi:0.0/1.0/0.0",
+    (char*)"RGBi:0.1/1.0/0.0",
+    (char*)"RGBi:0.2/1.0/0.0",
+    (char*)"RGBi:0.3/1.0/0.0",
+    (char*)"RGBi:0.4/1.0/0.0",
+    (char*)"RGBi:0.5/1.0/0.0",
+    (char*)"RGBi:0.6/1.0/0.0",
+    (char*)"RGBi:0.7/1.0/0.0",
+    (char*)"RGBi:0.8/1.0/0.0",
+    (char*)"RGBi:0.9/1.0/0.0",
+    (char*)"RGBi:1.0/0.9/0.0",
+    (char*)"RGBi:1.0/0.8/0.0",
+    (char*)"RGBi:1.0/0.7/0.0",
+    (char*)"RGBi:1.0/0.6/0.0",
+    (char*)"RGBi:1.0/0.5/0.0",
+    (char*)"RGBi:1.0/0.4/0.0",
+    (char*)"RGBi:1.0/0.3/0.0",
+    (char*)"RGBi:1.0/0.2/0.0",
+    (char*)"RGBi:1.0/0.1/0.0",
+    (char*)"RGBi:1.0/0.0/0.0",
+  };
+}
+
+} // namespace aevol
diff --git a/src/libaevol/ae_exp_manager_X11.h b/src/libaevol/ExpManager_X11.h
similarity index 64%
rename from src/libaevol/ae_exp_manager_X11.h
rename to src/libaevol/ExpManager_X11.h
index c227564..0589940 100644
--- a/src/libaevol/ae_exp_manager_X11.h
+++ b/src/libaevol/ExpManager_X11.h
@@ -3,32 +3,30 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef  __AE_EXP_SETUP_X11_H__
-#define  __AE_EXP_SETUP_X11_H__
- 
- 
+
+#ifndef AEVOL_EXP_SETUP_X11_H_
+#define AEVOL_EXP_SETUP_X11_H_
+
 // =================================================================
 //                              Libraries
 // =================================================================
@@ -42,19 +40,18 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_exp_manager.h>
-
-
+#include "ExpManager.h"
+#include "X11Window.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_setup;
-class ae_X11_window;
+class ExpSetup;
+class X11Window;
 
-enum key_map
-{
+enum key_map {
   KEY_ESCAPE = 0,
   KEY_F1 = 1,
   KEY_F2 = 2,
@@ -106,46 +103,46 @@ enum key_map
 };
 
 
-
-
- 
-class ae_exp_manager_X11 : public ae_exp_manager
+class ExpManager_X11 : public ExpManager
 {
-  friend class ae_exp_setup;
+  friend class ExpSetup;
   
   public :
     
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_exp_manager_X11( void );
-    //~ ae_exp_manager_X11( ae_param_overloader* param_overloader = NULL );
-    //~ ae_exp_manager_X11( char* backup_file_name, bool to_be_run = true, ae_param_overloader* param_overloader = NULL );
+    ExpManager_X11(void);
   
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_exp_manager_X11( void );
+    virtual ~ExpManager_X11(void) noexcept;
   
     // =================================================================
     //                              Accessors
     // =================================================================
-    inline bool             get_display_on( void );
-    inline Display *        get_display( void );
-    inline int8_t           get_screen( void );
-    inline Atom *           get_atoms ( void );
-    inline bool             get_show_window( int8_t win );
-    inline bool             get_new_show_window( int8_t win );
-    inline ae_X11_window *  get_window( int8_t win );
+    inline bool display_on();
+    inline Display* get_display();
+    inline int8_t screen();
+    inline Atom* atoms();
+    bool show_window(int8_t win) { return static_cast<bool>((show_window_ >> win) & 1); }
+    bool new_show_window(int8_t win) { return static_cast<bool>((new_show_window_ >> win) & 1); }
+    inline X11Window * window(int8_t win);
   
     // =================================================================
     //                            Public Methods
     // =================================================================
-    KeyCode* get_key_codes( void )  { return _key_codes;  };
-    virtual void display( void );
-    void toggle_display_on_off( void );
-    void handle_events( void );
-    bool quit_signal_received( void );
+    KeyCode* key_codes() { return key_codes_;  };
+    virtual void display(void);
+    void toggle_display_on_off(void);
+    void handle_events(void);
+    void display(X11Window * win, const AbstractFuzzy& fuzzy, color_map color,
+        bool fill = false, bool bold = false);
+    void display_3D(X11Window * win,
+                                  const AbstractFuzzy& fuzz, color_map color,
+                    int x0 , int y0, bool fill /*= false*/ );
+    void display_grid(X11Window * win, double** cell_grid);
 
     // =================================================================
     //                           Public Attributes
@@ -160,12 +157,12 @@ class ae_exp_manager_X11 : public ae_exp_manager
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    //~ ae_exp_manager_X11( void )
+    //~ ExpManager_X11(void)
     //~ {
       //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
       //~ exit( EXIT_FAILURE );
     //~ };
-    ae_exp_manager_X11( const ae_exp_manager_X11 &model )
+    ExpManager_X11( const ExpManager_X11 &model )
     {
       printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
       exit( EXIT_FAILURE );
@@ -174,77 +171,41 @@ class ae_exp_manager_X11 : public ae_exp_manager
   // =================================================================
   //                           Protected Methods
   // =================================================================
-  void    initialize( bool with_grid = false, bool with_plasmids = false );
-  void    set_codes( void );
-  int8_t  identify_window( Window winID );
-  void    draw_window( int8_t win_number );
-  void    refresh_window( int8_t win_number );
+  void initialize(bool with_grid = false, bool with_plasmids = false);
+  void compute_colormap();
+  void set_codes();
+  int8_t identify_window(Window winID);
+  void draw_window(int8_t win_number);
+  void refresh_window(int8_t win_number);
 
-  
   // =================================================================
   //                          Protected Attributes
   // =================================================================
-  bool      _display_on;
-  bool      _handle_display_on_off;
-  uint32_t  _show_window;     // (bitmap) windows that have to be displayed (user switches value pressing F1, F2, ...)
-  uint32_t  _new_show_window; // (bitmap) windows that have to be displayed but were not displayed at the last refresh
-  Display*  _display;
-  int8_t    _screen;
-  Atom*     _atoms;
-  KeyCode*  _key_codes;
-  
-  ae_X11_window** _win;       // Table containing the <nb_windows> windows
-  char **         _win_name;  // window names
-  unsigned int**  _win_size;  // window sizes
-  int**           _win_pos;   // window positions
+  bool     display_on_;
+  bool     handle_display_on_off_;
+  uint32_t show_window_;     // (bitmap) windows that have to be displayed (user switches value pressing F1, F2, ...)
+  uint32_t new_show_window_; // (bitmap) windows that have to be displayed but were not displayed at the last refresh
+  Display* display_;
+  int8_t   screen_;
+  Atom*    atoms_;
+  KeyCode* key_codes_;
+
+  X11Window**    win_;      // Table containing the <nb_windows> windows
+  char**         win_name_; // window names
+  unsigned int** win_size_; // window sizes
+  int**          win_pos_;  // window positions
+
+  std::vector<char*> col_map_;
 };
 
-
 // =====================================================================
 //                          Accessors' definitions
 // =====================================================================
-bool ae_exp_manager_X11::get_display_on( void )
-{
-  return _display_on;
-}
-
-Display * ae_exp_manager_X11::get_display( void )
-{
-  return _display;
-}
-
-
-bool ae_exp_manager_X11::get_show_window( int8_t win )
-{
-  return ( (_show_window >> win) & 1 );
-}
-
-bool ae_exp_manager_X11::get_new_show_window( int8_t win )
-{
-  return ( (_new_show_window >> win) & 1 );
-}
-
-
-int8_t ae_exp_manager_X11::get_screen( void )
-{
-  return _screen;
-}
-
-
-Atom* ae_exp_manager_X11::get_atoms( void )
-{
-  return _atoms;
-}
-
-
-ae_X11_window* ae_exp_manager_X11::get_window( int8_t win )
-{
-  return _win[win];
-}
 
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
 
+} // namespace aevol
 
-#endif // __AE_EXP_SETUP_X11_H__
+#endif // AEVOL_EXP_SETUP_X11_H_
diff --git a/src/libaevol/ExpSetup.cpp b/src/libaevol/ExpSetup.cpp
new file mode 100644
index 0000000..d0c10f2
--- /dev/null
+++ b/src/libaevol/ExpSetup.cpp
@@ -0,0 +1,356 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <zlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <set>
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "ExpSetup.h"
+#include "JumpingMT.h"
+
+
+#include "GzHelpers.h"
+
+namespace aevol {
+//##############################################################################
+//                                                                             #
+//                              Class ExpSetup                                 #
+//                                                                             #
+//##############################################################################
+
+// ===========================================================================
+//                         Definition of static attributes
+// ===========================================================================
+
+// ===========================================================================
+//                                  Constructors
+// ===========================================================================
+ExpSetup::ExpSetup( ExpManager * exp_m )
+{
+  exp_m_  = exp_m;
+  
+  // -------------------------------------------------------------- Selection
+  sel_ = new Selection( exp_m );
+  
+  // --------------------------------------------------------------- Transfer
+  with_HT_                    = false;
+  repl_HT_with_close_points_  = false;
+  HT_ins_rate_                = 0.0;
+  HT_repl_rate_               = 0.0;
+  repl_HT_detach_rate_         = 0.0;
+  
+  // --------------------------------------------------------------- Plasmids
+  with_plasmids_    = false;
+  prob_plasmid_HT_  = 0.0;
+  tune_donor_ability_     = 0.0;
+  tune_recipient_ability_ = 0.0;
+  donor_cost_       = 0.0;
+  recipient_cost_   = 0.0;
+  swap_GUs_         = false;
+  
+  // -------------------------------------------------------------- Secretion
+  with_secretion_ = false;
+  secretion_contrib_to_fitness_ = 0.0;
+  secretion_cost_               = 0.0;
+
+  fuzzy_flavor_                 = 0;
+
+#ifdef __REGUL
+  _protein_presence_limit = 1e-2;
+  _degradation_rate  = 1;
+  _nb_degradation_step  = 10;
+  _with_heredity          = false;
+  _nb_indiv_age      = 20;
+
+  _hill_shape_n      = 4;
+  _hill_shape_theta  = 0.5;
+  _hill_shape        = std::pow( _hill_shape_theta, _hill_shape_n );
+
+  _list_eval_step    = new std::set<int>();
+#endif
+}
+  
+
+// ===========================================================================
+//                                 Destructor
+// ===========================================================================
+
+/*!
+*/
+void ExpSetup::write_setup_file(gzFile exp_setup_file) const {
+  gzwrite(exp_setup_file,
+          fuzzy_flavor_);
+
+  // --------------------------------------------------------------- Transfer
+  gzwrite(exp_setup_file,
+          static_cast<int8_t>(with_HT_),
+          static_cast<int8_t>(repl_HT_with_close_points_));
+  if (with_HT_)
+    gzwrite(exp_setup_file,
+            HT_ins_rate_,
+            HT_repl_rate_);
+  if(repl_HT_with_close_points_)
+    gzwrite(exp_setup_file,
+            repl_HT_detach_rate_);
+
+  // --------------------------------------------------------------- Plasmids
+  int8_t tmp_with_plasmids = with_plasmids();
+  gzwrite(exp_setup_file, tmp_with_plasmids);
+  if (tmp_with_plasmids)
+    gzwrite(exp_setup_file,
+            prob_plasmid_HT_,
+            tune_donor_ability_,
+            tune_recipient_ability_,
+            donor_cost_,
+            recipient_cost_,
+            static_cast<int8_t>(swap_GUs_));
+
+  // -------------------------------------------------------------- Secretion
+  gzwrite(exp_setup_file,
+          static_cast<int8_t>(with_secretion_),
+          secretion_contrib_to_fitness_,
+          secretion_cost_);
+
+  sel()->write_setup_file(exp_setup_file);
+
+#ifdef __REGUL
+  gzwrite( exp_setup_file, _hill_shape, _hill_shape_n, _hill_shape_theta,
+          _degradation_rate, _nb_degradation_step, _nb_indiv_age, _with_heredity,
+          _protein_presence_limit);
+
+  char* binding_matrix_file_name = new char[100];
+
+  sprintf( binding_matrix_file_name, "binding_matrix.rae" );
+
+  gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "w" );
+
+  if ( binding_matrix_file == Z_NULL )
+  {
+    printf( "ERROR : Could not write binding matrix file %s\n", binding_matrix_file_name );
+    exit( EXIT_FAILURE );
+  }
+
+  write_binding_matrix_to_backup( binding_matrix_file );
+  gzclose( binding_matrix_file );
+
+  delete[] binding_matrix_file_name;
+
+  unsigned int eval_step_size = _list_eval_step->size();
+  gzwrite(exp_setup_file, eval_step_size);
+
+  for(auto eval_step : *_list_eval_step) {
+    gzwrite(exp_setup_file, eval_step);
+  }
+#endif
+  gzwrite(exp_setup_file,
+          first_regul_);
+}
+
+void ExpSetup::load(gzFile setup_file, gzFile backup_file, bool verbose) {
+  gzread(setup_file,fuzzy_flavor_);
+  // -------------------------------------------- Retrieve transfer parameters
+  int8_t tmp_with_HT;
+  int8_t tmp_repl_HT_with_close_points;
+  gzread(setup_file,
+         tmp_with_HT,
+         tmp_repl_HT_with_close_points);
+  with_HT_ = static_cast<bool>(tmp_with_HT);
+  repl_HT_with_close_points_ = static_cast<bool>(tmp_repl_HT_with_close_points);
+  if (with_HT_)
+  {
+    gzread(setup_file,
+           HT_ins_rate_,
+           HT_repl_rate_);
+  }
+   if(repl_HT_with_close_points_)
+    gzread(setup_file, repl_HT_detach_rate_);
+
+  // -------------------------------------------- Retrieve plasmid parameters
+  int8_t tmp_with_plasmids;
+  gzread(setup_file, tmp_with_plasmids);
+  with_plasmids_ = static_cast<bool>(tmp_with_plasmids);
+  if (with_plasmids_)
+  {
+    int8_t tmp_swap_GUs;
+    gzread(setup_file,
+           prob_plasmid_HT_,
+           tune_donor_ability_,
+           tune_recipient_ability_,
+           donor_cost_,
+           recipient_cost_,
+           tmp_swap_GUs);
+    swap_GUs_ = static_cast<bool>(tmp_swap_GUs);
+  }
+
+  // ------------------------------------------ Retrieve secretion parameters
+  int8_t tmp_with_secretion;
+  gzread(setup_file, tmp_with_secretion,
+         secretion_contrib_to_fitness_,
+         secretion_cost_);
+  with_secretion_ = static_cast<bool>(tmp_with_secretion);
+
+  // ---------------------------------------------- Retrieve selection context
+
+  sel()->load(setup_file, backup_file, verbose);
+
+#ifdef __REGUL
+  gzread( setup_file, _hill_shape, _hill_shape_n, _hill_shape_theta,
+          _degradation_rate, _nb_degradation_step, _nb_indiv_age, _with_heredity,
+          _protein_presence_limit);
+
+  char* binding_matrix_file_name = new char[100];
+//    _binding_matrix = new double[MAX_QUADON][MAX_CODON];
+
+  sprintf( binding_matrix_file_name, "binding_matrix.rae" );
+
+  gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "r" );
+
+  if ( binding_matrix_file == Z_NULL )
+  {
+    printf( "ERROR : Could not read binding matrix file %s\n", binding_matrix_file_name );
+    exit( EXIT_FAILURE );
+  }
+
+  read_binding_matrix_from_backup( binding_matrix_file );
+  gzclose( binding_matrix_file );
+
+  delete[] binding_matrix_file_name;
+
+  unsigned int eval_step_size;
+  gzread(setup_file, eval_step_size);
+
+  int eval_val;
+  for(unsigned int i = 0; i < eval_step_size; i++) {
+    gzread(setup_file, eval_val);
+    _list_eval_step->insert(eval_val);
+  }
+#endif
+
+  gzread(setup_file,
+          first_regul_);
+}
+
+#ifdef __REGUL
+void ExpSetup::init_binding_matrix( bool random_binding_matrix, double binding_zeros_percentage,
+		std::shared_ptr<JumpingMT> prng)
+{
+  if(random_binding_matrix==1)
+  {
+    for( int8_t i = 0; i < MAX_QUADON; i++ )  // i for the quadons
+    {
+      for( int8_t j = 0; j < MAX_CODON; j++ )  // j for the codons
+      {
+        if( prng->random() > binding_zeros_percentage)
+        {
+        	_binding_matrix[i][j] = prng->random();
+        }
+        else
+        {
+        	_binding_matrix[i][j] = 0;
+        }
+//  	  printf("m[%d][%d] = %f\n",MAX_QUADON,MAX_CODON, _binding_matrix[i][j]);
+      }
+    }
+  }
+  else // random_binding_matrix == 0
+  {
+    char* binding_matrix_file_name = new char[100];
+//    _binding_matrix = new double[MAX_QUADON][MAX_CODON];
+
+    sprintf( binding_matrix_file_name, "binding_matrix.rae" );
+
+    gzFile binding_matrix_file = gzopen( binding_matrix_file_name, "r" );
+
+    if ( binding_matrix_file == Z_NULL )
+    {
+      printf( "ERROR : Could not read binding matrix file %s\n", binding_matrix_file_name );
+      exit( EXIT_FAILURE );
+    }
+
+    read_binding_matrix_from_backup( binding_matrix_file );
+    gzclose( binding_matrix_file );
+
+    delete[] binding_matrix_file_name;
+  }
+
+
+
+
+}
+
+void ExpSetup::read_binding_matrix_from_backup(gzFile binding_matrix_file) {
+	for (int i=0; i < MAX_QUADON; i++) {
+		for (int j=0; j < MAX_CODON; j++) {
+			gzread( binding_matrix_file, (_binding_matrix[i][j]));
+		}
+	}
+}
+
+void ExpSetup::write_binding_matrix_to_backup(gzFile binding_matrix_file) const {
+	double value;
+	for (int i=0; i < MAX_QUADON; i++) {
+		for (int j=0; j < MAX_CODON; j++) {
+			value = _binding_matrix[i][j];
+			gzwrite( binding_matrix_file, (_binding_matrix[i][j]));
+		}
+	}
+}
+
+void ExpSetup::write_binding_matrix_to_file( FILE* file ) const
+{
+  for( int16_t row = 0 ; row < MAX_QUADON ; row++ )
+  {
+    for( int16_t column = 0 ; column < MAX_CODON ; column++ )
+    {
+      fprintf( file, "\t%e", _binding_matrix[row][column] );
+    }
+    fprintf( file, "\n");
+  }
+}
+
+void ExpSetup::print_binding_matrix()
+{
+  for( int16_t row = 0 ; row < MAX_QUADON ; row++ )
+  {
+    for( int16_t column = 0 ; column < MAX_CODON ; column++ )
+    {
+      printf("M[%d][%d] = %e\n", row, column, _binding_matrix[row][column] );
+    }
+  }
+}
+#endif
+
+// ===========================================================================
+//                                Protected Methods
+// ===========================================================================
+} // namespace aevol
diff --git a/src/libaevol/ExpSetup.h b/src/libaevol/ExpSetup.h
new file mode 100644
index 0000000..ca2882e
--- /dev/null
+++ b/src/libaevol/ExpSetup.h
@@ -0,0 +1,359 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_EXP_SETUP_H_
+#define AEVOL_EXP_SETUP_H_
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cinttypes>
+#include <cstdlib>
+#include <set>
+
+#include "Selection.h"
+#include "Stats.h"
+#include "Logging.h"
+#include "Tree.h"
+#include "Dump.h"
+#include "JumpingMT.h"
+
+namespace aevol {
+
+// ===========================================================================
+//                          Class declarations
+// ===========================================================================
+class ParamLoader;
+
+class ExpSetup {
+  friend class ExpManager;
+
+  public:
+  // =======================================================================
+  //                             Constructors
+  // =======================================================================
+  ExpSetup() = delete;
+  ExpSetup(const ExpSetup&) = delete;
+  ExpSetup(ExpManager* exp_m);
+
+  // =======================================================================
+  //                             Destructors
+  // =======================================================================
+  virtual ~ExpSetup() { delete sel_; }
+
+  // =======================================================================
+  //                         Accessors: getters
+  // =======================================================================
+  inline int get_fuzzy_flavor( void ) const;
+
+  // ----------------------------------------------------- Selection context
+  Selection * sel() const { return sel_; }
+
+  // --------------------------------------------------------------- Transfer
+  double repl_HT_detach_rate() const { return repl_HT_detach_rate_; }
+
+  // --------------------------------------------------------------- Plasmids
+  // See comments in ExpManager.h on how plasmids are handled
+  bool   with_plasmids() const { return with_plasmids_; }
+  double prob_plasmid_HT() const { return prob_plasmid_HT_; }
+  double tune_donor_ability() const { return tune_donor_ability_; }
+  double tune_recipient_ability() const { return tune_recipient_ability_; }
+  bool   swap_GUs() const { return swap_GUs_; }
+
+  // -------------------------------------------------------------- Secretion
+  bool   with_secretion() const { return with_secretion_; }
+  double secretion_contrib_to_fitness() const { return secretion_contrib_to_fitness_; }
+  double secretion_cost() const { return secretion_cost_; }
+
+#ifdef __REGUL
+    inline bool   get_with_heredity( void ) const;
+    inline double get_degradation_rate( void ) const;
+    inline int    get_nb_degradation_step( void ) const;
+    inline double get_protein_presence_limit( void ) const;
+
+    inline double get_hill_shape( void ) const;
+    inline double get_hill_shape_n( void ) const;
+    inline double get_hill_shape_theta( void ) const;
+
+    inline int get_nb_indiv_age( void ) const;
+    std::set<int>* get_list_eval_step( void ) const {
+      return _list_eval_step;
+    }
+#endif
+
+    bool first_regul() const { return first_regul_; }
+
+  // =======================================================================
+  //                         Accessors: setters
+  // =======================================================================
+  inline void set_fuzzy_flavor( int fuzzy_flavor );
+  // --------------------------------------------------------------- Transfer
+  void set_with_HT(bool with_HT) { with_HT_ = with_HT; }
+  void set_repl_HT_with_close_points(bool repl_HT_with_close_points) { repl_HT_with_close_points_ = repl_HT_with_close_points; }
+  void set_HT_ins_rate(double HT_ins_rate) { HT_ins_rate_ = HT_ins_rate; }
+  void set_HT_repl_rate(double HT_repl_rate) { HT_repl_rate_ = HT_repl_rate; }
+  void set_repl_HT_detach_rate(double repl_HT_detach_rate) { repl_HT_detach_rate_ = repl_HT_detach_rate; }
+
+  // --------------------------------------------------------------- Plasmids
+  void set_with_plasmids(bool with_p) { with_plasmids_ = with_p; }
+  void set_prob_plasmid_HT(double prob_p_HT) { prob_plasmid_HT_ = prob_p_HT; }
+  void set_tune_donor_ability(double tune_donor_ability) { tune_donor_ability_ = tune_donor_ability; }
+  void set_tune_recipient_ability(double tune_recipient_ability) { tune_recipient_ability_ = tune_recipient_ability; }
+  void set_donor_cost(double donor_cost) { donor_cost_ = donor_cost; }
+  void set_recipient_cost(double recipient_cost) { recipient_cost_ = recipient_cost; }
+  void set_swap_GUs(bool swap_GUs) { swap_GUs_ = swap_GUs; }
+
+  // -------------------------------------------------------------- Secretion
+  void set_with_secretion(bool with_secretion) { with_secretion_ = with_secretion; }
+  void set_secretion_contrib_to_fitness(double secretion_contrib) { secretion_contrib_to_fitness_ = secretion_contrib; }
+  void set_secretion_cost(double secretion_cost) { secretion_cost_ = secretion_cost; }
+
+#ifdef __REGUL
+    inline void set_with_heredity( bool with_heredity );
+    inline void set_degradation_rate( double degradation_rate );
+    inline void set_nb_degradation_step( int nb_degradation_step );
+    inline void set_protein_presence_limit( double protein_presence_limit );
+
+    inline void set_hill_shape( double hill_shape );
+    inline void set_hill_shape_n( double hill_shape_n );
+    inline void set_hill_shape_theta( double hill_shape_theta );
+
+    inline void set_nb_indiv_age( int nb_indiv_age );
+
+    inline void set_list_eval_step(std::set<int> list_eval_step);
+#endif
+    void set_first_regul(bool first_regul) { first_regul_ = first_regul; }
+
+  // =======================================================================
+  //                            Public Methods
+  // =======================================================================
+  void write_setup_file(gzFile exp_setup_file) const;
+  void save(gzFile backup_file) const;
+  void load(gzFile setup_file, gzFile backup_file, bool verbose);
+  /// Make the individuals reproduce
+  void step_to_next_generation() { sel_->step_to_next_generation(); }
+#ifdef __REGUL
+    // Regulation
+    void     init_binding_matrix( bool random_binding_matrix, double binding_zeros_percentage,
+    		       std::shared_ptr<JumpingMT> prng);
+
+    void     read_binding_matrix_from_backup(gzFile binding_matrix_file);
+    void     write_binding_matrix_to_backup(gzFile binding_matrix_file) const;
+
+    void     write_binding_matrix_to_file(FILE* binding_matrix_file) const;
+    void     print_binding_matrix( void );
+
+    double get_binding_matrix( int row, int column ) const;
+#endif
+
+  // =======================================================================
+  //                           Public Attributes
+  // =======================================================================
+
+#ifdef __REGUL
+double  _binding_matrix[MAX_QUADON][MAX_CODON];
+#endif
+
+ protected :
+  // =======================================================================
+  //                           Protected Methods
+  // =======================================================================
+  virtual void display() {};
+
+  // =======================================================================
+  //                          Protected Attributes
+  // =======================================================================
+  ExpManager* exp_m_;
+
+  int fuzzy_flavor_;
+  // ----------------------------------------------------- Selection context
+  Selection* sel_;
+
+  // --------------------------------------------------- Transfer parameters
+  bool   with_HT_;
+  bool   repl_HT_with_close_points_;
+  double HT_ins_rate_;
+  double HT_repl_rate_;
+  double repl_HT_detach_rate_;
+
+  // --------------------------------------------------- Plasmids parameters
+  bool   with_plasmids_;
+  double prob_plasmid_HT_; // Base transfer ability independent of evolvable donor and recipient ability
+  double tune_donor_ability_; // How much the individuals can tune their ability to send plasmids
+  double tune_recipient_ability_; // How much the individuals can tune their ability to receive plasmids
+  double donor_cost_;
+  double recipient_cost_;
+  bool   swap_GUs_; // Whether plasmid HT is uni- or bidirectional
+
+  // -------------------------------------------------- Secretion parameters
+  bool   with_secretion_;
+  double secretion_contrib_to_fitness_;
+  double secretion_cost_;
+#ifdef __REGUL
+    // Binding matrix
+
+
+    bool    _with_heredity;
+    double  _protein_presence_limit;
+
+    double  _degradation_rate;
+    int     _nb_degradation_step;
+
+    double _hill_shape_n;
+    double _hill_shape;
+    double _hill_shape_theta;
+
+    int    _nb_indiv_age;
+
+    std::set<int>* _list_eval_step;
+#endif
+  bool first_regul_;
+};
+
+
+// =====================================================================
+//                           Getters' definitions
+// =====================================================================
+
+inline int ExpSetup::get_fuzzy_flavor( void ) const
+{
+  return fuzzy_flavor_;
+}
+
+#ifdef __REGUL
+inline bool ExpSetup::get_with_heredity( void ) const
+{
+  return _with_heredity;
+}
+
+inline double ExpSetup::get_degradation_rate( void ) const
+{
+  return _degradation_rate;
+}
+
+
+inline int ExpSetup::get_nb_degradation_step( void ) const
+{
+  return _nb_degradation_step;
+}
+
+inline double ExpSetup::get_protein_presence_limit( void ) const
+{
+  return _protein_presence_limit;
+}
+
+inline double ExpSetup::get_hill_shape( void ) const
+{
+  return _hill_shape;
+}
+
+inline double ExpSetup::get_hill_shape_n( void ) const
+{
+  return _hill_shape_n;
+}
+
+inline double ExpSetup::get_hill_shape_theta( void ) const
+{
+  return _hill_shape_theta;
+}
+
+inline int ExpSetup::get_nb_indiv_age( void ) const
+{
+  return _nb_indiv_age;
+}
+#endif
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+// --------------------------------------------------------------- Transfer
+inline void ExpSetup::set_fuzzy_flavor( int fuzzy_flavor )
+{
+  fuzzy_flavor_ = fuzzy_flavor;
+}
+
+#ifdef __REGUL
+inline void ExpSetup::set_with_heredity( bool with_heredity )
+{
+  _with_heredity = with_heredity;
+}
+
+inline void ExpSetup::set_degradation_rate( double degradation_rate )
+{
+  _degradation_rate = degradation_rate;
+}
+
+inline void ExpSetup::set_nb_degradation_step( int degradation_step )
+{
+  _nb_degradation_step = degradation_step;
+}
+
+inline void ExpSetup::set_protein_presence_limit( double protein_presence_limit )
+{
+  _protein_presence_limit = protein_presence_limit;
+}
+
+inline void ExpSetup::set_hill_shape( double hill_shape )
+{
+  _hill_shape = hill_shape;
+}
+
+inline void ExpSetup::set_hill_shape_theta( double hill_shape_theta )
+{
+  _hill_shape_theta = hill_shape_theta;
+}
+
+inline void ExpSetup::set_hill_shape_n( double hill_shape_n )
+{
+  _hill_shape_n = hill_shape_n;
+}
+
+
+inline void ExpSetup::set_nb_indiv_age( int nb_indiv_age )
+{
+  _nb_indiv_age = nb_indiv_age;
+}
+
+inline void ExpSetup::set_list_eval_step( std::set<int> list_eval_step )
+{
+  _list_eval_step = new std::set<int>(list_eval_step);
+}
+#endif
+
+// =====================================================================
+//                       functions' definition
+// =====================================================================
+
+#ifdef __REGUL
+inline double ExpSetup::get_binding_matrix( int row, int column ) const
+{
+  return _binding_matrix[row][column];
+}
+#endif
+
+} // namespace aevol
+
+#endif // AEVOL_EXP_SETUP_H_
diff --git a/src/libaevol/Fuzzy.cpp b/src/libaevol/Fuzzy.cpp
new file mode 100644
index 0000000..20db370
--- /dev/null
+++ b/src/libaevol/Fuzzy.cpp
@@ -0,0 +1,440 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+/// TODO: add unit tests
+/// Why should there always be points (X_MIN, 0),(X_MAX, 0) ?
+/// Many tests for double-type equality ==. Should't we check mod ε?
+
+#include "Fuzzy.h"
+
+#include <cstdint>
+#include <cassert>
+#include <cmath>
+
+#include <iterator>
+#include <iostream>
+#include <algorithm>
+
+#include "Point.h"
+#include "macros.h"
+
+using std::list;
+using std::prev;
+using std::next;
+using std::find_if;
+using std::fabs;
+using std::cout;
+using std::endl;
+
+namespace aevol {
+
+/// Get probability of x belonging to fuzzy set.
+///
+/// If there is an actual point in `points_` list with abscissa `x`
+/// return it ordinate. Otherwise interpolate surrounding points.
+///
+/// TODO: use it! (vld, 2014-12-19)
+///
+double Fuzzy::y(double x, list<Point>::const_iterator begin) const {
+  assert(x >= X_MIN and x <= X_MAX);
+  assert(points_.size() >= 2);
+
+  // Get the first point having abscissa ≥ x
+  list<Point>::const_iterator p2 =
+    find_if(begin, points_.end(),
+            [x](const Point& m){return m.x >= x;});
+  assert(p2 != points_.end());
+
+  if (p2->x == x) // If p2 has abscissa x, he's the guy
+    return p2->y;
+  else { // Otherwise interpolate
+    list<Point>::const_iterator p1 = prev(p2);
+    return p1->y +
+      (x - p1->x) * ((p2->y - p1->y) /
+                         (p2->x - p1->x));
+  }
+}
+
+double Fuzzy::y(double x) const {
+  return y(x, points_.begin());
+}
+
+/// Get abscissa of point interpolated between `p1` and `p2`, at
+/// ordinate `y`.
+///
+/// \pre{`p1` and `p2` should not be on the same horizontal line}
+/// otherwise any x would fit.
+///
+/// \pre{`y` should be between `p1` and `p2` ordinates} Despite the
+/// fact that the reverse is mathematically sound, it's not supposed
+/// to happend here.
+double Fuzzy::x(const Point& p1, const Point& p2, double y) const {
+  assert((p2.y <= y and y <= p1.y) or
+         (p1.y <= y and y <= p2.y));
+  assert(p1.y != p2.y);
+  double x = p1.x + (y - p1.y) * (p2.x - p1.x) /
+                                 (p2.y - p1.y);
+  assert((p2.x <= x and x <= p1.x) or
+         (p1.x <= x and x <= p2.x));
+  return x;
+}
+
+/// Remove (some) superfluous points_.
+///
+/// When several (≥3) consecutive points_ in the fuzzy set are on the
+/// same segment, the inner ones don't add information as they could
+/// be interpolated from the outer ones. This function trims down the
+/// `points_` list from such points_, only when they are on the same
+/// ordinate or on the same abscissa.
+///
+/// For instance, on the following probability function, A and B would
+/// be removed:
+/// \verbatim
+///   ^      B
+///   |   +--+-----+
+///   |   |         \     ---
+///   |  A+          \   /
+///   |   |           \ /
+///   |---+------------+-------+----->
+/// \endverbatim
+///
+/// TODO: double check if using this function is beneficial. Removed
+/// points_ could then be recreated.
+///
+/// TODO: test with points_
+/// {(X_MIN,0), ((X_MIN+X_MAX)/2,0), (X_MAX,0)} → {(X_MIN,0), (X_MAX,0)}
+/// d:= (X_MIN+X_MAX)/n {(X_MIN,0), ..., (k * (X_MIN + X_MAX) / n,0), ..., (X_MAX,0)} → {(X_MIN,0), (X_MAX,0)}
+/// idem on non-null ordinate
+/// idem on //y-axis
+/// test with points_ starting/ending with constant
+void Fuzzy::simplify() {
+  // assert(invariant());
+
+  for (list<Point>::iterator p = points_.begin();
+       p != points_.end() and p != prev(points_.end()) and p != prev(points_.end(), 2);
+       ++p)
+    if (p->x == next(p)->x and p->x == next(p,2)->x)
+      points_.erase(next(p), prev(find_if(p, points_.end(), [p](const Point& q){return q.x != p->x;})));
+    else if (p->y == next(p)->y and p->y == next(p,2)->y)
+      points_.erase(next(p), prev(find_if(p, points_.end(), [p](const Point& q){return q.y != p->y;})));
+
+  // postcondition:
+  // there are no 3 points_ that all share the same abscissas or that all share the same ordinates
+  // all the points_ come from previous `points_` list
+  // assert(invariant());
+}
+
+/// Add a triangle to the fuzzy set.
+/// \param mean abscissa of its apex
+/// \param width of the side opposite to the apex
+/// \param height ordinate of the apex
+void Fuzzy::add_triangle(double mean, double width, double height) {
+  // assert(invariant());
+
+  assert(width > 0.0);
+  assert(X_MIN <= mean and mean <= X_MAX);
+  assert(W_MIN <= width); // the maximum width depends on each individual
+  // assert(MIN_H <= height and height <= MAX_H); Not necessarily because the concentration can be > 1
+
+  const double threshold = 1e-15; // TODO: should it not be the machine epsilon?
+                                  // if not, it should at least be a class constant
+
+  if (fabs(width) < threshold or fabs(height) < threshold)
+    return;
+
+  list<Point>::iterator p0, p1, p2;
+  p0 = p1 = points_.begin();
+  p2 = prev(points_.end());
+
+  double x0 = mean - width;
+  double x1 = mean;
+  double x2 = mean + width;
+
+  // TODO: bugfix? if points on borders X_MIN,MAX, should not the ordinate be appropriately set?
+  // TODO: create_interpolated_point should return an ITERATOR to point list
+  if (x0 >= X_MIN)  p0 = create_interpolated_point(x0);
+  p1 = create_interpolated_point(mean, p0);
+  if (x2 <= X_MAX)  p2 = create_interpolated_point(x2, p1);
+
+  // Update points with abscissas in (x0;x1)
+  for (list<Point>::iterator p = p0 ; p != p1 ; ++p)
+    p->y += (p->x - x0) / (x1 - x0) * height;
+
+  // Update points with abscissas in (x0;x1)
+  for (list<Point>::iterator p = p1 ; p != p2 ; ++p)
+    p->y += height * (x2 - p->x) / (x2 - x1);
+
+  // assert(invariant());
+  return;
+}
+
+/// Add a fuzzy set to the current one.
+///
+/// Should actually be called `operator+=()`.
+///
+/// Semantically speaking, we deal with fuzzy sets over the same
+/// range. So adding two fuzzy sets sums up to adding the probability
+/// functions.
+void Fuzzy::add(const AbstractFuzzy& f) {
+  const Fuzzy fs = (Fuzzy&)(f);
+  // assert(invariant());
+
+  // Add interpolated points_ to current fuzzy set so that
+  // `fs.points_` ⊂ `points_`
+  for (const Point& q: fs.points_)
+    create_interpolated_point(q.x);
+
+  // each point in `points_` gets `fs`'s counterpart ordinate added to
+  // it.
+  for (Point& p: points_)
+    p.y += fs.y(p.x);
+
+  // assert(invariant());
+}
+
+/// Substract to the current fuzzy set.
+///
+/// TODO: Dumb version (?), to be completed.
+void Fuzzy::sub(const AbstractFuzzy& f) {
+  const Fuzzy fs = (Fuzzy&)(f);
+  // assert(invariant());
+
+  for (const Point& q: fs.points_)
+    create_interpolated_point(q.x);
+
+  for (Point& p: points_)
+    p.y -= fs.y(p.x);
+
+  // assert(invariant());
+}
+
+/// Absolute area between x-axis and segment [p1,p2].
+///
+/// The area of a crossed trapezoid can be computed just the same as a
+/// normal one if the bases are counted algebrically (±).
+double trapezoid_area(const Point& p1, const Point& p2) {
+  return fabs((p1.y + p2.y) / 2.0 *
+              (p2.x - p1.x));
+}
+
+double Fuzzy::get_geometric_area() const {
+  return get_geometric_area(points_.begin(), points_.end());
+}
+
+/// Get integral of the absolute of probability function.
+///
+double Fuzzy::get_geometric_area(list<Point>::const_iterator begin,
+                             list<Point>::const_iterator end) const {
+  // Precondition would be along the lines of:
+  // assert(points_.begin() <= begin < end < points_.end());
+  double area = 0;
+  for (list<Point>::const_iterator p = begin ; next(p) != end ; ++p)
+    area += trapezoid_area(*p, *next(p));
+  return area;
+}
+
+double Fuzzy::get_geometric_area(double x_start, double x_stop) const {
+  // assert(invariant());
+  // Precondition: X_MIN ≤ x_start < x_stop ≤ X_MAX
+  assert(X_MIN <= x_start and x_start < x_stop and x_stop <= X_MAX);
+
+  // first point with abscissa ≥ x_start
+  list<Point>::const_iterator begin = find_if(points_.begin(), points_.end(),
+                                              [x_start](const Point& p){return p.x >= x_start;});
+  // point following the last one with abscissa ≤ x_stop
+  list<Point>::const_iterator end = find_if(begin, points_.end(),
+                                            [x_stop](const Point& p){return p.x > x_stop;});
+
+  // area before begin
+  double first_part = trapezoid_area(Point(x_start, y(x_start)), *begin);
+  // area after prev(end)
+  double last_part = trapezoid_area(*prev(end), Point(x_stop, y(x_stop)));
+
+  return first_part + get_geometric_area(begin, end) + last_part;
+}
+
+// double Fuzzy::geometric_area(double start_segment, double end_segment) const {
+//   // Precondition: X_MIN ≤ start_segment < end_segment ≤ X_MAX
+//   assert(X_MIN <= start_segment and start_segment < end_segment and end_segment <= X_MAX);
+
+//   Fuzzy copy(*this);
+
+//   return copy.geometric_area(copy.create_interpolated_point(start_segment), next(copy.create_interpolated_point(end_segment)));
+// }
+
+double area_test() {
+  Fuzzy f;
+  f.add_triangle(0.5, 1.0, 0.5);
+  double a = f.get_geometric_area(0.0, 1.0);
+  return a;
+}
+
+/// Probability function gets clipped either upwise ou downwise.
+///
+/// `pf` := min(`pf`, `upper_bound`)
+///
+///            X    above: removed               |
+///           / \                                |
+///          /   \               X      bound    |
+/// --------o-----o-------------o-o--------      |
+///        /       \   X       /   \             |
+///       X         \ / \     /     \            |
+///                  X   \   /       X           |
+///                       \ /                    |
+///      underneath: kept  X                     |
+
+/// `pf` := max(`pf`, `lower_bound`)
+void Fuzzy::clip(clipping_direction direction, double bound) {
+  // assert(invariant());
+
+  for (list<Point>::iterator p = points_.begin() ; p != points_.end() ; ++p) {
+    if (next(p) != points_.end() and
+        ((p->y < bound and bound < next(p)->y) or
+         (p->y > bound and bound > next(p)->y))) { // ie if p and next(p) are across bound
+      // insert interpolated point
+      //           *after* p
+      points_.insert(next(p), Point(x(*p, *next(p), bound),
+                                   bound));
+      // could now fast forward over created point... TODO?
+    }
+    if ((direction == clipping_direction::min and p->y < bound) or
+        (direction == clipping_direction::max and p->y > bound))
+      p->y = bound;
+  }
+
+  // assert(invariant());
+}
+
+
+bool Fuzzy::is_identical_to(const AbstractFuzzy& f, double tolerance ) const {
+  const Fuzzy fs = (Fuzzy&)(f);
+  // Since list::size() has constant complexity since C++ 11, checking
+  // size is an inexpensive first step.
+  if (points_.size() != fs.points_.size())
+    return false;
+
+  for (list<Point>::const_iterator p = points_.begin(), q = fs.points_.begin() ;
+       p != points_.end() ; // no need to check q because both lists have same size
+       ++p, ++q)
+    if (fabs(p->x - q->x) > tolerance * (fabs(p->x) + fabs(q->x)) or
+        fabs(p->y - q->y) > tolerance * (fabs(p->y) + fabs(q->y)))
+      return false;
+  return true;
+}
+
+
+void Fuzzy::save(gzFile backup_file) const {
+  int16_t nb_points = points_.size();
+  gzwrite(backup_file, &nb_points, sizeof(nb_points));
+  cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << endl;
+  cout << __FILE__ << ":" << __LINE__ << ":" << nb_points << endl;
+
+  for (const Point& p : points_)
+    writepoint(p, backup_file);
+}
+
+
+void Fuzzy::load(gzFile backup_file) {
+  // assert(invariant());
+
+  int16_t nb_points;
+  gzread(backup_file, &nb_points, sizeof(nb_points));
+  cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << endl;
+  cout << __FILE__ << ":" << __LINE__ << ":" << nb_points << endl;
+  for (int16_t i = 0 ; i < nb_points ; i++)
+    points_.push_back(Point(readpoint(backup_file)));
+
+  // assert(invariant());
+}
+
+list<Point>::iterator Fuzzy::create_interpolated_point(double x) {
+  return create_interpolated_point(x, points_.begin());
+}
+
+/// Find first point before abscissa `x`, starting from `start`.
+///
+/// `start_point` must refer to a point before abscissa `x`
+///
+/// idempotent: creating existing point returns existing point
+list<Point>::iterator Fuzzy::create_interpolated_point(double x, std::list<Point>::iterator start) {
+  // assert(invariant());
+  assert(x >= X_MIN and x <= X_MAX);
+
+  // TODO: probably denotes a logic error
+  if (start->x <= x)
+    start = points_.begin();
+
+  // get first point with abscissa stricly greater than x
+  list<Point>::iterator p = find_if(start, points_.end(), [x](Point& q){return q.x > x;});
+  if (prev(p)->x == x) {
+    // point already in points_
+    // assert(invariant());
+    return prev(p);
+  }
+  // insert point before p
+  // assert(invariant());
+  return points_.insert(p, Point(x, y(x)));
+}
+
+/// Check that list of `points_`' abscissas is (strictly) increasing.
+bool Fuzzy::is_increasing() const {
+  for (list<Point>::const_iterator p = points_.begin() ; p != prev(points_.end(), 2) ; ++p)
+    if (p->x > next(p)->x)
+      return false;
+  return true;
+}
+
+/// Set all points ordinate to 0
+///
+// TODO <david.parsons at inria.fr> Not sure if it's useful.
+void Fuzzy::reset() {
+  for (Point& p: points_)
+    p.y = 0;
+
+  // assert(invariant());
+}
+
+void Fuzzy::clear() {
+  points_.clear();
+}
+
+void Fuzzy::add_point(double x, double y)
+{
+  list<Point>::iterator p = find_if(points_.begin(), points_.end(), [x](Point& q){return q.x > x;});
+  if (prev(p)->x == x) {
+    prev(p)->y += y;
+  } else {
+    points_.insert(p,Point(x,y));
+  }
+}
+
+void Fuzzy::print() const
+{
+  for (const Point& p : points_)
+    printf("[%f : %f] ",p.x,p.y);
+  printf("\n");
+}
+} // namespace aevol
diff --git a/src/libaevol/Fuzzy.h b/src/libaevol/Fuzzy.h
new file mode 100644
index 0000000..a6fcd9e
--- /dev/null
+++ b/src/libaevol/Fuzzy.h
@@ -0,0 +1,158 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_FUZZY_H_
+#define AEVOL_FUZZY_H_
+
+#include <list>
+
+#include "macros.h"
+#include "Point.h"
+#include "AbstractFuzzy.h"
+
+namespace aevol {
+
+/// Triangular fuzzy sets.
+///
+/// This class provides management tools for "fuzzy sets" abscissa are
+/// bound between X_MIN and X_MAX (defined in macros.h) A "fuzzy
+/// set" should always have at least two points of abscissa X_MIN and
+/// X_MAX.
+///
+/// A fuzzy set holds elements in a set X together with a probability
+/// function X → [0,1] which tells how likely element x ∈ X beholds to
+/// the fuzzy set. With these triangular fuzzy sets, the probability
+/// function is a finite sum of isosceles triangles.
+///
+/// The current class models fuzzy sets over range X = [X_MIN; X_MAX]
+/// by representing the probability function as the list of singular
+/// points on its graph.
+///
+/// \verbatim
+/// \\code{.unparsed}
+///           ^
+///       y2  +...              X                                            ....
+///           |...             / \                                           ....
+///       y6  +...            /   \               X                          ....
+///           |...           /     \             / \                         ....
+///       y4  +...          /       \   X       /   \                        ....
+///           |...         /         \ / \     /     \                       ....
+///      y3,y9+...        /           X   \   /       \             X        ....
+///           |...       /                 \ /         \           / \       ....
+///       y5  +...      /                   X           \         /   \      ....
+///           |...     /                                 \       /     \     ....
+///       0   +--X----X---------|-----|-|---|-----|-------X-----X-------X----X--->
+///            X_MIN x1        x2    x3 x4 x5    x6      x7    x8  x9  x10 X_MAX
+/// \\endcode
+/// \endverbatim
+/// fs.points_ would hold the list {(X_MIN,0),(x1,y1),...,(x10,y10)(X_MAX,0)}
+///
+/// \invariant{`points_.size()` ≥ 2}
+/// \invariant{`points_.begin()->x == X_MIN`}
+/// \invariant{`prev(points_.end())->x == X_MAX`}
+/// \invariant{`is_increasing()`}
+class Fuzzy : public AbstractFuzzy
+{
+ public:
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Fuzzy(): points_({Point(X_MIN, 0.0), Point(X_MAX, 0.0)}) {};
+  Fuzzy(const Fuzzy& f): points_(f.points_) {};
+  Fuzzy(const gzFile backup) { load(backup); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Fuzzy() {};
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void save(gzFile backup) const;
+  void load(gzFile backup);
+  void reset();
+  void simplify();
+  void add_triangle(double mean, double width, double height);
+  void add(const AbstractFuzzy& f);
+  void sub(const AbstractFuzzy& f);
+  void add_point(double x, double y);
+
+  void clip(clipping_direction direction, double bound);
+  // TODO: should be made protected
+  std::list<Point>::iterator create_interpolated_point(double x);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  const std::list<Point>& points() const {return points_;}
+
+  double get_geometric_area() const;
+  double get_geometric_area(std::list<Point>::const_iterator begin,
+                            std::list<Point>::const_iterator end) const;
+  double get_geometric_area(double start_segment, double end_segment) const;
+  double y(double x, std::list<Point>::const_iterator begin) const;
+  double y(double x) const;
+  // get_x should be moved out of fuzzy class as it really applies to pair of points
+  double x(const Point& left, const Point& right, double y) const;
+  bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const;
+  void print() const;
+  void clear();
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+ protected:
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+  bool invariant() const {
+    return
+        points_.size() >= 2             and
+        points_.begin()->x == X_MIN     and
+        prev(points_.end())->x == X_MAX and
+        is_increasing();
+  };
+  bool is_increasing() const;
+
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  std::list<Point> points_;
+
+  std::list<Point>::iterator create_interpolated_point(
+          double x,
+          std::list<Point>::iterator start);
+};
+
+double trapezoid_area(const Point& p1, const Point& p2);
+} // namespace aevol
+#endif // AEVOL_FUZZY_H_
diff --git a/src/libaevol/ae_codon.cpp b/src/libaevol/FuzzyFactory.cpp
similarity index 51%
copy from src/libaevol/ae_codon.cpp
copy to src/libaevol/FuzzyFactory.cpp
index ea2dbf9..4820637 100644
--- a/src/libaevol/ae_codon.cpp
+++ b/src/libaevol/FuzzyFactory.cpp
@@ -27,100 +27,124 @@
 
 
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_codon.h>
-#include <ae_utils.h>
-
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "FuzzyFactory.h"
+#include "Fuzzy.h"
+#include "HybridFuzzy.h"
+#include "ExpSetup.h"
 
+namespace aevol {
 
 
 //##############################################################################
 //                                                                             #
-//                                Class ae_codon                               #
+//                           Class IndividualFactory                           #
 //                                                                             #
 //##############################################################################
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_codon::ae_codon( void )
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+/**
+ * Create an individual with random sequences
+ */
+/*static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s)
 {
-  _value = -1;
-}
+  AbstractFuzzy* fuzzy;
 
-ae_codon::ae_codon( const ae_codon &model )
-{
-  _value = model._value;
+  if (exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy();
+  } else {
+    fuzzy = new HybridFuzzy();
+  }
+
+  return fuzzy;
 }
 
-ae_codon::ae_codon( int8_t value )
+static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s, const AbstractFuzzy& copy)
 {
-  _value = value;
+  AbstractFuzzy* fuzzy;
+
+  if (exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy((Fuzzy&)(copy));
+  } else {
+    fuzzy = new HybridFuzzy((HybridFuzzy&)(copy));
+  }
+
+  return fuzzy;
 }
 
-ae_codon::ae_codon( ae_dna* dna, ae_strand strand, int32_t index )
+static AbstractFuzzy* FuzzyFactory::create_fuzzy(ExpSetup* exp_s, const gzFile backup)
 {
-  const char* gen = dna->get_data();
-  int32_t     len = dna->get_length();
-
-  _value = 0;
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index+i),len)] == '1' )
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
+  AbstractFuzzy* fuzzy;
+
+  if (exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy(backup);
+  } else {
+    fuzzy = new HybridFuzzy(backup);
   }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index-i),len)] != '1' ) // == and not != because we are on the complementary strand...
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
+
+  return fuzzy;
+}*/
+
+AbstractFuzzy* FuzzyFactory::create_fuzzy()
+{
+  AbstractFuzzy* fuzzy;
+
+  if (_exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy();
+  } else {
+    fuzzy = new HybridFuzzy();
   }
+
+  return fuzzy;
 }
 
-ae_codon::ae_codon( gzFile backup_file )
+AbstractFuzzy* FuzzyFactory::create_fuzzy(const AbstractFuzzy& copy)
 {
-  gzread( backup_file, &_value,   			sizeof(_value) );
+  AbstractFuzzy* fuzzy;
+
+  if (_exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy((Fuzzy&)(copy));
+  } else {
+    fuzzy = new HybridFuzzy((HybridFuzzy&)(copy));
+  }
+
+  return fuzzy;
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_codon::~ae_codon( void )
+AbstractFuzzy* FuzzyFactory::create_fuzzy(const gzFile backup)
 {
+  AbstractFuzzy* fuzzy;
+
+  if (_exp_s->get_fuzzy_flavor() == 0) {
+    fuzzy = new Fuzzy(backup);
+  } else {
+    fuzzy = new HybridFuzzy(backup);
+  }
+
+  return fuzzy;
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_codon::save( gzFile backup_file )
+int FuzzyFactory::get_fuzzy_flavor()
 {
-  gzwrite( backup_file, &_value,   			sizeof(_value) );
+  return _exp_s->get_fuzzy_flavor();
 }
-// =================================================================
-//                           Protected Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/FuzzyFactory.h
similarity index 50%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/FuzzyFactory.h
index fdb64b7..76d2311 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/FuzzyFactory.h
@@ -3,124 +3,115 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
+//
+//*****************************************************************************
 
 
+#ifndef AEVOL_FUZZY_FACTORY_H__
+#define AEVOL_FUZZY_FACTORY_H__
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
+#include "AbstractFuzzy.h"
 
+namespace aevol {
 
-// =================================================================
+// ============================================================================
 //                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
+// ============================================================================
+class ExpSetup;
 
+class FuzzyFactory
+{
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  FuzzyFactory(ExpSetup* exp_s) {_exp_s = exp_s;}; //< Default ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~FuzzyFactory(void) {}; //< Destructor
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  int get_fuzzy_flavor();
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+/*  static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s);
+  static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s, const AbstractFuzzy& copy);
+  static AbstractFuzzy* create_fuzzy(ExpSetup* exp_s, const gzFile backup);*/
+
+  AbstractFuzzy* create_fuzzy();
+  AbstractFuzzy* create_fuzzy(const AbstractFuzzy& copy);
+  AbstractFuzzy* create_fuzzy(const gzFile backup);
+
+  static FuzzyFactory* fuzzyFactory;
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  ExpSetup* _exp_s;
+};
 
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
 
 
-class ae_dump : public ae_object
-{  
- public :
-  
-  // =================================================================
-  //                             Constructors
-  // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
-  // =================================================================
-  //                             Destructors
-  // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
-  // =================================================================
-  //                              Accessors
-  // =================================================================
-  
-  // =================================================================
-  //                            Public Methods
-  // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
-  // =================================================================
-  //                           Public Attributes
-  // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-};
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
 
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
 
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
 
-// =====================================================================
+// ============================================================================
 //                       Inline functions' definition
-// =====================================================================
-#endif // __AE_DUMP_H__
+// ============================================================================
+
+} // namespace aevol
+
+#endif //AEVOL_FUZZYFACTORY_H
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/Gaussian.h
similarity index 55%
copy from src/libaevol/ae_dump.h
copy to src/libaevol/Gaussian.h
index fdb64b7..b2c0761 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/Gaussian.h
@@ -3,124 +3,127 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
+
+#ifndef AEVOL_GAUSSIAN_H_
+#define AEVOL_GAUSSIAN_H_
+
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cmath>
 
+#include <zlib.h>
 
+namespace aevol {
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-
-
-
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
-
-
-
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
-
 
-class ae_dump : public ae_object
-{  
+class Gaussian {
  public :
-  
+
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  Gaussian(double height, double mean, double width) : height_{height}, mean_{mean}, width_{width} {}
+  Gaussian(const Gaussian& model) : height_{model.height_}, mean_{model.mean_}, width_{model.width_} {}
+  Gaussian(gzFile backup_file);
+
   // =================================================================
-  //                             Destructors
+  //                             Destructor
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+  virtual ~Gaussian() {}
+
   // =================================================================
   //                              Accessors
   // =================================================================
-  
+  double height() const { return height_; }
+  double mean() const { return mean_; }
+  double width() const { return width_; }
+  void   set_height(double height) { height_ = height; }
+  void   set_mean(double mean) { mean_ = mean; }
+
   // =================================================================
   //                            Public Methods
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  double compute_y(double x) const { return height_ * exp(-(x- mean_)*(x- mean_) / (2* width_ * width_)); }
+  void save(gzFile backup_file) const;
+
   // =================================================================
   //                           Public Attributes
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
+
+ protected :
+  // =================================================================
+  //                         Forbidden Constructors
+  // =================================================================
+  Gaussian() = delete;
+
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  double height_;
+  double mean_;
+  double width_; // In fact half-width to the inflexion points
 };
 
 
 // =====================================================================
+//                               Constructors
+// =====================================================================
+inline Gaussian::Gaussian(gzFile backup_file) {
+  gzread(backup_file, &height_,  sizeof(height_));
+  gzread(backup_file, &mean_,    sizeof(mean_));
+  gzread(backup_file, &width_,   sizeof(width_));
+}
+
+// =====================================================================
+//                               Destructor
+// =====================================================================
+
+// =====================================================================
 //                          Accessors' definitions
 // =====================================================================
 
 // =====================================================================
-//                       Inline functions' definition
+//                       functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+inline void Gaussian::save(gzFile backup_file) const {
+  gzwrite(backup_file, &height_, sizeof(height_));
+  gzwrite(backup_file, &mean_, sizeof(mean_));
+  gzwrite(backup_file, &width_, sizeof(width_));
+}
+
+} // namespace aevol
+
+#endif // AEVOL_GAUSSIAN_H_
diff --git a/src/libaevol/GeneticUnit.cpp b/src/libaevol/GeneticUnit.cpp
new file mode 100644
index 0000000..bafd1f9
--- /dev/null
+++ b/src/libaevol/GeneticUnit.cpp
@@ -0,0 +1,3489 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "GeneticUnit.h"
+
+#include <cassert>
+#include <list>
+#include <algorithm>
+
+
+#include "FuzzyFactory.h"
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "Codon.h"
+#include "Mutation.h"
+#include "ae_enums.h"
+
+#ifdef __REGUL
+  #include "raevol/Individual_R.h"
+#else
+
+#include "Individual.h"
+
+#endif
+
+
+#include "Fuzzy.h"
+#include "PointMutation.h"
+#include "SmallDeletion.h"
+#include "SmallInsertion.h"
+#include "Duplication.h"
+#include "Deletion.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "InsertionHT.h"
+#include "ReplacementHT.h"
+
+namespace aevol {
+
+// =================================================================
+//                       Miscellaneous Functions
+// =================================================================
+int compare_prot_pos(const void* pos,
+                     const void* prot) // This function has to be a plain int
+// to comply with the definition of bsearch()
+{
+  if (((Protein*) prot)->shine_dal_pos() == *(int32_t*) pos) {
+    return 0;
+  }
+  else { return 1; }
+}
+
+//##############################################################################
+//                                                                             #
+//                              Class genetic_unit                             #
+//                                                                             #
+//##############################################################################
+// =====================================================================
+//                          Accessors' definitions
+// =====================================================================
+ExpManager* GeneticUnit::exp_m() const {
+  return exp_m_;
+}
+
+Individual* GeneticUnit::indiv() const {
+  return indiv_;
+}
+
+Dna* GeneticUnit::dna() const {
+  assert(dna_->length() != 0);
+  return dna_;
+}
+
+const Promoters2Strands& GeneticUnit::rna_list() const {
+  return rna_list_;
+}
+
+#ifndef __REGUL
+std::list<Protein>& GeneticUnit::protein_list(Strand strand) {
+  return protein_list_[strand];
+}
+#else
+std::list<Protein_R>& GeneticUnit::protein_list(Strand strand) {
+  return protein_list_[strand];
+}
+#endif
+
+void GeneticUnit::clear_protein_list(Strand strand) {
+  protein_list_[strand].clear();
+}
+
+AbstractFuzzy* GeneticUnit::activ_contribution() const
+{
+  return activ_contribution_;
+}
+
+AbstractFuzzy* GeneticUnit::inhib_contribution() const
+{
+  return inhib_contribution_;
+}
+
+AbstractFuzzy* GeneticUnit::phenotypic_contribution() const
+{
+  assert(phenotypic_contribution_ != NULL);
+  return phenotypic_contribution_;
+}
+
+/*!
+  Returns the DNA sequence
+*/
+const char* GeneticUnit::sequence() const {
+  return dna_->data();
+}
+
+/*!
+  Returns the DNA sequence length
+*/
+int32_t GeneticUnit::seq_length() const {
+  return dna_->length();
+}
+
+int32_t GeneticUnit::nb_coding_RNAs() const {
+  return nb_coding_RNAs_;
+}
+
+int32_t GeneticUnit::nb_non_coding_RNAs() const {
+  return nb_non_coding_RNAs_;
+}
+
+double GeneticUnit::overall_size_coding_RNAs() const {
+  return overall_size_coding_RNAs_;
+}
+
+double GeneticUnit::av_size_coding_RNAs() const {
+  if (nb_coding_RNAs_ != 0) {
+    return overall_size_coding_RNAs_ / nb_coding_RNAs_;
+  }
+  else { return 0.0; }
+}
+
+double GeneticUnit::overall_size_non_coding_RNAs() const {
+  return overall_size_non_coding_RNAs_;
+}
+
+double GeneticUnit::av_size_non_coding_RNAs() const {
+  if (nb_non_coding_RNAs_ != 0) {
+    return overall_size_non_coding_RNAs_ / nb_non_coding_RNAs_;
+  }
+  else { return 0.0; }
+}
+
+int32_t GeneticUnit::nb_genes_activ() const {
+  return nb_genes_activ_;
+}
+
+int32_t GeneticUnit::nb_genes_inhib() const {
+  return nb_genes_inhib_;
+}
+
+int32_t GeneticUnit::nb_functional_genes() const {
+  return nb_fun_genes_;
+}
+
+int32_t GeneticUnit::nb_non_functional_genes() const {
+  return nb_non_fun_genes_;
+}
+
+double GeneticUnit::overall_size_functional_genes() const {
+  return overall_size_fun_genes_;
+}
+
+double GeneticUnit::av_size_functional_genes() const {
+  if (nb_fun_genes_ != 0) {
+    return overall_size_fun_genes_ / nb_fun_genes_;
+  }
+  else { return 0.0; }
+}
+
+double GeneticUnit::overall_size_non_functional_genes() const {
+  return overall_size_non_fun_genes_;
+}
+
+double GeneticUnit::av_size_non_functional_genes() const {
+  if (nb_non_fun_genes_ != 0) {
+    return overall_size_non_fun_genes_ / nb_non_fun_genes_;
+  }
+  else { return 0.0; }
+}
+
+int32_t GeneticUnit::nb_bases_in_0_CDS() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_CDS_;
+}
+
+int32_t GeneticUnit::nb_bases_in_0_functional_CDS() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_functional_CDS_;
+}
+
+int32_t GeneticUnit::nb_bases_in_0_non_functional_CDS() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_non_functional_CDS_;
+}
+
+int32_t GeneticUnit::nb_bases_in_0_RNA() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_RNA_;
+}
+
+int32_t GeneticUnit::nb_bases_in_0_coding_RNA() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_coding_RNA_;
+}
+
+int32_t GeneticUnit::nb_bases_in_0_non_coding_RNA() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_0_non_coding_RNA_;
+}
+
+int32_t GeneticUnit::nb_bases_non_essential() const {
+  assert (non_coding_computed_);
+  return nb_bases_non_essential_;
+}
+
+int32_t GeneticUnit::nb_bases_non_essential_including_nf_genes() const {
+  assert (non_coding_computed_);
+  return nb_bases_non_essential_including_nf_genes_;
+}
+
+int32_t GeneticUnit::nb_bases_in_neutral_regions() const {
+  assert (non_coding_computed_);
+  return nb_bases_in_neutral_regions_;
+}
+
+int32_t GeneticUnit::nb_neutral_regions() const {
+  assert (non_coding_computed_);
+  return nb_neutral_regions_;
+}
+
+int32_t* GeneticUnit::beginning_neutral_regions() const {
+  assert (non_coding_computed_);
+  return beginning_neutral_regions_;
+}
+
+int32_t* GeneticUnit::end_neutral_regions() const {
+  assert (non_coding_computed_);
+  return end_neutral_regions_;
+}
+
+double GeneticUnit::modularity() const {
+  return modularity_;
+}
+
+double GeneticUnit::dist_to_target_by_feature(
+    PhenotypicFeature feature) const {
+  assert(distance_to_target_computed_);
+
+  return dist_to_target_by_feature_[feature];
+}
+
+double GeneticUnit::fitness() const {
+  assert(fitness_computed_);
+
+  return fitness_;
+}
+
+double GeneticUnit::fitness_by_feature(PhenotypicFeature feature) const {
+  assert(fitness_computed_);
+
+  return fitness_by_feature_[feature];
+}
+
+int32_t GeneticUnit::min_gu_length() const {
+  return min_gu_length_;
+}
+
+int32_t GeneticUnit::max_gu_length() const {
+  return max_gu_length_;
+}
+
+void GeneticUnit::set_min_gu_length(int32_t min_gu_length) {
+  min_gu_length_ = min_gu_length;
+}
+
+void GeneticUnit::set_max_gu_length(int32_t max_gu_length) {
+  max_gu_length_ = max_gu_length;
+}
+
+void GeneticUnit::set_exp_m(ExpManager* exp_m) {
+  exp_m_ = exp_m;
+}
+
+// =====================================================================
+//                       functions' definition
+// =====================================================================
+void GeneticUnit::print_rnas() const {
+  print_rnas(rna_list_);
+}
+
+/* static */ void GeneticUnit::print_rnas(const Promoters2Strands& rnas) {
+  print_rnas(rnas[LEADING], LEADING);
+  print_rnas(rnas[LAGGING], LAGGING);
+}
+
+/* static */ void GeneticUnit::print_rnas(const Promoters1Strand& rnas,
+                                          Strand strand) {
+  printf("  %s (%" PRId32 ")\n", strand == LEADING ? " LEADING " : "LAGGING",
+         static_cast<int32_t>(rnas.size()));
+  for (auto& rna: rnas) {
+    assert(rna.strand() == strand);
+    printf("    Promoter on %s at %" PRId32 "\n",
+           strand == LEADING ? " LEADING " : "LAGGING", rna.promoter_pos());
+  }
+}
+
+bool GeneticUnit::is_start(Strand strand, int32_t index) const {
+  return (codon(strand, index) == CODON_START);
+}
+
+bool GeneticUnit::is_stop(Strand strand, int32_t index) const {
+  return (codon(strand, index) == CODON_STOP);
+}
+
+void GeneticUnit::remove_all_promoters() {
+  rna_list_[LEADING].clear();
+  rna_list_[LAGGING].clear();
+}
+
+void GeneticUnit::move_all_promoters_after(int32_t pos, int32_t delta_pos) {
+  move_all_leading_promoters_after(pos, delta_pos);
+  move_all_lagging_promoters_after(pos, delta_pos);
+}
+
+void GeneticUnit::extract_promoters_included_in(int32_t pos_1,
+                                                int32_t pos_2,
+                                                Promoters2Strands& extracted_promoters) {
+  assert(pos_1 >= 0);
+  assert(pos_1 < pos_2);
+  assert(pos_2 <= dna_->length());
+
+  if (pos_2 - pos_1 < PROM_SIZE) {
+    return;
+  }
+  extract_leading_promoters_starting_between(pos_1, pos_2 - PROM_SIZE + 1,
+                                             extracted_promoters[LEADING]);
+  extract_lagging_promoters_starting_between(pos_1 + PROM_SIZE - 1, pos_2,
+                                             extracted_promoters[LAGGING]);
+}
+
+void GeneticUnit::extract_promoters_starting_between(int32_t pos_1,
+                                                     int32_t pos_2,
+                                                     Promoters2Strands& extracted_promoters) {
+  extract_leading_promoters_starting_between(pos_1, pos_2,
+                                             extracted_promoters[LEADING]);
+  extract_lagging_promoters_starting_between(pos_1, pos_2,
+                                             extracted_promoters[LAGGING]);
+}
+
+
+/*!
+  \brief  Remove those promoters that would be broken if the chromosome was cut at pos.
+
+  Remove promoters that include BOTH the base before AND after pos (marked X in the cartoon below).
+  If the genome is smaller than the size of a promoter, all the promoters will be removed.
+
+  \verbatim
+     -------------------------------------------------------
+    |   |   |   |   | X | X |   |   |   |   |   |   |   |   |
+     -------------------------------------------------------
+    ^                   ^
+    0                  pos
+  \endverbatim
+*/
+void GeneticUnit::remove_promoters_around(int32_t pos) {
+  if (dna_->length() >= PROM_SIZE) {
+    remove_leading_promoters_starting_between(Utils::mod(pos - PROM_SIZE + 1,
+                                                         dna_->length()),
+                                              pos);
+    remove_lagging_promoters_starting_between(pos,
+                                              Utils::mod(pos + PROM_SIZE - 1,
+                                                         dna_->length()));
+  }
+  else {
+    remove_all_promoters();
+  }
+}
+
+
+/*!
+  \brief  Remove those promoters that would be broken if the sequence [pos_1 ; pos_2[ was deleted.
+
+  Remove promoters that     * include BOTH the base before AND after pos_1 (marked X in the cartoon below).
+                            * include BOTH the base before AND after pos_2 (marked Y in the cartoon below).
+                            * are completely contained between pos_1 and pos_2.
+  If the remaining sequence, i.e. [pos_2 ; pos_1[ is smaller than the size of a promoter, all the promoters will be removed.
+
+  \verbatim
+     -------------------------------------------------------
+    |   |   |   |   | X | X |   |   |   | Y | Y |   |   |   |
+     -------------------------------------------------------
+    ^                   ^                   ^
+    0                 pos_1               pos_2
+  \endverbatim
+*/
+void GeneticUnit::remove_promoters_around(int32_t pos_1, int32_t pos_2) {
+  if (Utils::mod(pos_1 - pos_2, dna_->length()) >= PROM_SIZE) {
+    remove_leading_promoters_starting_between(Utils::mod(pos_1 - PROM_SIZE + 1,
+                                                         dna_->length()),
+                                              pos_2);
+    remove_lagging_promoters_starting_between(pos_1,
+                                              Utils::mod(pos_2 + PROM_SIZE - 1,
+                                                         dna_->length()));
+  }
+  else {
+    remove_all_promoters();
+  }
+}
+
+
+/// Look for promoters that are astride pos and add them to the list
+/// of promoters (rna_list_).
+///
+/// Look for promoters that include BOTH the base before AND after pos (marked X in the cartoon below).
+/// If the genome is smaller than the size of a promoter, no search is performed.
+///
+/// \verbatim
+///    -------------------------------------------------------
+///   |   |   |   |   | X | X |   |   |   |   |   |   |   |   |
+///    -------------------------------------------------------
+///   ^                   ^
+///   0                  pos
+/// \endverbatim
+void GeneticUnit::look_for_new_promoters_around(int32_t pos) {
+  assert(pos >= 0 && pos <= dna_->length());
+
+  if (dna_->length() >= PROM_SIZE) {
+    look_for_new_leading_promoters_starting_between(
+        Utils::mod(pos - PROM_SIZE + 1, dna_->length()),
+        pos);
+    look_for_new_lagging_promoters_starting_between(
+        pos,
+        Utils::mod(pos + PROM_SIZE - 1, dna_->length()));
+  }
+}
+
+
+/// Look for promoters that contain at least 1 base lying in [pos_1 ;
+/// pos_2[ and add them to the list of promoters (rna_list_).
+///
+/// Look for promoters that   * include BOTH the base before AND after pos_1 (marked X in the cartoon below).
+///                           * include BOTH the base before AND after pos_2 (marked Y in the cartoon below).
+///                           * are completely contained between pos_1 and pos_2.
+/// If the genome is smaller than the size of a promoter, no search is performed.
+///
+/// \verbatim
+///    -------------------------------------------------------
+///   |   |   |   |   | X | X |   |   |   | Y | Y |   |   |   |
+///    -------------------------------------------------------
+///   ^                   ^                   ^
+///   0                 pos_1               pos_2
+/// \endverbatim
+void GeneticUnit::look_for_new_promoters_around(int32_t pos_1, int32_t pos_2) {
+  //~ if (Utils::mod(pos_1 - pos_2, dna_->length()) == PROM_SIZE - 1)
+  //~ {
+  //~ // We have to look at every possible position on the genome.
+  //~ locate_promoters();
+  //~ }
+  /*else*/ if (dna_->length() >= PROM_SIZE) {
+    look_for_new_leading_promoters_starting_between(
+        Utils::mod(pos_1 - PROM_SIZE + 1,
+                   dna_->length()), pos_2);
+    look_for_new_lagging_promoters_starting_between(pos_1, Utils::mod(
+        pos_2 + PROM_SIZE - 1,
+        dna_->length()));
+  }
+}
+
+void GeneticUnit::copy_promoters_starting_between(int32_t pos_1,
+                                                  int32_t pos_2,
+                                                  Promoters2Strands& new_promoter_lists) {
+  copy_leading_promoters_starting_between(pos_1, pos_2,
+                                          new_promoter_lists[LEADING]);
+  copy_lagging_promoters_starting_between(pos_1, pos_2,
+                                          new_promoter_lists[LAGGING]);
+}
+
+void GeneticUnit::copy_promoters_included_in(int32_t pos_1,
+                                             int32_t pos_2,
+                                             Promoters2Strands& new_promoter_lists) {
+  if (Utils::mod(pos_2 - pos_1 - 1, dna_->length()) + 1 >= PROM_SIZE) {
+    copy_leading_promoters_starting_between(pos_1,
+                                            Utils::mod(pos_2 - PROM_SIZE + 1,
+                                                       dna_->length()),
+                                            new_promoter_lists[LEADING]);
+    copy_lagging_promoters_starting_between(Utils::mod(pos_1 + PROM_SIZE - 1,
+                                                       dna_->length()), pos_2,
+                                            new_promoter_lists[LAGGING]);
+  }
+}
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+/*!
+  \brief Create a new genetic unit for indiv with a random DNA sequence of length length
+
+  Promoters will be looked for on the whole sequence but no further process
+  will be performed.
+*/
+GeneticUnit::GeneticUnit(Individual* indiv,
+                         int32_t length,
+                         std::shared_ptr<JumpingMT> prng) {
+  indiv_ = indiv;
+  exp_m_ = indiv->exp_m();
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  min_gu_length_ = -1;
+  max_gu_length_ = -1;
+
+  dna_ = new Dna(this, length, prng);
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value,
+  //      it is not used for the whole phenotype computation
+
+  // dist_to_target_per_segment_ depends on the segmentation of the environment
+  // and will hence be newed at evaluation time
+  dist_to_target_per_segment_ = NULL;
+
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  // Look for promoters
+  locate_promoters();
+
+  init_statistical_data();
+}
+
+/// Create a new genetic unit for `indiv` with sequence `seq` of size
+/// `length` [and containing promoters `prom_list`]
+///
+///  Promoters will be looked for if prom_list is not provided (this
+///  may take some time).
+///
+/// WARNING:
+///   seq will be used directly which means the caller must not delete it
+///   The same goes for prom_list if it is provided.
+GeneticUnit::GeneticUnit(Individual* indiv,
+                         char* seq,
+                         int32_t length,
+                         const Promoters2Strands& prom_list /* = {{},{}} */) {
+  exp_m_ = indiv->exp_m();
+  indiv_ = indiv;
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  min_gu_length_ = -1;
+  max_gu_length_ = -1;
+
+  dna_ = new Dna(this, seq, length);
+
+  if (not prom_list[LEADING].empty() and
+      not prom_list[LAGGING].empty()) { // if not default `prom_list`
+    // Copy rna lists
+    rna_list_ = prom_list;
+    Dna::set_GU(rna_list_, this);
+  }
+  else {
+    for (auto& strand: {LEADING, LAGGING})
+      assert(rna_list_[strand].empty());
+
+    // Look for promoters
+    locate_promoters();
+  }
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value,
+  //      it is not used for the whole phenotype computation
+
+  // Initialize all the fitness-related stuff
+  dist_to_target_per_segment_ = NULL;
+
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  init_statistical_data();
+}
+
+
+/*!
+  \brief Copy constructor.
+
+  Copies the DNA and recomputes all the rest.
+  It is slower than copying as much as possible and regenerate only what is necessary but it works whatever the state of the model GU.
+*/
+GeneticUnit::GeneticUnit(Individual* indiv, const GeneticUnit& model) {
+  exp_m_ = indiv->exp_m();
+  indiv_ = indiv;
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = model.distance_to_target_computed_;
+  fitness_computed_ = model.fitness_computed_;
+
+  min_gu_length_ = model.min_gu_length_;
+  max_gu_length_ = model.max_gu_length_;
+
+  // Copy DNA
+  dna_ = new Dna(this, *(model.dna_));
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation
+  dist_to_target_per_segment_ = NULL;
+  dist_to_target_by_feature_  = new double [NB_FEATURES];
+  fitness_by_feature_         = new double [NB_FEATURES];
+
+  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
+  {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i]        = 0.0;
+  }
+
+  // Compute everything
+  init_statistical_data();
+  locate_promoters();
+  do_transcription();
+  do_translation();
+  compute_phenotypic_contribution();
+}
+
+/**
+ * Reproduction constructor
+ *
+ * Create a new genetic unit copying the DNA sequence and the promoter list
+ * from the provided `parent`
+ */
+GeneticUnit::GeneticUnit(Individual* indiv, const GeneticUnit* parent) {
+  exp_m_ = indiv->exp_m();
+  indiv_ = indiv;
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  min_gu_length_ = parent->min_gu_length_;
+  max_gu_length_ = parent->max_gu_length_;
+
+  // Copy DNA
+  dna_ = new Dna(this, parent->dna_);
+
+  // Copy promoter list (rna_list_)
+  // Note that the length of the RNA will have to be recomputed (do_transcription)
+  for (auto& strand: {LEADING, LAGGING}) {
+    for (auto& rna: parent->rna_list_[strand]) {
+#ifndef __REGUL
+      rna_list_[strand].emplace_back(this, rna);
+#else
+      rna_list_[strand].emplace_back(this, rna);
+#endif
+    }
+  }
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation
+
+  // Initialize all the fitness-related stuff
+  dist_to_target_per_segment_ = NULL;
+
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  init_statistical_data();
+}
+
+GeneticUnit::GeneticUnit(Individual* indiv, gzFile backup_file) {
+  exp_m_ = indiv->exp_m();
+  indiv_ = indiv;
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  dna_ = new Dna(this, backup_file);
+
+  gzread(backup_file, &min_gu_length_, sizeof(min_gu_length_));
+  gzread(backup_file, &max_gu_length_, sizeof(max_gu_length_));
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value, not used for the whole phenotype computation
+
+  // Initialize all the fitness-related stuff
+  dist_to_target_per_segment_ = NULL;
+
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+
+  // Look for promoters
+  locate_promoters();
+
+  init_statistical_data();
+}
+
+/*!
+  \brief Create a new genetic unit for indiv with a sequence saved in a text file
+
+  Promoters will be looked for on the whole sequence but no further process
+  will be performed.
+*/
+GeneticUnit::GeneticUnit(Individual* indiv, char* organism_file_name) {
+  exp_m_ = indiv->exp_m();
+  indiv_ = indiv;
+
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  dna_ = new Dna(this, organism_file_name);
+
+  // Create empty fuzzy sets for the phenotypic contributions
+  activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotypic_contribution_ = NULL;
+  // NB : phenotypic_contribution_ is only an indicative value,
+  //      it is not used for the whole phenotype computation
+
+  // Initialize all the fitness-related stuff
+  dist_to_target_per_segment_ = NULL;
+
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  // Look for promoters
+  locate_promoters();
+
+  init_statistical_data();
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+GeneticUnit::~GeneticUnit() {
+  delete dna_;
+  delete activ_contribution_;
+  delete inhib_contribution_;
+  if (phenotypic_contribution_ != NULL) delete phenotypic_contribution_;
+
+  if (dist_to_target_per_segment_ != NULL) delete[] dist_to_target_per_segment_;
+
+  assert(dist_to_target_by_feature_ != NULL);
+  delete[] dist_to_target_by_feature_;
+  assert(fitness_by_feature_ != NULL);
+  delete[] fitness_by_feature_;
+
+  delete[] beginning_neutral_regions_;
+  delete[] end_neutral_regions_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+/// Look for promoters in the genome and create a new Rna in the
+/// corresponding strand's RNA list
+void GeneticUnit::locate_promoters() {
+
+  // TODO vld 2015-04-14: make it return the generated rna-list rather
+  // than alter the current one?
+
+  int8_t dist; // Hamming distance of the sequence from the promoter consensus
+
+  // Empty RNA list
+  for (auto& strand: rna_list_) {
+    strand.clear();
+  }
+
+  if (dna_->length() < PROM_SIZE) {
+    return;
+  }
+  for (int32_t i = 0; i < dna_->length(); i++) {
+#ifndef __REGUL
+    if (is_promoter(LEADING, i,
+                    dist)) { // dist takes the hamming distance of the sequence from the consensus
+                      rna_list_[LEADING].emplace_back(this, LEADING, i, dist);
+    }
+    if (is_promoter(LAGGING, dna_->length() - i - 1, dist)) {
+      rna_list_[LAGGING].emplace_back(this, LAGGING, dna_->length() - i - 1,
+                                      dist);
+    }
+#else
+    if (is_promoter(LEADING, i, dist)) {
+      Rna_R rna(this, LEADING, i, dist);
+      rna_list_[LEADING].push_back(rna);
+    }
+    if (is_promoter(LAGGING, dna_->length() - i - 1, dist)) {
+      Rna_R rna(this, LAGGING, dna_->length() - i - 1,
+                dist);
+      rna_list_[LAGGING].push_back(rna);
+    }
+#endif
+  }
+}
+
+void GeneticUnit::do_transcription() {
+  if (transcribed_) return;
+  transcribed_ = true;
+
+  int32_t transcript_start = -1;
+  int32_t genome_length = dna_->length();
+
+  // If the genome is not long enough to bear a promoter and a terminator,
+  // we set all its RNAs to a length of -1
+  // (NB but a terminator can share code with the promoter, making it
+  // possible for the genome to be no longer than the promoter)
+  if (genome_length < PROM_SIZE) {
+    for (auto& strand: rna_list_)
+      for (auto& rna: strand)
+        rna.set_transcript_length(-1);
+    return;
+  }
+
+  for (auto& strand_id: {LEADING, LAGGING}) {
+    auto& strand = rna_list_[strand_id];
+    for (auto rna = strand.begin(); rna != strand.end(); ++rna) {
+      transcript_start = rna->first_transcribed_pos();
+      rna->set_transcript_length(-1);
+
+      int32_t i;
+      for (i = 0; i < genome_length; ++i) {
+        if (is_terminator(strand_id,
+                          transcript_start + (strand_id == LEADING ? i : -i))) {
+          // Found terminator => set transcript's length
+          rna->set_transcript_length(i + TERM_SIZE);
+
+          // Deduce the length of all the RNAs that share the same terminator
+          // These are the RNAs whose promoter is entirely (and strictly) included
+          // between the promoter and the terminator of the RNA we have just treated.
+          // They are hence the RNAs whose promoter starts at most i bases after the
+          // current rna's promoter
+          for (auto rna2 = std::next(rna); rna2 != strand.end(); ++rna2) {
+            // We know that if rna2 is after rna then:
+            // - rna_2.pos > rna.pos for LEADING strand
+            // - rna_2.pos < rna.pos for LAGGING strand
+            // because the list is sorted.
+
+            auto delta_pos = abs(
+                rna2->promoter_pos() - rna->promoter_pos());
+            if (delta_pos <= i) {
+              rna2->set_transcript_length(i - delta_pos + TERM_SIZE);
+            }
+            else {
+              // The promoter of rna_2 is after (or contains a part of) the terminator of rna,
+              // we will need to search its own terminator
+              break;
+            }
+          }
+          // Terminator found for this RNA, nothing else to do (for this RNA)
+          break;
+        }
+      }
+
+      if (i == genome_length) {
+        // We have searched the whole genome and found no terminator for this promoter.
+        // We consider that no RNA can actually be produced, hence we set the transcript
+        // length to -1. This will prevent the search for coding sequences downstream of this promoter.
+        // However, we do not destroy the Rna object, it must still be kept in memory and
+        // transmitted to the offspring in case a mutation recreates a terminator.
+        rna->set_transcript_length(-1);
+      }
+    }
+  }
+}
+
+void GeneticUnit::do_translation() {
+  if (translated_) {
+    return;
+  }
+  translated_ = true;
+  if (not transcribed_) {
+    do_transcription();
+  }
+
+  int32_t transcript_start = -1;
+  int32_t transcript_length = -1;
+  int32_t genome_length = dna_->length();
+
+  for (auto strand: {LEADING, LAGGING}) {
+    for (auto& rna: rna_list_[strand]) {
+      transcript_start = rna.first_transcribed_pos();
+      transcript_length = rna.transcript_length();
+
+      // Try every position where a translation process could occur
+      // Minimum number of bases needed is SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE
+      // (3 codons for START + STOP + at least one amino-acid)
+      for (int32_t i = 0;
+           transcript_length - i >= DO_TRANSLATION_LOOP;
+           ++i) {
+        if (is_shine_dalgarno(strand, Utils::mod(transcript_start
+                                                 + (strand == LEADING ? i : -i),
+                                                 genome_length))
+            and is_start(strand,
+                         Utils::mod(transcript_start
+                                    + (strand == LEADING ? 1 : -1)
+                                      *
+                                      (i + SHINE_DAL_SIZE + SHINE_START_SPACER),
+                                    genome_length))) {
+          // We found a translation initiation, we can now build the
+          // protein until we find a STOP codon or until we reach the
+          // end of the transcript (in which case the protein is not
+          // valid)
+
+          // First of all, we will check whether this CDS has already
+          // been translated (because it is present on another RNA).
+          // In that case, we don't need to tranlate it again, we only
+          // need to increase the protein's concentration according to
+          // the promoter transcription level
+          int32_t shine_dal_pos = Utils::mod(transcript_start +
+                                             (strand == LEADING ? i : -i),
+                                             genome_length);
+          auto& protein_strand = protein_list_[strand];
+          auto protein = find_if(protein_strand.begin(),
+                                 protein_strand.end(),
+                                 [shine_dal_pos](Protein& p) {
+                                   return p.shine_dal_pos() ==
+                                          shine_dal_pos;
+                                 });
+
+          if (protein != protein_strand.end()) {
+            protein->add_RNA(&rna);
+            rna.add_transcribed_protein(&*protein);
+          }
+          else {
+            // Build codon list and make new protein when stop found
+            int32_t j = i + SHINE_DAL_SIZE + SHINE_START_SPACER +
+                        CODON_SIZE; // next codon to examine
+
+            std::list<Codon*> codon_list;
+
+            while (transcript_length - j >= CODON_SIZE) {
+              auto codon = new Codon(dna_,
+                                     strand,
+                                     Utils::mod(transcript_start +
+                                                (strand == LEADING ? j : -j),
+                                                genome_length));
+
+              if (codon->is_stop()) {
+                if (not codon_list.empty()) { // at least one amino-acid
+                  // The protein is valid, create the corresponding object
+                  protein_strand.emplace_back(this, codon_list, strand,
+                                              shine_dal_pos, &rna,
+                                              indiv()->w_max());
+                  auto& protein = protein_strand.back();
+                  codon_list.clear(); // has been copied into `protein`
+                  rna.add_transcribed_protein(&protein);
+
+                  if (protein.is_functional()) {
+                    nb_fun_genes_++;
+                    overall_size_fun_genes_ +=
+                        protein.length() * CODON_SIZE;
+
+                    if (protein.height() > 0) {
+                      nb_genes_activ_++;
+                    }
+                    else { nb_genes_inhib_++; }
+                  }
+                  else {
+                    nb_non_fun_genes_++;
+                    overall_size_non_fun_genes_ += (strand == LEADING) ?
+                                                   protein.length() *
+                                                   CODON_SIZE :
+                                                   (protein.length() + 2) *
+                                                   CODON_SIZE;
+                  }
+                }
+                delete codon;
+                codon = nullptr;
+                break;
+              }
+              else {
+                codon_list.push_back(codon);
+                codon = nullptr; // don't delete codon: recycled into the list
+              }
+              j += CODON_SIZE;
+            }
+            if (not codon_list.empty()) {
+              for (auto& c: codon_list)
+                delete c;
+            }
+          }
+        }
+      }
+
+      // Statistics
+      if (not rna.transcribed_proteins().empty()) { // coding RNA
+        nb_coding_RNAs_++;
+        overall_size_coding_RNAs_ += rna.transcript_length();
+      }
+      else { // non-coding RNA
+        nb_non_coding_RNAs_++;
+        overall_size_non_coding_RNAs_ += rna.transcript_length();
+      }
+    }
+  }
+}
+
+void GeneticUnit::compute_phenotypic_contribution() {
+  if (phenotypic_contributions_computed_) return;
+  phenotypic_contributions_computed_ = true;
+  if (!translated_) do_translation();
+
+  //printf("Prot list: %ld %ld\n",protein_list_[LEADING].size(),protein_list_[LEADING].size());
+  for (const auto& strand: protein_list_) // two strands: LEADING & LAGGING
+    for (const auto& prot: strand)
+      if (prot.is_functional()) {
+        ((prot.height() > 0) ? activ_contribution_ : inhib_contribution_)
+            ->add_triangle(prot.mean(),
+                           prot.width(),
+                           prot.height() * prot.concentration());
+    //    printf("Add triangle : %f %f %f\n",prot.mean(),
+    //           prot.width(),
+    //           prot.height() * prot.concentration());
+      }
+  // if (prot->height() > 0)
+  //   activ_contribution_->add_triangle(prot->mean(),
+  //                                     prot->width(),
+  //                                     prot->height() * prot->concentration());
+  // else
+  //   inhib_contribution_->add_triangle(prot->get_mean(),
+  //                                     prot->get_width(),
+  //                                     prot->get_height() * prot->get_concentration() );
+
+  // It is not necessary to add a lower bound to activ_contribution_ as there can be no negative y
+  // The same goes for the upper bound for inhib_contribution_
+  activ_contribution_->clip(Fuzzy::max,   Y_MAX );
+  inhib_contribution_->clip(Fuzzy::min, - Y_MAX );
+  activ_contribution_->simplify();
+  inhib_contribution_->simplify();
+
+  if ( exp_m_->output_m()->compute_phen_contrib_by_GU() )
+  {
+    phenotypic_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+    phenotypic_contribution_->add( *activ_contribution_ );
+    phenotypic_contribution_->add( *inhib_contribution_ );
+    phenotypic_contribution_->simplify();
+  }
+}
+
+/*!
+  \brief Compute the areas between the phenotype and the environment for each environmental segment.
+
+  If the environment is not segmented, the total area is computed
+*/
+void GeneticUnit::compute_distance_to_target(const PhenotypicTarget& target) {
+  if (distance_to_target_computed_) return; // distance_to_target_ has already been computed, nothing to do.
+  distance_to_target_computed_ = true;
+
+  compute_phenotypic_contribution();
+
+  // Compute the difference between the (whole) phenotype and the environment
+  AbstractFuzzy* delta = FuzzyFactory::fuzzyFactory->create_fuzzy(*phenotypic_contribution_);
+  delta->sub( *(target.fuzzy()) );
+
+  PhenotypicSegment** segments = target.segments();
+
+  // TODO <david.parsons at inria.fr> We should take into account that we compute the areas in order (from the leftmost segment, rightwards)
+  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have
+  //      already been through them!)
+
+  if (dist_to_target_per_segment_ == NULL) {
+    dist_to_target_per_segment_ = new double[target.nb_segments()]; // Can not be allocated in constructor because number of segments is then unknow
+  }
+  for (int8_t i = 0; i < target.nb_segments(); i++) {
+    dist_to_target_per_segment_[i] = delta->get_geometric_area(
+      segments[i]->start, segments[i]->stop);
+    dist_to_target_by_feature_[segments[i]->feature] += dist_to_target_per_segment_[i];
+  }
+
+  delete delta;
+}
+
+/*!
+  \brief Compute a "proper" fitness value (one that increases when the individual is fitter).
+
+  The behaviour of this function depends on many parameters and most notably on whether it is
+  a "composite" fitness or not, and on the selection scheme.
+*/
+void GeneticUnit::compute_fitness(const PhenotypicTarget& target) {
+  if (fitness_computed_) return; // Fitness has already been computed, nothing to do.
+  fitness_computed_ = true;
+
+#ifdef NORMALIZED_FITNESS
+
+  for (int8_t i = 0 ; i < NB_FEATURES ; i++)
+  {
+    if (target.area_by_feature(i)==0.)
+    {
+      fitness_by_feature_[i] = 0.;
+    }
+    else
+    {
+      fitness_by_feature_[i] =  (target.area_by_feature(i) - dist_to_target_by_feature_[i]) / target.area_by_feature(i);
+      if ((fitness_by_feature_[i] < 0.) && (i != METABOLISM)) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good)
+      {
+        fitness_by_feature_[i] = 0.;
+      }
+    }
+  }
+
+  if ((! indiv_->placed_in_population()) || (! exp_m_->with_secretion()))
+  {
+    fitness_ = fitness_by_feature_[METABOLISM];
+  }
+  else
+  {
+    fitness_ =  fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * (indiv_->grid_cell()->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION]));
+  }
+
+  if (exp_m_->selection_scheme() == FITNESS_PROPORTIONATE) // Then the exponential selection is integrated inside the fitness value
+  {
+    fitness_ = exp(-exp_m_->selection_pressure() * (1 - fitness_));
+  }
+
+#else
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    if (i == SECRETION) {
+      fitness_by_feature_[SECRETION] = exp(-exp_m_->selection_pressure() *
+                                           dist_to_target_by_feature_[SECRETION])
+                                       - exp(-exp_m_->selection_pressure() *
+                                             target.area_by_feature(SECRETION));
+
+      if (fitness_by_feature_[i] < 0) {
+        fitness_by_feature_[i] = 0;
+      }
+    }
+    else {
+      fitness_by_feature_[i] = exp(
+          -exp_m_->selection_pressure() * dist_to_target_by_feature_[i]);
+    }
+  }
+
+  // Calculate combined, total fitness here!
+  // Multiply the contribution of metabolism and the amount of compound in the environment
+  if ((!indiv_->placed_in_population()) ||
+      (!exp_m_->with_secretion())) {
+    fitness_ = fitness_by_feature_[METABOLISM];
+  }
+  else {
+    fitness_ = fitness_by_feature_[METABOLISM] *
+               (1 + exp_m_->secretion_contrib_to_fitness() *
+                    indiv_->grid_cell()->compound_amount()
+                -
+                 exp_m_->secretion_cost() * fitness_by_feature_[SECRETION]);
+  }
+
+#endif
+
+}
+
+
+void GeneticUnit::reset_expression() {
+  // useful if the DNA sequence has changed (cf post-treatment programs
+  // which replay mutations)
+
+    if ( activ_contribution_ != NULL )
+    {
+      delete activ_contribution_;
+      activ_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+    }
+
+    if ( inhib_contribution_ != NULL )
+    {
+      delete inhib_contribution_;
+      inhib_contribution_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+    }
+  transcribed_ = false;
+  translated_ = false;
+  phenotypic_contributions_computed_ = false;
+  non_coding_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+
+
+  if (phenotypic_contribution_ != NULL) {
+    delete phenotypic_contribution_; // Not re-created now, will be conditionally allocated in compute_phenotypic_contribution
+    phenotypic_contribution_ = NULL;
+  }
+
+  init_statistical_data();
+}
+
+
+void GeneticUnit::print_coding_rnas() {
+  for (int strand_id = LEADING; strand_id <= LAGGING; ++strand_id) {
+    auto& strand = rna_list_[strand_id];
+    printf("  %s \n", StrandName[strand_id]);
+    for (const auto& rna: strand)
+      if (rna.is_coding()) {
+        printf(
+            "Promoter at %" PRId32 ", last transcribed position at %" PRId32 "\n",
+            rna.promoter_pos(), rna.last_transcribed_pos());
+      }
+  }
+}
+
+void GeneticUnit::print_proteins() const {
+  printf("  LEADING (%" PRId32 ")\n",
+         static_cast<int32_t>(protein_list_[LEADING].size()));
+  for (const auto& prot: protein_list_[LEADING])
+    printf(
+        "    Gene on LEADING at %" PRId32 " (%" PRId32 ") (%f %f %f) (%f) %s\n",
+        prot.shine_dal_pos(), prot.length(),
+        prot.mean(), prot.width(), prot.height(),
+        prot.concentration(),
+        prot.is_functional() ? "functional" : "non functional");
+
+
+  printf("  LAGGING (%" PRId32 ")\n",
+         static_cast<int32_t>(protein_list_[LAGGING].size()));
+  for (const auto& prot: protein_list_[LAGGING])
+    printf(
+        "    Gene on LAGGING at %" PRId32 " (%" PRId32 ") (%f %f %f) (%f) %s\n",
+        prot.shine_dal_pos(), prot.length(),
+        prot.mean(), prot.width(), prot.height(),
+        prot.concentration(),
+        prot.is_functional() ? "functional" : "non functional");
+}
+
+bool GeneticUnit::is_promoter(Strand strand, int32_t pos, int8_t& dist) const {
+  //~ printf("=============================================== is_promoter\n");
+  //~ printf("pos : %" PRId32 "\n", pos);
+
+  const char* genome = dna_->data();
+  int32_t len = dna_->length();
+
+  dist = 0;
+  bool ret = true;
+
+  if (strand == LEADING) {
+    //~ printf("LEADING\n");
+    for (int16_t i = 0; i < PROM_SIZE; i++) {
+      //~ printf( "LEADING\n" );
+      if (genome[Utils::mod((pos + i), len)] != PROM_SEQ[i]) {
+        dist++;
+        if (dist > PROM_MAX_DIFF) {
+          //~ printf( "=============================================== END is_promoter\n" );
+          ret = false;
+        }
+
+      }
+    }
+  }
+  else // (strand == LAGGING)
+  {
+    //~ printf("LAGGING\n");
+    for (int16_t i = 0; i < PROM_SIZE; i++) {
+      //~ printf("  i : %"PRId32" dist : %"PRId8"\n", i, dist);
+      if (genome[Utils::mod((pos - i), len)] ==
+          PROM_SEQ[i]) // == and not != because we are on the complementary strand...
+      {
+          dist++;
+          if ( dist > PROM_MAX_DIFF )
+          {
+            //~ printf( "=============================================== END is_promoter\n" );
+            ret = false;
+          }
+        }
+      }
+    }
+
+
+
+    //~ printf( "=============================================== END is_promoter\n" );
+    return ret;
+
+}
+
+bool GeneticUnit::is_terminator(Strand strand, int32_t pos) const {
+  const char* genome = dna_->data();
+  int32_t len = dna_->length();
+
+  if (strand == LEADING) {
+    for (int16_t i = 0; i < TERM_STEM_SIZE; i++) {
+      if (genome[Utils::mod(pos + i, len)] ==
+          genome[Utils::mod(pos + (TERM_SIZE - 1) - i, len)]) {
+            return false;
+      }
+    }
+  }
+  else // (strand == LAGGING)
+  {
+    for (int16_t i = 0; i < TERM_STEM_SIZE; i++) {
+      if (genome[Utils::mod(pos - i, len)] ==
+          genome[Utils::mod(pos - (TERM_SIZE - 1) + i, len)]) {
+            return false;
+      }
+    }
+  }
+
+  return true;
+}
+
+bool GeneticUnit::is_shine_dalgarno(Strand strand, int32_t pos) const {
+  const char* genome = dna_->data();
+  int32_t len = dna_->length();
+
+  if (strand == LEADING) {
+    for (int8_t i = 0; i < SHINE_DAL_SIZE; i++) {
+      if (genome[Utils::mod((pos + i), len)] != SHINE_DAL_SEQ[i]) {
+        return false;
+      }
+    }
+  }
+  else // (strand == LAGGING)
+  {
+    for (int8_t i = 0; i < SHINE_DAL_SIZE; i++) {
+      if (genome[Utils::mod((pos - i), len)] ==
+          SHINE_DAL_SEQ[i]) // == and not != because we are on the complementary strand...
+      {
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
+int8_t GeneticUnit::codon(Strand strand, int32_t pos) const {
+  const char* genome = dna_->data();
+  int32_t len = dna_->length();
+  int8_t codon = 0;
+
+  if (strand == LEADING) {
+    for (int8_t i = 0; i < CODON_SIZE; i++) {
+      if (genome[Utils::mod((pos + i), len)] == '1') {
+        codon += 1 << (CODON_SIZE - i - 1); //pow(2, CODON_SIZE - i - 1);
+      }
+    }
+  }
+  else // (strand == LAGGING)
+  {
+    for (int8_t i = 0; i < CODON_SIZE; i++) {
+      if (genome[Utils::mod((pos - i), len)] !=
+          '1') // == and not != because we are on the complementary strand...
+      {
+        codon += 1 << (CODON_SIZE - i - 1); //pow(2, CODON_SIZE - i - 1);
+      }
+    }
+  }
+
+  return codon;
+}
+
+void GeneticUnit::compute_non_coding() {
+  if (non_coding_computed_) return;
+  non_coding_computed_ = true;
+
+  // Create a table of <genome_length> bools initialized to false (non-coding)
+  int32_t genome_length = dna_->length();
+
+  // Including Shine-Dalgarno, spacer, START and STOP
+  bool* belongs_to_CDS;
+  bool* belongs_to_functional_CDS;
+  bool* belongs_to_non_functional_CDS; // non-functional CDSs are those that have a null area or that lack a kind of codons (M, W or H)
+
+  // Including Promoters and terminators
+  bool* belongs_to_RNA;
+  bool* belongs_to_coding_RNA;
+  bool* belongs_to_non_coding_RNA;
+
+  // Genes + prom + term (but not UTRs)
+  bool* is_essential_DNA;
+  bool* is_essential_DNA_including_nf_genes; // Adds non-functional genes + promoters & terminators
+
+  bool* is_not_neutral;            // prom + term + everything in between (as opposed to neutral)
+
+
+  belongs_to_CDS = new bool[genome_length];
+  belongs_to_functional_CDS = new bool[genome_length];
+  belongs_to_non_functional_CDS = new bool[genome_length];
+  belongs_to_RNA = new bool[genome_length];
+  belongs_to_coding_RNA = new bool[genome_length];
+  belongs_to_non_coding_RNA = new bool[genome_length];
+  is_essential_DNA = new bool[genome_length];
+  is_essential_DNA_including_nf_genes = new bool[genome_length];
+  is_not_neutral = new bool[genome_length];
+
+  memset(belongs_to_CDS, 0, genome_length);
+  memset(belongs_to_functional_CDS, 0, genome_length);
+  memset(belongs_to_non_functional_CDS, 0, genome_length);
+  memset(belongs_to_RNA, 0, genome_length);
+  memset(belongs_to_coding_RNA, 0, genome_length);
+  memset(belongs_to_non_coding_RNA, 0, genome_length);
+  memset(is_essential_DNA, 0, genome_length);
+  memset(is_essential_DNA_including_nf_genes, 0, genome_length);
+  memset(is_not_neutral, 0, genome_length);
+
+
+  // Parse protein lists and mark the corresponding bases as coding
+  for (auto strand: {LEADING, LAGGING}) {
+    for (const auto& prot: protein_list_[strand]) {
+      int32_t first;
+      int32_t last;
+
+      switch (strand) {
+        case LEADING:
+          first = prot.shine_dal_pos();
+          last = prot.last_STOP_base_pos();
+          break;
+        case LAGGING:
+          last = prot.shine_dal_pos();
+          first = prot.last_STOP_base_pos();
+          break;
+        default:
+          assert(false); // error: should never happen
+      }
+
+      if (first <= last) {
+        for (int32_t i = first; i <= last; i++) {
+          belongs_to_CDS[i] = true;
+          if (prot.is_functional()) is_essential_DNA[i] = true;
+          is_essential_DNA_including_nf_genes[i] = true;
+        }
+      }
+      else {
+        for (int32_t i = first; i < genome_length; i++) {
+          belongs_to_CDS[i] = true;
+          if (prot.is_functional()) is_essential_DNA[i] = true;
+          is_essential_DNA_including_nf_genes[i] = true;
+        }
+        for (int32_t i = 0; i <= last; i++) {
+          belongs_to_CDS[i] = true;
+          if (prot.is_functional()) is_essential_DNA[i] = true;
+          is_essential_DNA_including_nf_genes[i] = true;
+        }
+      }
+
+      // Include the promoter and terminator to essential DNA
+      // Mark everything between promoter and terminator as not neutral
+      for (const auto& rna: prot.rna_list()) {
+
+        int32_t prom_first;
+        int32_t prom_last;
+        int32_t term_first;
+        int32_t term_last;
+        int32_t rna_first;
+        int32_t rna_last;
+
+        if (strand == LEADING) {
+          prom_first = rna->promoter_pos();
+          prom_last = Utils::mod(prom_first + PROM_SIZE - 1, dna_->length());
+          term_last = rna->last_transcribed_pos();
+          term_first = Utils::mod(term_last - TERM_SIZE + 1, dna_->length());
+          rna_first = prom_first;
+          rna_last = term_last;
+        }
+        else {
+          prom_last = rna->promoter_pos();
+          prom_first = Utils::mod(prom_last - PROM_SIZE + 1, dna_->length());
+          term_first = rna->last_transcribed_pos();
+          term_last = Utils::mod(term_first + TERM_SIZE - 1, dna_->length());
+          rna_first = term_first;
+          rna_last = prom_last;
+        }
+
+        // Let us begin with "non-neutral" regions...
+        if (rna_first <= rna_last) {
+          for (int32_t i = rna_first;
+               i <= rna_last; i++) { is_not_neutral[i] = true; }
+        }
+        else {
+          for (int32_t i = rna_first;
+               i < genome_length; i++) { is_not_neutral[i] = true; }
+          for (int32_t i = 0; i <= rna_last; i++) { is_not_neutral[i] = true; }
+        }
+
+        // ...and go on with essential DNA
+        if (prom_first <= prom_last) {
+          for (int32_t i = prom_first; i <= prom_last; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+        }
+        else {
+          for (int32_t i = prom_first; i < genome_length; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+          for (int32_t i = 0; i <= prom_last; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+        }
+        //~ printf("\n");
+
+        //~ printf("term ");
+        if (term_first <= term_last) {
+          for (int32_t i = term_first; i <= term_last; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+        }
+        else {
+          for (int32_t i = term_first; i < genome_length; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+          for (int32_t i = 0; i <= term_last; i++) {
+            //~ printf("%ld ", i);
+            if (prot.is_functional()) is_essential_DNA[i] = true;
+            is_essential_DNA_including_nf_genes[i] = true;
+          }
+        }
+        //~ printf("\n");
+        //~ getchar();
+      }
+
+
+      if (prot.is_functional()) {
+        if (first <= last) {
+          for (int32_t i = first; i <= last; i++) {
+            belongs_to_functional_CDS[i] = true;
+          }
+        }
+        else {
+          for (int32_t i = first; i < genome_length; i++) {
+            belongs_to_functional_CDS[i] = true;
+          }
+          for (int32_t i = 0; i <= last; i++) {
+            belongs_to_functional_CDS[i] = true;
+          }
+        }
+      }
+      else // degenerated protein
+      {
+        if (first <= last) {
+          for (int32_t i = first; i <= last; i++) {
+            belongs_to_non_functional_CDS[i] = true;
+          }
+        }
+        else {
+          for (int32_t i = first; i < genome_length; i++) {
+            belongs_to_non_functional_CDS[i] = true;
+          }
+          for (int32_t i = 0; i <= last; i++) {
+            belongs_to_non_functional_CDS[i] = true;
+          }
+        }
+      }
+    }
+  }
+
+
+  // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs)
+  // TODO vld: this block cries for refactoring
+  for (int8_t strand = LEADING; strand <= LAGGING; strand++) {
+    for (auto& rna: rna_list_[strand]) {
+      int32_t first;
+      int32_t last;
+
+      if (strand == LEADING) {
+        first = rna.promoter_pos();
+        last = rna.last_transcribed_pos();
+      }
+      else { // (strand == LAGGING)
+        first = rna.last_transcribed_pos();
+        last = rna.promoter_pos();
+      }
+
+      assert(first < indiv_->amount_of_dna());
+      assert(last < indiv_->amount_of_dna());
+
+      if (first <= last) {
+        for (int32_t i = first; i <= last; i++) {
+          belongs_to_RNA[i] = true;
+        }
+      }
+      else {
+        for (int32_t i = first; i < genome_length; i++)
+          belongs_to_RNA[i] = true;
+        for (int32_t i = 0; i <= last; i++)
+          belongs_to_RNA[i] = true;
+      }
+
+      if (not rna.transcribed_proteins().empty()) { // coding RNA
+        if (first <= last) {
+          for (int32_t i = first; i <= last; i++)
+            belongs_to_coding_RNA[i] = true;
+        }
+        else {
+          for (int32_t i = first; i < genome_length; i++)
+            belongs_to_coding_RNA[i] = true;
+          for (int32_t i = 0; i <= last; i++)
+            belongs_to_coding_RNA[i] = true;
+        }
+      }
+      else // non coding RNA
+      {
+        if (first <= last) {
+          for (int32_t i = first; i <= last; i++)
+            belongs_to_non_coding_RNA[i] = true;
+        }
+        else {
+          for (int32_t i = first; i < genome_length; i++)
+            belongs_to_non_coding_RNA[i] = true;
+          for (int32_t i = 0; i <= last; i++)
+            belongs_to_non_coding_RNA[i] = true;
+        }
+      }
+    }
+  }
+
+  // Count non-coding bases
+  nb_bases_in_0_CDS_ = 0;
+  nb_bases_in_0_functional_CDS_ = 0;
+  nb_bases_in_0_non_functional_CDS_ = 0;
+  nb_bases_in_0_RNA_ = 0;
+  nb_bases_in_0_coding_RNA_ = 0;
+  nb_bases_in_0_non_coding_RNA_ = 0;
+  nb_bases_non_essential_ = 0;
+  nb_bases_non_essential_including_nf_genes_ = 0;
+  nb_bases_in_neutral_regions_ = 0;
+  nb_neutral_regions_ = 0;
+
+  // We do not know how many neutral regions there will be, but
+  // there should be less than nb_coding_RNAs_ + 1
+  // As we will see, there may be a shift in values so we take size nb_coding_RNAs_ + 2
+  int32_t* tmp_beginning_neutral_regions = new int32_t[nb_coding_RNAs_ + 2];
+  int32_t* tmp_end_neutral_regions = new int32_t[nb_coding_RNAs_ + 2];
+  memset(tmp_beginning_neutral_regions, -1, nb_coding_RNAs_ + 2);
+  memset(tmp_end_neutral_regions, -1, nb_coding_RNAs_ + 2);
+
+  for (int32_t i = 0; i < genome_length; i++) {
+    if (belongs_to_CDS[i] == false) {
+      nb_bases_in_0_CDS_++;
+    }
+    if (belongs_to_functional_CDS[i] == false) {
+      nb_bases_in_0_functional_CDS_++;
+    }
+    if (belongs_to_non_functional_CDS[i] == false) {
+      nb_bases_in_0_non_functional_CDS_++;
+    }
+    if (belongs_to_RNA[i] == false) {
+      nb_bases_in_0_RNA_++;
+    }
+    if (belongs_to_coding_RNA[i] == false) {
+      nb_bases_in_0_coding_RNA_++;
+    }
+    if (belongs_to_non_coding_RNA[i] == false) {
+      nb_bases_in_0_non_coding_RNA_++;
+    }
+    if (is_essential_DNA[i] == false) {
+      nb_bases_non_essential_++;
+    }
+    if (is_essential_DNA_including_nf_genes[i] == false) {
+      nb_bases_non_essential_including_nf_genes_++;
+    }
+    if (is_not_neutral[i] == false) {
+      nb_bases_in_neutral_regions_++;
+    }
+    if (i != 0) {
+      if (is_not_neutral[i] != is_not_neutral[i - 1]) {
+        if (is_not_neutral[i - 1] == true) // beginning of a neutral region
+        {
+          tmp_beginning_neutral_regions[nb_neutral_regions_] = i;
+        }
+        else // end of a neutral region
+        {
+          tmp_end_neutral_regions[nb_neutral_regions_] = i - 1;
+          nb_neutral_regions_++;
+        }
+      }
+    }
+    else // i = 0
+    {
+      // we arbitrarily set 0 as the beginning of a neutral region (linkage with end of genetic unit
+      // will be done later)
+      if (is_not_neutral[0] ==
+          false) { tmp_beginning_neutral_regions[nb_neutral_regions_] = 0; }
+    }
+  }
+
+  // we have to treat specifically the last base of the genetic unit in order to link neutral regions
+  // at the end and the beginning of genetic unit
+  int32_t shift = 0;
+  if (is_not_neutral[genome_length - 1] == false) {
+    if (is_not_neutral[0] == true) // end of a neutral region
+    {
+      tmp_end_neutral_regions[nb_neutral_regions_] = genome_length - 1;
+      nb_neutral_regions_++;
+    }
+    else // neutral region goes on after base 0, linkage to be done
+    {
+      if (nb_neutral_regions_ != 0) {
+        tmp_end_neutral_regions[nb_neutral_regions_] = tmp_end_neutral_regions[0];
+        // the first neutral region is only a subpart of the last one, it should not be
+        // taken into account. When we transfer values to the final array, we introduce a shift
+        shift = 1;
+        // we do not ++ nb_neutral_regions_ as it was already counted
+      }
+      else // no neutral region detected until now -> all the genetic unit is neutral
+      {
+        // as all the chromosome is neutral, we indicate 0 as the beginning of the region
+        // and genome_length - 1 as its end
+        tmp_end_neutral_regions[0] = genome_length - 1;
+        nb_neutral_regions_++;
+      }
+    }
+  }
+
+  // now that we know how many neutral regions there are, we can transfer data to correctly sized arrays
+  assert(nb_neutral_regions_ <= nb_coding_RNAs_ + 1);
+  if (beginning_neutral_regions_ !=
+      NULL) { delete[] beginning_neutral_regions_; }
+  if (end_neutral_regions_ != NULL) { delete[] end_neutral_regions_; }
+
+  if (nb_neutral_regions_ >
+      0) // as unlikely as it seems, there may be no neutral region
+  {
+    beginning_neutral_regions_ = new int32_t[nb_neutral_regions_];
+    end_neutral_regions_ = new int32_t[nb_neutral_regions_];
+    // transfer from tmp to attributes
+    for (int32_t i = 0; i < nb_neutral_regions_; i++) {
+      beginning_neutral_regions_[i] = tmp_beginning_neutral_regions[i + shift];
+      end_neutral_regions_[i] = tmp_end_neutral_regions[i + shift];
+    }
+  }
+  else // nb_neutral_regions_ == 0
+  {
+    beginning_neutral_regions_ = NULL;
+    end_neutral_regions_ = NULL;
+  }
+
+  delete[] tmp_beginning_neutral_regions;
+  delete[] tmp_end_neutral_regions;
+
+  delete[] belongs_to_CDS;
+  delete[] belongs_to_functional_CDS;
+  delete[] belongs_to_non_functional_CDS;
+  delete[] belongs_to_RNA;
+  delete[] belongs_to_coding_RNA;
+  delete[] belongs_to_non_coding_RNA;
+  delete[] is_essential_DNA;
+  delete[] is_essential_DNA_including_nf_genes;
+  delete[] is_not_neutral;
+}
+
+///
+///
+/// `duplicated_promoters` is an output parameter, it should be initially empty
+void GeneticUnit::duplicate_promoters_included_in(int32_t pos_1,
+                                                  int32_t pos_2,
+                                                  Promoters2Strands& duplicated_promoters) {
+  // 1) Get promoters to be duplicated
+  Promoters2Strands retrieved_promoters = {{},
+                                           {}};
+  promoters_included_in(pos_1, pos_2, retrieved_promoters);
+
+  // 2) Set RNAs' position as their position on the duplicated segment
+  for (auto& strand: {LEADING, LAGGING}) {
+    for (auto& rna: retrieved_promoters[strand]) {
+      // Make a copy of current RNA inside container
+#ifndef __REGUL
+      duplicated_promoters[strand].emplace_back(this, rna);
+#else
+        Rna_R rna_r(this, rna);
+        duplicated_promoters[strand].push_back(rna_r);
+        #endif
+
+      // Set RNA's position as it's position on the duplicated segment
+      duplicated_promoters[strand].back().shift_position(-pos_1,
+                                                         dna_->length());
+    }
+  }
+}
+
+void GeneticUnit::promoters_included_in(int32_t pos_1,
+                                            int32_t pos_2,
+                                            Promoters2Strands& promoters_list) {
+  assert(pos_1 >= 0 && pos_1 <= dna_->length() && pos_2 >= 0 &&
+         pos_2 <= dna_->length());
+
+  if (pos_1 < pos_2) {
+    int32_t seg_length = pos_2 - pos_1;
+
+    if (seg_length >= PROM_SIZE) {
+      promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1,
+                    promoters_list[LEADING]);
+      promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1,
+                    promoters_list[LAGGING]);
+    }
+  }
+  else {
+    int32_t seg_length = dna_->length() + pos_2 - pos_1;
+
+    if (seg_length >= PROM_SIZE) {
+      bool is_near_end_of_genome = (pos_1 + PROM_SIZE > dna_->length());
+      bool is_near_beginning_of_genome = (pos_2 - PROM_SIZE < 0);
+
+      if (!is_near_end_of_genome && !is_near_beginning_of_genome) {
+        promoters(LEADING, AFTER, pos_1, -1, promoters_list[LEADING]);
+        promoters(LEADING, BEFORE, -1, pos_2 - PROM_SIZE + 1,
+                      promoters_list[LEADING]);
+        promoters(LAGGING, AFTER, pos_2, -1, promoters_list[LAGGING]);
+        promoters(LAGGING, BEFORE, -1, pos_1 + PROM_SIZE - 1,
+                      promoters_list[LAGGING]);
+      }
+      else if (!is_near_end_of_genome) // => && is_near_beginning_of_genome
+      {
+        // promoters(leading, between, pos_1, pos_2 + dna_->length() - PROM_SIZE + 1,
+        //                                         promoters_list[LEADING]);
+        promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1 +
+                                               dna_->length(),
+                      promoters_list[LEADING]);
+        promoters(LAGGING, AFTER, pos_2, -1, promoters_list[LAGGING]);
+        promoters(LAGGING, BEFORE, -1, pos_1 + PROM_SIZE - 1,
+                      promoters_list[LAGGING]);
+      }
+      else if (!is_near_beginning_of_genome) // => && is_near_end_of_genome
+      {
+        promoters(LEADING, AFTER, pos_1, -1, promoters_list[LEADING]);
+        promoters(LEADING, BEFORE, -1, pos_2 - PROM_SIZE + 1,
+                      promoters_list[LEADING]);
+        promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1 -
+                                               dna_->length(),
+                      promoters_list[LAGGING]);
+      }
+      else // is_near_end_of_genome && is_near_beginning_of_genome
+      {
+        // promoters(leading, between, pos_1, pos_2 + dna_->length() - PROM_SIZE + 1,
+        //                                         promoters_list[LEADING]);
+        promoters(LEADING, BETWEEN, pos_1, pos_2 - PROM_SIZE + 1 +
+                                               dna_->length(),
+                      promoters_list[LEADING]);
+        promoters(LAGGING, BETWEEN, pos_2, pos_1 + PROM_SIZE - 1 -
+                                               dna_->length(),
+                      promoters_list[LAGGING]);
+      }
+    }
+  }
+}
+
+/** Get promoters whose starting position are between/before/after
+ * pos_1 and pos_2.
+ *
+ * The promoters will be ordered with regard to the strand's reading direction
+ */
+void GeneticUnit::promoters(Strand strand_id,
+                                Position before_after_btw, // with regard to the strand's reading direction
+                                int32_t pos1,
+                                int32_t pos2,
+                                Promoters1Strand& promoters) {
+  // TODO vld: First try, the parameter list could be cleverer.
+
+  // TODO vld: These find_if puns are not very nice. Could just negate
+  // return if LAGGING or something in that spirit.
+
+  assert((before_after_btw == BETWEEN and pos1 >= 0 and pos2 >= 0 and
+          pos1 <= dna_->length() and pos2 <= dna_->length()) or
+         (before_after_btw == BEFORE and pos2 >= 0 and
+          pos2 <= dna_->length()) or
+         (before_after_btw == AFTER and pos1 >= 0 and pos1 <= dna_->length()));
+
+  auto strand = rna_list_[strand_id];
+  auto it_begin = strand.begin();
+  auto it_end = strand.end();
+
+  if (before_after_btw != BEFORE) {
+    it_begin = find_if(strand.begin(),
+                       strand.end(),
+                       [pos1, strand_id](Rna& p) {
+                         if (strand_id == LEADING) {
+                           return p.promoter_pos() >= pos1;
+                         }
+                         else {
+                           return p.promoter_pos() < pos1;
+                         }
+                       });
+  }
+
+  if (before_after_btw != AFTER) {
+    it_end = find_if(it_begin,
+                     strand.end(),
+                     [pos2, strand_id](Rna& p) {
+                       if (strand_id == LEADING) {
+                         return p.promoter_pos() >= pos2;
+                       }
+                       else {
+                         return p.promoter_pos() < pos2;
+                       }
+                     });
+  }
+
+  promoters.insert(promoters.end(), it_begin, it_end);
+}
+
+/// Invert all the promoters of promoter_lists for a sequence of
+/// length seq_length.
+/*static*/ void GeneticUnit::invert_promoters(Promoters2Strands& promoter_lists,
+                                              int32_t seq_length) {
+  GeneticUnit::invert_promoters(promoter_lists, 0, seq_length);
+}
+
+/// Invert all the promoters of promoter_lists knowing that they
+/// represent the promoters of a subsequence beginning at pos_1 and
+/// ending at pos_2.
+///
+/// WARNING : This function is pretty specific, make sure you
+/// understand its precise behaviour before using it.
+/*static*/ void GeneticUnit::invert_promoters(Promoters2Strands& promoter_lists,
+                                              int32_t pos1,
+                                              int32_t pos2) {
+  assert(pos1 >= 0 && pos1 <=
+                      pos2); // Could check (pos2 < length) but another parameter would be necessary
+
+  // Exchange LEADING and LAGGING lists
+  promoter_lists[LEADING].swap(promoter_lists[LAGGING]);
+
+  // Update the position and strand of each promoter to be inverted...
+  for (auto& strand: {LEADING, LAGGING})
+    for (auto& rna: promoter_lists[strand]) {
+      assert(rna.strand() != strand); // strands have just been swapped
+      assert(rna.promoter_pos() >= pos1);
+      assert(rna.promoter_pos() < pos2);
+
+      rna.set_promoter_pos(pos1 + pos2 - rna.promoter_pos() - 1);
+      rna.set_strand(strand);
+    }
+}
+
+void GeneticUnit::invert_promoters_included_in(int32_t pos1,
+                                               int32_t pos2) {
+  assert(pos1 >= 0);
+  assert(pos1 <= pos2);
+  assert(pos2 <= dna_->length());
+
+  int32_t segment_length = pos2 - pos1;
+
+  if (segment_length < PROM_SIZE) {
+    return;
+  }
+
+  Promoters2Strands inverted_promoters = {{},
+                                          {}};
+
+  // 1) Extract the promoters completely included on the segment to be inverted
+  extract_promoters_included_in(pos1, pos2, inverted_promoters);
+
+  // 2) Invert segment's promoters
+  GeneticUnit::invert_promoters(inverted_promoters, pos1, pos2);
+
+  // 3) Reinsert the inverted promoters
+  insert_promoters(inverted_promoters);
+}
+
+// TODO vld: should it append extracted promoters to extracted_promoters or replace its content
+void GeneticUnit::extract_leading_promoters_starting_between(int32_t pos_1,
+                                                             int32_t pos_2,
+                                                             Promoters1Strand& extracted_promoters) {
+  assert(pos_1 >= 0);
+  assert(pos_1 < pos_2);
+  assert(pos_2 <= dna_->length());
+
+  // Find the first promoters in the interval
+  auto& strand = rna_list_[LEADING];
+  auto first = find_if(strand.begin(),
+                       strand.end(),
+                       [pos_1](Rna& p) {
+                         return p.promoter_pos() >= pos_1;
+                       });
+
+  if (first == strand.end() or first->promoter_pos() >= pos_2) {
+    return;
+  }
+
+  // Find the last promoters in the interval
+  auto end = find_if(first,
+                     strand.end(),
+                     [pos_2](Rna& p) { return p.promoter_pos() >= pos_2; });
+
+  // Extract the promoters (remove them from the individual's list and put them in extracted_promoters)
+  extracted_promoters.insert(extracted_promoters.end(), first, end);
+  strand.erase(first, end);
+}
+
+void GeneticUnit::extract_lagging_promoters_starting_between(int32_t pos_1,
+                                                             int32_t pos_2,
+                                                             Promoters1Strand& extracted_promoters) {
+  assert(pos_1 >= 0);
+  assert(pos_1 < pos_2);
+  assert(pos_2 <= dna_->length());
+
+  // Find the first promoters in the interval (if any)
+  auto& strand = rna_list_[LAGGING];
+  auto first = find_if(strand.begin(),
+                       strand.end(),
+                       [pos_2](Rna& r) {
+                         return r.promoter_pos() < pos_2;
+                       });
+
+  if (first == strand.end() or first->promoter_pos() < pos_1) {
+    return;
+  }
+
+  // Find the last promoters in the interval
+  auto end = find_if(first,
+                     strand.end(),
+                     [pos_1](Rna& r) { return r.promoter_pos() < pos_1; });
+
+  // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
+  extracted_promoters.insert(extracted_promoters.end(), first, end);
+  strand.erase(first, end);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/// Shift all the promoters in <promoters_to_shift> by <delta_pos> in a sequence of length <seq_length>.
+///
+/// Every promoter in double stranded list <promoters_to_shift> will
+///  be shifted by <delta_pos>, then a modulo <seq_length> will be
+///  applied
+/*static*/ void GeneticUnit::shift_promoters(
+    Promoters2Strands& promoters_to_shift,
+    int32_t delta_pos,
+    int32_t seq_length) {
+  for (auto& strand: {LEADING, LAGGING})
+    for (auto& rna: promoters_to_shift[strand])
+      rna.shift_position(delta_pos, seq_length);
+}
+
+/// Insert promoters in double stranded list `promoters_to_insert` into `this->rna_list_`.
+///
+/// The promoters in <promoters_to_insert> must already be at their
+/// rightful position according to <this>
+/// and the positions of the promoters from <promoters_to_insert> and
+/// <this->rna_list_> must not be interlaced
+/// i.e. no promoter in <this->rna_list_> must have a position in
+/// [first_prom_to_insert->pos ; last_prom_to_insert->pos]
+void GeneticUnit::insert_promoters(Promoters2Strands& promoters_to_insert) {
+  // TODO vld: to be merged with insert_promoters_at(...)
+  for (auto strand: {LEADING, LAGGING}) {
+    if (promoters_to_insert[strand].size() <= 0) {
+      continue;
+    }
+    // Get to the right position in individual's list (first promoter after the inserted segment)
+    int32_t from_pos = promoters_to_insert[strand].back().promoter_pos();
+
+    auto pos = find_if(rna_list_[strand].begin(),
+                       rna_list_[strand].end(),
+                       [from_pos, strand](Rna& r) {
+                         if (strand == LEADING) {
+                           return r.promoter_pos() >= from_pos;
+                         }
+                         else {
+                           return r.promoter_pos() < from_pos;
+                         }
+                       });
+
+    // Insert the promoters in the individual's RNA list
+    for (auto& to_insert: promoters_to_insert[strand])
+      // TODO vld: could be compacted in a unique emplace(pos, to_insert) ?
+      if (pos != rna_list_[strand].end()) {
+        rna_list_[strand].insert(pos, to_insert);
+      }
+      else {
+        rna_list_[strand].push_back(to_insert);
+      }
+  }
+}
+
+/// Insert promoters in double stranded list `promoters_to_insert`
+/// into `this->rna_list_` at position `pos`
+///
+/// The promoters in `promoters_to_insert` must be at their rightful
+/// position according to a stand-alone sequence (i.e. at a RELATIVE
+/// position). Their position will be updated automatically.
+void GeneticUnit::insert_promoters_at(Promoters2Strands& promoters_to_insert,
+                                      int32_t pos) {
+  for (auto strand: {LEADING, LAGGING}) {
+    if (promoters_to_insert[strand].size() <= 0) {
+      continue;
+    }
+    // Get to the right position in individual's list (first promoter after the inserted segment)
+    auto first = find_if(rna_list_[strand].begin(),
+                         rna_list_[strand].end(),
+                         [pos, strand](Rna& r) {
+                           if (strand == LEADING) {
+                             return r.promoter_pos() >= pos;
+                           }
+                           else {
+                             return r.promoter_pos() < pos;
+                           }
+                         });
+
+    // Insert the promoters in the individual's RNA list
+    for (auto& to_insert: promoters_to_insert[strand]) {
+      // Update promoter position
+      to_insert.shift_position(pos, dna_->length());
+      // Insert
+      if (first != rna_list_[strand].end()) {
+        rna_list_[strand].insert(first, to_insert);
+      }
+      else {
+        rna_list_[strand].push_back(to_insert);
+      }
+    }
+  }
+}
+
+
+/// Remove the RNAs of the LEADING strand whose starting positions lie
+/// in [pos_1 ; pos_2[
+void GeneticUnit::remove_leading_promoters_starting_between(int32_t pos_1,
+                                                            int32_t pos_2) {
+  assert(pos_1 >= 0);
+  assert(pos_1 < dna_->length());
+  assert(pos_2 >= 0);
+  assert(pos_2 <= dna_->length());
+
+  if (pos_1 > pos_2) {
+    remove_leading_promoters_starting_after(pos_1);
+    remove_leading_promoters_starting_before(pos_2);
+  }
+  else {
+    auto& strand = rna_list_[LEADING];
+    // Delete RNAs until we pass pos_2 (or we reach the end of the list)
+    // STL Warning: don't erase the current iterator in the for-loop!
+    for (auto it = find_if(strand.begin(),
+                           strand.end(),
+                           [pos_1](Rna& r) {
+                             return r.promoter_pos() >= pos_1;
+                           }),
+             nextit = it;
+         it != strand.end() and it->promoter_pos() < pos_2;
+         it = nextit) {
+      nextit = next(it);
+      strand.erase(it);
+    }
+  }
+}
+
+
+/// Remove the RNAs of the LAGGING strand whose starting positions lie
+/// in [pos_1 ; pos_2[
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::remove_lagging_promoters_starting_between(int32_t pos_1,
+                                                            int32_t pos_2) {
+  assert(pos_1 >= 0 && pos_1 <= dna_->length() && pos_2 >= 0 &&
+         pos_2 <= dna_->length());
+
+  if (pos_1 == dna_->length()) pos_1 = 0;
+  if (pos_2 == 0) pos_2 = dna_->length();
+  if (pos_1 >
+      pos_2) { // vld: that's a weird case... really do this? used from remove_promoters_around()
+    remove_lagging_promoters_starting_after(pos_1);
+    remove_lagging_promoters_starting_before(pos_2);
+  }
+  else {
+    auto& strand = rna_list_[LAGGING];
+    // Delete RNAs until we pass pos_1 (or we reach the end of the list)
+    for (auto it = find_if(strand.begin(),
+                           strand.end(),
+                           [pos_2](Rna& r) {
+                             return r.promoter_pos() < pos_2;
+                           }),
+             nextit = it;
+         it != strand.end() and it->promoter_pos() >= pos_1;
+         it = nextit) {
+      nextit = next(it);
+      strand.erase(it);
+    }
+  }
+}
+
+
+/// Remove the promoters from the LEADING strand whose starting
+/// positions are < pos
+void GeneticUnit::remove_leading_promoters_starting_before(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  auto& strand = rna_list_[LEADING];
+  // Delete RNAs until we reach pos (or we reach the end of the list)
+  for (auto it = strand.begin(),
+           nextit = it;
+       it != strand.end() and it->promoter_pos() < pos;
+       it = nextit) {
+    nextit = next(it);
+    strand.erase(it);
+  }
+}
+
+
+/// Remove the promoters from the LAGGING strand whose starting
+/// positions are < pos
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::remove_lagging_promoters_starting_before(int32_t pos) {
+  assert(pos >= 0 and pos < dna_->length());
+
+  auto& strand = rna_list_[LAGGING];
+  // Delete RNAs until we reach pos (or we reach the end of the list)
+  // TODO: optimize by starting from the end (with reverse iterators)
+  for (auto it = find_if(strand.begin(),
+                         strand.end(),
+                         [pos](Rna& r) { return r.promoter_pos() < pos; }),
+           nextit = it;
+       it != strand.end();
+       it = nextit) {
+    nextit = next(it);
+    strand.erase(it);
+  }
+}
+
+
+/// Remove the promoters from the LEADING strand whose starting
+/// positions are >= pos
+void GeneticUnit::remove_leading_promoters_starting_after(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  auto& strand = rna_list_[LEADING];
+  // TODO: optimize by starting from the end (with reverse iterators)
+  for (auto it = find_if(strand.begin(), strand.end(),
+                         [pos](Rna& r) { return r.promoter_pos() >= pos; }),
+           nextit = it;
+       it != strand.end();
+       it = nextit) {
+    nextit = next(it);
+    strand.erase(it);
+  }
+}
+
+
+/// Remove the promoters from the LAGGING strand whose starting
+/// positions are >= pos
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::remove_lagging_promoters_starting_after(int32_t pos) {
+  assert(pos < dna_->length() && pos >= 0);
+
+  auto& strand = rna_list_[LAGGING];
+  // Delete RNAs until we pass pos (or we reach the end of the list)
+  for (auto it = strand.begin(),
+           nextit = it;
+       it != strand.end() and it->promoter_pos() >= pos;
+       it = nextit) {
+    nextit = next(it);
+    strand.erase(it);
+  }
+}
+
+
+/// Look for new promoters on the LEADING strand whose starting
+/// positions would lie in [pos_1 ; pos_2[
+void GeneticUnit::look_for_new_leading_promoters_starting_between(int32_t pos_1,
+                                                                  int32_t pos_2) {
+  assert(pos_1 >= 0 && pos_1 < dna_->length() && pos_2 >= 0 &&
+         pos_2 < dna_->length());
+
+  // When pos_1 > pos_2, we will perform the search in 2 steps.
+  // As positions  0 and dna_->length() are equivalent, it's preferable to
+  // keep 0 for pos_1 and dna_->length() for pos_2.
+
+  if (pos_1 >= pos_2) {
+    look_for_new_leading_promoters_starting_after(pos_1);
+    look_for_new_leading_promoters_starting_before(pos_2);
+    return;
+  }
+  int8_t dist; // Hamming distance of the sequence from the promoter consensus
+
+  for (int32_t i = pos_1; i < pos_2; i++) {
+    if (is_promoter(LEADING, i,
+                    dist)) // dist takes the hamming distance of the sequence from the consensus
+    {
+      //~ char tmp[255];
+      //~ memcpy(tmp, &dna_->data()[i], PROM_SIZE * sizeof(char));
+      //~ printf("new promoter found on the LEADING strand at position %"PRId32" : %s\n", i, tmp);
+
+      // Look for the right place to insert the new promoter in the list
+      auto& strand = rna_list_[LEADING];
+      auto first = find_if(strand.begin(),
+                           strand.end(),
+                           [i](Rna& r) { return r.promoter_pos() >= i; });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#else
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#endif
+      }
+    }
+  }
+}
+
+
+/*!
+  \brief Look for new promoters on the LAGGING strand whose starting positions would lie in [pos_1 ; pos_2[
+
+  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
+  \verbatim
+     -------------------------------
+    |   |   | X | X | X | X |   |   |
+     -------------------------------
+                        ^
+                       pos
+  \endverbatim
+*/
+void GeneticUnit::look_for_new_lagging_promoters_starting_between(int32_t pos_1,
+                                                                  int32_t pos_2) {
+  assert(pos_1 >= 0 && pos_1 < dna_->length() && pos_2 >= 0 &&
+         pos_2 < dna_->length());
+
+  // When pos_1 > pos_2, we will perform the search in 2 steps.
+  // As positions  0 and dna_->length() are equivalent, it's preferable to
+  // keep 0 for pos_1 and dna_->length() for pos_2.
+
+  if (pos_1 >= pos_2) {
+    look_for_new_lagging_promoters_starting_after(pos_1);
+    look_for_new_lagging_promoters_starting_before(pos_2);
+    return;
+  }
+
+  int8_t dist; // Hamming distance of the sequence from the promoter consensus
+  for (int32_t i = pos_2 - 1; i >= pos_1; i--) {
+    if (is_promoter(LAGGING, i,
+                    dist)) // dist takes the hamming distance of the sequence from the consensus
+    {
+      assert (i >= 0 && i < dna_->length());
+
+      // Look for the right place to insert the new promoter in the list
+      auto& strand = rna_list_[LAGGING];
+      auto first = find_if(strand.begin(),
+                           strand.end(),
+                           [i](Rna& r) { return r.promoter_pos() <= i; });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#else
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#endif // __REGUL
+      }
+    }
+  }
+}
+
+
+/// Look for new promoters on the LEADING strand whose starting positions would be >= pos
+void GeneticUnit::look_for_new_leading_promoters_starting_after(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  // Hamming distance of the sequence from the promoter consensus
+  int8_t dist;
+
+  // rna list node used to find the new promoter's place in the list
+
+  for (int32_t i = pos; i < dna_->length(); i++) {
+    if (is_promoter(LEADING, i,
+                    dist)) { // dist takes the hamming distance of the sequence from the consensus
+      // Look for the right place to insert the new promoter in the list
+      auto& strand = rna_list_[LEADING];
+      auto first = find_if(strand.begin(),
+                           strand.end(),
+                           [i](Rna& r) {
+                             return r.promoter_pos() >= i;
+                           });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#else
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#endif
+      }
+    }
+  }
+}
+
+
+/// Look for new promoters on the LAGGING strand whose starting
+/// positions would be >= pos
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::look_for_new_lagging_promoters_starting_after(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  // Hamming distance of the sequence from the promoter consensus
+  int8_t dist;
+  auto& strand = rna_list_[LAGGING];
+  auto first = strand.begin();
+
+  for (int32_t i = dna_->length() - 1; i >= pos; i--) {
+    if (is_promoter(LAGGING, i,
+                    dist)) // dist takes the hamming distance of the sequence from the consensus
+    {
+      assert (i >= 0 && i < dna_->length());
+      // Look for the right place to insert the new promoter in the list
+      first = find_if(first,
+                      strand.end(),
+                      [i](Rna& r) { return r.promoter_pos() <= i; });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#else
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#endif
+      }
+    }
+  }
+}
+
+
+/// Look for new promoters on the LEADING strand whose starting
+/// positions would be < pos
+void GeneticUnit::look_for_new_leading_promoters_starting_before(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  // Hamming distance of the sequence from the promoter consensus
+  int8_t dist;
+
+  auto& strand = rna_list_[LEADING];
+  auto first = strand.begin(); // TODO vld: should it not be reset at each loop step?
+
+  for (int32_t i = 0; i < pos; i++) {
+    if (is_promoter(LEADING, i,
+                    dist)) // dist takes the hamming distance of the sequence from the consensus
+    {
+      // Look for the right place to insert the new promoter in the list
+      first = find_if(first,
+                      strand.end(),
+                      [i](Rna& r) { return r.promoter_pos() >= i; });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#else
+        rna_list_[LEADING].emplace(first, this, LEADING, i, dist);
+#endif
+      }
+    }
+  }
+}
+
+
+/// Look for new promoters on the LAGGING strand whose starting positions would be < pos
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::look_for_new_lagging_promoters_starting_before(int32_t pos) {
+  assert(pos >= 0 && pos < dna_->length());
+
+  // Hamming distance of the sequence from the promoter consensus
+  int8_t dist;
+
+  // rna list node used to find the new promoter's place in the list
+  auto& strand = rna_list_[LAGGING];
+  auto first = strand.begin();
+
+  for (int32_t i = pos - 1; i >= 0; i--) {
+    if (is_promoter(LAGGING, i,
+                    dist)) // dist takes the hamming distance of the sequence from the consensus
+    {
+      assert (i >= 0 && i < dna_->length());
+      // Look for the right place to insert the new promoter in the list
+      first = find_if(first,
+                      strand.end(),
+                      [i](Rna& r) {
+                        return r.promoter_pos() <= i;
+                      });
+      if (first == strand.end() or first->promoter_pos() != i) {
+#ifndef __REGUL
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#else
+        rna_list_[LAGGING].emplace(first, this, LAGGING, i, dist);
+#endif
+      }
+    }
+  }
+}
+
+
+/// Shift (by delta_post) the positions of the promoters from the
+/// LEADING strand whose starting positions are >= pos.
+void GeneticUnit::move_all_leading_promoters_after(int32_t pos,
+                                                   int32_t delta_pos) {
+  auto& strand = rna_list_[LEADING];
+  for (auto rna = find_if(strand.begin(), strand.end(), [pos](Rna& r) {
+    return r.promoter_pos() >= pos;
+  });
+       rna != strand.end();
+       ++rna)
+    rna->shift_position(delta_pos, dna_->length());
+}
+
+
+/// Shift (by delta_post) the positions of the promoters from the
+/// LAGGING strand whose starting positions are >= pos.
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::move_all_lagging_promoters_after(int32_t pos,
+                                                   int32_t delta_pos) {
+  auto& strand = rna_list_[LAGGING];
+  // Update RNAs until we pass pos (or we reach the end of the list)
+  for (auto rna = strand.begin();
+       rna != strand.end() and rna->promoter_pos() >= pos;
+       ++rna)
+    rna->shift_position(delta_pos, dna_->length());
+}
+
+/// Copy (into new_promoter_list) the promoters from the LEADING
+/// strand whose starting positions lie in [pos_1 ; pos_2[
+  void GeneticUnit::copy_leading_promoters_starting_between(int32_t pos_1,
+                                                            int32_t pos_2,
+                                                            Promoters1Strand& new_promoter_list ) {
+    // 1) Go to first RNA to copy
+    auto& strand = rna_list_[LEADING];
+    const auto& first = find_if(strand.begin(),
+                                strand.end(),
+                                [pos_1](Rna & r) { return r.promoter_pos() >= pos_1; });
+
+    // 2) Copy RNAs
+    if ( pos_1 < pos_2 ) {
+      // Copy from pos_1 to pos_2
+      for (auto rna = first; rna != strand.end() and rna->promoter_pos() < pos_2; ++rna) {
+        #ifndef __REGUL
+        new_promoter_list.emplace_back(this, *rna);
+        #else
+        Rna_R rna_r(this, *rna);
+        new_promoter_list.push_back(rna_r);
+        #endif
+      }
+    }
+    else {
+      // Copy from pos_1 to the end of the list
+      for (auto rna = first; rna != strand.end(); ++rna) {
+        #ifndef __REGUL
+        new_promoter_list.emplace_back(this, *rna);
+        #else
+        Rna_R rna_r(this, *rna);
+        new_promoter_list.push_back(rna_r);
+        #endif
+      }
+
+      // Copy from the beginning of the list to pos_2
+      for (auto& rna: strand) {
+        if (rna.promoter_pos() >= pos_2)
+          break;
+        #ifndef __REGUL
+        new_promoter_list.emplace_back(this, rna);
+        #else
+        Rna_R rna_r(this, rna);
+        new_promoter_list.push_back(rna_r);
+        #endif
+      }
+
+    }
+}
+
+
+/// Copy (into new_promoter_list) the promoters from the LAGGING
+/// strand whose starting positions lie in [pos_1 ; pos_2[
+///
+/// NOTE : A lagging promoter whose starting position is pos spans
+/// [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
+///
+/// Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting
+/// position is pos spans the cells filled with X on the following
+/// cartoon:
+/// \verbatim
+///    -------------------------------
+///   |   |   | X | X | X | X |   |   |
+///    -------------------------------
+///                       ^
+///                      pos
+/// \endverbatim
+void GeneticUnit::copy_lagging_promoters_starting_between(int32_t pos_1,
+                                                          int32_t pos_2,
+                                                          Promoters1Strand& new_promoter_list) {
+  // Go to first RNA to copy
+  auto& strand = rna_list_[LAGGING];
+  const auto& first = find_if(strand.rbegin(),
+                              strand.rend(),
+                              [pos_1](Rna& r) {
+                                return r.promoter_pos() >= pos_1;
+                              });
+
+  // Copy RNAs
+  if (pos_1 < pos_2) {
+    // Copy from pos_1 to pos_2
+    for (auto rna = first;
+         rna != strand.rend() and rna->promoter_pos() < pos_2; ++rna)
+      new_promoter_list.emplace_front(this, *rna);
+  }
+  else {
+    // Copy from pos_1 to the beginning of the list (we are going backwards)
+    for (auto rna = first; rna != strand.rend(); ++rna)
+      new_promoter_list.emplace_front(this, *rna);
+
+    // Copy from the end of the list to pos_2 (we are going backwards)
+    for (auto rna = strand.rbegin();
+         rna != strand.rend() and rna->promoter_pos() < pos_2; ++rna)
+      new_promoter_list.emplace_front(this, *rna);
+  }
+}
+
+void GeneticUnit::save(gzFile backup_file) const {
+  dna_->save(backup_file);
+  gzwrite(backup_file, &min_gu_length_, sizeof(min_gu_length_));
+  gzwrite(backup_file, &max_gu_length_, sizeof(max_gu_length_));
+}
+
+int32_t GeneticUnit::nb_terminators() {
+  int32_t nb_term = 0;
+  if (dna_->length() >= TERM_SIZE) {
+    for (int32_t i = 0; i < dna_->length(); i++)
+      if (is_terminator(LEADING, i)) {  // No need to count on both the
+        // LEADING and the LAGGING
+        // strand as terminators are
+        // "shared"
+        nb_term++;
+      }
+  }
+  return nb_term;
+}
+
+#ifdef DEBUG
+
+/// Compare current rna_list_ with locate_promoters-generated rna_list_
+void GeneticUnit::assert_promoters() {
+  // Check that the lists are ordered correctly
+  assert_promoters_order();
+
+  // Make a backup of the genetic unit's lists of RNAs
+  auto backup = rna_list_;
+  rna_list_ = {{},
+               {}};
+  locate_promoters(); // regenerate rna_list_
+
+  // Compare lists
+  for (auto strand: {LEADING, LAGGING}) {
+    if (backup[strand].size() != rna_list_[strand].size()) {
+      printf("Individual %" PRId32 "\n", indiv_->id());
+      printf("***************** FOUND *******************");
+      print_rnas(backup[strand], strand);
+      printf("***************** EXPECTED *******************");
+      print_rnas(rna_list_[strand], strand);
+      printf("******************************************");
+      assert(false);
+    }
+
+    auto node_old = backup[strand].begin();
+    auto node_new = node_old; // just for the type
+    for (node_old = backup[strand].begin(), node_new = rna_list_[strand].begin();
+         node_old !=
+         backup[strand].end(); // rna_list_ is the same size as backup
+         ++node_old, ++node_new) {
+      // TODO vld: to factor
+      if (node_old->strand() != node_new->strand()) {
+        printf("Individual %" PRId32 "\n", indiv_->id());
+        printf(
+            "****************************** STRAND problem ******************************\n");
+        printf("should be : \n");
+        print_rnas(rna_list_);
+        printf("is : \n");
+        print_rnas(backup);
+        printf(
+            "****************************************************************************\n");
+        printf("  %" PRId32 " (%s) : %f    vs    %" PRId32 " (%s) : %f\n",
+               node_old->promoter_pos(), StrandName[strand],
+               node_old->basal_level(),
+               node_new->promoter_pos(), StrandName[strand],
+               node_new->basal_level());
+        printf("  genome length : %" PRId32 "\n", dna_->length());
+        assert(node_old->strand() == node_new->strand());
+      }
+
+      if (node_old->promoter_pos() != node_new->promoter_pos()) {
+        printf("Individual %" PRId32 "\n", indiv_->id());
+        printf(
+            "***************************** POSITION problem *****************************\n");
+        printf("should be : \n");
+        print_rnas(rna_list_);
+        printf("is : \n");
+        print_rnas(backup);
+        printf(
+            "****************************************************************************\n");
+        printf("  %" PRId32 " (%s) : %f    vs    %" PRId32 " (%s) : %f\n",
+               node_old->promoter_pos(), StrandName[strand],
+               node_old->basal_level(),
+               node_new->promoter_pos(), StrandName[strand],
+               node_new->basal_level());
+        printf("  genome length : %" PRId32 "\n", dna_->length());
+        assert(node_old->promoter_pos() == node_new->promoter_pos());
+      }
+
+      if (node_old->basal_level() != node_new->basal_level()) {
+        printf("Individual %" PRId32 "\n", indiv_->id());
+        printf(
+            "*************************** BASAL LEVEL problem ****************************\n");
+        printf("should be : \n");
+        print_rnas(rna_list_);
+        printf("is : \n");
+        print_rnas(backup);
+        printf(
+            "****************************************************************************\n");
+        printf("  %" PRId32 " (%s) : %f    vs    %" PRId32 " (%s) : %f\n",
+               node_old->promoter_pos(), StrandName[strand],
+               node_old->basal_level(),
+               node_new->promoter_pos(), StrandName[strand],
+               node_new->basal_level());
+        printf("  genome length : %" PRId32 "\n", dna_->length());
+        assert(node_old->basal_level() == node_new->basal_level());
+      }
+    }
+  }
+
+  rna_list_[LEADING].clear();
+  rna_list_[LAGGING].clear();
+  rna_list_ = backup;
+}
+
+void GeneticUnit::assert_promoters_order() {
+  for (auto strand: {LEADING, LAGGING}) {
+    if (rna_list_[strand].size() < 2) {
+      continue;
+    }
+
+    for (auto it = rna_list_[strand].begin();
+         next(it) != rna_list_[strand].end(); ++it) {
+      if ((strand == LEADING and
+           it->promoter_pos() >= next(it)->promoter_pos()) or
+          (strand == LAGGING and
+           it->promoter_pos() <= next(it)->promoter_pos())) {
+        printf("Individual %" PRId32 "\n", indiv_->id());
+        printf(
+            "********************** ORDER problem (%s) ***********************\n",
+            StrandName[strand]);
+        print_rnas();
+        printf(
+            "****************************************************************************\n");
+        assert(false);
+      }
+    }
+  }
+}
+
+#endif
+
+/// Retrieve for each base if it belongs or not to coding RNA.
+///
+/// \return Boolean table of sequence length size with for each base if it belongs or not to coding RNA
+bool* GeneticUnit::is_belonging_to_coding_RNA() {
+  int32_t genome_length = dna_->length();
+  bool* belongs_to_coding_RNA = new bool[genome_length];
+  memset(belongs_to_coding_RNA, 0, genome_length);
+
+  // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs)
+  for (int8_t strand = LEADING; strand <= LAGGING; strand++) {
+    for (auto& rna: rna_list_[strand]) {
+      int32_t first;
+      int32_t last;
+
+      if (strand == LEADING) {
+        first = rna.promoter_pos();
+        last = rna.last_transcribed_pos();
+      }
+      else // (strand == LAGGING)
+      {
+        last = rna.promoter_pos();
+        first = rna.last_transcribed_pos();
+      }
+
+      if (not rna.transcribed_proteins().empty()) // coding RNA
+      {
+        if (first <= last) {
+          for (int32_t i = first; i <= last; i++) {
+            belongs_to_coding_RNA[i] = true;
+          }
+        }
+        else {
+          for (int32_t i = first; i < genome_length; i++) {
+            belongs_to_coding_RNA[i] = true;
+          }
+          for (int32_t i = 0; i <= last; i++) {
+            belongs_to_coding_RNA[i] = true;
+          }
+        }
+      }
+    }
+  }
+  return belongs_to_coding_RNA;
+}
+
+/**
+ * Remove the bases that are not in coding RNA
+ *
+ * Remove the bases that are not in coding RNA and test at each loss that fitness is not changed
+ */
+void GeneticUnit::remove_non_coding_bases() {
+  // TODO <david.parsons at inria.fr> Restore method (deal with checking that the fitness remains untouched)
+//  Environment* env = exp_m_->env() ;
+//
+//  reset_expression();
+//  locate_promoters();
+//  distance_to_target_computed_        = false;
+//  fitness_computed_                   = false;
+//  compute_phenotypic_contribution();
+//  if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//  {
+//    compute_distance_to_target(env);
+//  }
+//  compute_fitness(env);
+//  double initial_fitness = fitness();
+//
+//  int32_t genome_length = dna_->length();
+//  bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA();
+//
+//  int32_t non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//  int32_t start = 0;
+//  int32_t end = 0;
+//
+//
+//  for (int32_t i = genome_length-1 ; i >= 0 ; i--)
+//  {
+//    if (belongs_to_coding_RNA[i] == false)
+//    {
+//      end = i+1;
+//      while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false)
+//      {
+//        i--;
+//      }
+//      start = i;
+//      dna_->remove(start,end);
+//
+//      locate_promoters();
+//      reset_expression();
+//      distance_to_target_computed_        = false;
+//      fitness_computed_                   = false;
+//      compute_phenotypic_contribution();
+//      if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//      {
+//        compute_distance_to_target(env);
+//      }
+//      compute_fitness(env);
+//      assert(fitness()==initial_fitness);
+//
+//      non_coding_computed_ = false;
+//      non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//    }
+//  }
+//
+//  locate_promoters();
+//  reset_expression();
+//  distance_to_target_computed_        = false;
+//  fitness_computed_                   = false;
+//  compute_phenotypic_contribution();
+//  if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//  {
+//    compute_distance_to_target(env);
+//  }
+//  compute_fitness(env);
+//  assert(fitness()==initial_fitness);
+//
+//  non_coding_computed_ = false;
+//  non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//  assert(non_coding_bases_nb==0);
+//
+//  delete [] belongs_to_coding_RNA;
+}
+
+/**
+ * Double the bases that are not in coding RNA
+ *
+ * Double the bases that are not in coding RNA by addition of random bases and test at each addition that fitness is not changed
+ */
+void GeneticUnit::double_non_coding_bases() {
+  // TODO <david.parsons at inria.fr> Restore method (deal with checking that the fitness remains untouched)
+//  Environment* env = exp_m_->env() ;
+//
+//  reset_expression();
+//  locate_promoters();
+//  distance_to_target_computed_        = false;
+//  fitness_computed_                   = false;
+//  compute_phenotypic_contribution();
+//  if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//  {
+//    compute_distance_to_target(env);
+//  }
+//  compute_fitness(env);
+//  double initial_fitness = fitness();
+//
+//  int32_t genome_length = dna_->length();
+//  bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA();
+//
+//  non_coding_computed_ = false;
+//  int32_t inital_non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//  int32_t start = 0;
+//  int32_t end = 0;
+//  int32_t length = 0;
+//  int32_t pos = 0;
+//  char * random_portion = NULL;
+//  bool insertion_ok = false;
+//  int32_t non_coding_bases_nb_before_fitness = nb_bases_in_0_coding_RNA();
+//  int32_t non_coding_bases_nb_after_fitness = nb_bases_in_0_coding_RNA();
+//
+//  int32_t non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//
+//  for (int32_t i = genome_length-1 ; i >= 0 ; i--)
+//  {
+//    if (belongs_to_coding_RNA[i] == false)
+//    {
+//      end = i+1;
+//      while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false)
+//      {
+//        i--;
+//      }
+//      start = i;
+//      length = end-start;
+//
+//      insertion_ok = false;
+//      while(not insertion_ok)
+//      {
+//        random_portion = new char [length+1];
+//        for (int32_t j = 0 ; j < length ; j++)
+//        {
+//          random_portion[j] = '0' + indiv_->mut_prng()->random(NB_BASE);
+//        }
+//        random_portion[length] = 0;
+//        pos = indiv_->mut_prng()->random(length)+start;
+//        dna_->insert(pos, random_portion);
+//
+//        non_coding_computed_ = false;
+//        non_coding_bases_nb_before_fitness = nb_bases_in_0_coding_RNA();
+//
+//        locate_promoters();
+//        reset_expression();
+//        distance_to_target_computed_        = false;
+//        fitness_computed_                   = false;
+//        compute_phenotypic_contribution();
+//        if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//        {
+//          compute_distance_to_target(env);
+//        }
+//        compute_fitness(env);
+//        assert(fitness()==initial_fitness);
+//
+//        non_coding_computed_ = false;
+//        non_coding_bases_nb_after_fitness = nb_bases_in_0_coding_RNA();
+//
+//        if (non_coding_bases_nb_before_fitness != non_coding_bases_nb_after_fitness)
+//        {
+//          dna_->remove(pos, pos + length);
+//        }
+//        else
+//        {
+//          insertion_ok = true;
+//        }
+//
+//      }
+//      non_coding_computed_ = false;
+//
+//      delete [] random_portion;
+//      random_portion = NULL;
+//    }
+//  }
+//
+//  locate_promoters();
+//  reset_expression();
+//  distance_to_target_computed_        = false;
+//  fitness_computed_                   = false;
+//  compute_phenotypic_contribution();
+//  if(exp_m_->output_m()->compute_phen_contrib_by_GU())
+//  {
+//    compute_distance_to_target(env);
+//  }
+//  compute_fitness(env);
+//  assert(fitness()==initial_fitness);
+//
+//  non_coding_computed_ = false;
+//  non_coding_bases_nb = nb_bases_in_0_coding_RNA();
+//  assert(non_coding_bases_nb == 2*inital_non_coding_bases_nb);
+//
+//  delete [] belongs_to_coding_RNA;
+}
+
+
+// This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes.
+// The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be:
+//  - the beginning of the promoter if the gene is on the leading strand
+//  - or the end of the terminator if the gene is on the lagging strand.
+static bool breakpoint_inside_gene(int32_t pos_brkpt, int32_t first,
+                                   int32_t last) {
+  if (first < last) // most frequent case
+  {
+    if ((first <= pos_brkpt) && (pos_brkpt <= last)) { return true; }
+    else { return false; }
+  }
+  else // special case where the RNA overlaps ori
+  {
+    if ((first <= pos_brkpt) || (pos_brkpt <= last)) { return true; }
+    else { return false; }
+  }
+}
+
+
+// This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes.
+// It return true if the gene is totally included in the segment [pos1, pos2].
+// The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be:
+//  - the beginning of the promoter if the gene is on the leading strand
+//  - or the end of the terminator if the gene is on the lagging strand.
+static bool gene_totally_in_segment(int32_t pos1, int32_t pos2, int32_t first,
+                                    int32_t last) {
+  if ((first < last) && (pos1 <= pos2)) {
+    if (((first >= pos1) && (first <= pos2)) &&
+        ((last >= pos1) && (last <= pos2))) { return true; }
+    else { return false; }
+  }
+  else if ((first < last) &&
+           (pos1 > pos2))  // mut seg in 2 pieces but not the gene
+  {
+    if ((first >= pos1) || (last <=
+                            pos2))  // the gene is either completely in [pos1, genlen-1] or completely in [0, pos2]
+    {
+      return true;
+    }
+    else { return false; }
+  }
+  else if ((first > last) && (pos1 <=
+                              pos2))  // gene in two pieces but not mut seg, the gene cannot be totally included
+  {
+    return false;
+  }
+  else // both mut seg and the gene are in 2 pieces
+  {
+    if ((first >= pos1) && (last <= pos2)) { return true; }
+    else { return false; }
+  }
+}
+
+
+// WARNING: This method works properly only in the case of a single genetic unit (no plasmid).
+// Translocations between different genetic units is not managed.
+void GeneticUnit::compute_nb_of_affected_genes(const Mutation* mut,
+                                               int& nb_genes_at_breakpoints,
+                                               int& nb_genes_in_segment,
+                                               int& nb_genes_in_replaced_segment) {
+  nb_genes_at_breakpoints = 0;
+  nb_genes_in_segment = 0;
+  nb_genes_in_replaced_segment = 0;
+  int32_t genlen = seq_length(); // length of the genetic unit, in bp
+
+  int32_t pos0 = -1, pos1 = -1, pos2 = -1, pos3 = -1, mutlength = -1;
+  int32_t pos3donor = -1;
+  char* seq = NULL;
+  int32_t first, last;
+  MutationType type = mut->mut_type();
+  switch (type) {
+    case SWITCH:
+      pos0 = dynamic_cast<const PointMutation*>(mut)->pos();
+      mutlength = 1;
+      break;
+    case S_INS : {
+      const auto* s_ins = dynamic_cast<const SmallInsertion*>(mut);
+      pos0 = s_ins->pos();
+      mutlength = s_ins->length();
+      break;
+    }
+    case S_DEL : {
+      const auto* s_del = dynamic_cast<const SmallDeletion*>(mut);
+      pos0 = s_del->pos();
+      mutlength = s_del->length();
+      break;
+    }
+    case DUPL : {
+      const auto& dupl = dynamic_cast<const Duplication*>(mut);
+      pos1 = dupl->pos1();
+      pos2 = Utils::mod(dupl->pos2() - 1, genlen);
+      pos0 = dupl->pos3();
+      mutlength = dupl->length();
+    }
+    case DEL : {
+      const auto& del = dynamic_cast<const Deletion*>(mut);
+      pos1 = del->pos1();
+      pos2 = Utils::mod(del->pos2() - 1, genlen);
+      mutlength = del->length();
+      break;
+    }
+    case TRANS : {
+      const auto& trans = dynamic_cast<const Translocation*>(mut);
+      pos1 = trans->pos1();
+      pos2 = Utils::mod(trans->pos2() - 1, genlen);
+      pos3 = trans->pos3();
+      pos0 = trans->pos4();
+      mutlength = trans->length();
+      break;
+    }
+    case INV : {
+      const auto& inv = dynamic_cast<const Inversion*>(mut);
+      pos1 = inv->pos1();
+      pos2 = Utils::mod(inv->pos2() - 1, genlen);
+      mutlength = inv->length();
+      break;
+    }
+    case INS_HT: {
+      const auto& ins_ht = dynamic_cast<const InsertionHT*>(mut);
+      pos0 = ins_ht->exogenote_pos();// TODO <david.parsons at inria.fr> weird !
+      pos3donor = ins_ht->receiver_pos();// TODO <david.parsons at inria.fr> weird !
+      mutlength = ins_ht->length();
+      seq = ins_ht->seq();
+
+      // Make a temporary genetic unit and translate it to count how many genes were on the exogenote
+      GeneticUnit* tmpunit = new GeneticUnit(indiv_, seq, mutlength);
+      tmpunit->do_transcription();
+      tmpunit->do_translation();
+      nb_genes_in_segment = tmpunit->nb_coding_RNAs();
+
+      // Check whether the pos3donor breakpoint killed one or several of those genes, in that case decrement nb_genes_in_segment
+      for (auto& strand: tmpunit->rna_list_)
+        for (auto& rna: strand) {
+          if (not rna.is_coding()) {
+            continue;
+          }
+          first = rna.promoter_pos();
+          last = rna.last_transcribed_pos();
+          if (breakpoint_inside_gene(pos3donor, first, last)) {
+            nb_genes_in_segment--;
+          }
+        }
+
+      delete tmpunit;
+      seq = NULL;
+      break;
+    }
+    case REPL_HT: {
+      const auto& repl_ht = dynamic_cast<const ReplacementHT*>(mut);
+      pos1 = repl_ht->receiver_pos1();
+      pos2 = Utils::mod(repl_ht->receiver_pos2() - 1, genlen);
+      mutlength = repl_ht->length();
+      seq = repl_ht->seq();
+
+      // Make a temporary genetic unit and translate it to count how many genes were on the donor segment
+      GeneticUnit* tmpunit = new GeneticUnit(indiv_, seq, mutlength);
+      tmpunit->do_transcription();
+      tmpunit->do_translation();
+      nb_genes_in_segment = tmpunit->nb_coding_RNAs();
+
+      // Remove the genes that overlap ori in this temporary unit, as the transferred segment was actually linear
+      for (auto& strand: tmpunit->rna_list_)
+        for (auto& rna: strand) {
+          if (not rna.is_coding()) {
+            continue;
+          }
+          first = rna.promoter_pos();
+          last = rna.last_transcribed_pos();
+          if (first > last) {
+            nb_genes_in_segment--;
+          }
+        }
+
+      delete tmpunit;
+      seq = NULL;
+      break;
+    }
+    default:
+      fprintf(stderr,
+              "Error: unknown mutation type in ae_genetic_unit::compute_nb_of_affected_genes.\n");
+  }
+
+  for (auto strand: {LEADING, LAGGING})
+    for (auto& rna: rna_list_[strand]) {
+      if (rna.is_coding() == false) continue;
+
+      switch (strand) {
+        case LEADING:
+          first = rna.promoter_pos();
+          last = rna.last_transcribed_pos();
+          break;
+        case LAGGING:
+          first = rna.last_transcribed_pos();
+          last = rna.promoter_pos();
+      };
+
+      // TODO vld: reoder lines (if invariant) in cases DUPL and
+      // DEL/INV and merge with S_DEL thanks to fallthrough (etc)
+      switch (type) {
+        case SWITCH: // fall through
+        case S_INS:  // fall through
+        case INSERT: // fall through
+        case INS_HT: // fall through
+        case S_DEL:
+          if (breakpoint_inside_gene(pos0, first, last)) {
+            nb_genes_at_breakpoints++;
+          }
+          break;
+        case DUPL:
+          if (gene_totally_in_segment(pos1, pos2, first,
+                                      last)) {
+                                        nb_genes_in_segment++;
+          }
+          if (breakpoint_inside_gene(pos0, first, last)) {
+            nb_genes_at_breakpoints++;
+          }
+          break;
+        case DEL:
+        case INV:
+          if (gene_totally_in_segment(pos1, pos2, first,
+                                      last)) {
+                                        nb_genes_in_segment++;
+          }
+          if (breakpoint_inside_gene(pos1, first, last)) {
+            nb_genes_at_breakpoints++;
+          }
+          else if (breakpoint_inside_gene(pos2, first,
+                                          last)) {
+                                            nb_genes_at_breakpoints++;
+          }     // else because the gene must not be counted twice if both p1 and p2 are in the same gene
+          break;
+        case TRANS:
+          if (gene_totally_in_segment(pos1, pos2, first,
+                                      last))
+            nb_genes_in_segment++;
+          if (breakpoint_inside_gene(pos1, first, last))
+            nb_genes_at_breakpoints++;   // beginning of the excised segment
+          else if (breakpoint_inside_gene(pos2, first,
+                                          last))
+            nb_genes_at_breakpoints++;   // end of the excised segment
+          else if (breakpoint_inside_gene(pos3, first,
+                                          last))
+            nb_genes_at_breakpoints++;   // breakpoint inside the segment for the reinsertion
+          else if (breakpoint_inside_gene(pos0, first,
+                                          last))
+            nb_genes_at_breakpoints++;   // reinsertion point in the genetic unit
+          break;
+        case REPL_HT:
+          if (gene_totally_in_segment(pos1, pos2, first,
+                                      last))
+            nb_genes_in_replaced_segment++; // the whole gene sequence was replaced by the donor DNA
+          if (breakpoint_inside_gene(pos1, first, last))
+            nb_genes_at_breakpoints++;  // the gene was disrupted by the breakpoint p1
+          else if (breakpoint_inside_gene(pos2, first,
+                                          last))
+            nb_genes_at_breakpoints++;  // the gene was disrupted by the breakpoint p2
+          break;
+        default:
+          // Only simple mutation types are considered.
+          break;
+      }
+    }
+
+  //  if (type == REPL_HT) printf("%d genes in the replaced segment, %d in the donor\n", nb_genes_in_replaced_segment, nb_genes_in_segment);
+
+  if (seq != NULL) delete[] seq;
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void GeneticUnit::init_statistical_data(
+    void) // TODO : integrate into compute_statistical_data
+{
+  //~ nb_promoters_[LEADING]        = 0;
+  //~ nb_promoters_[LAGGING]        = 0;
+  //~ nb_genes_[LEADING]            = 0;
+  //~ nb_genes_[LAGGING]            = 0;
+  //~ average_gene_size_            = 0;
+  //~ average_functional_gene_size_ = 0;
+  //~ nb_coding_bp_                 = 0;
+  //~ clustering_                   = 0;
+
+  nb_coding_RNAs_ = 0;
+  nb_non_coding_RNAs_ = 0;
+  overall_size_coding_RNAs_ = 0;
+  overall_size_non_coding_RNAs_ = 0;
+  nb_genes_activ_ = 0;
+  nb_genes_inhib_ = 0;
+  nb_fun_genes_ = 0;
+  nb_non_fun_genes_ = 0;
+  overall_size_fun_genes_ = 0;
+  overall_size_non_fun_genes_ = 0;
+
+  nb_bases_in_0_CDS_ = -1;
+  nb_bases_in_0_functional_CDS_ = -1;
+  nb_bases_in_0_non_functional_CDS_ = -1;
+  nb_bases_in_0_RNA_ = -1;
+  nb_bases_in_0_coding_RNA_ = -1;
+  nb_bases_in_0_non_coding_RNA_ = -1;
+  nb_bases_non_essential_ = -1;
+  nb_bases_non_essential_including_nf_genes_ = -1;
+
+  modularity_ = -1;
+
+  beginning_neutral_regions_ = NULL;
+  end_neutral_regions_ = NULL;
+}
+
+void GeneticUnit::clear_transcribed_proteins() {
+  for (auto strand: {LEADING, LAGGING}) {
+    for (auto& rna: rna_list_[strand])
+      rna.clear_transcribed_proteins();
+    protein_list_[strand].clear();
+  }
+}
+} // namespace aevol
diff --git a/src/libaevol/GeneticUnit.h b/src/libaevol/GeneticUnit.h
new file mode 100644
index 0000000..6f970ad
--- /dev/null
+++ b/src/libaevol/GeneticUnit.h
@@ -0,0 +1,563 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_GENETIC_UNIT_H_
+#define AEVOL_GENETIC_UNIT_H_
+
+#include <cinttypes>
+#include <cstdio>
+#include <memory>
+#include <array>
+
+#include "Dna.h"
+#include "Rna.h"
+#include "Protein.h"
+#include "AbstractFuzzy.h"
+#include "FuzzyFactory.h"
+#include "JumpingMT.h"
+#include "Utils.h"
+#include "PhenotypicTarget.h"
+
+#ifdef __REGUL
+#include "raevol/Protein_R.h"
+#endif
+
+using std::vector;
+using std::list;
+
+namespace aevol {
+
+#ifndef __REGUL
+// TODO vld: check types
+using Promoters1Strand = std::list<Rna>;
+#else
+using Promoters1Strand = std::list<Rna_R>;
+#endif
+
+using Promoters2Strands = std::vector<Promoters1Strand>;
+
+class ExpManager;
+
+class GeneticUnit {
+ public :
+
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  GeneticUnit(Individual* indiv,
+              int32_t length,
+              std::shared_ptr<JumpingMT> prng);
+
+  GeneticUnit(Individual* indiv,
+              char* seq,
+              int32_t length,
+              const Promoters2Strands& prom_list = {{},
+                                                    {}});
+
+  GeneticUnit(Individual* indiv, const GeneticUnit& model);
+
+  GeneticUnit(Individual* indiv, const GeneticUnit* parent);
+
+  GeneticUnit(Individual* indiv, gzFile backup_file);
+
+  GeneticUnit(Individual* indiv, char* organism_file_name);
+
+  GeneticUnit() = delete;
+
+  GeneticUnit(const GeneticUnit&) = delete;
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~GeneticUnit();
+
+  // =================================================================
+  //                              Accessors
+  // =================================================================
+
+  ExpManager* exp_m() const;
+
+  Individual* indiv() const;
+
+  Dna* dna() const;
+
+  AbstractFuzzy* activ_contribution() const;
+
+  AbstractFuzzy* inhib_contribution() const;
+
+  AbstractFuzzy* phenotypic_contribution() const;
+
+  const Promoters2Strands& rna_list() const;
+
+  // TODO return as reference
+#ifndef __REGUL
+  std::list<Protein>& protein_list(Strand strand);
+#else
+  std::list<Protein_R>& protein_list(Strand strand);
+  #endif
+  void clear_protein_list(Strand strand);
+  void clear_transcribed_proteins();
+
+
+  // Direct DNA access
+  const char* sequence() const;
+
+  int32_t seq_length() const;
+
+  // Statistical data
+  int32_t nb_coding_RNAs() const;
+
+  int32_t nb_non_coding_RNAs() const;
+
+  double overall_size_coding_RNAs() const;
+
+  double av_size_coding_RNAs() const;
+
+  double overall_size_non_coding_RNAs() const;
+
+  double av_size_non_coding_RNAs() const;
+
+  int32_t nb_genes_activ() const;
+
+  int32_t nb_genes_inhib() const;
+
+  int32_t nb_functional_genes() const;
+
+  int32_t nb_non_functional_genes() const;
+
+  double overall_size_functional_genes() const;
+
+  double av_size_functional_genes() const;
+
+  double overall_size_non_functional_genes() const;
+
+  double av_size_non_functional_genes() const;
+
+  int32_t nb_bases_in_0_CDS() const;
+
+  int32_t nb_bases_in_0_functional_CDS() const;
+
+  int32_t nb_bases_in_0_non_functional_CDS() const;
+
+  int32_t nb_bases_in_0_RNA() const;
+
+  int32_t nb_bases_in_0_coding_RNA() const;
+
+  int32_t nb_bases_in_0_non_coding_RNA() const;
+
+  int32_t nb_bases_non_essential() const;
+
+  int32_t nb_bases_non_essential_including_nf_genes() const;
+
+  int32_t nb_bases_in_neutral_regions() const;
+
+  int32_t nb_neutral_regions() const;
+
+  int32_t* beginning_neutral_regions() const;
+
+  int32_t* end_neutral_regions() const;
+
+  double modularity() const;
+
+  double dist_to_target_by_feature(PhenotypicFeature feature) const;
+
+  double fitness() const;
+
+  double fitness_by_feature(PhenotypicFeature feature) const;
+
+  int32_t min_gu_length() const;
+
+  int32_t max_gu_length() const;
+
+  void set_min_gu_length(int32_t min_gu_length);
+
+  void set_max_gu_length(int32_t max_gu_length);
+
+  void set_exp_m(ExpManager* exp_m);
+
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void locate_promoters();
+
+  void do_transcription();
+
+  void do_translation();
+
+  void compute_phenotypic_contribution();
+
+  void take_ownership_of_all_rnas() { Dna::set_GU(rna_list(), this); };
+
+
+  // DM: these two are identical to functions from Individual
+  void compute_distance_to_target(const PhenotypicTarget& target);
+
+  void compute_fitness(const PhenotypicTarget& target);
+
+  void reset_expression(); // useful for post-treatment programs
+
+  void print_rnas() const;
+
+  void print_coding_rnas();
+
+  static void print_rnas(const Promoters2Strands& rnas);
+
+  static void print_rnas(const Promoters1Strand& rnas, Strand strand);
+
+  void print_proteins() const;
+
+  bool is_promoter(Strand strand, int32_t pos, int8_t& dist) const;
+
+  bool is_terminator(Strand strand, int32_t pos) const;
+
+  bool is_shine_dalgarno(Strand strand, int32_t pos) const;
+
+  bool is_start(Strand strand, int32_t pos) const;
+
+  bool is_stop(Strand strand, int32_t pos) const;
+
+  int8_t codon(Strand strand, int32_t pos) const;
+
+  void compute_non_coding();
+
+
+  // these functions are called once, they should likely not be public methods
+  void duplicate_promoters_included_in(int32_t pos_1,
+                                       int32_t pos_2,
+                                       Promoters2Strands& duplicated_promoters);
+
+  void promoters_included_in(int32_t pos_1,
+                                 int32_t pos_2,
+                                 Promoters2Strands& promoters_list);
+
+  void promoters(Strand strand_id,
+                     Position start,
+                     int32_t pos1,
+                     int32_t pos2,
+                     Promoters1Strand& promoters);
+
+  void invert_promoters_included_in(int32_t pos_1, int32_t pos_2);
+
+  static void invert_promoters(Promoters2Strands& promoter_lists,
+                               int32_t seq_length);
+
+  static void invert_promoters(Promoters2Strands& promoter_lists,
+                               int32_t pos_1, int32_t pos_2); // See WARNING
+
+  void extract_promoters_included_in(int32_t pos_1,
+                                     int32_t pos_2,
+                                     Promoters2Strands& extracted_promoters);
+
+  void extract_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters2Strands& extracted_promoters);
+
+  void extract_leading_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters);
+
+  void extract_lagging_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters1Strand& extracted_promoters);
+
+
+
+
+
+  // end comment
+
+  static void shift_promoters(Promoters2Strands& promoters_to_shift,
+                              int32_t delta_pos,
+                              int32_t seq_length);
+
+  void insert_promoters(Promoters2Strands& promoters_to_insert);
+
+  void insert_promoters_at(Promoters2Strands& promoters_to_insert,
+                           int32_t pos);
+
+  void remove_promoters_around(int32_t pos);
+
+  void remove_promoters_around(int32_t pos_1, int32_t pos_2);
+
+  void remove_all_promoters();
+
+  void look_for_new_promoters_around(int32_t pos);
+
+  void look_for_new_promoters_around(int32_t pos_1, int32_t pos_2);
+
+  void move_all_promoters_after(int32_t pos, int32_t delta_pos);
+
+  void move_all_leading_promoters_after(int32_t pos, int32_t delta_pos);
+
+  void move_all_lagging_promoters_after(int32_t pos, int32_t delta_pos);
+
+  void copy_promoters_included_in(
+      int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists);
+
+  void copy_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters2Strands& new_promoter_lists);
+
+  void copy_leading_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list);
+
+  void copy_lagging_promoters_starting_between(
+      int32_t pos_1, int32_t pos_2, Promoters1Strand& new_promoter_list);
+
+  void save(gzFile backup_file) const;
+
+  int32_t nb_terminators();
+
+  //~ // set the genetic unit of all promoters to the appropriate
+  //~ void reasign_promoter_genetic_unit ();
+
+  void assert_promoters();
+
+  void assert_promoters_order();
+
+  bool* is_belonging_to_coding_RNA();
+
+  void remove_non_coding_bases();
+
+  void double_non_coding_bases();
+
+  // WARNING: The method below works properly only in the case of a single
+  // genetic unit (no plasmid).
+  // Translocations between different genetic units is not managed.
+  void compute_nb_of_affected_genes(const Mutation* mut,
+                                    int& nb_genes_at_breakpoints,
+                                    int& nb_genes_in_segment,
+                                    int& nb_genes_in_replaced_segment);
+
+  // =================================================================
+  //                           Public Attributes
+  // =================================================================
+
+
+
+
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  void init_statistical_data();
+
+  void remove_leading_promoters_starting_between(int32_t pos_1, int32_t pos_2);
+
+  void remove_lagging_promoters_starting_between(int32_t pos_1, int32_t pos_2);
+
+  void remove_leading_promoters_starting_before(int32_t pos);
+
+  void remove_lagging_promoters_starting_before(int32_t pos);
+
+  void remove_leading_promoters_starting_after(int32_t pos);
+
+  void remove_lagging_promoters_starting_after(int32_t pos);
+
+  void look_for_new_leading_promoters_starting_between(int32_t pos_1,
+                                                       int32_t pos_2);
+
+  void look_for_new_lagging_promoters_starting_between(int32_t pos_1,
+                                                       int32_t pos_2);
+
+  void look_for_new_leading_promoters_starting_after(int32_t pos);
+
+  void look_for_new_lagging_promoters_starting_after(int32_t pos);
+
+  void look_for_new_leading_promoters_starting_before(int32_t pos);
+
+  void look_for_new_lagging_promoters_starting_before(int32_t pos);
+
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+
+  ExpManager* exp_m_;
+
+  Individual* indiv_;
+  Dna* dna_;
+  AbstractFuzzy* activ_contribution_;
+  AbstractFuzzy* inhib_contribution_;
+  // NB : phenotypic_contribution_ is only an indicative value,
+  // not used for the whole phenotype computation
+  AbstractFuzzy* phenotypic_contribution_;
+
+  // rna_list_ always has 2 elements: make it an std::array
+  Promoters2Strands rna_list_ = {{},
+                                 {}};
+  // protein_list_ always has 2 elements: make it an std::array
+#ifndef __REGUL
+  std::array<std::list<Protein>, 2> protein_list_; // = {{},{}};
+#else
+  std::array<std::list<Protein_R>, 2> protein_list_; // = {{},{}};
+  #endif
+
+  // DM: For plasmid work, we sometimes *need* all the data
+  // (e.g. fitness, secretion) calculated for each GU
+  double* dist_to_target_per_segment_;
+  double* dist_to_target_by_feature_;
+  double* fitness_by_feature_;
+  double fitness_;
+
+  // Statistical data (intrinsic for this genetic unit)
+  /**
+   * Number of coding RNAs (at least one gene on RNA)
+   */
+  int32_t nb_coding_RNAs_;
+
+  /**
+   * Number of non-coding-RNAs
+   */
+  int32_t nb_non_coding_RNAs_;
+
+  /**
+   * Average size of coding RNAs
+   */
+  double overall_size_coding_RNAs_;
+
+  /**
+   * Average size of non-coding RNAs
+   */
+  double overall_size_non_coding_RNAs_;
+
+  /**
+   * Number of genes realizing a function
+   */
+  int32_t nb_genes_activ_;
+
+  /**
+   * Number of genes inhibitting a function
+   */
+  int32_t nb_genes_inhib_;
+
+  /**
+   * Number of functional genes
+   */
+  int32_t nb_fun_genes_;
+
+  /**
+   * Number of non-functional genes
+   */
+  int32_t nb_non_fun_genes_;
+
+  /**
+   * Average size of functional genes
+   */
+  double overall_size_fun_genes_;
+
+  /**
+   * Average size of non-functional genes
+   */
+  double overall_size_non_fun_genes_;
+
+  /**
+   * Number of bases that are not included in any gene
+   */
+  int32_t nb_bases_in_0_CDS_;
+
+  /**
+   * Number of bases that are not included in any non-degenerated gene
+   */
+  int32_t nb_bases_in_0_functional_CDS_;
+
+  /**
+   * Number of bases that are not included in any degenerated gene
+   */
+  int32_t nb_bases_in_0_non_functional_CDS_;
+
+  /**
+   * Number of bases that are not included in any RNA
+   */
+  int32_t nb_bases_in_0_RNA_;
+
+  /**
+   * Number of bases that are not included in any coding RNA
+   * (RNAs containing at least one CDS)
+   */
+  int32_t nb_bases_in_0_coding_RNA_;
+
+  /**
+   * Number of bases that are not included in any non coding RNA
+   */
+  int32_t nb_bases_in_0_non_coding_RNA_;
+
+  /**
+   * Number of bases that are not included in any non-degenerated gene or
+   * involved in its expression
+   */
+  int32_t nb_bases_non_essential_;
+
+  /**
+   * Number of bases that are not included in any gene or involved in its
+   * expression
+   */
+  int32_t nb_bases_non_essential_including_nf_genes_;
+
+  /**
+   * Number of bases that are not included in a neutral region
+   */
+  int32_t nb_bases_in_neutral_regions_;
+
+  /**
+   * A base is considered neutral when neither itself NOR its corresponding
+   * base on the other strand belongs to a coding [promoter->terminator] region
+   */
+  /**
+   * Number of neutral regions
+   */
+  int32_t nb_neutral_regions_;
+
+  /**
+   * Beginning of neutral regions
+   */
+  int32_t* beginning_neutral_regions_;
+
+  /**
+   * Corresponding ends of neutral regions
+   */
+  int32_t* end_neutral_regions_;
+
+  /**
+   * Ratio between the pairwise distance between genes whose corresponding
+   * phenotypic triangles overlap and the average intergenic distance
+   * (ignoring non-functional genes)
+   */
+  double modularity_;
+
+  int32_t min_gu_length_;
+  int32_t max_gu_length_;
+
+  // We keep trace of what we have already computed to avoid double
+  // computation (mainly in post-treaments)
+  bool transcribed_;
+  bool translated_;
+  bool phenotypic_contributions_computed_;
+  bool non_coding_computed_;
+  bool distance_to_target_computed_;
+  bool fitness_computed_;
+};
+
+} // namespace aevol
+#endif // AEVOL_GENETIC_UNIT_H_
diff --git a/src/libaevol/GridCell.cpp b/src/libaevol/GridCell.cpp
new file mode 100644
index 0000000..e679497
--- /dev/null
+++ b/src/libaevol/GridCell.cpp
@@ -0,0 +1,162 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "GridCell.h"
+
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include <iostream>
+
+#include "Individual.h"
+
+#ifdef __X11
+#include "Individual_X11.h"
+#endif
+
+#ifdef __REGUL
+#include "raevol/Individual_R.h"
+#include "raevol/Habitat_R.h"
+#endif
+
+using std::cout;
+using std::endl;
+
+
+namespace aevol {
+
+
+
+//##############################################################################
+//                                                                             #
+//                              Class GridCell                             #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+GridCell::GridCell(int16_t x, int16_t y,
+                   std::unique_ptr<Habitat>&& habitat,
+                   Individual* indiv, std::shared_ptr<JumpingMT> mut_prng,
+                   std::shared_ptr<JumpingMT> stoch_prng)
+{
+  x_ = x;
+  y_ = y;
+
+  mut_prng_ = mut_prng;
+  stoch_prng_ = stoch_prng;
+
+  individual_ = indiv;
+  habitat_ = std::move(habitat);
+}
+
+GridCell::GridCell(gzFile backup_file,
+                   ExpManager* exp_m,
+                   PhenotypicTargetHandler* phenotypic_target_handler)
+{
+  load(backup_file, exp_m, phenotypic_target_handler);
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+GridCell::~GridCell()
+{
+  delete individual_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void GridCell::ApplyHabitatVariation() {
+  habitat_->ApplyVariation();
+}
+
+void GridCell::save(gzFile backup_file,
+                        bool skip_phenotypic_target /*=false*/) const
+{
+  gzwrite(backup_file, &x_, sizeof(x_));
+  gzwrite(backup_file, &y_, sizeof(y_));
+
+  mut_prng_->save(backup_file);
+  stoch_prng_->save(backup_file);
+
+  #ifndef __REGUL
+  habitat_->save(backup_file, skip_phenotypic_target);
+  individual_->save(backup_file);
+  #else
+  (dynamic_cast<Habitat_R*> (habitat_.get()))->save(backup_file, skip_phenotypic_target);
+  (dynamic_cast<Individual_R*> (individual_))->save(backup_file);
+  #endif
+}
+
+void GridCell::load(gzFile backup_file,
+                        ExpManager * exp_m,
+                        PhenotypicTargetHandler* phenotypic_target_handler)
+{
+  gzread(backup_file, &x_, sizeof(x_));
+  gzread(backup_file, &y_, sizeof(y_));
+
+  // Retrieve PRNGs
+  mut_prng_ = std::make_shared<JumpingMT>(backup_file);
+  stoch_prng_ = std::make_shared<JumpingMT>(backup_file);
+
+  habitat_ = HabitatFactory::create_unique_habitat(backup_file, phenotypic_target_handler);
+
+  // Create individual se charge de retourner un individual_R pour RAevol
+  individual_ = Individual::CreateIndividual(exp_m, backup_file);
+
+  individual_->set_mut_prng(mut_prng_);
+  individual_->set_stoch_prng(stoch_prng_);
+
+  individual_->set_grid_cell(this);
+}
+
+/// TODO
+std::shared_ptr<JumpingMT> GridCell::mut_prng() const {
+  return mut_prng_;
+}
+
+/// TODO
+std::shared_ptr<JumpingMT> GridCell::stoch_prng() const {
+  return stoch_prng_;
+}
+// =================================================================
+//                           Protected Methods
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/GridCell.h b/src/libaevol/GridCell.h
new file mode 100644
index 0000000..79ff6b2
--- /dev/null
+++ b/src/libaevol/GridCell.h
@@ -0,0 +1,209 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_GRID_CELL_H_
+#define AEVOL_GRID_CELL_H_
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <zlib.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Individual.h"
+#include "HabitatFactory.h"
+#ifndef __REGUL
+#include "Habitat.h"
+#else
+#include "raevol/Habitat_R.h"
+#endif
+
+namespace aevol {
+
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+
+
+
+
+
+class GridCell
+{
+ public :
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  GridCell() = delete;
+  GridCell(const GridCell &) = delete;
+  GridCell(int16_t x, int16_t y,
+               std::unique_ptr<Habitat>&& habitat,
+               Individual * indiv, std::shared_ptr<JumpingMT> mut_prng,
+              std::shared_ptr<JumpingMT> stoch_prng);
+  GridCell(gzFile backup_file,
+               ExpManager * exp_m,
+               PhenotypicTargetHandler* phenotypic_target_handler);
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~GridCell();
+
+
+  // =================================================================
+  //                        Accessors: getters
+  // =================================================================
+  inline int16_t x() const {return x_;};
+  inline int16_t y() const {return y_;};
+  inline double compound_amount() const;
+  inline Individual * individual() const;
+
+  inline double secreted_amount() const;
+  inline double metabolic_fitness() const;
+  inline double total_fitness() const;
+
+  const Habitat& habitat() const {
+    return *habitat_;
+  }
+  const PhenotypicTarget& phenotypic_target() const {
+    return habitat_->phenotypic_target();
+  }
+
+
+  std::shared_ptr<JumpingMT> mut_prng() const;
+  std::shared_ptr<JumpingMT> stoch_prng() const;
+  // =================================================================
+  //                        Accessors: setters
+  // =================================================================
+  inline void set_compound_amount(double compound_amount);
+  inline void set_individual(Individual * indiv);
+  inline void set_mut_prng(std::shared_ptr<JumpingMT> prng);
+  inline void set_stoch_prng(std::shared_ptr<JumpingMT> prng);
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void ApplyHabitatVariation();
+  void save(gzFile backup_file,
+            bool skip_phenotypic_target = false) const;
+  void load(gzFile backup_file,
+            ExpManager * exp_m,
+            PhenotypicTargetHandler* phenotypic_target_handler);
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  // Position on the grid
+  int16_t x_;
+  int16_t y_;
+
+  // Pointer to the individual in this cell
+  Individual* individual_ = NULL;
+
+  std::unique_ptr<Habitat> habitat_ = nullptr;
+
+  std::shared_ptr<JumpingMT> mut_prng_ = nullptr;
+  std::shared_ptr<JumpingMT> stoch_prng_ = nullptr;
+};
+
+
+// =====================================================================
+//                           Getters' definitions
+// =====================================================================
+inline double GridCell::compound_amount() const
+{
+  return habitat_->compound_amount();
+}
+
+inline Individual *GridCell::individual() const
+{
+  return individual_;
+}
+
+inline double GridCell::secreted_amount() const
+{
+  return individual_->fitness_by_feature(SECRETION);
+}
+
+inline double GridCell::metabolic_fitness() const
+{
+  return individual_->fitness_by_feature(METABOLISM);
+}
+
+inline double GridCell::total_fitness() const
+{
+  return individual_->fitness();
+}
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+inline void GridCell::set_compound_amount(double compound_amount)
+{
+  habitat_->set_compound_amount(compound_amount);
+}
+
+inline void GridCell::set_individual(Individual * indiv)
+{
+  individual_ = indiv;
+  if (individual_->grid_cell() != this)
+  {
+    individual_->set_grid_cell(this);
+  }
+}
+
+inline void GridCell::set_mut_prng(std::shared_ptr<JumpingMT> prng) {
+  mut_prng_ = prng;
+}
+
+inline void GridCell::set_stoch_prng(std::shared_ptr<JumpingMT> prng) {
+  stoch_prng_ = prng;
+}
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+
+} // namespace aevol
+#endif // AEVOL_GRID_CELL_H_
diff --git a/src/libaevol/GzHelpers.h b/src/libaevol/GzHelpers.h
new file mode 100644
index 0000000..b33f33e
--- /dev/null
+++ b/src/libaevol/GzHelpers.h
@@ -0,0 +1,79 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_GZHELPERS_H_
+#define AEVOL_GZHELPERS_H_
+
+#include <zlib.h>
+
+// ===========================================================================
+//                                 Public Methods
+// ===========================================================================
+enum class GzAction {READ, WRITE};
+// begin variadic template gzwrite(...)
+
+// Base case for the next template.
+// Useless by itself. Not intented to be called directly.
+void gz(GzAction action, gzFile file) {
+  return;
+}
+
+/// Read/write variables to gzip file
+/// \param `action` tells whether to read or write
+/// \param `file` an open gzip file
+/// \param `field` the field to be written
+/// \param `fields_list` the remaining fields
+/// The function is simply called like: `gz(action, file, x, y, z, t)`.
+/// Warning: as it is currently written, this template overrides any
+/// call to gzwrite, which causes writing the length of the field to the file.
+template<typename Field, typename... Args>
+void gz(GzAction action, gzFile file, Field& field, Args&&... fields_list) {
+  // This switch is unfortunate especially since the alternatives are pretty much the same.
+  // But there is a subtle difference that prevented me from a trivial factorization:
+  // gzwrite takes a _const_ void pointer as second argument.
+  switch (action) {
+    case GzAction::READ:
+      ::gzread(file, &field, sizeof(field));
+      break;
+    case GzAction::WRITE:
+      ::gzwrite(file, &field, sizeof(field));
+      break;
+  }
+  gz(action, file, fields_list...);
+}
+// end variadic template gzwrite
+
+template<typename... Args>
+void gzwrite(Args... args) {
+  gz(GzAction::WRITE, args...);
+}
+
+template<typename... Args>
+void gzread(Args&&... args) {
+  gz(GzAction::READ, args...);
+}
+
+#endif //AEVOL_GZHELPERS_H_
diff --git a/src/libaevol/ae_codon.cpp b/src/libaevol/Habitat.cpp
similarity index 51%
copy from src/libaevol/ae_codon.cpp
copy to src/libaevol/Habitat.cpp
index ea2dbf9..42c46bd 100644
--- a/src/libaevol/ae_codon.cpp
+++ b/src/libaevol/Habitat.cpp
@@ -3,124 +3,110 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
+
 
 
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
+#include "Habitat.h"
 
+#include <iostream>
 
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_codon.h>
-#include <ae_utils.h>
+using std::cout;
+using std::endl;
 
 
+namespace aevol {
 
 
 //##############################################################################
 //                                                                             #
-//                                Class ae_codon                               #
+//                                Class Habitat                                #
 //                                                                             #
 //##############################################################################
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_codon::ae_codon( void )
-{
-  _value = -1;
+// ============================================================================
+//                                Constructors
+// ============================================================================
+Habitat::Habitat() {
+  compound_amount_ = 0.0;
+  phenotypic_target_handler_ = new PhenotypicTargetHandler();
 }
 
-ae_codon::ae_codon( const ae_codon &model )
-{
-  _value = model._value;
+Habitat::Habitat(const Habitat& rhs, bool share_phenotypic_target) {
+  assert(share_phenotypic_target);
+  compound_amount_ = rhs.compound_amount_;
+  phenotypic_target_handler_ = rhs.phenotypic_target_handler_;
 }
 
-ae_codon::ae_codon( int8_t value )
-{
-  _value = value;
+Habitat::Habitat(gzFile backup_file,
+                 PhenotypicTargetHandler* phenotypic_target_handler) {
+  load(backup_file, phenotypic_target_handler);
 }
 
-ae_codon::ae_codon( ae_dna* dna, ae_strand strand, int32_t index )
-{
-  const char* gen = dna->get_data();
-  int32_t     len = dna->get_length();
-
-  _value = 0;
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index+i),len)] == '1' )
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index-i),len)] != '1' ) // == and not != because we are on the complementary strand...
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
-}
+// ============================================================================
+//                                 Destructor
+// ============================================================================
 
-ae_codon::ae_codon( gzFile backup_file )
-{
-  gzread( backup_file, &_value,   			sizeof(_value) );
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Habitat::ApplyVariation() {
+  //printf("Appel au apply_variation de habitat\n");
+  phenotypic_target_handler_->ApplyVariation();
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_codon::~ae_codon( void )
-{
+void Habitat::save(gzFile backup_file,
+                   bool skip_phenotypic_target /*=false*/) const {
+  //printf("Appel a la sauvegarde de Habitat\n");
+  gzwrite(backup_file, &compound_amount_, sizeof(compound_amount_));
+  if (not skip_phenotypic_target)
+    phenotypic_target_handler_->save(backup_file);
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_codon::save( gzFile backup_file )
-{
-  gzwrite( backup_file, &_value,   			sizeof(_value) );
+void Habitat::load(gzFile backup_file,
+                   PhenotypicTargetHandler* phenotypic_target_handler) {
+  //printf("Appel au chargement de Habitat\n");
+  gzread(backup_file, &compound_amount_, sizeof(compound_amount_));
+  if (phenotypic_target_handler == nullptr)
+    phenotypic_target_handler_ = new PhenotypicTargetHandler(backup_file);
+  else
+    phenotypic_target_handler_ = phenotypic_target_handler;
 }
-// =================================================================
-//                           Protected Methods
-// =================================================================
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/Habitat.h b/src/libaevol/Habitat.h
new file mode 100644
index 0000000..c546478
--- /dev/null
+++ b/src/libaevol/Habitat.h
@@ -0,0 +1,150 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_HABITAT_H_
+#define AEVOL_HABITAT_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
+
+#include <zlib.h>
+
+#include "PhenotypicTargetHandler.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+
+
+class Habitat
+{
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Habitat(); //< Default ctor
+  Habitat(const Habitat&) = delete; //< Copy ctor
+  Habitat(Habitat&&) = delete; //< Move ctor
+  Habitat(const Habitat&, bool share_phenotypic_target);
+  Habitat(gzFile backup_file,
+          PhenotypicTargetHandler* phenotypic_target_handler);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Habitat() = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  Habitat& operator=(const Habitat&) = default;
+  Habitat& operator=(Habitat&&) = default;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void ApplyVariation();
+  void save(gzFile backup_file,
+            bool skip_phenotypic_target = false) const;
+  void load(gzFile backup_file,
+            PhenotypicTargetHandler* phenotypic_target_handler);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  double compound_amount() const {return compound_amount_;};
+  const PhenotypicTarget& phenotypic_target() const {
+    return phenotypic_target_handler_->phenotypic_target();
+  }
+  virtual const PhenotypicTargetHandler& phenotypic_target_handler() const {
+    return *phenotypic_target_handler_;
+  }
+  virtual PhenotypicTargetHandler& phenotypic_target_handler_nonconst() const {
+    return *phenotypic_target_handler_;
+  }
+
+  double mean_environmental_area() const {
+    return phenotypic_target_handler_->mean_environmental_area();
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+  void set_compound_amount(double compound_amount) {
+    compound_amount_ = compound_amount;
+  };
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  // Amount of secreted compound currently present in the grid cell
+  double compound_amount_;
+
+  /** Handler for the phenotypic target and its "evolution" over time */
+  PhenotypicTargetHandler* phenotypic_target_handler_;
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_HABITAT_H_
diff --git a/src/libaevol/HabitatFactory.cpp b/src/libaevol/HabitatFactory.cpp
new file mode 100644
index 0000000..99097c6
--- /dev/null
+++ b/src/libaevol/HabitatFactory.cpp
@@ -0,0 +1,51 @@
+//
+// Created by arrouan on 19/11/15.
+//
+
+#include "HabitatFactory.h"
+
+namespace aevol {
+
+
+std::unique_ptr<Habitat> HabitatFactory::create_unique_habitat(Habitat& habitat,
+                                                      bool share_phenotypic_target) {
+
+#ifndef __REGUL
+#if __cplusplus == 201103L
+  return make_unique<Habitat> (habitat, share_phenotypic_target);
+#else
+  return std::make_unique<Habitat> (habitat, share_phenotypic_target);
+#endif
+#else
+#if __cplusplus == 201103L
+  return make_unique<Habitat_R> (dynamic_cast<Habitat_R&>(habitat), share_phenotypic_target);
+#else
+  return std::make_unique<Habitat_R> (dynamic_cast<Habitat_R&>(habitat), share_phenotypic_target);
+#endif
+#endif
+}
+
+std::unique_ptr<Habitat> 
+HabitatFactory::create_unique_habitat(gzFile backup_file,
+                 					  PhenotypicTargetHandler* phenotypic_target_handler) {
+#ifndef __REGUL
+#if __cplusplus == 201103L
+  return make_unique<Habitat>(backup_file, phenotypic_target_handler);
+#else
+  return std::make_unique<Habitat>(backup_file, phenotypic_target_handler);
+#endif
+#else
+#if __cplusplus == 201103L
+  return make_unique<Habitat_R>(backup_file, dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler));
+#else
+  return std::make_unique<Habitat_R>(backup_file, dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler));
+#endif
+
+ #endif
+
+}
+
+
+
+
+}
diff --git a/src/libaevol/HabitatFactory.h b/src/libaevol/HabitatFactory.h
new file mode 100644
index 0000000..12f46ab
--- /dev/null
+++ b/src/libaevol/HabitatFactory.h
@@ -0,0 +1,28 @@
+//
+// Created by arrouan on 19/11/15.
+//
+
+#ifndef AEVOL_REGUL_HABITATFACTORY_H
+#define AEVOL_REGUL_HABITATFACTORY_H
+
+#include "Habitat.h"
+#include "raevol/Habitat_R.h"
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+namespace aevol {
+
+
+class HabitatFactory {
+ public:
+  static std::unique_ptr<Habitat> create_unique_habitat(Habitat& habitat,
+                                                        bool share_phenotypic_target);
+
+  static std::unique_ptr<Habitat> create_unique_habitat(gzFile backup_file,
+                 					  PhenotypicTargetHandler* phenotypic_target_handler);
+
+};
+
+}
+#endif //AEVOL_REGUL_HABITATFACTORY_H
diff --git a/src/libaevol/HorizontalTransfer.h b/src/libaevol/HorizontalTransfer.h
new file mode 100644
index 0000000..3f9d94c
--- /dev/null
+++ b/src/libaevol/HorizontalTransfer.h
@@ -0,0 +1,84 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_HT_H_
+#define AEVOL_HT_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "Mutation.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class HorizontalTransfer : public Mutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  virtual Mutation* Clone() const override = 0;
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override = 0;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override = 0;
+  bool is_ht() const override final { return true; };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+} // namespace aevol
+#endif //AEVOL_HT_H_
diff --git a/src/libaevol/HybridFuzzy.cpp b/src/libaevol/HybridFuzzy.cpp
new file mode 100644
index 0000000..7257e80
--- /dev/null
+++ b/src/libaevol/HybridFuzzy.cpp
@@ -0,0 +1,229 @@
+//
+// Created by arrouan on 31/07/15.
+//
+
+
+#include <math.h>
+
+#ifdef __BLAS__
+#include <cblas.h>
+#endif
+
+#include <iostream>
+#include "HybridFuzzy.h"
+
+namespace aevol {
+
+
+HybridFuzzy::HybridFuzzy( )
+{
+  _pheno_size = PHENO_SIZE;
+  _points = new double[_pheno_size];
+  for (int i = 0; i < _pheno_size; i++)
+    _points[i] = 0.0;
+}
+
+HybridFuzzy::HybridFuzzy( const HybridFuzzy& model )
+{
+  _pheno_size = PHENO_SIZE;
+  _points = new double[_pheno_size];
+
+#ifdef __BLAS__
+  cblas_dcopy(_pheno_size,model._points,1,_points,1);
+#else
+	for (int i=0; i < _pheno_size; i++)
+		_points[i] = model._points[i];
+#endif
+}
+
+HybridFuzzy::HybridFuzzy( gzFile backup_file )
+{
+  _pheno_size = PHENO_SIZE;
+  _points = new double[_pheno_size];
+  for (int i = 0; i < _pheno_size; i++)
+    _points[i] = 0.0;
+
+  load( backup_file );
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+
+HybridFuzzy::~HybridFuzzy( void )
+{
+  if (_points != NULL) delete [] _points;
+  _points = NULL;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void HybridFuzzy::simplify( )
+{
+
+}
+
+void HybridFuzzy::reset( )
+{
+  for (int i = 0; i < _pheno_size; i++)
+    _points[i] = 0.0;
+}
+
+void HybridFuzzy::add_triangle( double mean, double width, double height )
+{
+  if ( fabs(width) < 1e-15 || fabs(height) < 1e-15 ) return;
+
+  // Compute triangle points' coordinates
+  double x0 = mean - width;
+  double x1 = mean;
+  double x2 = mean + width;
+
+  int ix0 = (int) (x0 * _pheno_size);
+  int ix1 = (int) (x1 * _pheno_size);
+  int ix2 = (int) (x2 * _pheno_size);
+
+  if (ix0 < 0) ix0 = 0; else if (ix0 > (_pheno_size-1)) ix0 = _pheno_size-1;
+  if (ix1 < 0) ix1 = 0; else if (ix1 > (_pheno_size-1)) ix1 = _pheno_size-1;
+  if (ix2 < 0) ix2 = 0; else if (ix2 > (_pheno_size-1)) ix2 = _pheno_size-1;
+
+  // Compute the first equation of the triangle
+  double incY = height / (ix1 - ix0);
+  int count = 1;
+  // Updating value between x0 and x1
+//  _points[ix0] = 0.0;
+  for (int i = ix0+1; i < ix1; i++) {
+    _points[i]+=incY*(count++);
+  }
+
+  _points[ix1]+= height;
+
+  // Compute the second equation of the triangle
+  incY = height / (ix2 - ix1);
+  count = 1;
+
+  // Updating value between x1 and x2
+  for (int i = ix1+1; i < ix2; i++) {
+    _points[i]+=(height-(incY*(count++)));
+  }
+}
+
+void HybridFuzzy::add( const AbstractFuzzy& f )
+{
+  const HybridFuzzy to_add = (HybridFuzzy&)(f);
+#ifdef __BLAS__
+  cblas_daxpy(_pheno_size, 1.0, to_add.points(), 1, _points, 1);
+#else
+		for (int i = 0; i < _pheno_size; i++) {
+			if (to_add._points[i] != 0) _points[i] = _points[i] + to_add._points[i];
+		}
+#endif
+}
+
+void HybridFuzzy::sub( const AbstractFuzzy& f )
+{
+  const HybridFuzzy to_sub = (HybridFuzzy&)(f);
+#ifdef __BLAS__
+  cblas_daxpy(_pheno_size, -1.0, to_sub.points(), 1, _points, 1);
+#else
+		for (int i = 0; i < _pheno_size; i++) {
+			if (to_sub._points[i] !=0 ) _points[i] = _points[i] - to_sub._points[i];
+		}
+#endif
+}
+
+double HybridFuzzy::get_geometric_area( ) const
+{
+  return get_geometric_area(X_MIN,X_MAX);
+}
+
+double HybridFuzzy::get_geometric_area( double start_segment, double end_segment ) const
+{
+  double area = 0;
+
+  int istart_segment = (int) (start_segment  * _pheno_size);
+  int iend_segment = (int) (end_segment  * _pheno_size);
+
+  if (istart_segment < 0) istart_segment = 0; else if (istart_segment > (_pheno_size-1)) istart_segment = _pheno_size-1;
+  if (iend_segment < 0) iend_segment = 0; else if (iend_segment > (_pheno_size-1)) iend_segment = _pheno_size-1;
+  for (int i = istart_segment; i < iend_segment; i++) {
+    area+=((fabs(_points[i]) + fabs(_points[i+1])) / (2.0*_pheno_size));
+  }
+
+  return area;
+}
+
+
+
+bool HybridFuzzy::is_identical_to( const AbstractFuzzy& f, double tolerance  ) const
+{
+  const HybridFuzzy fs = (HybridFuzzy&)(f);
+  // Since list::size() has constant complexity since C++ 11, checking
+  // size is an inexpensive first step.
+  if (get_pheno_size() != fs.get_pheno_size())
+    return false;
+
+  for (int i = 0; i < _pheno_size; i++)
+    if (fabs(_points[i] - fs.points()[i]) > tolerance * (fabs(_points[i]) + fabs(fs.points()[i])) or
+        fabs(_points[i] - fs.points()[i]) > tolerance * (fabs(_points[i]) + fabs(fs.points()[i])))
+      return false;
+  return true;
+}
+
+
+void HybridFuzzy::save( gzFile backup_file ) const
+{
+  gzwrite(backup_file, &_pheno_size, sizeof(_pheno_size));
+  std::cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) << std::endl;
+  std::cout << __FILE__ << ":" << __LINE__ << ":" << _pheno_size << std::endl;
+
+  for (int i = 0; i < _pheno_size; i++)
+    gzwrite(backup_file, &_points[i], sizeof(_points[i]));
+}
+
+
+void HybridFuzzy::load( gzFile backup_file ) {
+  gzread(backup_file, &_pheno_size, sizeof(_pheno_size));
+  std::cout << __FILE__ << ":" << __LINE__ << ":" << gztell(backup_file) <<
+                                                     std::endl;
+  std::cout << __FILE__ << ":" << __LINE__ << ":" << _pheno_size << std::endl;
+  for (int i = 0; i < _pheno_size; i++) {
+    gzread(backup_file, &_points[i], sizeof(_points[i]));
+  }
+}
+
+
+void HybridFuzzy::clip(clipping_direction direction, double bound) {
+
+  if (direction == clipping_direction::min)
+    for (int i = 0; i < _pheno_size; i++)
+      _points[i] = _points[i] < bound ? bound : _points[i];
+  else if (direction == clipping_direction::max)
+    for (int i = 0; i < _pheno_size; i++)
+      _points[i] = _points[i] > bound ? bound : _points[i];
+}
+
+void HybridFuzzy::add_point(double x, double y) {
+  int ix = (int) ( x * _pheno_size);
+  _points[ix] = y;
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+double HybridFuzzy::get_y( double x ) const
+{
+  int ix = (int) ( x * _pheno_size);
+
+  double retValue = _points[ix];
+
+  return retValue;
+}
+
+void HybridFuzzy::print() const
+{
+  for (int i = 0; i < _pheno_size; i++)
+    if (_points[i]!=0) printf("[%d : %f] ",i,_points[i]);
+  printf("\n");
+}
+}
diff --git a/src/libaevol/HybridFuzzy.h b/src/libaevol/HybridFuzzy.h
new file mode 100644
index 0000000..8dd4ed7
--- /dev/null
+++ b/src/libaevol/HybridFuzzy.h
@@ -0,0 +1,91 @@
+//
+// Created by arrouan on 31/07/15.
+//
+
+#ifndef AEVOL_HYBRIDFUZZY_H
+#define AEVOL_HYBRIDFUZZY_H
+
+#define PHENO_SIZE 300
+
+#include <vector>
+
+#include "macros.h"
+#include "Point.h"
+#include "AbstractFuzzy.h"
+
+namespace aevol {
+
+class HybridFuzzy : public AbstractFuzzy
+{
+ public:
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  HybridFuzzy();
+  HybridFuzzy(const HybridFuzzy& f);
+  HybridFuzzy(const gzFile backup);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~HybridFuzzy();
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void save(gzFile backup) const;
+  void load(gzFile backup);
+  void reset();
+  void simplify();
+  void add_triangle(double mean, double width, double height);
+  void add(const AbstractFuzzy& f);
+  void sub(const AbstractFuzzy& f);
+  void add_point(double x, double y);
+
+  void clip(clipping_direction direction, double bound);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  double* points() const { return _points; };
+
+  double get_geometric_area() const;
+
+  double get_geometric_area(double start_segment, double end_segment) const;
+
+  double get_y(double x) const;
+  // get_x should be moved out of fuzzy class as it really applies to pair of points
+
+  bool is_identical_to(const AbstractFuzzy& fs, double tolerance) const;
+
+  int get_pheno_size() const { return _pheno_size; };
+
+  void print() const;
+  inline void clear()  {reset();};
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+ protected:
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  double* _points = NULL;
+  int _pheno_size = PHENO_SIZE;
+};
+
+double trapezoid_area(const Point& p1, const Point& p2);
+} // namespace aevol
+
+
+#endif //AEVOL_HYBRIDFUZZY_H
diff --git a/src/libaevol/Individual.cpp b/src/libaevol/Individual.cpp
new file mode 100644
index 0000000..92dc369
--- /dev/null
+++ b/src/libaevol/Individual.cpp
@@ -0,0 +1,1743 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#include <cstdio>
+#include <cmath>
+#include <sys/stat.h>
+#include <algorithm>
+#include <cassert>
+#include <list>
+
+#include "Codon.h"
+#include "ExpSetup.h"
+#include "ExpManager.h"
+#include "GridCell.h"
+#include "GeneticUnit.h"
+#include "VisAVis.h"
+#include "Utils.h"
+
+#ifdef __NO_X
+  #ifdef __REGUL
+    #include "raevol/Individual_R.h"
+  #else
+    #include "Individual.h"
+  #endif
+#elif defined __X11
+  #ifdef __REGUL
+    #include "raevol/Individual_R_X11.h"
+  #else
+    #include "Individual_X11.h"
+  #endif
+#endif
+namespace aevol {
+
+// ===========================================================================
+//                             Constructors
+// ===========================================================================
+/**
+ * // TODO <david.parsons at inria.fr>
+ */
+Individual::Individual(ExpManager* exp_m,
+                       std::shared_ptr<JumpingMT> mut_prng,
+                       std::shared_ptr<JumpingMT> stoch_prng,
+                       std::shared_ptr<MutationParams> param_mut,
+                       double w_max,
+                       int32_t min_genome_length,
+                       int32_t max_genome_length,
+                       bool allow_plasmids,
+                       int32_t id,
+                       const char* strain_name,
+                       int32_t age) {
+  // Experiment manager
+  exp_m_ = exp_m;
+
+  // PRNGs
+  mut_prng_ = mut_prng;
+  stoch_prng_ = stoch_prng;
+
+  // ID and rank of the indiv ; name and "age" of the strain
+  set_id(id);
+  rank_ = -1; // TODO: UNRANKED
+  age_ = age;
+  strain_name_ = new char[strlen(strain_name) + 1];
+  strcpy(strain_name_, strain_name);
+
+  phenotype_activ_ = NULL;
+  phenotype_inhib_ = NULL;
+  phenotype_ = NULL;
+
+  dist_to_target_by_segment_ = NULL;
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+  for (int i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0;
+    fitness_by_feature_[i] = 0;
+  }
+
+  fitness_ = 0.0;
+
+  // TODO <david.parsons at inria.fr> Deal with cell coordinates on the grid
+  // When using structured population, this is the cell the individual is in
+  // x = y = -1;
+
+  // The chromosome and plasmids (if allowed)
+  // TODO <david.parsons at inria.fr> ???
+
+  // Generic probes
+  int_probes_ = new int32_t[5];
+  double_probes_ = new double[5];
+  for (int8_t i = 0; i < 5; i++) {
+    int_probes_[i] = 0;
+    double_probes_[i] = 0.0;
+  }
+
+  // Mutation rates etc...
+  mut_params_ = param_mut;
+
+  // Artificial chemistry
+  w_max_ = w_max;
+
+  // Genome size constraints
+  min_genome_length_ = min_genome_length;
+  max_genome_length_ = max_genome_length;
+
+  // Plasmids settings
+  allow_plasmids_ = allow_plasmids;
+
+
+  // --------------------------------------------------
+  // "State" of the individual
+  // --------------------------------------------------
+  evaluated_ = false;
+  transcribed_ = false;
+  translated_ = false;
+  folded_ = false;
+  phenotype_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+  placed_in_population_ = false;
+
+
+
+  // ----------------------------------------
+  // Statistical data
+  // ----------------------------------------
+  modularity_ = 0.0;
+}
+
+/**
+ * This constructor retrieves an individual from a backup file.
+ *
+ * Since this generation has already been processed, no unnecessary calculation
+ * (e.g. fitness) will be done.
+ * No transcription, translation or other process of that kind is performed.
+ */
+Individual::Individual(ExpManager* exp_m, gzFile backup_file) {
+  exp_m_ = exp_m;
+
+  // Retrieve the name and "age" of the strain
+  int8_t strain_string_len;
+  gzread(backup_file, &strain_string_len, sizeof(strain_string_len));
+  strain_name_ = new char[strain_string_len + 1];
+  gzread(backup_file, strain_name_, strain_string_len + 1);
+  gzread(backup_file, &age_, sizeof(age_));
+
+  // Retrieve the PRNGs
+  if (exp_m == NULL) {
+    // Detached mode
+    mut_prng_ = NULL;
+    stoch_prng_ = NULL;
+  }
+  else {
+    // TODO: => prngs as parameters
+    mut_prng_ = exp_m->world()->mut_prng();
+    stoch_prng_ = exp_m->world()->stoch_prng();
+    assert(mut_prng_);
+    assert(stoch_prng_);
+  }
+
+  // Retrieve id and rank
+  gzread(backup_file, &id_, sizeof(id_));
+  gzread(backup_file, &rank_, sizeof(rank_));
+
+  // Retrieve spatial coordinates
+  // gzread(backup_file, &x, sizeof(x));
+  // gzread(backup_file, &y, sizeof(y));
+  placed_in_population_ = false;
+
+  // Retrieve generic probes
+  int_probes_ = new int32_t[5];
+  double_probes_ = new double[5];
+  gzread(backup_file, int_probes_, 5 * sizeof(*int_probes_));
+  gzread(backup_file, double_probes_, 5 * sizeof(*double_probes_));
+
+  // Retrieve mutational parameters
+  mut_params_ = std::make_shared<MutationParams>(backup_file);
+
+  // ------------------------------------------------- Phenotypic stochasticity
+  gzread(backup_file, &with_stochasticity_, sizeof(with_stochasticity_));
+
+  // Retrieve artificial chemistry parameters
+  gzread(backup_file, &w_max_, sizeof(w_max_));
+
+  // Retrieve genome size constraints
+  gzread(backup_file, &min_genome_length_, sizeof(min_genome_length_));
+  gzread(backup_file, &max_genome_length_, sizeof(max_genome_length_));
+
+  // Retrieve plasmids settings
+  int8_t tmp_allow_plasmids;
+  gzread(backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids));
+  allow_plasmids_ = tmp_allow_plasmids ? 1 : 0;
+
+  // Retrieve genetic units
+  int16_t nb_gen_units;
+  gzread(backup_file, &nb_gen_units, sizeof(nb_gen_units));
+
+  for (int16_t i = 0; i < nb_gen_units; i++)
+    genetic_unit_list_.emplace_back(this, backup_file);
+
+  // --------------------------------------------------------------------------
+  // No more data to retrieve, the following are only structural
+  // initializations (no data is set)
+  // --------------------------------------------------------------------------
+
+  // Create empty fuzzy sets for activation and inhibition
+  phenotype_activ_ = NULL;
+  phenotype_inhib_ = NULL;
+  phenotype_ = NULL;
+
+  dist_to_target_by_segment_ = NULL;
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  // Initialize the computational state of the individual
+  evaluated_ = false;
+  transcribed_ = false;
+  translated_ = false;
+  folded_ = false;
+  phenotype_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  modularity_ = -1;
+}
+
+/**
+ * Copy constructor
+ */
+Individual::Individual(const Individual& other) {
+  exp_m_ = other.exp_m_;
+
+  // PRNGs
+  mut_prng_ = other.mut_prng_;
+  stoch_prng_ = other.stoch_prng_;
+
+  int strain_string_len = strlen(other.strain_name_);
+  strain_name_ = new char[strain_string_len + 1];
+  memcpy(strain_name_, other.strain_name_, strain_string_len + 1);
+  age_ = other.age_;
+
+  id_ = other.id_;
+  rank_ = other.rank_;
+
+  grid_cell_ = other.grid_cell_;
+
+  evaluated_ = other.evaluated_;
+  transcribed_ = other.transcribed_;
+  translated_ = other.translated_;
+  folded_ = other.folded_;
+  phenotype_computed_ = other.phenotype_computed_;
+
+  with_stochasticity_ = other.with_stochasticity_;
+
+  // Artificial chemistry parameters
+  w_max_ = other.w_max_;
+
+  distance_to_target_computed_ = other.distance_to_target_computed_;
+  fitness_computed_ = other.fitness_computed_;
+  placed_in_population_ = other.placed_in_population_;
+
+  // Copy genetic units from other
+  // Should actually use GeneticUnit copy ctor which is disabled.
+  for (const auto& gu: other.genetic_unit_list_)
+    genetic_unit_list_.emplace_back(this, gu);
+
+  // Copy phenotype
+  if (phenotype_computed_) {
+    phenotype_activ_  = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_activ_)));
+    phenotype_inhib_  = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_inhib_)));
+    phenotype_        = FuzzyFactory::fuzzyFactory->create_fuzzy((*(other.phenotype_)));
+  }
+  else {
+    phenotype_activ_ = NULL;
+    phenotype_inhib_ = NULL;
+    phenotype_ = NULL;
+  }
+
+
+  // Copy fitness-related stuff
+  dist_to_target_by_segment_ = NULL;
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = other.dist_to_target_by_feature_[i];
+    fitness_by_feature_[i] = other.fitness_by_feature_[i];
+  }
+
+  fitness_ = other.fitness_;
+
+  // Copy statistical data
+  metrics_ = other.metrics_ ?
+             new Metrics(*other.metrics_) :
+             nullptr;
+  nc_metrics_ = other.nc_metrics_ ?
+                new NonCodingMetrics(*other.nc_metrics_) :
+                nullptr;
+
+  modularity_ = other.modularity_;
+
+  // Generic probes
+  int_probes_ = new int32_t[5];
+  double_probes_ = new double[5];
+  for (int8_t i = 0; i < 5; i++) {
+    int_probes_[i] = other.int_probes_[i];
+    double_probes_[i] = other.double_probes_[i];
+  }
+
+  // Mutation rates etc...
+  mut_params_ = std::make_shared<MutationParams>(*(other.mut_params_));
+
+  // Genome size constraints
+  min_genome_length_ = other.min_genome_length_;
+  max_genome_length_ = other.max_genome_length_;
+
+  // Plasmids settings
+  allow_plasmids_ = other.allow_plasmids_;
+}
+
+/**
+ * Reproduction constructor
+ *
+ * This constructor creates a new individual with the same genome as it's
+ * parent. The location of promoters will be copied but no further process will
+ * be performed.
+ *
+ * The phenotype and the fitness are not set, neither is the statistical data.
+*/
+Individual::Individual(const Individual* parent, int32_t id,
+                       std::shared_ptr<JumpingMT> mut_prng,
+                       std::shared_ptr<JumpingMT> stoch_prng) {
+  exp_m_ = parent->exp_m_;
+
+  // PRNGs
+  mut_prng_ = mut_prng;
+  stoch_prng_ = stoch_prng;
+
+  int strain_string_len = strlen(parent->strain_name_);
+  strain_name_ = new char[strain_string_len + 1];
+  memcpy(strain_name_, parent->strain_name_, strain_string_len + 1);
+  age_ = parent->age_ + 1;
+
+  id_ = id;
+  rank_ = -1;
+
+  evaluated_ = false;
+  transcribed_ = false;
+  translated_ = false;
+  folded_ = false;
+  phenotype_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  placed_in_population_ = false;
+  // x = y = -1;
+
+  with_stochasticity_ = parent->with_stochasticity_;
+
+  // Artificial chemistry parameters
+  w_max_ = parent->w_max_;
+
+  // Create new genetic units with their DNA copied from here
+  // NOTE : The RNA lists (one per genetic unit) will also be copied so that we don't
+  // need to look for promoters on the whole genome
+  for (auto& gu: parent->genetic_unit_list_)
+    genetic_unit_list_.emplace_back(this, &gu);
+
+  phenotype_activ_ = NULL;
+  phenotype_inhib_ = NULL;
+  phenotype_ = NULL;
+
+  // Initialize all the fitness-related stuff
+  dist_to_target_by_segment_ = NULL;
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+  fitness_by_feature_ = new double[NB_FEATURES];
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+  // Generic probes
+  int_probes_ = new int32_t[5];
+  double_probes_ = new double[5];
+  for (int8_t i = 0; i < 5; i++) {
+    int_probes_[i] = parent->int_probes_[i];
+    double_probes_[i] = parent->double_probes_[i];
+  }
+
+  // Mutation rates etc...
+  mut_params_ = std::make_shared<MutationParams>(*(parent->mut_params_));
+
+  // Genome size constraints
+  min_genome_length_ = parent->min_genome_length_;
+  max_genome_length_ = parent->max_genome_length_;
+
+  // Plasmids settings
+  allow_plasmids_ = parent->allow_plasmids_;
+
+  // Initialize statistical data
+  modularity_ = -1;
+}
+
+Individual* Individual::CreateIndividual(ExpManager* exp_m,
+                                         gzFile backup_file) {
+  Individual* indiv = NULL;
+  #ifdef __NO_X
+    #ifndef __REGUL
+      indiv = new Individual(exp_m, backup_file);
+    #else
+      indiv = new Individual_R(exp_m, backup_file);
+    #endif
+  #elif defined __X11
+    #ifndef __REGUL
+      indiv = new Individual_X11(exp_m, backup_file);
+    #else
+      indiv = new Individual_R_X11(exp_m, backup_file);
+    #endif
+  #endif
+
+  return indiv;
+}
+
+/*!
+  \brief Create a clone
+
+  \param dolly original individual to be cloned
+  \param id ID of the clone
+  \return clone of dolly (not evaluated)
+*/
+Individual* Individual::CreateClone(const Individual* dolly, int32_t id) {
+  Individual* indiv = new Individual(*dolly);
+  indiv->set_id(id);
+  return indiv;
+}
+
+
+// =================================================================
+//                             Destructor
+// =================================================================
+Individual::~Individual() {
+  delete[] strain_name_;
+
+  // Proteins and RNAs are recycled, don't delete them.
+
+  delete phenotype_activ_;
+  delete phenotype_inhib_;
+  delete phenotype_;
+
+  if (dist_to_target_by_segment_ != NULL) delete[] dist_to_target_by_segment_;
+  delete[] dist_to_target_by_feature_;
+
+  delete[] fitness_by_feature_;
+
+  // Generic probes
+  delete[] int_probes_;
+  delete[] double_probes_;
+
+  delete metrics_;
+  delete nc_metrics_;
+}
+
+// =================================================================
+//                        Non-inline Accessors
+// =================================================================
+void Individual::set_exp_m(ExpManager* exp_m) {
+  exp_m_ = exp_m;
+
+  // Update pointer to exp_manager in each GU
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.set_exp_m(exp_m_);
+}
+
+/// TODO
+void Individual::set_grid_cell(GridCell* grid_cell) {
+  grid_cell_ = grid_cell;
+  placed_in_population_ = true;
+  // x = grid_cell->x();
+  // y = grid_cell->y();
+  if (grid_cell->individual() != this) {
+    grid_cell->set_individual(this);
+  }
+}
+
+/// TODO
+const char* Individual::strain_name() const {
+  return strain_name_;
+}
+
+/// TODO
+int32_t Individual::age() const {
+  return age_;
+}
+
+/// TODO
+int32_t Individual::id() const {
+  return id_;
+}
+
+/// TODO
+double* Individual::dist_to_target_by_segment() const {
+  return dist_to_target_by_segment_;
+}
+
+/*!
+  Get the individual's rank in the population (1 for the worst indiv, POP_SIZE for the best)
+
+  Warning: be sure you call sort_individuals() before using rank_in_population
+*/
+int32_t Individual::rank() const {
+  return rank_;
+}
+
+/// TODO
+ExpManager* Individual::exp_m() const {
+  return exp_m_;
+}
+
+/// TODO
+std::shared_ptr<JumpingMT> Individual::mut_prng() const {
+  return mut_prng_;
+}
+
+/// TODO
+std::shared_ptr<JumpingMT> Individual::stoch_prng() const {
+  return stoch_prng_;
+}
+
+/*!
+  Returns the number of genetic units
+*/
+int16_t Individual::nb_genetic_units() const {
+  return genetic_unit_list_.size();
+}
+
+/// Get the number of plasmids. That is, the number of genetic units
+/// minus one DNA-based genetic unit.
+int32_t Individual::nb_plasmids() const {
+  return genetic_unit_list_.size() - 1;
+}
+
+/// TODO
+int32_t Individual::amount_of_dna() const {
+  int32_t amount = 0;
+  for (const auto& gen_unit: genetic_unit_list_)
+    amount += gen_unit.dna()->length();
+  return amount;
+}
+
+/// Return the list of genetic units.
+const std::list<GeneticUnit>& Individual::genetic_unit_list() const {
+  return genetic_unit_list_;
+}
+
+std::list<GeneticUnit>& Individual::genetic_unit_list_nonconst() {
+  return genetic_unit_list_;
+}
+
+/// Remove all the elements from the GU list except the firt and the
+/// last ones. If the GU list has less that 2 elements, do nothing.
+void Individual::drop_nested_genetic_units() {
+  if (genetic_unit_list_.size() <= 2) {
+    return;
+  }
+
+  genetic_unit_list_.erase(std::next(genetic_unit_list_.begin()),
+                           std::prev(genetic_unit_list_.end()));
+  assert(genetic_unit_list_.size() <= 2);
+}
+
+/// Returns genetic unit number `num_unit` (0 for main chromosome)
+const GeneticUnit& Individual::genetic_unit(int16_t num_unit) const {
+  assert(num_unit < static_cast<int32_t>(genetic_unit_list_.size()));
+  auto it = genetic_unit_list_.cbegin();
+  std::advance(it, num_unit);
+  return *it;
+}
+
+/// Returns genetic unit number `num_unit` (0 for main chromosome) as
+/// a non-constant reference. To be used when the purpose is to alter
+/// the individual.
+GeneticUnit& Individual::genetic_unit_nonconst(int16_t num_unit) {
+  assert(num_unit < static_cast<int32_t>(genetic_unit_list_.size()));
+  auto it = genetic_unit_list_.begin();
+  std::advance(it, num_unit);
+  return *it;
+}
+
+/// TODO
+double Individual::dist_to_target_by_feature(
+    PhenotypicFeature feature) const {
+  assert(distance_to_target_computed_);
+
+  return dist_to_target_by_feature_[feature];
+}
+
+/// TODO
+double Individual::fitness() const {
+  assert(fitness_computed_);
+
+  return fitness_;
+}
+
+/// TODO
+double Individual::fitness_by_feature(PhenotypicFeature feature) const {
+  assert(fitness_computed_);
+
+  return fitness_by_feature_[feature];
+}
+
+/// TODO
+GridCell* Individual::grid_cell() const {
+  return grid_cell_;
+}
+
+/// TODO
+const Habitat& Individual::habitat() const {
+  return grid_cell_->habitat();
+}
+
+/// TODO
+bool Individual::placed_in_population() const {
+  return placed_in_population_;
+}
+
+/*!
+  Returns the sequence of genetic unit number <num_unit> (0 for main chromosome)
+*/
+const char* Individual::genetic_unit_sequence(int16_t num_unit) const {
+  return genetic_unit(num_unit).sequence();
+}
+
+/*!
+  Returns the sequence length of genetic unit number <num_unit> (0 for main chromosome)
+*/
+int32_t Individual::genetic_unit_seq_length(int16_t num_unit) const {
+  return genetic_unit(num_unit).seq_length();
+}
+
+/// TODO
+AbstractFuzzy* Individual::phenotype_activ() const {
+  return phenotype_activ_;
+}
+
+/// TODO
+AbstractFuzzy* Individual::phenotype_inhib() const {
+  return phenotype_inhib_;
+}
+
+/// TODO
+Phenotype* Individual::phenotype() const {
+  return phenotype_;
+}
+
+const PhenotypicTarget& Individual::phenotypic_target() const {
+  return grid_cell_->phenotypic_target();
+}
+
+/// TODO
+const std::list<Protein*>& Individual::protein_list() const {
+  return protein_list_;
+}
+
+/// TODO
+const std::list<const Rna*>& Individual::rna_list() const {
+  return rna_list_;
+}
+
+/// TODO
+int32_t Individual::total_genome_size() const {
+  assert(metrics_ != nullptr);
+  return metrics_->total_genome_size();
+}
+
+/// TODO
+int16_t Individual::nb_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_coding_RNAs();
+}
+
+/// TODO
+int16_t Individual::nb_non_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_non_coding_RNAs();
+}
+
+/// TODO
+int32_t Individual::overall_size_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->overall_size_coding_RNAs();
+}
+
+/// TODO
+double Individual::av_size_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_coding_RNAs() == 0 ?
+         0.0 :
+         metrics_->overall_size_coding_RNAs() /
+         metrics_->nb_coding_RNAs();
+}
+
+/// TODO
+int32_t Individual::overall_size_non_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->overall_size_non_coding_RNAs();
+}
+
+/// TODO
+double Individual::av_size_non_coding_RNAs() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_non_coding_RNAs() == 0 ?
+         0.0 :
+         metrics_->overall_size_non_coding_RNAs() /
+         metrics_->nb_non_coding_RNAs();
+}
+
+/// TODO
+int16_t Individual::nb_genes_activ() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_genes_activ();
+}
+
+/// TODO
+int16_t Individual::nb_genes_inhib() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_genes_inhib();
+}
+
+/// TODO
+int16_t Individual::nb_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_functional_genes();
+}
+
+/// TODO
+int16_t Individual::nb_non_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_non_functional_genes();
+}
+
+/// TODO
+int32_t Individual::overall_size_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->overall_size_functional_genes();
+}
+
+/// TODO
+double Individual::av_size_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_functional_genes() == 0 ?
+         0.0 :
+         metrics_->overall_size_functional_genes() /
+         metrics_->nb_functional_genes();
+}
+
+/// TODO
+int32_t Individual::overall_size_non_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->overall_size_non_functional_genes();
+}
+
+/// TODO
+double Individual::av_size_non_functional_genes() const {
+  assert(metrics_ != nullptr);
+  return metrics_->nb_non_functional_genes() == 0 ?
+         0.0 :
+         metrics_->overall_size_non_functional_genes() /
+         metrics_->nb_non_functional_genes();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_CDS() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_CDS();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_functional_CDS() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_functional_CDS();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_non_functional_CDS() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_non_functional_CDS();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_RNA() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_RNA();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_coding_RNA() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_coding_RNA();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_0_non_coding_RNA() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_0_non_coding_RNA();
+}
+
+/// TODO
+int32_t Individual::nb_bases_in_neutral_regions() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_bases_in_neutral_regions();
+}
+
+/// TODO
+int32_t Individual::nb_neutral_regions() const {
+  assert(nc_metrics_ != nullptr);
+  return nc_metrics_->nb_neutral_regions();
+}
+
+/// TODO
+double Individual::modularity() {
+  printf("\n  WARNING : modularity measure not yet implemented.\n");
+  //~ if (modularity_ < 0) compute_modularity();
+  //~ return modularity_;
+  return 0;
+}
+
+/// TODO
+double Individual::w_max() const {
+  return w_max_;
+}
+
+// ------------------------------------------------------------- Mutation rates
+/// TODO
+double Individual::point_mutation_rate() const {
+  return mut_params_->point_mutation_rate();
+}
+
+/// TODO
+double Individual::small_insertion_rate() const {
+  return mut_params_->small_insertion_rate();
+}
+
+/// TODO
+double Individual::small_deletion_rate() const {
+  return mut_params_->small_deletion_rate();
+}
+
+/// TODO
+int16_t Individual::max_indel_size() const {
+  return mut_params_->max_indel_size();
+}
+
+// ---------------------------------- Rearrangement rates (without alignements)
+/// TODO
+double Individual::duplication_rate() const {
+  return mut_params_->duplication_rate();
+}
+
+/// TODO
+double Individual::deletion_rate() const {
+  return mut_params_->deletion_rate();
+}
+
+/// TODO
+double Individual::translocation_rate() const {
+  return mut_params_->translocation_rate();
+}
+
+/// TODO
+double Individual::inversion_rate() const {
+  return mut_params_->inversion_rate();
+}
+
+// ------------------------------------- Rearrangement rates (with alignements)
+/// TODO
+double Individual::neighbourhood_rate() const {
+  return mut_params_->neighbourhood_rate();
+}
+
+/// TODO
+double Individual::duplication_proportion() const {
+  return mut_params_->duplication_proportion();
+}
+
+/// TODO
+double Individual::deletion_proportion() const {
+  return mut_params_->deletion_proportion();
+}
+
+/// TODO
+double Individual::translocation_proportion() const {
+  return mut_params_->translocation_proportion();
+}
+
+/// TODO
+double Individual::inversion_proportion() const {
+  return mut_params_->inversion_proportion();
+}
+
+// ---------------------------------------------------------------- Transfer
+bool Individual::with_4pts_trans() const {
+  return mut_params_->with_4pts_trans();
+}
+
+bool Individual::with_HT() const {
+  return mut_params_->with_HT();
+}
+
+bool Individual::repl_HT_with_close_points() const {
+  return mut_params_->repl_HT_with_close_points();
+}
+
+double Individual::HT_ins_rate() const {
+  return mut_params_->HT_ins_rate();
+}
+
+double Individual::HT_repl_rate() const {
+  return mut_params_->HT_repl_rate();
+}
+
+double Individual::repl_HT_detach_rate() const {
+  return mut_params_->repl_HT_detach_rate();
+}
+
+
+// ---------------------------------------------------------------- Alignements
+bool Individual::with_alignments() const {
+  return mut_params_->with_alignments();
+}
+
+AlignmentFunctionShape Individual::align_fun_shape() const {
+  return mut_params_->align_fun_shape();
+}
+
+double Individual::align_sigm_lambda() const {
+  return mut_params_->align_sigm_lambda();
+}
+
+int16_t Individual::align_sigm_mean() const {
+  return mut_params_->align_sigm_mean();
+}
+
+int16_t Individual::align_lin_min() const {
+  return mut_params_->align_lin_min();
+}
+
+int16_t Individual::align_lin_max() const {
+  return mut_params_->align_lin_max();
+}
+
+int16_t Individual::align_max_shift() const {
+  return mut_params_->align_max_shift();
+}
+
+int16_t Individual::align_w_zone_h_len() const {
+  return mut_params_->align_w_zone_h_len();
+}
+
+int16_t Individual::align_match_bonus() const {
+  return mut_params_->align_match_bonus();
+}
+
+int16_t Individual::align_mismatch_cost() const {
+  return mut_params_->align_mismatch_cost();
+}
+
+/// TODO
+bool Individual::with_stochasticity() const {
+  return with_stochasticity_;
+}
+
+void Individual::set_allow_plasmids(bool allow_plasmids) {
+  allow_plasmids_ = allow_plasmids;
+}
+
+// Genome size constraints
+/// TODO
+int32_t Individual::min_genome_length() const {
+  return min_genome_length_;
+}
+
+/// TODO
+int32_t Individual::max_genome_length() const {
+  return max_genome_length_;
+}
+
+// Plasmids settings
+/// TODO
+bool Individual::allow_plasmids() const {
+  return allow_plasmids_;
+}
+
+/*!
+  \brief Return the int_probes_
+
+  \return int_probes_
+*/
+int32_t* Individual::int_probes() const {
+  return int_probes_;
+}
+
+/*!
+  \brief Return the double_probes_
+
+  \return double_probes_
+*/
+double* Individual::double_probes() const {
+  return double_probes_;
+}
+
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+void Individual::set_strain_name(char* name) {
+  assert(name && strlen(name) < INT8_MAX); // Conservative, could be <=
+  int8_t name_len = strlen(name);
+  delete[] strain_name_;
+  strain_name_ = new char[name_len + 1];
+  memcpy(strain_name_, name, name_len + 1);
+}
+
+/// TODO
+void Individual::set_id(int32_t id) {
+  id_ = id;
+}
+
+/// TODO
+void Individual::set_rank(int32_t rank) {
+  rank_ = rank;
+}
+
+/// TODO
+void Individual::set_placed_in_population(bool placed_in_population) {
+  placed_in_population_ = placed_in_population;
+}
+
+/// TODO
+void Individual::set_w_max(double w_max) {
+  w_max_ = w_max;
+}
+
+
+// Genome size constraints
+/// TODO
+void Individual::set_min_genome_length(int32_t min_genome_length) {
+  min_genome_length_ = min_genome_length;
+}
+
+/// TODO
+void Individual::set_max_genome_length(int32_t max_genome_length) {
+  max_genome_length_ = max_genome_length;
+}
+
+
+void Individual::set_point_mutation_rate(double point_mutation_rate) {
+  mut_params_->set_point_mutation_rate(point_mutation_rate);
+}
+
+void Individual::set_small_insertion_rate(double small_insertion_rate) {
+  mut_params_->set_small_insertion_rate(small_insertion_rate);
+}
+
+void Individual::set_small_deletion_rate(double small_deletion_rate) {
+  mut_params_->set_small_deletion_rate(small_deletion_rate);
+}
+
+void Individual::set_max_indel_size(int16_t max_indel_size) {
+  mut_params_->set_max_indel_size(max_indel_size);
+}
+
+void Individual::set_duplication_rate(double duplication_rate) {
+  mut_params_->set_duplication_rate(duplication_rate);
+}
+
+void Individual::set_deletion_rate(double deletion_rate) {
+  mut_params_->set_deletion_rate(deletion_rate);
+}
+
+void Individual::set_translocation_rate(double translocation_rate) {
+  mut_params_->set_translocation_rate(translocation_rate);
+}
+
+void Individual::set_inversion_rate(double inversion_rate) {
+  mut_params_->set_inversion_rate(inversion_rate);
+}
+
+void Individual::set_neighbourhood_rate(double neighbourhood_rate) {
+  mut_params_->set_neighbourhood_rate(neighbourhood_rate);
+}
+
+void Individual::set_duplication_proportion(double duplication_proportion) {
+  mut_params_->set_duplication_proportion(duplication_proportion);
+}
+
+void Individual::set_deletion_proportion(double deletion_proportion) {
+  mut_params_->set_deletion_proportion(deletion_proportion);
+}
+
+void Individual::set_translocation_proportion(double translocation_proportion) {
+  mut_params_->set_translocation_proportion(translocation_proportion);
+}
+
+void Individual::set_inversion_proportion(double inversion_proportion) {
+  mut_params_->set_inversion_proportion(inversion_proportion);
+}
+
+void Individual::set_with_4pts_trans(bool with_4pts_trans) {
+  mut_params_->set_with_4pts_trans(with_4pts_trans);
+}
+
+void Individual::set_with_alignments(bool with_alignments) {
+  mut_params_->set_with_alignments(with_alignments);
+}
+
+void Individual::set_with_HT(bool with_HT) {
+  mut_params_->set_with_HT(with_HT);
+}
+
+void Individual::set_repl_HT_with_close_points(bool repl_HT_with_close_points) {
+  mut_params_->set_repl_HT_with_close_points(repl_HT_with_close_points);
+}
+
+void Individual::set_HT_ins_rate(double HT_ins_rate) {
+  mut_params_->set_HT_ins_rate(HT_ins_rate);
+}
+
+void Individual::set_HT_repl_rate(double HT_repl_rate) {
+  mut_params_->set_HT_repl_rate(HT_repl_rate);
+}
+
+void Individual::set_repl_HT_detach_rate(double repl_HT_detach_rate) {
+  mut_params_->set_repl_HT_detach_rate(repl_HT_detach_rate);
+}
+
+
+void Individual::set_with_stochasticity(bool with_stoch) {
+  with_stochasticity_ = with_stoch;
+}
+
+void Individual::set_stoch_prng(std::shared_ptr<JumpingMT> prng) {
+  stoch_prng_ = prng;
+}
+
+void Individual::set_mut_prng(std::shared_ptr<JumpingMT> prng) {
+  mut_prng_ = prng;
+}
+
+/*!
+  \brief Change the int_probes_
+
+  \param int_probes 5 int32_t* that constitute a probe
+*/
+void Individual::set_int_probes(int32_t* int_probes) {
+  int_probes_ = int_probes;
+}
+
+/*!
+  \brief Change the double_probes_
+
+  \param double_probes 5 double* that constitute a probe
+*/
+void Individual::set_double_probes(double* double_probes) {
+  double_probes_ = double_probes;
+}
+
+// =====================================================================
+//                       functions' definition
+// =====================================================================
+
+void Individual::reset_dist_to_target_by_segment(
+    double* dist_to_target_by_segment) {
+  if (dist_to_target_by_segment_ != NULL) delete[] dist_to_target_by_segment_;
+  dist_to_target_by_segment_ = dist_to_target_by_segment;
+}
+
+void Individual::renew_dist_to_target_by_feature() {
+  if (dist_to_target_by_feature_ != NULL) delete[] dist_to_target_by_feature_;
+  dist_to_target_by_feature_ = new double[NB_FEATURES];
+}
+
+
+void Individual::renew_fitness_by_feature() {
+  if (fitness_by_feature_ != NULL) delete[] fitness_by_feature_;
+  fitness_by_feature_ = new double[NB_FEATURES];
+}
+
+void Individual::do_transcription_translation_folding() {
+  if (transcribed_ == true && translated_ == true && folded_ == true) return;
+
+  do_transcription();
+  do_translation();
+  do_folding();
+
+  make_protein_list();
+}
+
+#ifdef DEBUG
+
+void Individual::assert_promoters() {
+  // Perform assertion for each genetic unit
+  // for (auto& gen_unit: genetic_unit_list_)
+  //   gen_unit.assert_promoters();
+}
+
+void Individual::assert_promoters_order() {
+  // Perform assertion for each genetic unit
+  // for (auto& gen_unit: genetic_unit_list_)
+  //   gen_unit.assert_promoters_order();
+}
+
+#endif
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void Individual::compute_phenotype() {
+  if (phenotype_computed_) return; // Phenotype has already been computed, nothing to do.
+  phenotype_computed_ = true;
+
+  // Make sure the transcription, translation and folding stages have taken place
+  do_transcription_translation_folding();
+
+
+  // We will use two fuzzy sets :
+  //   * phenotype_activ_ for the proteins realising a set of functions
+  //   * phenotype_inhib_ for the proteins inhibiting a set of functions
+  // The phenotype will then be given by the sum of these 2 fuzzy sets
+  phenotype_activ_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotype_inhib_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+
+  for (const auto& gen_unit: genetic_unit_list_) {
+    phenotype_activ_->add(*gen_unit.activ_contribution());
+    phenotype_inhib_->add(*gen_unit.inhib_contribution());
+  }
+
+  phenotype_activ_->clip(AbstractFuzzy::max,   Y_MAX);
+  phenotype_inhib_->clip(AbstractFuzzy::min, - Y_MAX);
+
+  phenotype_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotype_->add(*phenotype_activ_);
+  phenotype_->add(*phenotype_inhib_);
+  phenotype_->clip(AbstractFuzzy::min, Y_MIN);
+  phenotype_->simplify();
+}
+
+void Individual::compute_distance_to_target(const PhenotypicTarget& target) {
+// Compute the areas between the phenotype and the target for each segment
+// If the target is not segmented, the total area is computed
+  if (distance_to_target_computed_) {
+    return;
+  } // distance_to_target_ has already been computed, nothing to do.
+
+  distance_to_target_computed_ = true;
+
+  if (not phenotype_computed_)
+    compute_phenotype();
+
+  // Compute the difference between the (whole) phenotype and the target
+  AbstractFuzzy* delta = FuzzyFactory::fuzzyFactory->create_fuzzy(*phenotype_);
+  delta->sub(*(target.fuzzy()));
+
+  PhenotypicSegment ** segments = target.segments();
+  delete [] dist_to_target_by_segment_;
+  dist_to_target_by_segment_ = new double [target.nb_segments()];
+
+  for (size_t i = 0 ; i < static_cast<size_t>(target.nb_segments()) ; i++) {
+    dist_to_target_by_segment_[i] = 0;
+  }
+
+  // TODO : We should take into account that we compute the areas in order (from the leftmost segment, rightwards)
+  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have
+  //      already been through them!)
+
+  for (size_t i = 0; i < static_cast<size_t>(target.nb_segments()); i++) {
+    dist_to_target_by_segment_[i] = delta->get_geometric_area(
+      segments[i]->start, segments[i]->stop);
+    dist_to_target_by_feature_[segments[i]->feature] += dist_to_target_by_segment_[i];
+  }
+
+  delete delta;
+}
+
+/*!
+  Computation of a "proper" fitness value (one that increases when the individual is fitter)
+
+  Computation of a "proper" fitness value (one that increases when the individual is fitter)
+  The behaviour of this function depends on many parameters and most notably on whether it is
+  a "composite" fitness or not, and on the selection scheme.
+*/
+void Individual::compute_fitness(const PhenotypicTarget& target) {
+  if (fitness_computed_) return; // Fitness has already been computed, nothing to do.
+  fitness_computed_ = true;
+
+#ifdef NORMALIZED_FITNESS
+  for (int8_t i = 0 ; i < NB_FEATURES ; i++) {
+    if (envir->area_by_feature(i)==0.) {
+      fitness_by_feature_[i] = 0.;
+    }
+    else {
+      fitness_by_feature_[i] =  (envir->area_by_feature(i) - dist_to_target_by_feature_[i]) / envir->area_by_feature(i);
+      if ((fitness_by_feature_[i] < 0.) && (i != METABOLISM)) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good)
+      {
+        fitness_by_feature_[i] = 0.;
+      }
+    }
+  }
+
+  if ((! placed_in_population_) || (! exp_m_->with_secretion())) {
+    fitness_ = fitness_by_feature_[METABOLISM];
+  }
+  else {
+    fitness_ =  fitness_by_feature_[METABOLISM] * (1 + exp_m_->secretion_contrib_to_fitness() * (grid_cell_->compound_amount() - exp_m_->secretion_cost() * fitness_by_feature_[SECRETION]));
+  }
+
+  if (exp_m_->selection_scheme() == FITNESS_PROPORTIONATE) // Then the exponential selection is integrated inside the fitness value
+  {
+    fitness_ = exp(-exp_m_->selection_pressure() * (1 - fitness_));
+  }
+#else
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    if (i == SECRETION) {
+      fitness_by_feature_[SECRETION] = exp(-exp_m_->selection_pressure() *
+                                           dist_to_target_by_feature_[SECRETION])
+                                       - exp(-exp_m_->selection_pressure() *
+                                             target.area_by_feature(SECRETION));
+
+      if (fitness_by_feature_[i] < 0) {
+        fitness_by_feature_[i] = 0;
+      }
+    }
+    else {
+      fitness_by_feature_[i] = exp(
+          -exp_m_->selection_pressure() * dist_to_target_by_feature_[i]);
+    }
+  }
+
+  // Calculate combined, total fitness here!
+  // Multiply the contribution of metabolism and the amount of compound in the
+  // habitat
+  if ((!placed_in_population_) || (!exp_m_->with_secretion())) {
+    fitness_ = fitness_by_feature_[METABOLISM];
+  }
+  else {
+    fitness_ = fitness_by_feature_[METABOLISM]
+               * (1 + exp_m_->secretion_contrib_to_fitness() *
+                      grid_cell()->compound_amount()
+                  - exp_m_->secretion_cost() *
+                    fitness_by_feature_[SECRETION]);
+  }
+#endif
+}
+
+
+void Individual::clear_everything_except_dna_and_promoters() {
+  protein_list_.clear();
+
+  evaluated_ = false;
+  transcribed_ = false;
+  translated_ = false;
+  folded_ = false;
+  phenotype_computed_ = false;
+  distance_to_target_computed_ = false;
+  fitness_computed_ = false;
+
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.reset_expression();
+
+  if (phenotype_activ_ != NULL) {
+    delete phenotype_activ_;
+    phenotype_activ_ = NULL;
+  }
+
+  if (phenotype_inhib_ != NULL) {
+    delete phenotype_inhib_;
+    phenotype_inhib_ = NULL;
+  }
+
+  if (phenotype_ != NULL) {
+    delete phenotype_;
+    phenotype_ = NULL;
+  }
+
+  // Initialize all the fitness-related stuff
+  if (dist_to_target_by_segment_ != NULL) {
+    delete[] dist_to_target_by_segment_;
+    dist_to_target_by_segment_ = NULL;
+  }
+
+  for (int8_t i = 0; i < NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0.0;
+    fitness_by_feature_[i] = 0.0;
+  }
+
+
+  // For each RNA / individual / genetic_unit delete proteins it knows
+  // Deleting the protein itself is made only once
+
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.clear_transcribed_proteins();
+
+  // Clear RNA and proteins
+  rna_list_.clear();
+  protein_list_.clear();
+
+  // Reset statistical data
+  delete metrics_;
+  metrics_ = nullptr;
+  delete nc_metrics_;
+  nc_metrics_ = nullptr;
+
+  modularity_ = -1;
+}
+
+void Individual::Reevaluate() {
+  // useful for post-treatment programs that replay mutations
+  // on a single individual playing the role of the successive
+  // ancestors
+
+  clear_everything_except_dna_and_promoters();
+  Evaluate();
+}
+
+void Individual::ReevaluateInContext(const Habitat& habitat) {
+  // useful for post-treatment programs that replay mutations
+  // on a single individual playing the role of the successive
+  // ancestors
+
+  clear_everything_except_dna_and_promoters();
+  EvaluateInContext(habitat);
+}
+
+
+void Individual::add_GU(char*& sequence, int32_t length) {
+  clear_everything_except_dna_and_promoters();
+  genetic_unit_list_.emplace_back(this, sequence, length);
+}
+
+/// Overloaded version to prevent the use of GeneticUnit disabled
+/// copy ctor. Forwards arguments to GeneticUnit's ctor.
+void Individual::add_GU(Individual* indiv,
+                        int32_t chromosome_length,
+                        std::shared_ptr<JumpingMT> prng) {
+  clear_everything_except_dna_and_promoters();
+  genetic_unit_list_.emplace_back(indiv, chromosome_length, prng);
+}
+
+void Individual::remove_GU(int16_t num_unit) {
+  clear_everything_except_dna_and_promoters();
+  auto it = genetic_unit_list_.begin();
+  std::advance(it, num_unit);
+  genetic_unit_list_.erase(it);
+}
+
+
+void Individual::do_transcription() {
+  if (transcribed_) {
+    return;
+  } // Transcription has already been performed, nothing to do.
+  transcribed_ = true;
+
+  for (auto& gen_unit: genetic_unit_list_) {
+    gen_unit.do_transcription();
+    const auto& rna_list = gen_unit.rna_list();
+    for (auto& strand: {LEADING, LAGGING}) {
+      for (auto& rna: rna_list[strand])
+        rna_list_.push_back(&rna);
+    }
+  }
+}
+
+void Individual::do_translation() {
+  if (translated_) {
+    return;
+  } // ARNs have already been translated, nothing to do.
+  translated_ = true;
+
+  if (not transcribed_)
+    do_transcription();
+
+  for (auto& gen_unit: genetic_unit_list_) {
+    gen_unit.do_translation();
+    // append all proteins from `gen_unit` to `protein_list_`
+    for (auto& strand_id: {LEADING, LAGGING}) {
+      auto& strand = gen_unit.protein_list(strand_id);
+      for (auto& p: strand)
+        protein_list_.push_back(&p);
+    }
+  }
+}
+
+void Individual::do_folding() {
+  if (folded_) {
+    return;
+  } // Proteins have already been folded, nothing to do.
+  folded_ = true;
+
+  if (not translated_)
+    do_translation();
+
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.compute_phenotypic_contribution();
+}
+
+void Individual::Evaluate() {
+  EvaluateInContext(grid_cell_->habitat());
+}
+
+void Individual::EvaluateInContext(const Habitat& habitat) {
+  if (evaluated_ == true) {
+    return;
+  } // Individual has already been evaluated, nothing to do.
+  evaluated_ = true;
+
+  // ----------------------------------------------------------------------
+  // Transcription - Translation - Folding
+  // ----------------------------------------------------------------------
+  do_transcription_translation_folding();
+
+  // ----------------------------------------------------------------------
+  // Compute phenotype and compare it to the target => fitness
+  // ----------------------------------------------------------------------
+  compute_phenotype();
+  compute_distance_to_target(habitat.phenotypic_target());
+  compute_fitness(habitat.phenotypic_target());
+
+  if (exp_m_->output_m()->compute_phen_contrib_by_GU())
+    for (auto& gen_unit: genetic_unit_list_) {
+      gen_unit.compute_distance_to_target(habitat.phenotypic_target());
+      gen_unit.compute_fitness(habitat.phenotypic_target());
+    }
+}
+
+
+void Individual::inject_GU(Individual* donor) {
+  // Add the GU at the end of the list
+  genetic_unit_list_.emplace_back(this, donor->genetic_unit_list_.back());
+}
+
+void Individual::inject_2GUs(Individual* partner) {
+  // We swap GUs from the end of the list.
+
+  // TODO vld: As far as I understood the old code (47b27578), the
+  // elements were not swapped but appended to the end of the other GU
+  // lists. Error?  Original author (Dule, commit 47b27578), asked for
+  // clarification by e-mail on 2015-02-23.
+
+  const auto& gu_list_back_it = std::prev(
+      genetic_unit_list_.end()); // initial last cell from genetic_unit_list_
+  genetic_unit_list_.splice(genetic_unit_list_.end(),
+                            partner->genetic_unit_list_,
+                            std::prev(partner->genetic_unit_list_.end()));
+  partner->genetic_unit_list_.splice(partner->genetic_unit_list_.end(),
+                                     genetic_unit_list_, gu_list_back_it);
+}
+
+void Individual::compute_statistical_data() {
+  if (metrics_ != nullptr) {
+    return;
+  } // Statistical data has already been computed,
+  // nothing to do.
+
+  metrics_ = new Metrics();
+
+  if (not phenotype_computed_)
+    compute_phenotype();
+
+  for (const auto& gen_unit : genetic_unit_list_) {
+    metrics_->Accumulate(gen_unit);
+  }
+}
+
+void Individual::compute_non_coding() {
+  if (nc_metrics_ != nullptr) return; // NC stats have already been computed,
+  // nothing to do.
+  nc_metrics_ = new NonCodingMetrics();
+
+  for (auto& gen_unit: genetic_unit_list_) {
+    gen_unit.compute_non_coding();
+    nc_metrics_->Accumulate(gen_unit);
+  }
+}
+
+void Individual::save(gzFile backup_file) const {
+  //printf("Appel à la sauvegarde de Individual\n");
+  // Write the name and "age" of the strain
+  int8_t strain_string_len = strlen(strain_name_);
+  gzwrite(backup_file, &strain_string_len, sizeof(strain_string_len));
+  gzwrite(backup_file, strain_name_, strain_string_len + 1);
+  gzwrite(backup_file, &age_, sizeof(age_));
+
+  // Write id and rank
+  gzwrite(backup_file, &id_, sizeof(id_));
+  gzwrite(backup_file, &rank_, sizeof(rank_));
+
+  // Write the position of the individual
+  // gzwrite(backup_file, &x, sizeof(x));
+  // gzwrite(backup_file, &y, sizeof(y));
+
+  // Write generic probes
+  gzwrite(backup_file, int_probes_, 5 * sizeof(*int_probes_));
+  gzwrite(backup_file, double_probes_, 5 * sizeof(*double_probes_));
+
+  // Write mutational parameters
+  mut_params_->save(backup_file);
+
+  // ------------------------------------------------- Phenotypic stochasticity
+  gzwrite(backup_file, &with_stochasticity_, sizeof(with_stochasticity_));
+
+  // Write artificial chemistry parameters
+  gzwrite(backup_file, &w_max_, sizeof(w_max_));
+
+  // Write genome size constraints
+  gzwrite(backup_file, &min_genome_length_, sizeof(min_genome_length_));
+  gzwrite(backup_file, &max_genome_length_, sizeof(max_genome_length_));
+
+  // Write plasmids settings
+  int8_t tmp_allow_plasmids = allow_plasmids_;
+  gzwrite(backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids));
+
+  // Write genetic units
+  int16_t nb_gen_units = genetic_unit_list_.size();
+  gzwrite(backup_file, &nb_gen_units, sizeof(nb_gen_units));
+
+  for (const auto& gen_unit: genetic_unit_list_)
+    gen_unit.save(backup_file);
+}
+
+int32_t Individual::nb_terminators() {
+  int32_t nb_term = 0;
+  for (auto& gen_unit: genetic_unit_list_)
+    nb_term += gen_unit.nb_terminators();
+  return nb_term;
+}
+
+/// Remove the bases that are not in coding RNA.
+///
+/// Remove the bases that are not in coding RNA and test at each loss
+/// that fitness is not changed.
+void Individual::remove_non_coding_bases() {
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.remove_non_coding_bases();
+
+  // Delete the obsolete stats
+  delete metrics_;
+  metrics_ = NULL;
+  delete nc_metrics_;
+  nc_metrics_ = NULL;
+
+#ifdef DEBUG
+  compute_statistical_data();
+  compute_non_coding();
+  assert(nb_bases_in_0_coding_RNA() == 0);
+#endif
+}
+
+/// Double the bases that are not in coding RNA.
+///
+/// Double the bases that are not in coding RNA by addition of random
+/// bases and test at each addition that fitness is not changed.
+void Individual::double_non_coding_bases() {
+  metrics_->total_genome_size_ = 0;
+  int32_t initial_non_coding_base_nb = nb_bases_in_0_coding_RNA();
+
+  for (auto& gen_unit: genetic_unit_list_)
+    gen_unit.double_non_coding_bases();
+
+  // Delete the obsolete stats
+  delete metrics_;
+  metrics_ = NULL;
+  delete nc_metrics_;
+  nc_metrics_ = NULL;
+
+#ifdef DEBUG
+  compute_statistical_data();
+  compute_non_coding();
+  assert(nb_bases_in_0_coding_RNA() == 2 * initial_non_coding_base_nb);
+#endif
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+// TODO vld: refactor make_protein_list and make_rna_list
+void Individual::make_protein_list() {
+  // Clear list
+  protein_list_.clear();
+
+  // Make a copy of each genetic unit's protein list
+  for (auto& gen_unit: genetic_unit_list_) {
+    // append all proteins from `gen_unit` to `protein_list_`
+    for (auto& strand_id: {LEADING, LAGGING}) {
+      auto& strand = gen_unit.protein_list(strand_id);
+      for (auto& p: strand)
+        protein_list_.push_back(&p);
+    }
+  }
+}
+
+void Individual::make_rna_list() {
+  // Clear list
+  rna_list_.clear();
+
+  // Make a copy of each genetic unit's rna list
+  for (const auto& gen_unit: genetic_unit_list_) {
+    // Create proxies
+    const auto& rna_list = gen_unit.rna_list();
+
+    // append pointers to rna material to local rna_list_
+    for (auto& strand: {LEADING, LAGGING})
+      for (auto& rna: rna_list[strand])
+        rna_list_.push_back(&rna);
+  }
+}
+} // namespace aevol
diff --git a/src/libaevol/Individual.h b/src/libaevol/Individual.h
new file mode 100644
index 0000000..fd9922f
--- /dev/null
+++ b/src/libaevol/Individual.h
@@ -0,0 +1,630 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_INDIVIDUAL_H_
+#define AEVOL_INDIVIDUAL_H_
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <zlib.h>
+
+#include <list>
+#include <memory>
+
+#include "Metrics.h"
+#include "NonCodingMetrics.h"
+#include "GeneticUnit.h"
+#include "Dna.h"
+#include "Rna.h"
+#include "Protein.h"
+#include "Phenotype.h"
+#include "MutationParams.h"
+#include "Fuzzy.h"
+#include "PhenotypicTarget.h"
+#include "Habitat.h"
+#include "Observable.h"
+
+
+namespace aevol {
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+class GridCell;
+
+
+/// Models an individual cell.
+///
+/// Proteins and RNAs are shared with descent.
+/// Genetic units are an individual's own.
+class Individual : public Observable {
+  friend class Dna;
+
+ public :
+
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  Individual() = delete;
+
+  Individual(const Individual& other);
+
+  Individual(ExpManager* exp_m,
+             std::shared_ptr<JumpingMT> mut_prng,
+             std::shared_ptr<JumpingMT> stoch_prng,
+             std::shared_ptr<MutationParams> param_mut,
+             double w_max,
+             int32_t min_genome_length,
+             int32_t max_genome_length,
+             bool allow_plasmids,
+             int32_t id,
+             const char* strain_name,
+             int32_t age);
+
+  Individual(ExpManager* exp_m, gzFile backup_file);
+
+  Individual(const Individual* parent, int32_t id,
+             std::shared_ptr<JumpingMT> mut_prng,
+             std::shared_ptr<JumpingMT> stoch_prng);
+
+  static Individual* CreateIndividual(ExpManager* exp_m,
+                                      gzFile backup_file);
+
+  /**
+   * \brief Create of clone of an Individual
+   *
+   * A clone is ... TODO
+   *
+   * \param dolly original individual to be cloned
+   * \param id ID of the clone in the population
+   * \return clone of dolly
+   */
+  static Individual* CreateClone(const Individual* dolly, int32_t id);
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~Individual() noexcept(true);
+
+  // =================================================================
+  //                        Accessors: Getters
+  // =================================================================
+  const char* strain_name() const;
+
+  int32_t age() const;
+
+  ExpManager* exp_m() const;
+
+  int16_t nb_genetic_units() const;
+
+  int32_t nb_plasmids() const;
+
+  int32_t amount_of_dna() const;
+
+  const GeneticUnit& genetic_unit(int16_t num_unit) const;
+
+  GeneticUnit& genetic_unit_nonconst(int16_t num_unit);
+
+  double dist_to_target_by_feature(PhenotypicFeature feature) const;
+
+  double fitness() const;
+
+  double fitness_by_feature(PhenotypicFeature feature) const;
+
+  GridCell* grid_cell() const;
+
+  const Habitat& habitat() const;
+
+  bool placed_in_population() const;
+
+  std::shared_ptr<JumpingMT> mut_prng() const;
+
+  std::shared_ptr<JumpingMT> stoch_prng() const;
+
+  const std::list<GeneticUnit>& genetic_unit_list() const;
+
+  std::list<GeneticUnit>& genetic_unit_list_nonconst();
+
+  /// Keep only the first (main chromosome) and the last chromosomes from the GU.
+  void drop_nested_genetic_units();
+
+  const char* genetic_unit_sequence(int16_t num_unit) const;
+
+  int32_t genetic_unit_seq_length(int16_t num_unit) const;
+
+  int32_t id() const;
+
+  int32_t rank() const;
+
+
+  Phenotype* phenotype() const;
+
+  AbstractFuzzy* phenotype_activ() const;
+  AbstractFuzzy* phenotype_inhib() const;
+
+  const PhenotypicTarget& phenotypic_target() const;
+
+  double* dist_to_target_by_segment() const;
+
+  const std::list<Protein*>& protein_list() const;
+
+  const std::list<const Rna*>& rna_list() const;
+
+  double w_max() const;
+
+  // Genome size constraints
+  int32_t min_genome_length() const;
+
+  int32_t max_genome_length() const;
+
+  // Plasmids settings
+  bool allow_plasmids() const;
+
+  // Mutation rates etc...
+  double point_mutation_rate() const;
+
+  double small_insertion_rate() const;
+
+  double small_deletion_rate() const;
+
+  int16_t max_indel_size() const;
+
+  double duplication_rate() const;
+
+  double deletion_rate() const;
+
+  double translocation_rate() const;
+
+  double inversion_rate() const;
+
+  double neighbourhood_rate() const;
+
+  double duplication_proportion() const;
+
+  double deletion_proportion() const;
+
+  double translocation_proportion() const;
+
+  double inversion_proportion() const;
+
+  // Transfer
+  bool with_4pts_trans() const;
+
+  bool with_HT() const;
+
+  bool repl_HT_with_close_points() const;
+
+  double HT_ins_rate() const;
+
+  double HT_repl_rate() const;
+
+  double repl_HT_detach_rate() const;
+
+  // ------------------------------------------------------------ Alignements
+  bool with_alignments() const;
+
+  AlignmentFunctionShape align_fun_shape() const;
+
+  double align_sigm_lambda() const;
+
+  int16_t align_sigm_mean() const;
+
+  int16_t align_lin_min() const;
+
+  int16_t align_lin_max() const;
+
+  // Maximum shift of one seq on the other
+  int16_t align_max_shift() const;
+
+  // Work zone half length
+  int16_t align_w_zone_h_len() const;
+
+  // Corresponding residues match bonus
+  int16_t align_match_bonus() const;
+
+  // Corresponding residues mismatch cost
+  int16_t align_mismatch_cost() const;
+
+
+  // ----------------------------------------------- Phenotypic stochasticity
+  bool with_stochasticity() const;
+
+  // Statistical data
+  int32_t total_genome_size() const; // TODO: duplicate with amount_of_dna?
+  int16_t nb_coding_RNAs() const;
+
+  int16_t nb_non_coding_RNAs() const;
+
+  int32_t overall_size_coding_RNAs() const;
+
+  double av_size_coding_RNAs() const;
+
+  int32_t overall_size_non_coding_RNAs() const;
+
+  double av_size_non_coding_RNAs() const;
+
+  int16_t nb_genes_activ() const;
+
+  int16_t nb_genes_inhib() const;
+
+  int16_t nb_functional_genes() const;
+
+  int16_t nb_non_functional_genes() const;
+
+  int32_t overall_size_functional_genes() const;
+
+  double av_size_functional_genes() const;
+
+  int32_t overall_size_non_functional_genes() const;
+
+  double av_size_non_functional_genes() const;
+
+  int32_t nb_bases_in_0_CDS() const;
+
+  int32_t nb_bases_in_0_functional_CDS() const;
+
+  int32_t nb_bases_in_0_non_functional_CDS() const;
+
+  int32_t nb_bases_in_0_RNA() const;
+
+  int32_t nb_bases_in_0_coding_RNA() const;
+
+  int32_t nb_bases_in_0_non_coding_RNA() const;
+
+  int32_t nb_bases_in_neutral_regions() const;
+
+  int32_t nb_neutral_regions() const;
+
+  double modularity(); // Not const
+
+  int32_t* int_probes() const;
+
+  double* double_probes() const;
+
+
+  // =================================================================
+  //                        Accessors: Setters
+  // =================================================================
+  void set_strain_name(char* name);
+
+  void set_exp_m(ExpManager* exp_m);
+
+  void set_id(int32_t id);
+
+  void set_rank(int32_t rank);
+
+  void set_grid_cell(GridCell* grid_cell);
+
+  void set_placed_in_population(bool placed_in_population);
+
+  void reset_dist_to_target_by_segment(double* dist_to_target_by_segment);
+
+  void set_w_max(double w_max);
+
+  // Genome size constraints
+  void set_min_genome_length(int32_t min_genome_length);
+
+  void set_max_genome_length(int32_t max_genome_length);
+
+  // Plasmids
+  void set_allow_plasmids(bool allow_plasmids);
+
+  // Mutation rates etc...
+  void set_point_mutation_rate(double point_mutation_rate);
+
+  void set_small_insertion_rate(double small_insertion_rate);
+
+  void set_small_deletion_rate(double small_deletion_rate);
+
+  void set_max_indel_size(int16_t max_indel_size);
+
+  void set_duplication_rate(double duplication_rate);
+
+  void set_deletion_rate(double deletion_rate);
+
+  void set_translocation_rate(double translocation_rate);
+
+  void set_inversion_rate(double inversion_rate);
+
+  void set_neighbourhood_rate(double neighbourhood_rate);
+
+  void set_duplication_proportion(double duplication_proportion);
+
+  void set_deletion_proportion(double deletion_proportion);
+
+  void set_translocation_proportion(double translocation_proportion);
+
+  void set_inversion_proportion(double inversion_proportion);
+
+  // Transfer
+  void set_with_4pts_trans(bool with_4pts_trans);
+
+  void set_with_alignments(bool with_alignments);
+
+  void set_with_HT(bool with_HT);
+
+  void set_repl_HT_with_close_points(bool repl_HT_with_close_points);
+
+  void set_HT_ins_rate(double HT_ins_rate);
+
+  void set_HT_repl_rate(double HT_repl_rate);
+
+  void set_repl_HT_detach_rate(double repl_HT_detach_rate);
+
+  // ----------------------------------------------- Phenotypic stochasticity
+  void set_with_stochasticity(bool with_stoch);
+
+  void set_mut_prng(std::shared_ptr<JumpingMT> prng);
+
+  void set_stoch_prng(std::shared_ptr<JumpingMT> prng);
+
+  //------------------------------------------------ Generic probes
+  void set_int_probes(int32_t* int_probes);
+
+  void set_double_probes(double* double_probes);
+
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  // warning: the individual is left in a totally "cleared" state but not
+  // reevaluated
+  void add_GU(char*& sequence,  int32_t length);
+  // void add_GU(GeneticUnit&& unit); // warning: the individual is left in
+  // a totally "cleared" state but not reevaluated
+  void add_GU(Individual* indiv, int32_t chromosome_length,
+              std::shared_ptr<JumpingMT> prng);
+
+  // void add_GU(Individual* indiv, int32_t length, JumpingMT* prng);
+  // warning: the individual is left in a totally "cleared" state but not
+  // reevaluated
+  void remove_GU(int16_t num_unit);
+  void renew_dist_to_target_by_feature();
+
+  void renew_fitness_by_feature();
+
+  void inject_GU(Individual* donor);
+
+  void inject_2GUs(Individual* partner);
+
+  /**
+   * Main evaluation method
+   */
+  virtual void Evaluate();
+
+  /**
+   * Evaluate within the provided context
+   */
+  virtual void EvaluateInContext(const Habitat& habitat);
+
+  /**
+   * Reset expression, proteins, phenotype and so on and evaluate
+   */
+  virtual void Reevaluate();
+
+  /**
+   * Reset expression, proteins, phenotype and so on and evaluate in context
+   */
+  virtual void ReevaluateInContext(const Habitat& habitat);
+
+  virtual void clear_everything_except_dna_and_promoters();
+
+  void do_transcription_translation_folding();
+
+  void do_transcription();
+
+  void do_translation();
+
+  void do_folding();
+
+  void compute_phenotype();
+
+  void compute_distance_to_target(const PhenotypicTarget& target);
+
+  // Computation of a "proper" fitness value (one that increases when the individual is fitter)
+  // The behaviour of this function depends on many parameters and most notably on whether it is
+  // a "composite" fitness or not, and on the selection scheme.
+  void compute_fitness(const PhenotypicTarget& target);
+
+  void compute_statistical_data();
+
+  void compute_non_coding();
+
+  virtual void save(gzFile backup_file) const;
+
+  int32_t nb_terminators();
+
+#ifdef DEBUG
+
+  void assert_promoters();
+
+  void assert_promoters_order();
+
+#endif
+
+  double compute_theoritical_f_nu();
+  // These functions compute the probability of neutral reproduction (F_nu).
+  // The first method replicates the individual "nb_children" times and counts how often
+  // a child has the same fitness as its parent (and if second argument not NULL, how often
+  // a child has same or better fitness and stores the result at the adress contained in the
+  // pointer). Results are proportions.
+  // The second is an estimate based on genome structure as defined by Carole.
+  // They have been implemented on the chromosome only !
+
+  void remove_non_coding_bases();
+
+  void double_non_coding_bases();
+
+
+  // =================================================================
+  //                           Public Attributes
+  // =================================================================
+
+
+
+
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  virtual void make_protein_list();
+
+  virtual void make_rna_list();
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  ExpManager* exp_m_;
+
+  // Name and "Age" of the strain
+  char* strain_name_;
+  int32_t age_;
+
+  // Random number generators
+  // These are shared pointers because depending on the configuration,
+  // they can either be exclusive to the individual or grid cell, or they
+  // can be mutualized (shared) for all or part of the population
+  std::shared_ptr<JumpingMT> mut_prng_;
+  std::shared_ptr<JumpingMT> stoch_prng_;
+
+  // Individual ID and rank of the individual in the population
+  // WARNING : The ID is no longer corresponding to the rank of the individual.
+  //           The reason for this change is that we now need an identifier for the individuals
+  //           as soon as they are created (the rank is only known when all the individuals have been evaluated).
+  //           The rank will now be handled in a specific new attribute. (1 for the worst indiv, POP_SIZE for the best)
+  int32_t id_;   // [0 ; POP_SIZE[
+  int32_t rank_; // [1 ; POP_SIZE]
+
+  // Total activation (resp. inhibition) of metabolic functions
+  AbstractFuzzy* phenotype_activ_;
+  AbstractFuzzy* phenotype_inhib_;
+
+  // The phenotype, roughly corresponding to the sum of activ and inhib
+  Phenotype* phenotype_;
+
+  // Array containing the partial area of the "gap" (difference between the
+  // phenotype and the target) for each phenotypic target segment.
+  // Note: if the  phenotypic target is not segmented, there will be a single
+  // cell in this array
+  double* dist_to_target_by_segment_;
+
+  // This array contains the aggregated area of the gap for each type of
+  // segment (PhenotypicFeature).
+  // When the  phenotypic target is not segmented, the only meaningful value
+  // will be held in dist_to_target_[METABOLISM]
+  double* dist_to_target_by_feature_;
+
+  // This array contains the fitness contribution for each type of segment
+  // (PhenotypicFeature).
+  // For metabolic segment, this is the metabolic fitness contribution;
+  // For secretion segment, this is the amount of compound that gets secreted
+  // into the  phenotypic target;
+  // Note: total fitness is the combination of metabolic fitness and the amount
+  // of compound present in the habitat, not the amount of compound secreted by
+  // the individual.
+  double* fitness_by_feature_;
+
+  // THE fitness
+  double fitness_;
+
+  // When using structured population, this is the cell the individual is in
+  GridCell* grid_cell_ = nullptr;
+  // int16_t x, y;
+
+  // The chromosome and plasmids (if allowed)
+  std::list<GeneticUnit> genetic_unit_list_;
+
+  // Access lists to all the proteins/RNAs of the individual.
+  // Please note that these proteins/RNAs are actually managed (i.e. newed and deleted) via genetic units.
+  std::list<Protein*> protein_list_;
+  std::list<const Rna*> rna_list_;
+
+  // Generic probes
+  int32_t* int_probes_; // Array of 5 int32_t values to be used as one wishes
+  double* double_probes_; // Array of 5 double values to be used as one wishes
+
+  // Mutation rates etc...
+  std::shared_ptr<MutationParams> mut_params_;
+
+  // ----------------------------------------------- Phenotypic stochasticity
+  bool with_stochasticity_;
+
+  // Artificial chemistry
+  double w_max_;
+
+  // Genome size constraints
+  int32_t min_genome_length_;
+  int32_t max_genome_length_;
+
+  // Plasmids settings
+  bool allow_plasmids_;
+
+
+  // --------------------------------------------------
+  // "State" of the individual
+  // --------------------------------------------------
+  // We keep trace of what we have already computed to avoid double computation (mainly in post-treaments)
+  bool evaluated_;
+  bool transcribed_;
+  bool translated_;
+  bool folded_;
+  bool phenotype_computed_;
+  bool distance_to_target_computed_;
+  bool fitness_computed_;
+
+  bool placed_in_population_; // TODO: spatial ?
+
+
+
+  // ----------------------------------------
+  // Statistical data
+  // ----------------------------------------
+  // Genome, RNAs and genes size and stuff
+  Metrics* metrics_ = nullptr;
+  // Coding / non-coding
+  NonCodingMetrics* nc_metrics_ = nullptr;
+
+  // Mutation/Rearrangement statistics are managed in the replication report
+
+
+  double modularity_; // Ratio between the pairwise distance between genes whose corresponding
+  // phenotypic triangles overlap and the average intergenic distance
+  // (ignoring non-functional genes)void compute_phenotype();
+};
+
+} // namespace aevol
+
+#endif // AEVOL_INDIVIDUAL_H_
diff --git a/src/libaevol/IndividualFactory.cpp b/src/libaevol/IndividualFactory.cpp
new file mode 100644
index 0000000..7e35673
--- /dev/null
+++ b/src/libaevol/IndividualFactory.cpp
@@ -0,0 +1,229 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "IndividualFactory.h"
+
+#include <limits>
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                           Class IndividualFactory                           #
+//                                                                             #
+//##############################################################################
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+/**
+ * Create an individual with random sequences
+ */
+Individual* IndividualFactory::create_random_individual(
+    ExpManager* exp_m,
+    int32_t id,
+    std::shared_ptr<MutationParams> param_mut,
+    std::shared_ptr<JumpingMT> mut_prng,
+    std::shared_ptr<JumpingMT> stoch_prng,
+    const Habitat& habitat,
+    double w_max,
+    int32_t min_genome_length,
+    int32_t max_genome_length,
+    int32_t chromosome_initial_length,
+    bool allow_plasmids,
+    bool plasmid_initial_gene,
+    int32_t plasmid_initial_length,
+    char* strain_name,
+    std::shared_ptr<JumpingMT> local_prng,
+    bool better_than_flat) {
+  // Create a genome-less individual with the provided parameters
+
+  #ifndef __REGUL
+  Individual *indiv = new Individual(exp_m,
+                         mut_prng,
+                         stoch_prng,
+                         param_mut,
+                         w_max,
+                         min_genome_length,
+                         max_genome_length,
+                         allow_plasmids,
+                         id,
+                         strain_name,
+                         0);
+  #else
+  Individual_R* indiv = new Individual_R(exp_m,
+                                     mut_prng,
+                                     stoch_prng,
+                                     param_mut,
+                                     w_max,
+                                     min_genome_length,
+                                     max_genome_length,
+                                     allow_plasmids,
+                                     id,
+                                     strain_name,
+                                     0);
+  #endif
+
+  // Give it a randomly generated genome
+  indiv->add_GU(indiv, chromosome_initial_length, local_prng);
+
+  // If it was requested that the generated individual be better than a flat
+  // one, test whether it is and if not re-generate until the condition is
+  // satisfied
+  double env_metabolic_area;
+  if (better_than_flat) {
+#ifdef __REGUL
+    env_metabolic_area = dynamic_cast<Habitat_R*>(const_cast<Habitat*>(&habitat))->phenotypic_target_handler().mean_environmental_area();
+#else
+    env_metabolic_area = habitat.phenotypic_target_handler().mean_environmental_area();
+#endif
+
+    indiv->EvaluateInContext(habitat);
+    //TESTING
+    //exit(EXIT_FAILURE);
+
+    double r_compare = round((indiv->dist_to_target_by_feature(METABOLISM)-env_metabolic_area) * 1E10) / 1E10;
+
+    // indiv->dist_to_target_by_feature(METABOLISM) >= env_metabolic_area
+    while (r_compare >= 0.0) {
+#ifdef __REGUL
+      indiv->set_networked(false);
+#endif
+
+      // Replace the former chromosome by a new random one and re-evaluate the
+      // individual
+      indiv->remove_GU(0);
+      indiv->add_GU(indiv, chromosome_initial_length, local_prng);
+      indiv->EvaluateInContext(habitat);
+      //debug :
+     // printf("Dist to target du nouveau clone : %f\n", indiv->dist_to_target_by_feature(METABOLISM));
+      r_compare = round((indiv->dist_to_target_by_feature(METABOLISM)-env_metabolic_area) * 1E10) / 1E10;
+    }
+  }
+  if (allow_plasmids) // We create a plasmid
+  {
+    if (plasmid_initial_gene) {
+      // The plasmid is generated independently from the chromosome
+      indiv->add_GU(indiv, plasmid_initial_length, local_prng);
+
+      if (better_than_flat) {
+        indiv->EvaluateInContext(habitat);
+
+        while (indiv->genetic_unit(1).
+            dist_to_target_by_feature(METABOLISM) >= env_metabolic_area) {
+          indiv->remove_GU(1);
+          indiv->add_GU(indiv, plasmid_initial_length, local_prng);
+          indiv->EvaluateInContext(habitat);
+        }
+      }
+    }
+    else {
+      // The plasmid is a copy of the chromosome
+      char* plasmid_genome = new char[chromosome_initial_length + 1];
+      strncpy(plasmid_genome,
+              indiv->genetic_unit_list().back().sequence(),
+              chromosome_initial_length + 1);
+      indiv->add_GU(plasmid_genome, chromosome_initial_length);
+    }
+  }
+
+  // Insert a few IS in the sequence
+  /*if (ae_common::init_params->init_method() & WITH_INS_SEQ)
+  {
+    // Create a random sequence
+    int32_t seq_len = 50;
+    char* ins_seq = new char[seq_len+1];
+    int16_t nb_insert = 50;
+    int16_t nb_invert = 50;
+
+    for (int32_t i = 0 ; i < seq_len ; i++)
+    {
+      ins_seq[i] = '0' + ae_common::sim->prng->random(NB_BASE);
+    }
+    ins_seq[seq_len] = '\0';
+
+
+    // Insert the sequence at random positions
+    Mutation* mut1 = NULL;
+    for (int16_t i = 0 ; i < nb_insert ; i++)
+    {
+      mut1 = indiv->genetic_unit(0)->dna()->do_insertion(ins_seq, seq_len);
+      delete mut1;
+    }
+
+
+    // Invert the sequence and insert it at random positions
+    char* inverted_seq = new char[seq_len+1];
+    for (int32_t i = 0 ; i < seq_len ; i++)
+    {
+      inverted_seq[i] = (ins_seq[seq_len-1-i] == '1') ? '0' : '1';
+    }
+    inverted_seq[seq_len] = '\0';
+
+    for (int16_t i = 0 ; i < nb_invert ; i++)
+    {
+      mut1 = indiv->genetic_unit(0)->dna()->do_insertion(inverted_seq, seq_len);
+      delete mut1;
+    }
+
+    delete [] ins_seq;
+    delete [] inverted_seq;
+  }*/
+
+  // If the individual hasn't been evaluated yet, do it
+  if (not better_than_flat) {
+    indiv->EvaluateInContext(habitat);
+  }
+
+  // Compute the "good" individual's statistics
+  indiv->compute_statistical_data();
+
+  return indiv;
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+} // namespace aevol
diff --git a/src/libaevol/IndividualFactory.h b/src/libaevol/IndividualFactory.h
new file mode 100644
index 0000000..0277dd5
--- /dev/null
+++ b/src/libaevol/IndividualFactory.h
@@ -0,0 +1,148 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_INDIVIDUAL_FACTORY_H_
+#define AEVOL_INDIVIDUAL_FACTORY_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#ifdef __NO_X
+  #ifndef __REGUL
+    #include <Individual.h>
+  #else
+    #include <raevol/Individual_R.h>
+  #endif
+#elif defined __X11
+  #ifndef __REGUL
+    #include <Individual_X11.h>
+  #else
+    #include <raevol/Individual_R_X11.h>
+  #endif
+#endif
+
+#include "Habitat.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+
+
+class IndividualFactory {
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  IndividualFactory() = default; //< Default ctor
+  IndividualFactory(const IndividualFactory&) = delete; //< Copy ctor
+  IndividualFactory(IndividualFactory&&) = delete; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~IndividualFactory() = default; //< Destructor
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  static Individual* create_random_individual(
+      ExpManager* exp_m,
+      int32_t id,
+      std::shared_ptr<MutationParams> param_mut,
+      std::shared_ptr<JumpingMT> mut_prng,
+      std::shared_ptr<JumpingMT> stoch_prng,
+      const Habitat& habitat,
+      double w_max,
+      int32_t min_genome_length,
+      int32_t max_genome_length,
+      int32_t chromosome_initial_length,
+      bool allow_plasmids,
+      bool plasmid_initial_gene,
+      int32_t plasmid_initial_length,
+      char* strain_name,
+      std::shared_ptr<JumpingMT> local_prng,
+      bool better_than_flat);
+
+
+
+
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_INDIVIDUAL_FACTORY_H_
diff --git a/src/libaevol/Individual_X11.cpp b/src/libaevol/Individual_X11.cpp
new file mode 100644
index 0000000..c62e19a
--- /dev/null
+++ b/src/libaevol/Individual_X11.cpp
@@ -0,0 +1,840 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <stdio.h>
+#include <math.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Individual_X11.h"
+
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "Utils.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                           Class Individual_X11                           #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Individual_X11::Individual_X11(ExpManager * exp_manager, gzFile backup_file) :
+    Individual(exp_manager, backup_file)
+{
+  init_occupied_sectors();
+}
+
+Individual_X11::Individual_X11(const Individual_X11 &model) :
+    Individual(model)
+{
+  init_occupied_sectors();
+}
+
+Individual_X11::Individual_X11(Individual_X11 * const parent,
+                                     int32_t id,
+                                     std::shared_ptr<JumpingMT> mut_prng,
+                                     std::shared_ptr<JumpingMT> stoch_prng) :
+    Individual(parent, id, mut_prng, stoch_prng)
+{
+  init_occupied_sectors();
+}
+
+Individual_X11::Individual_X11(ExpManager * exp_m, std::shared_ptr<JumpingMT> mut_prng,
+    std::shared_ptr<JumpingMT> stoch_prng, std::shared_ptr<MutationParams> param_mut,
+    double w_max, int32_t min_genome_length, int32_t max_genome_length, bool allow_plasmids,
+    int32_t id, const char* strain_name, int32_t age) :
+    Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length,
+      max_genome_length,allow_plasmids,id,strain_name,age) {
+init_occupied_sectors();
+}
+
+
+/*Individual_X11::Individual_X11(char* genome, int32_t genome_size) : Individual(genome, genome_size)
+{
+  init_occupied_sectors();
+}*/
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Individual_X11::~Individual_X11()
+{
+  for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++)
+  {
+    delete [] occupied_sectors_[LEADING][layer];
+    delete [] occupied_sectors_[LAGGING][layer];
+  }
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void Individual_X11::display()
+{
+}
+
+void Individual_X11::display_cdss(X11Window * win)
+{
+  // Retreive the genetic unit corresponding to the main chromosome
+  GeneticUnit* gen_unit = &genetic_unit_list_.front();
+  int32_t genome_length = gen_unit->dna()->length();
+
+  // Display the number of CDSs
+  char display_string[40];
+  sprintf(display_string, "Main chromosome size : %" PRId32 "bp", genome_length);
+  win->draw_string(15, 25, display_string);
+  sprintf(display_string, "Leading : %" PRId32 " CDSs", static_cast<int32_t>(gen_unit->protein_list(LEADING).size()));
+  win->draw_string(15, 40, display_string);
+  sprintf(display_string, "Lagging : %" PRId32 " CDSs", static_cast<int32_t>(gen_unit->protein_list(LAGGING).size()));
+  win->draw_string(15, 55, display_string);
+
+  // Compute display diameter according to genome length and window size
+  int16_t canvas_width;
+  if (allow_plasmids_) canvas_width = win->width() / 2;
+  else canvas_width = win->width();
+  int16_t canvas_height = win->height();
+
+  int16_t canvas_size = Utils::min(canvas_width, canvas_height);
+  int16_t diam        = round(canvas_size * log((double)genome_length) / 16);
+
+  // Prevent diameter from getting greater than 2/3 of the window size
+  if (diam > 2 * canvas_size / 3)
+  {
+    diam = 2 * canvas_size / 3;
+  }
+
+  // Compute coordinates of the upper-left corner of the containing square
+  int16_t pos_x = (canvas_width - diam) / 2;
+  int16_t pos_y = (canvas_height - diam) / 2;
+
+  // Draw main circle
+  win->draw_circle(pos_x, pos_y, diam);
+
+  // Sector occupation management
+  reset_sectors();
+
+
+  // ---------------
+  //  Draw each CDS
+  // ---------------
+  // NB : As we want OriC to be at the "top" of the circle and the orientation
+  //      to be clockwise, the drawing angle (theta) will be given as
+  //      (90 - alpha), alpha being the "classical" trigonometric angle
+  int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
+  int16_t theta_first; //, theta_last; // Transposed angles on the trigonometric circle (degrees)
+  int16_t nb_sect;
+  // Same as above with precision = 1/64 degree
+  int16_t alpha_first_64, alpha_last_64;
+  int16_t theta_first_64; //, theta_last_64;
+  int16_t nb_sect_64;
+
+  // ----------------
+  //  LEADING strand
+  // ----------------
+  for (const auto& cds: gen_unit->protein_list(LEADING))
+  {
+    // Alpha : angles from OriC (in degrees)
+    // Theta : angles on the trigonometric circle (in degrees)
+    // nb_sect : "length" in degrees of the arc to be drawn
+    alpha_first   = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length));
+    alpha_last    = (int16_t) round(360 * ((double)cds.last_translated_pos()  / (double)genome_length));
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    // theta_last    = Utils::mod(90 - alpha_last, 360);
+    nb_sect       = Utils::mod(alpha_last - alpha_first + 1,  360);
+
+    // These are the same as above but with a higher precision (1/64 degrees)
+    alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length));
+    alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length));
+    theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+    // theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+    nb_sect_64       = Utils::mod(alpha_last_64 - alpha_first_64 + 1,  64 * 360);
+
+
+    // Look for the inmost layer that has all the sectors between
+    // theta_first and theta_last free
+    int16_t layer = 0;
+    bool sectors_free = false;
+    while (! sectors_free)
+    {
+      sectors_free = true;
+
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)])
+        {
+          sectors_free = false;
+          break;
+        }
+      }
+
+      if (sectors_free)
+      {
+        break; // All the needed sectors are free on the current layer
+      }
+      else
+      {
+        layer++;
+
+        if (layer >= outmost_layer_)
+        {
+          add_layer();
+          break; // An added layer is necessarily free, no need to look further
+        }
+      }
+    }
+
+    // Mark sectors to be drawn as occupied
+    for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+    {
+      occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true;
+    }
+    // Mark flanking sectors as occupied
+    occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true;
+    occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true;
+
+
+    // Draw
+    const int8_t cds_layer_spacing = 5; // TODO : param?
+    layer++; // index starting at 0 but needed to start at 1
+
+    int16_t diam2 = diam + (layer * 2 * cds_layer_spacing);
+    pos_x         = (int16_t) round((double)(canvas_width  - diam2) / 2.0);
+    pos_y         = (int16_t) round((double)(canvas_height - diam2) / 2.0);
+
+    char* color = X11Window::color(cds.mean());
+    win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color);
+    delete [] color;
+  }
+
+  // ----------------
+  //  LAGGING strand
+  // ----------------
+  for (const auto& cds: gen_unit->protein_list(LAGGING))
+  {
+    // Alpha : angles from OriC (in degrees)
+    // Theta : angles on the trigonometric circle (in degrees)
+    // nb_sect : "length" in degrees of the arc to be drawn
+    alpha_first   = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length));
+    alpha_last    = (int16_t) round(360 * ((double)cds.last_translated_pos()  / (double)genome_length));
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    // theta_last    = Utils::mod(90 - alpha_last, 360);
+    nb_sect = Utils::mod(alpha_first - alpha_last + 1,  360);
+
+    // These are the same as above but with a higher precision (1/64 degrees)
+    alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length));
+    alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length));
+    theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+    // theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+    nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1,  64 * 360);
+
+
+    // Look for the inmost layer that has all the sectors between
+    // theta_first and theta_last free
+    int16_t layer = 0;
+    bool sectors_free = false;
+    while (! sectors_free)
+    {
+      sectors_free = true;
+
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)])
+        {
+          sectors_free = false;
+          break;
+        }
+      }
+
+      if (sectors_free)
+      {
+        break; // All the needed sectors are free on the current layer
+      }
+      else
+      {
+        layer++;
+
+        if (layer >= outmost_layer_)
+        {
+          add_layer();
+          break; // An added layer is necessarily free, no need to look further
+        }
+      }
+    }
+
+    // Mark sectors to be drawn as occupied
+    for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+    {
+      occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true;
+    }
+    // Mark flanking sectors as occupied
+    occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true;
+    occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true;
+
+
+    // Draw
+    const int8_t cds_layer_spacing = 5; // TODO : param?
+    layer++; // index starting at 0 but needed to start at 1
+
+    int16_t diam2 = diam - (layer * 2 * cds_layer_spacing);
+    pos_x         = (int16_t) round((double)(canvas_width  - diam2) / 2.0);
+    pos_y         = (int16_t) round((double)(canvas_height - diam2) / 2.0);
+
+    char* color = X11Window::color(cds.mean());
+    win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color);
+    delete [] color;
+  }
+
+
+
+
+
+
+
+
+
+  // --------------------------------------------------------------------------This is temporary, it is a big copy-paste of what's above.
+  if (allow_plasmids_)
+  {
+    // Retreive the genetic unit corresponding to the plasmid (i.e. index 1 in genetic_unit_list_)
+    GeneticUnit* gen_unit = &*std::next(genetic_unit_list_.begin());
+    if (gen_unit == NULL) return;
+
+    int32_t genome_length = gen_unit->dna()->length();
+
+
+    // Compute display diameter according to genome length and window size
+    int16_t canvas_width;
+    int16_t canvas_height;
+    int16_t canvas_size ;
+    if (allow_plasmids_)
+    {
+      canvas_width  = win->width() / 2;
+      canvas_size   = canvas_width;
+    }
+    else
+    {
+      canvas_width  = win->width();
+      canvas_size   = Utils::min(canvas_width, canvas_width);
+    }
+    canvas_height = win->height();
+
+    int16_t diam  = round(canvas_size * log((double)genome_length) / 16);
+
+    // Prevent diameter from getting greater than 2/3 of the window size
+    if (diam > 2 * canvas_size / 3)
+    {
+      diam = 2 * canvas_size / 3;
+    }
+
+    // Compute coordinates of the upper-left corner of the containing square
+    int16_t pos_x = canvas_width + (canvas_width - diam) / 2;
+    int16_t pos_y = (canvas_height - diam) / 2;
+
+
+    // Draw main circle
+    win->draw_circle(pos_x, pos_y, diam);
+
+    // Sector occupation management
+    reset_sectors();
+
+
+    // ---------------
+    //  Draw each CDS
+    // ---------------
+    // NB : As we want OriC to be at the "top" of the circle and the orientation
+    //      to be clockwise, the drawing angle (theta) will be given as
+    //      (90 - alpha), alpha being the "classical" trigonometric angle
+    int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
+    int16_t theta_first; //, theta_last; // Transposed angles on the trigonometric circle (degrees)
+    int16_t nb_sect;
+    // Same as above with precision = 1/64 degree
+    int16_t alpha_first_64, alpha_last_64;
+    int16_t theta_first_64; //, theta_last_64;
+    int16_t nb_sect_64;
+
+    // ----------------
+    //  LEADING strand
+    // ----------------
+    for (const auto& cds: gen_unit->protein_list(LEADING))
+    {
+      // Alpha : angles from OriC (in degrees)
+      // Theta : angles on the trigonometric circle (in degrees)
+      // nb_sect : "length" in degrees of the arc to be drawn
+      alpha_first   = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length));
+      alpha_last    = (int16_t) round(360 * ((double)cds.last_translated_pos()  / (double)genome_length));
+      theta_first   = Utils::mod(90 - alpha_first, 360);
+      // theta_last    = Utils::mod(90 - alpha_last, 360);
+      nb_sect       = Utils::mod(alpha_last - alpha_first + 1,  360);
+
+      // These are the same as above but with a higher precision (1/64 degrees)
+      alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length));
+      alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length));
+      theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+      // theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+      nb_sect_64       = Utils::mod(alpha_last_64 - alpha_first_64 + 1,  64 * 360);
+
+
+      // Look for the inmost layer that has all the sectors between
+      // theta_first and theta_last free
+      int16_t layer = 0;
+      bool sectors_free = false;
+      while (! sectors_free)
+      {
+        sectors_free = true;
+
+        for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+        {
+          if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)])
+          {
+            sectors_free = false;
+            break;
+          }
+        }
+
+        if (sectors_free)
+        {
+          break; // All the needed sectors are free on the current layer
+        }
+        else
+        {
+          layer++;
+
+          if (layer >= outmost_layer_)
+          {
+            add_layer();
+            break; // An added layer is necessarily free, no need to look further
+          }
+        }
+      }
+
+      // Mark sectors to be drawn as occupied
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true;
+      }
+      // Mark flanking sectors as occupied
+      occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true;
+      occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true;
+
+
+      // Draw
+      const int8_t cds_layer_spacing = 5; // TODO : param?
+      layer++; // index starting at 0 but needed to start at 1
+
+      int16_t diam2 = diam + (layer * 2 * cds_layer_spacing);
+      pos_x         = canvas_width + (int16_t) round((double)(canvas_width  - diam2) / 2.0);
+      pos_y         = (int16_t) round((double)(canvas_height - diam2) / 2.0);
+
+      char* color = X11Window::color(cds.mean());
+      win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color);
+      delete [] color;
+    }
+
+    // ----------------
+    //  LAGGING strand
+    // ----------------
+    for (const auto& cds: gen_unit->protein_list(LAGGING))
+    {
+      // Alpha : angles from OriC (in degrees)
+      // Theta : angles on the trigonometric circle (in degrees)
+      // nb_sect : "length" in degrees of the arc to be drawn
+      alpha_first   = (int16_t) round(360 * ((double)cds.first_translated_pos() / (double)genome_length));
+      alpha_last    = (int16_t) round(360 * ((double)cds.last_translated_pos()  / (double)genome_length));
+      theta_first   = Utils::mod(90 - alpha_first, 360);
+      // theta_last    = Utils::mod(90 - alpha_last, 360);
+      nb_sect = Utils::mod(alpha_first - alpha_last + 1,  360);
+
+      // These are the same as above but with a higher precision (1/64 degrees)
+      alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds.first_translated_pos() / (double)genome_length));
+      alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds.last_translated_pos() / (double)genome_length));
+      theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+      // theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+      nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1,  64 * 360);
+
+
+      // Look for the inmost layer that has all the sectors between
+      // theta_first and theta_last free
+      int16_t layer = 0;
+      bool sectors_free = false;
+      while (! sectors_free)
+      {
+        sectors_free = true;
+
+        for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+        {
+          if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)])
+          {
+            sectors_free = false;
+            break;
+          }
+        }
+
+        if (sectors_free)
+        {
+          break; // All the needed sectors are free on the current layer
+        }
+        else
+        {
+          layer++;
+
+          if (layer >= outmost_layer_)
+          {
+            add_layer();
+            break; // An added layer is necessarily free, no need to look further
+          }
+        }
+      }
+
+      // Mark sectors to be drawn as occupied
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true;
+      }
+      // Mark flanking sectors as occupied
+      occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true;
+      occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true;
+
+
+      // Draw
+      const int8_t cds_layer_spacing = 5; // TODO : param?
+      layer++; // index starting at 0 but needed to start at 1
+
+      int16_t diam2 = diam - (layer * 2 * cds_layer_spacing);
+      pos_x         = canvas_width + (int16_t) round((double)(canvas_width  - diam2) / 2.0);
+      pos_y         = (int16_t) round((double)(canvas_height - diam2) / 2.0);
+
+      char* color = X11Window::color(cds.mean());
+      win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color);
+      delete [] color;
+    }
+  }
+}
+
+void Individual_X11::display_rnas(X11Window * win)
+{
+  // Retreive the genetic unit corresponding to the main chromosome
+  const GeneticUnit* gen_unit = &genetic_unit_list_.front();
+  int32_t genome_length = gen_unit->dna()->length();
+
+  // Display the number of RNAs
+  char nb_rna[40];
+  sprintf(nb_rna, "Leading : %" PRId32 " RNAs", static_cast<int32_t>(gen_unit->rna_list()[LEADING].size()));
+  win->draw_string(15, 15, nb_rna);
+  sprintf(nb_rna, "Lagging : %" PRId32 " RNAs", static_cast<int32_t>(gen_unit->rna_list()[LAGGING].size()));
+  win->draw_string(15, 30, nb_rna);
+
+  // Compute display diameter according to genome length and window size
+  int16_t win_size      = Utils::min(win->width(), win->height());
+  int16_t diam          = round(win_size * log((double)genome_length) / 16);
+
+  // Prevent diameter from getting greater than 2/3 of the window size
+  if (diam > 2 * win_size / 3)
+  {
+    diam = 2 * win_size / 3;
+  }
+
+  // Compute coordinates of the upper-left corner of the containing square
+  int16_t pos_x = (win->width() - diam) / 2;
+  int16_t pos_y = (win->height() - diam) / 2;
+
+  // Draw main circle
+  win->draw_circle(pos_x, pos_y, diam);
+
+  // Sector occupation management
+  reset_sectors();
+
+
+  // ---------------
+  //  Draw each RNA
+  // ---------------
+  // NB : As we want OriC to be at the "top" of the circle and the orientation
+  //      to be clockwise, the drawing angle (theta) will be given as
+  //      (90 - alpha), alpha being the "classical" trigonometric angle
+  int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
+  int16_t theta_first, theta_last; // Transposed angles on the trigonometric circle (degrees)
+  int16_t nb_sect;
+  // Same as above with precision = 1/64 degree
+  int16_t alpha_first_64, alpha_last_64;
+  int16_t theta_first_64, theta_last_64;
+  int16_t nb_sect_64;
+
+  // ----------------
+  //  LEADING strand
+  // ----------------
+  const auto& rna_lists = gen_unit->rna_list();
+  for (const auto& rna: rna_lists[LEADING])
+  {
+    // Alpha : angles from OriC (in degrees)
+    // Theta : angles on the trigonometric circle (in degrees)
+    // nb_sect : "length" in degrees of the arc to be drawn
+    alpha_first   = (int16_t) round(360 * ((double)rna.first_transcribed_pos() / (double)genome_length));
+    alpha_last    = (int16_t) round(360 * ((double)rna.last_transcribed_pos() / (double)genome_length));
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    theta_last    = Utils::mod(90 - alpha_last, 360);
+    nb_sect       = Utils::mod(alpha_last - alpha_first + 1,  360);
+
+    // These are the same as above but with a higher precision (1/64 degrees)
+    alpha_first_64   = (int16_t) round(64 * 360 * ((double)rna.first_transcribed_pos() / (double)genome_length));
+    alpha_last_64    = (int16_t) round(64 * 360 * ((double)rna.last_transcribed_pos() / (double)genome_length));
+    theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+    theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+    nb_sect_64       = Utils::mod(alpha_last_64 - alpha_first_64 + 1,  64 * 360);
+
+    //~ printf("    LEADING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->first_transcribed_pos(), rna->last_transcribed_pos(), theta_first, theta_last);
+
+
+    // Look for the inmost layer that has all the sectors between
+    // theta_first and theta_last free
+    int16_t layer = 0;
+    bool sectors_free = false;
+    while (! sectors_free)
+    {
+      sectors_free = true;
+
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        if (occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)])
+        {
+          sectors_free = false;
+          break;
+        }
+      }
+
+      if (sectors_free)
+      {
+        break; // All the needed sectors are free on the current layer
+      }
+      else
+      {
+        layer++;
+
+        if (layer >= outmost_layer_)
+        {
+          add_layer();
+          break; // An added layer is necessarily free, no need to look further
+        }
+      }
+    }
+
+    // Mark sectors to be drawn as occupied
+    for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+    {
+      occupied_sectors_[LEADING][layer][Utils::mod(theta_first-rho, 360)] = true;
+    }
+    // Mark flanking sectors as occupied
+    occupied_sectors_[LEADING][layer][Utils::mod(theta_first+1, 360)] = true;
+    occupied_sectors_[LEADING][layer][Utils::mod(theta_first-nb_sect, 360)] = true;
+
+
+    // Determine drawing color
+    char* color;
+    if (rna.is_coding())
+    {
+      color = X11Window::color(rna.basal_level());
+    }
+    else
+    {
+      color = new char[8];
+      strcpy(color, "#FFFFFF");
+    }
+
+    // Draw arrow body
+    const int8_t rna_layer_spacing = 5; // TODO : param?
+    layer++; // index starting at 0 but needed to start at 1
+
+    int16_t diam2 = diam + (layer * 2 * rna_layer_spacing);
+    pos_x         = (int16_t) round((double)(win->width()  - diam2) / 2.0);
+    pos_y         = (int16_t) round((double)(win->height() - diam2) / 2.0);
+
+    win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color);
+
+    // Draw arrow head
+    int8_t arrow_thick = 6; // Must be an even value
+    pos_x = (win->width() / 2.0) + (cos((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
+    pos_y = (win->height() / 2.0) - (sin((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
+
+    win->fill_arc(pos_x, pos_y, arrow_thick, Utils::mod(180+theta_last, 360), 180, color);
+
+    delete [] color;
+  }
+
+  // ----------------
+  //  LAGGING strand
+  // ----------------
+  for (const auto& rna: rna_lists[LAGGING]) {
+    // Alpha : angles from OriC (in degrees)
+    // Theta : angles on the trigonometric circle (in degrees)
+    // nb_sect : "length" in degrees of the arc to be drawn
+    alpha_first   = (int16_t) round(360 * ((double)rna.first_transcribed_pos() / (double)genome_length));
+    alpha_last    = (int16_t) round(360 * ((double)rna.last_transcribed_pos()  / (double)genome_length));
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    theta_last    = Utils::mod(90 - alpha_last, 360);
+    nb_sect = Utils::mod(alpha_first - alpha_last + 1,  360);
+
+    // These are the same as above but with a higher precision (1/64 degrees)
+    alpha_first_64   = (int16_t) round(64 * 360 * ((double)rna.first_transcribed_pos() / (double)genome_length));
+    alpha_last_64    = (int16_t) round(64 * 360 * ((double)rna.last_transcribed_pos()  / (double)genome_length));
+    theta_first_64   = Utils::mod(64 * 90 - alpha_first_64, 64 * 360);
+    theta_last_64    = Utils::mod(64 * 90 - alpha_last_64, 64 * 360);
+    nb_sect_64 = Utils::mod(alpha_first_64 - alpha_last_64 + 1,  64 * 360);
+
+    //~ printf("    LAGGING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->first_transcribed_pos(), rna->last_transcribed_pos(), theta_first, theta_last);
+
+
+    // Look for the inmost layer that has all the sectors between
+    // theta_first and theta_last free
+    int16_t layer = 0;
+    bool sectors_free = false;
+    while (! sectors_free)
+    {
+      sectors_free = true;
+
+      for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+      {
+        if (occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)])
+        {
+          sectors_free = false;
+          break;
+        }
+      }
+
+      if (sectors_free)
+      {
+        break; // All the needed sectors are free on the current layer
+      }
+      else
+      {
+        layer++;
+
+        if (layer >= outmost_layer_)
+        {
+          add_layer();
+          break; // An added layer is necessarily free, no need to look further
+        }
+      }
+    }
+
+    // Mark sectors to be drawn as occupied
+    for (int16_t rho = 0 ; rho < nb_sect ; rho++)
+    {
+      occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+rho, 360)] = true;
+    }
+    // Mark flanking sectors as occupied
+    occupied_sectors_[LAGGING][layer][Utils::mod(theta_first-1, 360)] = true;
+    occupied_sectors_[LAGGING][layer][Utils::mod(theta_first+nb_sect, 360)] = true;
+
+
+    // Determine drawing color
+    char* color;
+    if (rna.is_coding())
+    {
+      color = X11Window::color(rna.basal_level());
+    }
+    else
+    {
+      color = new char[8];
+      strcpy(color, "#FFFFFF");
+    }
+
+    // Draw arrow body
+    const int8_t rna_layer_spacing = 5; // TODO : param?
+    layer++; // index starting at 0 but needed to start at 1
+
+    int16_t diam2 = diam - (layer * 2 * rna_layer_spacing);
+    pos_x         = (int16_t) round((double)(win->width()  - diam2) / 2.0);
+    pos_y         = (int16_t) round((double)(win->height() - diam2) / 2.0);
+
+    win->draw_arc_64(pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color);
+
+    // Draw arrow head
+    int8_t arrow_thick = 6; // Must be an even value
+    pos_x = (win->width() / 2.0) + (cos((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
+    pos_y = (win->height() / 2.0) - (sin((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
+
+    win->fill_arc(pos_x, pos_y, arrow_thick, theta_last, 180, color);
+
+    delete [] color;
+  }
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void Individual_X11::add_layer()
+{
+  occupied_sectors_[LEADING][outmost_layer_] = new bool[360];
+  occupied_sectors_[LAGGING][outmost_layer_] = new bool[360];
+
+  for (int16_t angle = 0 ; angle < 360 ; angle++)
+  {
+    occupied_sectors_[LEADING][outmost_layer_][angle] = false;
+    occupied_sectors_[LAGGING][outmost_layer_][angle] = false;
+  }
+
+  outmost_layer_++;
+}
+
+void Individual_X11::init_occupied_sectors()
+{
+  outmost_layer_ = 1;
+
+  for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++)
+  {
+    occupied_sectors_[LEADING][layer] = new bool[360];
+    occupied_sectors_[LAGGING][layer] = new bool[360];
+  }
+}
+
+void Individual_X11::reset_sectors()
+{
+  for (int16_t layer = 0 ; layer < outmost_layer_ ; layer++)
+  {
+    for (int16_t angle = 0 ; angle < 360 ; angle++)
+    {
+      occupied_sectors_[LEADING][layer][angle] = false;
+      occupied_sectors_[LAGGING][layer][angle] = false;
+    }
+  }
+}
+} // namespace aevol
diff --git a/src/libaevol/ae_fuzzy_set_X11.h b/src/libaevol/Individual_X11.h
similarity index 69%
rename from src/libaevol/ae_fuzzy_set_X11.h
rename to src/libaevol/Individual_X11.h
index 2414c48..1a6f025 100644
--- a/src/libaevol/ae_fuzzy_set_X11.h
+++ b/src/libaevol/Individual_X11.h
@@ -3,49 +3,49 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_FUZZY_SET_X11_H__
-#define __AE_FUZZY_SET_X11_H__
- 
- 
+
+
+#ifndef  AEVOL_INDIVIDUAL_X11_H_
+#define  AEVOL_INDIVIDUAL_X11_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <zlib.h>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_fuzzy_set.h>
-#include <ae_X11_window.h>
-
-
+#include "Individual.h"
+#include "X11Window.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
@@ -55,52 +55,72 @@
 
 
 
- 
-class ae_fuzzy_set_X11 : public ae_fuzzy_set
-{  
+
+class Individual_X11 : public virtual Individual
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_fuzzy_set_X11( void );
-    ae_fuzzy_set_X11( const ae_fuzzy_set &model );
+    Individual_X11(ExpManager * exp_manager, gzFile backup_file);
+    //Individual_X11(const Individual_X11 &model, bool replication_report_copy);
+    Individual_X11(const Individual_X11& other);
+    Individual_X11(ExpManager * exp_m,
+      std::shared_ptr<JumpingMT> mut_prng,
+      std::shared_ptr<JumpingMT> stoch_prng,
+      std::shared_ptr<MutationParams> param_mut,
+      double w_max,
+      int32_t min_genome_length,
+      int32_t max_genome_length,
+      bool allow_plasmids,
+      int32_t id,
+      const char* strain_name,
+      int32_t age);
+    Individual_X11(Individual_X11 * const parent, int32_t id,
+                      std::shared_ptr<JumpingMT> mut_prng,
+                      std::shared_ptr<JumpingMT> stoch_prng);
+    Individual_X11() = delete; // forbidden constructor
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_fuzzy_set_X11( void );
-  
+
+    virtual ~Individual_X11();
+
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+
     // =================================================================
     //                            Public Methods
     // =================================================================
-    virtual void display( ae_X11_window* win, color_map color, bool fill = false, bool bold = false );
-  
+    virtual void display();
+    virtual void display_cdss(X11Window * win);
+    virtual void display_rnas(X11Window * win);
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-  
-  
-  
-  
-  
+
+
+
+
+
   protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-   
     // =================================================================
     //                           Protected Methods
     // =================================================================
-  
+    void reset_sectors();
+    void add_layer();
+    void init_occupied_sectors();
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
+    // These are used to manage overlapping CDS and RNA display
+    int16_t outmost_layer_;
+    bool*   occupied_sectors_[2][100];  // TODO : find a way to manage this table's size properly?
 };
 
 
@@ -108,5 +128,6 @@ class ae_fuzzy_set_X11 : public ae_fuzzy_set
 //                          Accessors definitions
 // =====================================================================
 
+} // namespace aevol
 
-#endif // __AE_FUZZY_SET_X11_H__
+#endif // AEVOL_INDIVIDUAL_X11_H_
diff --git a/src/libaevol/ae_grid_cell.cpp b/src/libaevol/InsertionHT.cpp
similarity index 52%
copy from src/libaevol/ae_grid_cell.cpp
copy to src/libaevol/InsertionHT.cpp
index ca43c39..3c0845c 100644
--- a/src/libaevol/ae_grid_cell.cpp
+++ b/src/libaevol/InsertionHT.cpp
@@ -3,96 +3,80 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_grid_cell.h>
-#include <ae_individual.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_grid_cell                             #
-//                                                                             #
-//##############################################################################
+//
+// ****************************************************************************
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "InsertionHT.h"
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+InsertionHT::InsertionHT(VisAVis& donor_donor_align, VisAVis& exo_recv_align,
+                         int32_t length, char* seq, int32_t donor_id)
+    : donor_donor_align_(donor_donor_align), exo_recv_align_(exo_recv_align),
+      length_(length), donor_id_(donor_id) {
+  assert(donor_donor_align_.sense() == DIRECT);
+  seq_ = new char[length_ + 1];
+  memcpy(seq_, seq, length_ + 1);
+}
 
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_grid_cell::ae_grid_cell( int16_t x, int16_t y, ae_individual* indiv )
-{
-  _x = x;
-  _y = y;
-  
-  _compound_amount  = 0.0;
-  
-  _individual       = indiv;
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+InsertionHT::~InsertionHT() noexcept {
+  delete seq_;
 }
 
-ae_grid_cell::ae_grid_cell( gzFile backup_file )
-{
-  gzread( backup_file, &_x, sizeof(_x) );
-  gzread( backup_file, &_y, sizeof(_y) );
-  
-  gzread( backup_file, &_compound_amount, sizeof(_compound_amount) );
-  
-  _individual = NULL;
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void InsertionHT::save(gzFile backup_file) const {
+  Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_grid_cell::~ae_grid_cell( void )
-{
+void InsertionHT::load(gzFile backup_file) {
+  Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_grid_cell::save( gzFile backup_file ) const
-{
-  gzwrite( backup_file, &_x, sizeof(_x) );
-  gzwrite( backup_file, &_y, sizeof(_y) );
-  
-  gzwrite( backup_file, &_compound_amount, sizeof(_compound_amount) );
+void InsertionHT::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(),
+          donor_pos1(), donor_pos2(), exogenote_pos(), receiver_pos(),
+          sense(),
+          donor_donor_align_.score(), exo_recv_align_.score(),
+          length_, (int32_t) -1);
 }
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/InsertionHT.h b/src/libaevol/InsertionHT.h
new file mode 100644
index 0000000..cafe92a
--- /dev/null
+++ b/src/libaevol/InsertionHT.h
@@ -0,0 +1,136 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_INSERTION_HT_H_
+#define AEVOL_INSERTION_HT_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "HorizontalTransfer.h"
+#include "VisAVis.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class InsertionHT : public HorizontalTransfer {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  InsertionHT() = default; //< Default ctor
+  InsertionHT(const InsertionHT&) = default; //< Copy ctor
+  InsertionHT(InsertionHT&&) = delete; //< Move ctor
+  InsertionHT(VisAVis& donor_donor_align, VisAVis& exo_recv_align,
+              int32_t length, char* seq, int32_t donor_id);
+
+  virtual Mutation* Clone() const override { return new InsertionHT(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~InsertionHT() noexcept; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  InsertionHT& operator=(const InsertionHT& other) = default;
+
+  /// Move assignment
+  InsertionHT& operator=(InsertionHT&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return INS_HT;
+  };
+
+  int32_t donor_pos1() const {
+    return donor_donor_align_.i_1();
+  }
+
+  int32_t donor_pos2() const {
+    return donor_donor_align_.i_2();
+  }
+
+  int32_t exogenote_pos() const {
+    return exo_recv_align_.i_1();
+  }
+
+  int32_t receiver_pos() const {
+    return exo_recv_align_.i_2();
+  }
+
+  AlignmentSense sense() const {
+    return exo_recv_align_.sense();
+  }
+
+  int32_t length() const {
+    return length_;
+  }
+
+  char* seq() const {
+    return seq_;
+  }
+
+  int32_t donor_id() const {
+    return donor_id_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  VisAVis donor_donor_align_, exo_recv_align_;
+  int32_t length_;
+  char* seq_ = nullptr;
+  int32_t donor_id_ = -1;
+};
+
+} // namespace aevol
+#endif //AEVOL_INSERTION_HT_H_
diff --git a/src/libaevol/f_line.cpp b/src/libaevol/Inversion.cpp
similarity index 52%
copy from src/libaevol/f_line.cpp
copy to src/libaevol/Inversion.cpp
index 710c0a4..ea03e84 100644
--- a/src/libaevol/f_line.cpp
+++ b/src/libaevol/Inversion.cpp
@@ -3,74 +3,79 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-//##############################################################################
-//                                                                             #
-//                             Class f_line                                    #
-//                                                                             #
-//##############################################################################
+//
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Inversion.h"
 
+namespace aevol {
 
-// =================================================================
-//                             Constructors
-// =================================================================
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
+// ============================================================================
+//                                Constructors
+// ============================================================================
+Inversion::Inversion(int32_t pos1, int32_t pos2, int32_t length,
+                     int16_t align_score) :
+    pos1_(pos1), pos2_(pos2),
+    length_(length), align_score_(align_score) {
+}
 
-f_line::f_line( void )
-{
-  nb_words = 0;
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Inversion::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = INV;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos1_, sizeof(pos1_));
+  gzwrite(backup_file, &pos2_, sizeof(pos2_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, &align_score_, sizeof(align_score_));
 }
 
+void Inversion::load(gzFile backup_file) {
+  gzread(backup_file, &pos1_, sizeof(pos1_));
+  gzread(backup_file, &pos2_, sizeof(pos2_));
+  gzread(backup_file, &length_, sizeof(length_));
+  gzread(backup_file, &align_score_, sizeof(align_score_));
+}
 
-// =================================================================
-//                             Destructors
-// =================================================================
+void Inversion::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos1(), pos2(), -1, -1,
+          -1, align_score_, -1, length_, -1);
+}
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/Inversion.h b/src/libaevol/Inversion.h
new file mode 100644
index 0000000..20a1e99
--- /dev/null
+++ b/src/libaevol/Inversion.h
@@ -0,0 +1,118 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_INVERSION_H_
+#define AEVOL_INVERSION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "Rearrangement.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class Inversion : public Rearrangement{
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Inversion() = default; //< Default ctor
+  Inversion(const Inversion&) = default; //< Copy ctor
+  Inversion(Inversion&&) = delete; //< Move ctor
+  Inversion(int32_t pos1, int32_t pos2,
+            int32_t length, int16_t align_score = -1);
+
+  virtual Mutation* Clone() const override { return new Inversion(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Inversion() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  Inversion& operator=(const Inversion& other) = default;
+
+  /// Move assignment
+  Inversion& operator=(Inversion&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return INV;
+  };
+
+  int32_t pos1() const {
+    return pos1_;
+  }
+
+  int32_t pos2() const {
+    return pos2_;
+  }
+
+  int32_t length() const {
+    return length_;
+  }
+
+  int16_t align_score() const {
+    return align_score_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos1_, pos2_;
+  int32_t length_;
+  int16_t align_score_ = -1;
+};
+
+} // namespace aevol
+#endif //AEVOL_INVERSION_H_
diff --git a/src/libaevol/JumpPoly.h b/src/libaevol/JumpPoly.h
new file mode 100644
index 0000000..dc98d80
--- /dev/null
+++ b/src/libaevol/JumpPoly.h
@@ -0,0 +1,62 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+#ifndef AEVOL_JUMP_POLY_H_
+#define AEVOL_JUMP_POLY_H_
+
+namespace aevol {
+
+/*! \brief Definition of jumping polynomials for various settings of the Mersenne Twister
+*/
+
+#if SFMT_MEXP == 607
+constexpr const char* jump_poly = "2c375358c852082b88bdf47ffe5ac31b6cd4e255a12f271951f250f805d473248be9e75baee81f0474e793983cdc11c198d269b4bd9c34ca9eec3f91cceb172450d9b6001eaa29d97ba1cdb59c50684e";
+#elif SFMT_MEXP == 1279
+constexpr const char* jump_poly = "d9b26ff41ff79250750aa52e7426726d6ade8b9ee66174636bc772ade2aec8f913f573763a809dbeebac14488a5e04da0adc700e064da0ee470935e771d119eb9f08bfa78a3ac74516f4aa8b7885bf212287c03ab64837e8a56c12a0862adfc9a6d054e372b3ae2e11cd2d3c4a3ea924b6beb11f8f96227c61cf8b528b59565b2c040962d5d24d37cf7a0dee5175ca10e0ac797f8f1a3eb99a319ad15d540996";
+#elif SFMT_MEXP == 2281
+constexpr const char* jump_poly = "2b1e867bcc6a7adda82c2a26cb38b0ccb7f236848f6c3179e98b5d8b9db21d7df3bfa37941c8fcc0fa42cc4e244503040bad9575e6b0c138d52fe3f83b851495995a561ce64df116fa918b247e3a43817dd77f41115150cf2802c7a511f4e1487798ae3ee0b3cc2e155f82575731dc3bca3a08df85f511179bd7435c9594bd8dc28068d35251820015cd3ef7a23c8d5a1cabb6149a8e36216d4c9838b3ef79d06cb6e2f6e26daef80c2803f11bc03d06f75c2d69f064b72d3abf526961af2510cf688af3f2bfc56e7e4e11286a6302ee21e1109e0f3fbe328d9ad907976fde4aff6e683e3 [...]
+#elif SFMT_MEXP == 4253
+constexpr const char* jump_poly = "9da17b7f8b81dd8668afea353420300fc56674207f120d8350c6b565d3a04608ebad52f9826d4f0d30b6547ef0ee6be8bfd85d970ee9d7573c72f44a7a90f2eb86d59528a8146b811407f1b08c61d5e349bda9aac6a04a785ba66736e5160858e123a2d06fdfe59eef6e7093b54da08219a3f179cd2776e4595bce3c72307dc555f3d9485d1f82b2a46dded685d2e200d93584a49eae81b541d2e7eb0a1c3cf8d13ba75119a15e606decbb2067e8a760bd024a3dc2b2c703fae28db65a0fbca2466aa2bac285200cfd1702a9b47b29541ae4375b23734d0ff26254e855ad912e9260713a1 [...]
+#elif SFMT_MEXP == 11213
+constexpr const char* jump_poly = "e1fb174eeaec8c048fdd060653c54c0e59746d6bc66ff4cabbbda5f086d06d3796982a80b6467dde91bcd2922b87732361602b2c5610b8146fda7090b5d82aca1c69d40fa235b4f9b44bfc75bf670d089dae22e63f416d009eda5ec00af694026ff7fa0889f830d1ffd0863785190a8c65ff1baa8f5379451d3964766c7e205aa30c66c33f7734a906f8348e008d5d8f1194625711028a77443c986cb71f19b805c9866afdf2f65aed441faa734749dab56e908d1c8edfcba9b0b65752ad5cdafb4efbb18f3bff49974f26cca3a5ac90f97a714fa0b84124f227b4cde80230911be4493a9 [...]
+#elif SFMT_MEXP == 19937
+constexpr const char* jump_poly = "a23d5563c1fff635b7d3687fe879e3d54f7caddb7371f6174fbd8870d7b7db4aedc6a2c671133f72ab011abf5a98910b1024f2e5c1e89722572831d99320b814b252d58f9433ca547804394c69f4ed2b612068320daad25dc1e0bcef4c59deaa0095329c362103eda909c683e0a9b398efc2b69ac74087f0443842ce5c618d4bb58c66b3046dc752a633f040b2be7b32c7e7de01e17f93a10329d9249bb0a9c25bc41f3831c66a255a61904ce209dee70e7448df9aa741d01da9368ff827915b6f5860cdce17ee9c0e462fdb983709229b4e011796e425d5c0c42079bdae36dcda3760331 [...]
+#elif SFMT_MEXP == 44497
+constexpr const char* jump_poly = "6caad9646010c6e030ad6486ede1d7e2d0d9122a99553188d1972357e0eeeb500586646c540a925f430cbfef2ec953b259bc21128bc82e8e3fdd29310fc07e48578b710f4002a6bc178b59dbbab4e2d999c2ad41844859541c857e4efb86f1b66ffce0d43aa66a041ec2b48ec669cca2fb86abac00cb2e8323bf3977d0bbb2c7c711b4bed35578d7b8bfb6cd0698ca5112785bd5e94604c825e3a268cf5e83d30cf2f587d5267e7938053291e837ddfa99baa243aa39ea065f893854ff28987163ae1aa0b4c1cfa186c8046add5844d345401f8a56e0b4240484551f0431da0620cbbd33b [...]
+#elif SFMT_MEXP == 86243
+constexpr const char* jump_poly = "933da3fcceeb5ce9c3b6f2eea0dda398900240ba716aef34723cf6d7417c4318858493833a3cbb3d094d1b5b977c7a87105827de0ac72d586ef73bd385022eb28e52f3ac527785bede4fda45a0f320de350efecae3a0553e56f4aab32e02124bf83b07f989d2b37fbc4b45c994ccd03f909a83e08c7458a8bc79dc5eda62b7667ea1acf094b636e81119b9a9ec0ddadb9c3433de8d0516d456b529e9fa08382f030c411dfa02a7adaf9a16ce5193f0a17b673d4c5f32b296b21a3af5bdc6da5f4043d34599b04c55ac6f0d4f4dc28ea46101bfa35219d2b79a33cfeb9612bfbcd761925e2 [...]
+#elif SFMT_MEXP == 132049
+constexpr const char* jump_poly = "ee86f54b0be59c6204771bea03d614ca275a40a9a3ef32f8a14fea7d0a74faef106b8c6406a8dc468b78b5494b3620ac0b895c23685904c1cefb5c80336caa2ef9d5b595733f2a6f4ba6f1acc44cce80ba67f0da127f98de09e07314c32551a9854d09a8d9a64b9f3feaec4551d7192c49c2f02ecc26f5f2fd1da46a77aa0c3f50576c5cb604105abb3af3acfaa7ba2dbe5df35af84dffe4ae0cebaa2fa8ff5c85ffa5dadb5881d02acaf4c7412a8c1b29503150c96fa2dac1dd44d771fd6751bb3b53082a9723e2a80de276229143bdee8e97ff04330b01b18c045eea05eb2dcde96d4ab [...]
+#elif SFMT_MEXP == 216091
+constexpr const char* jump_poly = "fabdf682938a008933e7f552cdb0c935af57be5a1b9ad2331f52d39f03f0faf355a359cf9953bb56f515d37ec77c1a681737893e649c9552c7d4b275924c17a7395674d620a389468d1735220fc98d9d562a3a04c82b9155ce8b367353578f378cef6e8da22df79d90d2e6caca511b9fd96d3e6bf03e3b2fdb9d7639999fc77a14373f339f30c3c54d575eb043a38fd1fa1a1b1175ed5f31d40e374b2f1ed6ed98dc24a8a8c0d47a208ab0ac2ec865b4f8ba268081d727ff07965bba7a47fe9500ccf12f4d042613bba5a65fbdaa51b05bd28b0a2839d51e887aadb91ca89c0b627539fae [...]
+#endif
+
+} // namespace aevol
+
+#endif // AEVOL_JUMP_POLY_H_
diff --git a/src/libaevol/ae_jumping_mt.cpp b/src/libaevol/JumpingMT.cpp
similarity index 58%
rename from src/libaevol/ae_jumping_mt.cpp
rename to src/libaevol/JumpingMT.cpp
index 096d89b..4bf3e7a 100644
--- a/src/libaevol/ae_jumping_mt.cpp
+++ b/src/libaevol/JumpingMT.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -31,30 +31,31 @@
 //                              Libraries
 // =================================================================
 #include <string.h>
-#include <time.h>
+#include "AeTime.h"
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_jumping_mt.h>
-#include <ae_jump_poly.h>
+#include "JumpingMT.h"
+#include "JumpPoly.h"
 
 
+namespace aevol {
 
 
 //##############################################################################
 //                                                                             #
-//                             Class ae_jumping_mt                             #
+//                             Class JumpingMT                             #
 //                                                                             #
 //##############################################################################
 
 // =================================================================
 //                    Definition of static attributes
 // =================================================================
-int32_t ae_jumping_mt::nb_jumps   = 0;
-double  ae_jumping_mt::jump_time  = 0;
+int32_t JumpingMT::nb_jumps   = 0;
+double  JumpingMT::jump_time  = 0;
 
 // =================================================================
 //                             Constructors
@@ -62,11 +63,11 @@ double  ae_jumping_mt::jump_time  = 0;
 /*!
   Create a generator initialized with a simple uint32_t
  */
-ae_jumping_mt::ae_jumping_mt( const uint32_t& simple_seed )
+JumpingMT::JumpingMT(const uint32_t& simple_seed)
 {
-  _sfmt = new sfmt_t();
-  sfmt_init_gen_rand( _sfmt, simple_seed );
-  
+  sfmt_ = new sfmt_t();
+  sfmt_init_gen_rand(sfmt_, simple_seed);
+
   // Jump to get rid of the initializatino skew
   jump();
 }
@@ -74,29 +75,29 @@ ae_jumping_mt::ae_jumping_mt( const uint32_t& simple_seed )
 /*!
   Create a copy of an existing generator
  */
-ae_jumping_mt::ae_jumping_mt( const ae_jumping_mt& model )
+JumpingMT::JumpingMT(const JumpingMT & model)
 {
-  _sfmt = new sfmt_t();
-  memcpy(_sfmt->state, model._sfmt->state, SFMT_N*sizeof(_sfmt->state[0]));
-  _sfmt->idx = model._sfmt->idx;
+  sfmt_ = new sfmt_t();
+  memcpy(sfmt_->state, model.sfmt_->state, SFMT_N*sizeof(sfmt_->state[0]));
+  sfmt_->idx = model.sfmt_->idx;
 }
 
 /*!
   Load a generator from a gz backup file
  */
-ae_jumping_mt::ae_jumping_mt( gzFile backup_file )
+JumpingMT::JumpingMT(gzFile backup_file)
 {
-  _sfmt = new sfmt_t();
-  gzread( backup_file, _sfmt->state, SFMT_N * sizeof( _sfmt->state[0] ) );
-  gzread( backup_file, &(_sfmt->idx), sizeof( _sfmt->idx ) );
+  sfmt_ = new sfmt_t();
+  gzread(backup_file, sfmt_->state, SFMT_N * sizeof(sfmt_->state[0]));
+  gzread(backup_file, &(sfmt_->idx), sizeof(sfmt_->idx));
 }
 
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_jumping_mt::~ae_jumping_mt( void )
+JumpingMT::~JumpingMT()
 {
-  delete _sfmt;
+  delete sfmt_;
 }
 
 // =================================================================
@@ -105,29 +106,29 @@ ae_jumping_mt::~ae_jumping_mt( void )
 /*!
   Jump Ahead by a predefined jump length
  */
-void ae_jumping_mt::jump( void )
+void JumpingMT::jump()
 {
   //~ clock_t start, end;
   //~ start = clock();
-  
+
   #ifdef TRIVIAL_METHOD_JUMP_SIZE
-    for ( int i = 0 ; i < TRIVIAL_METHOD_JUMP_SIZE ; i++ )
+    for (int i = 0 ; i < TRIVIAL_METHOD_JUMP_SIZE ; i++)
     {
-      sfmt_genrand_real2( _sfmt );
+      sfmt_genrand_real2(sfmt_);
     }
   #else
-    SFMT_jump( _sfmt, jump_poly );
+    SFMT_jump(sfmt_, jump_poly);
   #endif
-    
-    
+
+
   //~ int nb_sup_steps = 100 * (double)rand() / ((double)RAND_MAX + 1);
-  //~ for ( int i = 0 ; i < nb_sup_steps ; i++ )
+  //~ for (int i = 0 ; i < nb_sup_steps ; i++)
   //~ {
-    //~ sfmt_genrand_real2( _sfmt );
+    //~ sfmt_genrand_real2(sfmt_);
   //~ }
-    
-  
-  
+
+
+
   //~ end = clock();
   //~ jump_time += (end - start) * 1000 / CLOCKS_PER_SEC;
   //~ nb_jumps++;
@@ -138,115 +139,115 @@ void ae_jumping_mt::jump( void )
 
   Number of successes out of nb_drawings trials each of probability prob.
  */
-int32_t ae_jumping_mt::binomial_random( int32_t nb_drawings, double prob )
+int32_t JumpingMT::binomial_random(int32_t nb_drawings, double prob)
 {
   int32_t nb_success;
 
-  // The binomial distribution is invariant under changing 
-  // ProbSuccess to 1-ProbSuccess, if we also change the answer to 
+  // The binomial distribution is invariant under changing
+  // ProbSuccess to 1-ProbSuccess, if we also change the answer to
   // NbTrials minus itself; we ll remember to do this below.
   double p;
-  if ( prob <= 0.5 ) p = prob;
+  if (prob <= 0.5) p = prob;
   else p = 1.0 - prob;
 
-  // mean of the deviate to be produced   
-  double mean = nb_drawings * p; 
+  // mean of the deviate to be produced
+  double mean = nb_drawings * p;
+
 
-  
-  if ( nb_drawings < 25 )
-  // Use the direct method while NbTrials is not too large. 
-  // This can require up to 25 calls to the uniform random. 
+  if (nb_drawings < 25)
+  // Use the direct method while NbTrials is not too large.
+  // This can require up to 25 calls to the uniform random.
   {
-    nb_success = 0; 
-    for ( int32_t j = 1 ; j <= nb_drawings ; j++ ) 
+    nb_success = 0;
+    for (int32_t j = 1 ; j <= nb_drawings ; j++)
     {
-      if ( random() < p ) nb_success++; 
+      if (random() < p) nb_success++;
     }
   }
-  else if ( mean < 1.0 )
-  // If fewer than one event is expected out of 25 or more trials, 
-  // then the distribution is quite accurately Poisson. Use direct Poisson method. 
+  else if (mean < 1.0)
+  // If fewer than one event is expected out of 25 or more trials,
+  // then the distribution is quite accurately Poisson. Use direct Poisson method.
   {
-    double g = exp( -mean ); 
-    double t = 1.0; 
+    double g = exp(-mean);
+    double t = 1.0;
     int32_t j;
-    for ( j = 0; j <= nb_drawings ; j++ ) 
-    { 
-      t = t * random(); 
-      if ( t < g ) break; 
+    for (j = 0; j <= nb_drawings ; j++)
+    {
+      t = t * random();
+      if (t < g) break;
     }
 
-    if ( j <= nb_drawings ) nb_success = j;
+    if (j <= nb_drawings) nb_success = j;
     else nb_success = nb_drawings;
   }
 
   else
   // Use the rejection method.
   {
-    double en     = nb_drawings; 
-    double oldg   = gammln( en + 1.0 ); 
-    double pc     = 1.0 - p; 
-    double plog   = log( p ); 
-    double pclog  = log( pc ); 
-    
+    double en     = nb_drawings;
+    double oldg   = gammln(en + 1.0);
+    double pc     = 1.0 - p;
+    double plog   = log(p);
+    double pclog  = log(pc);
+
     // rejection method with a Lorentzian comparison function.
-    double sq = sqrt( 2.0 * mean * pc );  
+    double sq = sqrt(2.0 * mean * pc);
     double angle, y, em, t;
-    do 
+    do
     {
-      do 
+      do
       {
-        angle = M_PI * random(); 
-        y = tan( angle ); 
-        em = sq*y + mean; 
-      } while ( em < 0.0 || em >= (en + 1.0) ); // Reject. 
+        angle = M_PI * random();
+        y = tan(angle);
+        em = sq*y + mean;
+      } while (em < 0.0 || em >= (en + 1.0)); // Reject.
 
-      em = floor( em ); // Trick for integer-valued distribution. 
+      em = floor(em); // Trick for integer-valued distribution.
       t = 1.2 * sq * (1.0 + y*y)
-              * exp( oldg - gammln(em + 1.0) - gammln(en - em + 1.0) + em * plog + (en - em) * pclog ); 
+              * exp(oldg - gammln(em + 1.0) - gammln(en - em + 1.0) + em * plog + (en - em) * pclog);
 
-    } while ( random() > t ); // Reject. This happens about 1.5 times per deviate, on average. 
-    
-    nb_success = (int32_t) rint( em ); 
+    } while (random() > t); // Reject. This happens about 1.5 times per deviate, on average.
+
+    nb_success = (int32_t) rint(em);
   }
-  
-  
-  // Undo the symmetry transformation. 
-  if ( p != prob ) nb_success = nb_drawings - nb_success;
+
+
+  // Undo the symmetry transformation.
+  if (p != prob) nb_success = nb_drawings - nb_success;
 
   return nb_success;
 }
 
-double ae_jumping_mt::gaussian_random( void )
+double JumpingMT::gaussian_random()
 {
   double x1, x2;
   double r = 0;
-  do 
+  do
   {
     x1 = 2.0 * random() - 1.0;
     x2 = 2.0 * random() - 1.0;
-    
+
     r = x1*x1 + x2*x2; // (x1,x2) must be in the unit circle
-  } 
-  while ( (r >= 1.0) || (r == 0) );
-  
-  r = sqrt( (-2.0 * log(r)) / r ); // Box-muller transformation
-  
+  }
+  while ((r >= 1.0) || (r == 0));
+
+  r = sqrt((-2.0 * log(r)) / r); // Box-muller transformation
+
   return x1 * r;
 }
 
-int8_t ae_jumping_mt::roulette_random( double* probs, int8_t nb_elts )
+int8_t JumpingMT::roulette_random(double* probs, int8_t nb_elts)
 {
   double pick_one = 0.0;
-  while ( pick_one == 0 )
+  while (pick_one == 0)
   {
     pick_one = random();
   }
-  
+
   int8_t found_org = 0;
-  
+
   pick_one -= probs[0];
-  while ( pick_one > 0 )
+  while (pick_one > 0)
   {
     assert(found_org<nb_elts-1);
     pick_one -= probs[++found_org];
@@ -254,7 +255,7 @@ int8_t ae_jumping_mt::roulette_random( double* probs, int8_t nb_elts )
   return found_org;
 }
 
-void ae_jumping_mt::multinomial_drawing( int32_t* destination, double* source, int32_t nb_drawings, int32_t nb_colors )
+void JumpingMT::multinomial_drawing(int32_t* destination, double* source, int32_t nb_drawings, int32_t nb_colors)
 {
   //    This function generates a vector of random variates, each with the
   //    binomial distribution (source code from http://www.agner.org/random/).
@@ -262,63 +263,63 @@ void ae_jumping_mt::multinomial_drawing( int32_t* destination, double* source, i
   //    balls from an urn with more than two colors, with replacement.
 
   //    Parameters:
-  //    destination:    An output array to receive the number of balls of each 
+  //    destination:    An output array to receive the number of balls of each
   //                    color. Must have space for at least 'nb_colors' elements.
-  //    source:         An input array containing the probability or fraction 
+  //    source:         An input array containing the probability or fraction
   //                    of each color in the urn. Must have 'nb_colors' elements.
   //                    All elements must be non-negative. The sum doesn't have
   //                    to be 1, but the sum must be positive.
-  //    nb_drawings:    The number of balls drawn from the urn.                   
-  //    nb_colors:      The number of possible colors. 
-  
-  
-  if ( nb_drawings < 0 || nb_colors < 0 ) 
+  //    nb_drawings:    The number of balls drawn from the urn.
+  //    nb_colors:      The number of possible colors.
+
+
+  if (nb_drawings < 0 || nb_colors < 0)
   {
-    printf( "%s:%d: error: Negative parameter in multinomial function.\n", __FILE__, __LINE__ );
-    assert( false );
-    exit( EXIT_FAILURE );
+    printf("%s:%d: error: Negative parameter in multinomial function.\n", __FILE__, __LINE__);
+    assert(false);
+    exit(EXIT_FAILURE);
   }
-  if ( nb_colors == 0 ) return;
-  
+  if (nb_colors == 0) return;
+
   // compute sum of probabilities
   double sum = 0.0;
   double p;
-  for ( int32_t i = 0 ; i < nb_colors ; i++ ) 
-  { 
+  for (int32_t i = 0 ; i < nb_colors ; i++)
+  {
     p = source[i];
-    if ( p < 0 )
+    if (p < 0)
     {
-      printf( "%s:%d: error: Negative parameter in multinomial function.\n", __FILE__, __LINE__ );
-      assert( false );
-      exit( EXIT_FAILURE );
+      printf("%s:%d: error: Negative parameter in multinomial function.\n", __FILE__, __LINE__);
+      assert(false);
+      exit(EXIT_FAILURE);
     }
     sum += p;
   }
-  if ( sum == 0 && nb_drawings > 0 ) 
+  if (sum == 0 && nb_drawings > 0)
   {
-    printf( "Zero sum in multinomial function\n" );
-    assert( false );
-    exit( EXIT_FAILURE );
+    printf("Zero sum in multinomial function\n");
+    assert(false);
+    exit(EXIT_FAILURE);
   }
 
   int32_t x;
   int32_t n = nb_drawings;
-  for ( int32_t i = 0 ; i < nb_colors - 1 ; i++ ) 
-  { 
+  for (int32_t i = 0 ; i < nb_colors - 1 ; i++)
+  {
     // generate output by calling binomial (nb_colors-1) times
     p = source[i];
-    if ( sum <= p ) 
+    if (sum <= p)
     {
       // this fixes two problems:
       // 1. prevent division by 0 when sum = 0
       // 2. prevent p/sum getting bigger than 1 in case of rounding errors
       x = n;
     }
-    else 
-    {    
-      x = binomial_random( n, p/sum );
+    else
+    {
+      x = binomial_random(n, p/sum);
     }
-    n = n - x; 
+    n = n - x;
     sum = sum - p;
     destination[i] = x;
   }
@@ -327,43 +328,44 @@ void ae_jumping_mt::multinomial_drawing( int32_t* destination, double* source, i
   destination[nb_colors-1] = n;
 }
 
-void ae_jumping_mt::save( gzFile backup_file ) const
+void JumpingMT::save(gzFile backup_file) const
 {
-  gzwrite( backup_file, _sfmt->state, SFMT_N * sizeof( _sfmt->state[0] ) );
-  gzwrite( backup_file, &(_sfmt->idx), sizeof( _sfmt->idx ) );
+  gzwrite(backup_file, sfmt_->state, SFMT_N * sizeof(sfmt_->state[0]));
+  gzwrite(backup_file, &(sfmt_->idx), sizeof(sfmt_->idx));
 }
 
 
 // =================================================================
 //                           Protected Methods
 // =================================================================
-double ae_jumping_mt::gammln( double X )
+double JumpingMT::gammln(double X)
 // Returns the value ln[gamma(X)] for X.
-// The gamma function is defined by the integral  gamma(z) = int(0, +inf, t^(z-1).e^(-t)dt). 
-// When the argument z is an integer, the gamma function is just the familiar factorial 
+// The gamma function is defined by the integral  gamma(z) = int(0, +inf, t^(z-1).e^(-t)dt).
+// When the argument z is an integer, the gamma function is just the familiar factorial
 // function, but offset by one, n! = gamma(n + 1).
 {
-  double x, y, tmp, ser; 
+  double x, y, tmp, ser;
   static double cof[6] = {  76.18009172947146,
                             -86.50532032941677,
                             24.01409824083091,
                             -1.231739572450155,
                             0.1208650973866179e-2,
-                            -0.5395239384953e-5 }; 
+                            -0.5395239384953e-5 };
 
   y = x = X;
-  tmp = x + 5.5; 
+  tmp = x + 5.5;
   tmp -= (x+0.5) * log(tmp);
-  ser = 1.000000000190015; 
-  
-  for ( int8_t j = 0 ; j <= 5 ; j++ )
+  ser = 1.000000000190015;
+
+  for (int8_t j = 0 ; j <= 5 ; j++)
   {
-    ser += cof[j] / ++y; 
+    ser += cof[j] / ++y;
   }
 
-  return -tmp + log(2.5066282746310005 * ser / x); 
+  return -tmp + log(2.5066282746310005 * ser / x);
 }
 
 // =================================================================
 //                          Non inline accessors
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_jumping_mt.h b/src/libaevol/JumpingMT.h
similarity index 67%
rename from src/libaevol/ae_jumping_mt.h
rename to src/libaevol/JumpingMT.h
index 07994ba..20017a1 100644
--- a/src/libaevol/ae_jumping_mt.h
+++ b/src/libaevol/JumpingMT.h
@@ -3,47 +3,50 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
-#ifndef __AE_JUMPING_MT_H__
-#define __AE_JUMPING_MT_H__
+#ifndef AEVOL_JUMPING_MT_H_
+#define AEVOL_JUMPING_MT_H_
 
 
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
+#include <cinttypes>
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
 #include <zlib.h>
-#include <math.h>
-#include <SFMT-src-1.4/SFMT.h>
-#include <SFMT-src-1.4/jump/SFMT-jump.h>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
+#include "SFMT-src-1.4/SFMT.h"
+#include "SFMT-src-1.4/jump/SFMT-jump.h"
 
 
 
@@ -59,24 +62,22 @@
 #define MT_RAND_MAX         4294967295.0
 #define MT_RAND_MAX_PLUS_1  4294967296.0
 
+namespace aevol {
 
-
-
-
-class ae_jumping_mt : public ae_object
+class JumpingMT
 {
   public :
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_jumping_mt( const uint32_t& simple_seed );   // Initialize with a simple uint32_t
-    ae_jumping_mt( const ae_jumping_mt &model );    // Create a copy of an existing generator
-    ae_jumping_mt( gzFile backup_file );           // Load from a gz backup file
+    JumpingMT(const uint32_t& simple_seed);   // Initialize with a simple uint32_t
+    JumpingMT(const JumpingMT &model);    // Create a copy of an existing generator
+    JumpingMT(gzFile backup_file);           // Load from a gz backup file
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_jumping_mt( void );
+    virtual ~JumpingMT();
 
     // =================================================================
     //                        Accessors: getters
@@ -93,20 +94,20 @@ class ae_jumping_mt : public ae_object
     // =================================================================
     //                            Public Methods
     // =================================================================
-    inline double   random( void );         // Double in [0, 1[ (uniform distribution)
-    inline int8_t   random( int8_t max );   // ~
-    inline int16_t  random( int16_t max );  // ~
-    inline int32_t  random( int32_t max );  // ~ > Integer in [0, max[ (uniform distribution)
-    inline int64_t  random( int64_t max );  // ~
-    int32_t         binomial_random( int32_t nb, double prob ); // Binomial drawing of parameters (nb, prob)
-    double          gaussian_random( void );                    // Double following a Standard Normal distribution
-    int8_t          roulette_random( double* probs, int8_t nb_elts ); // Roulette selection
-    void            multinomial_drawing ( int32_t* destination, double* source, int32_t nb_drawings, int32_t colors );
-    // Multinomial drawing of parameters ( nb, {source[0], source[1], ... source[colors-1]} )
-    
-    void jump( void );
-    
-    void save( gzFile backup_file ) const;
+    inline double   random();         // Double in [0, 1[ (uniform distribution)
+    inline int8_t   random(int8_t max);   // ~
+    inline int16_t  random(int16_t max);  // ~
+    inline int32_t  random(int32_t max);  // ~ > Integer in [0, max[ (uniform distribution)
+    inline int64_t  random(int64_t max);  // ~
+    int32_t         binomial_random(int32_t nb, double prob); // Binomial drawing of parameters (nb, prob)
+    double          gaussian_random();                    // Double following a Standard Normal distribution
+    int8_t          roulette_random(double* probs, int8_t nb_elts); // Roulette selection
+    void            multinomial_drawing (int32_t* destination, double* source, int32_t nb_drawings, int32_t colors);
+    // Multinomial drawing of parameters (nb, {source[0], source[1], ... source[colors-1]})
+
+    void jump();
+
+    void save(gzFile backup_file) const;
 
     // =================================================================
     //                           Public Attributes
@@ -119,31 +120,31 @@ class ae_jumping_mt : public ae_object
 
 
   protected :
-    
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    ae_jumping_mt( void )
+    JumpingMT()
     {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     };
-    /*ae_jumping_mt( const ae_jumping_mt &model )
+    /*JumpingMT(const JumpingMT &model)
     {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     };*/
 
 
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    static double gammln( double X );
+    static double gammln(double X);
 
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    sfmt_t* _sfmt;
+    sfmt_t* sfmt_;
 };
 
 
@@ -165,42 +166,43 @@ class ae_jumping_mt : public ae_object
 /*!
   Draw a double precision real-number in [0, 1) with a uniform distribution
  */
-inline double ae_jumping_mt::random( void )
+inline double JumpingMT::random()
 {
-  return sfmt_genrand_real2( _sfmt );
+  return sfmt_genrand_real2(sfmt_);
 }
 
 /*!
   Draw an 8-bit integer in [0, max[ with a uniform distribution
  */
-inline int8_t ae_jumping_mt::random( int8_t max )
+inline int8_t JumpingMT::random(int8_t max)
 {
-  return (int8_t) floor( ((double)max) * sfmt_genrand_real2(_sfmt) );
+  return (int8_t) floor(((double)max) * sfmt_genrand_real2(sfmt_));
 }
 
 /*!
   Draw an 16-bit integer in [0, max[ with a uniform distribution
  */
-inline int16_t ae_jumping_mt::random( int16_t max )
+inline int16_t JumpingMT::random(int16_t max)
 {
-  return (int16_t) floor( ((double)max) * sfmt_genrand_real2(_sfmt) );
+  return (int16_t) floor(((double)max) * sfmt_genrand_real2(sfmt_));
 }
 
 /*!
   Draw an 32-bit integer in [0, max[ with a uniform distribution
  */
-inline int32_t ae_jumping_mt::random( int32_t max )
+inline int32_t JumpingMT::random(int32_t max)
 {
-  return (int32_t) floor( ((double)max) * sfmt_genrand_real2(_sfmt) );
+  return (int32_t) floor(((double)max) * sfmt_genrand_real2(sfmt_));
 }
 
 /*!
   Draw an 64-bit integer in [0, max[ with a uniform distribution
  */
-inline int64_t ae_jumping_mt::random( int64_t max )
+inline int64_t JumpingMT::random(int64_t max)
 {
-  return (int64_t) floor( ((double)max) * sfmt_genrand_real2(_sfmt) );
+  return (int64_t) floor(((double)max) * sfmt_genrand_real2(sfmt_));
 }
 
+} // namespace aevol
 
-#endif // __AE_JUMPING_MT_H__
+#endif // AEVOL_JUMPING_MT_H_
diff --git a/src/libaevol/LocalMutation.h b/src/libaevol/LocalMutation.h
new file mode 100644
index 0000000..a817533
--- /dev/null
+++ b/src/libaevol/LocalMutation.h
@@ -0,0 +1,83 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_LOCALMUTATION_H_
+#define AEVOL_LOCALMUTATION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Mutation.h"
+
+namespace aevol {
+
+/**
+ * Abstract base class for local mutations
+ */
+class LocalMutation : public Mutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  virtual Mutation* Clone() const override = 0;
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override = 0;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override = 0;
+  virtual bool is_local_mut() const override final { return true; };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+} // namespace aevol
+#endif //AEVOL_LOCALMUTATION_H_
diff --git a/src/libaevol/Logging.cpp b/src/libaevol/Logging.cpp
new file mode 100644
index 0000000..aadee6d
--- /dev/null
+++ b/src/libaevol/Logging.cpp
@@ -0,0 +1,446 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Logging.h"
+#include "ExpSetup.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                                Class Logging                                #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+
+Logging::Logging()
+{
+  logs_ = 0;
+
+  transfer_log_         = NULL;
+  rear_log_             = NULL;
+  barrier_log_          = NULL;
+  //param_modification_log_ = NULL;
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Logging::~Logging()
+{
+  if (logs_ & LOG_TRANSFER)
+  {
+    fclose(transfer_log_);
+  }
+  if (logs_ & LOG_REAR)
+  {
+    fclose(rear_log_);
+  }
+  if (logs_ & LOG_BARRIER)
+  {
+    fclose(barrier_log_);
+  }
+  /*if (logs_ & LOG_LOADS)
+  {
+    fclose(param_modification_log_);
+  }*/
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+/*void Logging::save(gzFile setup_file) const
+{
+  gzwrite(backup_file, &logs_, sizeof(logs_));
+}*/
+
+void Logging::load(int8_t logs, int32_t num_gener)
+{
+  char* line = new char[500];
+
+  logs_ = logs;
+
+  // Prepare required log files
+  if (logs_ & LOG_TRANSFER)
+  {
+    rename ("log_transfer.out", "log_transfer.out.old");
+    FILE* old_transfer_log = fopen("log_transfer.out.old", "r");
+    if (old_transfer_log == NULL)
+    {
+      printf("Error: Failed to open file \"log_transfer.out.old\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    transfer_log_ = fopen("log_transfer.out", "w");
+    if (transfer_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_transfer.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    // Copy file headers
+    if (fgets(line, 500, old_transfer_log) == NULL) {
+      // TODO check for error
+    }
+    while (!feof(old_transfer_log) && line[0] == '#')
+    {
+      fputs(line, transfer_log_);
+      if (fgets(line, 500, old_transfer_log) == NULL) {
+	// TODO check for error
+      }
+    }
+    // This is the empty line between the header and the values
+    //fputs(line, transfer_log_);
+
+    // Copy log entries until num_gener (excluded)
+    while ((int32_t)atol(line) < num_gener && !feof(old_transfer_log))
+    {
+      fputs(line, transfer_log_);
+      if (fgets(line, 500, old_transfer_log) == NULL) {
+	// TODO check for error
+      }
+      while(!feof(old_transfer_log) & (line[0] == '\t' || line[0] == ' '))
+      {
+        fputs(line, transfer_log_);
+        if (fgets(line, 500, old_transfer_log) == NULL) {
+	  // TODO check for error
+	}
+      }
+    }
+
+    fclose(old_transfer_log);
+    remove("log_transfer.out.old");
+  }
+  if (logs_ & LOG_REAR)
+  {
+    rename ("log_rear.out", "log_rear.out.old");
+    FILE* old_rear_log = fopen("log_rear.out.old", "r");
+    if (old_rear_log == NULL)
+    {
+      printf("Error: Failed to open file \"log_rear.out.old\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    rear_log_ = fopen("log_rear.out", "w");
+    if (rear_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_rear.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    // Copy file headers
+    if (fgets(line, 500, old_rear_log) == NULL) {
+      // TODO check for error
+    }
+    while (!feof(old_rear_log) && line[0] == '#')
+    {
+      fputs(line, rear_log_);
+      if (fgets(line, 500, old_rear_log) == NULL) {
+	// TODO check for error
+      }
+    }
+    // This is the empty line between the header and the values
+    //fputs(line, rear_log_);
+
+    // Copy log entries until num_gener (excluded)
+    while ((int32_t)atol(line) < num_gener && !feof(old_rear_log))
+    {
+      fputs(line, rear_log_);
+      if (fgets(line, 500, old_rear_log) == NULL) {
+	// TODO check for error
+      }
+    }
+
+    fclose(old_rear_log);
+    remove("log_rear.out.old");
+  }
+  if (logs_ & LOG_BARRIER)
+  {
+    rename ("log_barrier.out", "log_barrier.out.old");
+    FILE* old_barrier_log = fopen("log_barrier.out.old", "r");
+    if (old_barrier_log == NULL)
+    {
+      printf("Error: Failed to open file \"log_barrier.out.old\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    barrier_log_ = fopen("log_barrier.out", "w");
+    if (barrier_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_barrier.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    // Copy file headers
+    if (fgets(line, 500, old_barrier_log) == NULL) {
+      // TODO check for error
+    }
+    while (!feof(old_barrier_log) && line[0] == '#')
+    {
+      fputs(line, barrier_log_);
+      if (fgets(line, 500, old_barrier_log) == NULL) {
+	// TODO check for error
+      }
+    }
+    // This is the empty line between the header and the values
+    //fputs(line, barrier_log_);
+
+    // Copy log entries until num_gener (excluded)
+    while ((int32_t)atol(line) < num_gener && !feof(old_barrier_log))
+    {
+      fputs(line, barrier_log_);
+      if (fgets(line, 500, old_barrier_log) == NULL) {
+	// TODO check for error
+      }
+    }
+
+    fclose(old_barrier_log);
+    remove("log_barrier.out.old");
+  }
+  /*if (logs_ & LOG_LOADS)
+  {
+    rename ("log_param_modification.out", "log_param_modification.out.old");
+    FILE* old_param_modification_log = fopen("log_param_modification.out.old", "r");
+    if (old_param_modification_log == NULL)
+    {
+      printf("Error: Failed to open file \"log_param_modification.out.old\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    param_modification_log_ = fopen("log_param_modification.out", "w");
+    if (param_modification_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_param_modification.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+
+    //Copy file headers
+    ret = fgets(line, 500, old_param_modification_log);
+    while (!feof(old_param_modification_log) && line[0] == '#')
+    {
+      fputs(line, param_modification_log_);
+      ret = fgets(line, 500, old_param_modification_log);
+    }
+    // This is the empty line between the header and the values
+    //fputs(line, param_modification_log_);
+
+    // Copy log entries until num_gener (excluded)
+    while ((int32_t)atol(line) < num_gener && !feof(old_param_modification_log))
+    {
+      fputs(line, param_modification_log_);
+      ret = fgets(line, 500, old_param_modification_log);
+    }
+
+    fclose(old_param_modification_log);
+    remove("log_param_modification.out.old");
+  }*/
+
+  delete [] line;
+}
+
+void Logging::print_to_file(FILE* file) const
+{
+  fprintf(file, "logs        :                %" PRId8 "\n", logs_);
+}
+
+void Logging::set_logs(int8_t logs)
+{
+  logs_ = logs;
+
+  // Open required log files
+  if (logs_ & LOG_TRANSFER)
+  {
+    transfer_log_ = fopen("log_transfer.out", "w");
+    if (transfer_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_transfer.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  if (logs_ & LOG_REAR)
+  {
+    rear_log_ = fopen("log_rear.out", "w");
+    if (rear_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_rear.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  if (logs_ & LOG_BARRIER)
+  {
+    barrier_log_ = fopen("log_barrier.out", "w");
+
+    if (barrier_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_barrier.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  /*if (logs_ & LOG_LOADS)
+  {
+    param_modification_log_ = fopen("log_param_modification.out", "w");
+
+    if (param_modification_log_ == NULL)
+    {
+      printf("Error: Failed to open file \"log_param_modification.out\"\n");
+      exit(EXIT_FAILURE);
+    }
+  }*/
+
+  this->write_headers();
+}
+
+void Logging::flush()
+{
+  if (logs_ & LOG_TRANSFER)
+  {
+    fflush(transfer_log_);
+  }
+  if (logs_ & LOG_REAR)
+  {
+    fflush(rear_log_);
+  }
+  if (logs_ & LOG_BARRIER)
+  {
+    fflush(barrier_log_);
+  }
+  /*if (logs_ & LOG_LOADS)
+  {
+    fflush(param_modification_log_);
+  }*/
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void Logging::write_headers() const
+{
+  // ========== TRANSFER LOG ==========
+  if (logs_ & LOG_TRANSFER)
+  {
+    fprintf(transfer_log_, "######################################################################\n");
+    fprintf(transfer_log_, "#                 Horizontal transfer log\n");
+    fprintf(transfer_log_, "#\n");
+    fprintf(transfer_log_, "# Log of every horizontal transfer that occured during the simulation\n");
+    fprintf(transfer_log_, "#\n");
+    fprintf(transfer_log_, "# 1.  Generation\n");
+    fprintf(transfer_log_, "# 2.  Index of the recepient\n");
+    fprintf(transfer_log_, "# 3.  Index of the donor (generation n-1)\n");
+    fprintf(transfer_log_, "# 4.  Type of transfer\n");
+    fprintf(transfer_log_, "# 5.  Length of the transferred segment\n");
+    fprintf(transfer_log_, "# 6.  Length of the replaced segment (if any)\n");
+    fprintf(transfer_log_, "# 7.  Size of the genome before the transfer\n");
+    fprintf(transfer_log_, "# 8.  Size of the genome after the transfer\n");
+    fprintf(transfer_log_, "# 9.  Alignment 1 point 1\n");
+    fprintf(transfer_log_, "# 10. Alignment 1 point 2\n");
+    fprintf(transfer_log_, "# 11. Alignment 1 score\n");
+    fprintf(transfer_log_, "# 12. Alignment 2 point 1\n");
+    fprintf(transfer_log_, "# 13. Alignment 2 point 2\n");
+    fprintf(transfer_log_, "# 14. Alignment 2 score\n");
+    fprintf(transfer_log_, "#\n");
+    fprintf(transfer_log_, "######################################################################\n");
+    fprintf(transfer_log_, "#\n");
+    fprintf(transfer_log_, "# Header for R\n");
+    fprintf(transfer_log_, "gener recepient donor t_type seg_len replaced_len size_before size_after align1_pt1 align1_pt2 score1 align2_pt1 align2_pt2 score2\n");
+    fprintf(transfer_log_, "#\n");
+  }
+
+  // ========== REAR LOG ==========
+  if (logs_ & LOG_REAR)
+  {
+    fprintf(rear_log_, "######################################################################\n");
+    fprintf(rear_log_, "#                 Chromosomal rearrangement log\n");
+    fprintf(rear_log_, "#\n");
+    fprintf(rear_log_, "# Log of every rearrangement that occured during the simulation\n");
+    fprintf(rear_log_, "# (not just one lineage)\n");
+    fprintf(rear_log_, "#\n");
+    fprintf(rear_log_, "# 1. Generation\n");
+    fprintf(rear_log_, "# 2. Index of the individual that has undergone the rearrangement\n");
+    fprintf(rear_log_, "# 3. Type of rearrangement\n");
+    fprintf(rear_log_, "# 4. Length of the rearranged segment\n");
+    fprintf(rear_log_, "# 5. Size of the genome before the rearrangement\n");
+    fprintf(rear_log_, "# 6. Alignment score that was needed for this rearrangement to occur\n");
+    fprintf(rear_log_, "# 7. Second alignment score (translocation only)\n");
+    fprintf(rear_log_, "#\n");
+    fprintf(rear_log_, "######################################################################\n");
+    fprintf(rear_log_, "#\n");
+    fprintf(rear_log_, "# Header for R\n");
+    fprintf(rear_log_, "gener indiv r_type seg_len genome_size score1 score2\n");
+    fprintf(rear_log_, "#\n");
+  }
+
+  // ========== BARRIER LOG ==========
+  if (logs_ & LOG_BARRIER)
+  {
+    fprintf(barrier_log_, "######################################################################\n");
+    fprintf(barrier_log_, "#                     Genome size limits log\n");
+    fprintf(barrier_log_, "#\n");
+    fprintf(barrier_log_, "# An entry is written whenever a mutation would have produced a\n");
+    fprintf(barrier_log_, "# genome whose size wouldn't lie in [min, max].\n");
+    fprintf(barrier_log_, "# The corresponding mutation is \"cancelled\"\n");
+    fprintf(barrier_log_, "#\n");
+    fprintf(barrier_log_, "# 1. Generation\n");
+    fprintf(barrier_log_, "# 2. Index of the individual\n");
+    fprintf(barrier_log_, "# 3. Type of event\n");
+    fprintf(barrier_log_, "# 4. Segment length\n");
+    fprintf(barrier_log_, "# 5. Replaced segment length\n");
+    fprintf(barrier_log_, "# 6. GU size (before the event)\n");
+    fprintf(barrier_log_, "# 7. Genome size (before the event)\n");
+    fprintf(barrier_log_, "#\n");
+    fprintf(barrier_log_, "######################################################################\n");
+
+  }
+
+  // ========== LOADS LOG ==========
+  /*if (logs_ & LOG_LOADS)
+  {
+    fprintf(param_modification_log_, "######################################################################\n");
+    fprintf(param_modification_log_, "#                     Parameter modification log\n");
+    fprintf(param_modification_log_, "#\n");
+    fprintf(param_modification_log_, "# An entry is written whenever a parameter is modified by aevol_modify.\n");
+    fprintf(param_modification_log_, "######################################################################\n");
+  }*/
+}
+} // namespace aevol
diff --git a/src/libaevol/ae_logs.h b/src/libaevol/Logging.h
similarity index 71%
rename from src/libaevol/ae_logs.h
rename to src/libaevol/Logging.h
index bd70d33..bed67f4 100644
--- a/src/libaevol/ae_logs.h
+++ b/src/libaevol/Logging.h
@@ -3,30 +3,30 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
-#ifndef __AE_LOGS_H__
-#define __AE_LOGS_H__
+#ifndef AEVOL_LOGS_H_
+#define AEVOL_LOGS_H_
 
 
 // =================================================================
@@ -40,11 +40,13 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-#include <ae_enums.h>
-
-
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "ae_enums.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
@@ -52,26 +54,26 @@
 
 
 
-class ae_logs : public ae_object
+class Logging
 {
   public :
 
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_logs( void );
+    Logging();
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_logs( void );
+    virtual ~Logging();
 
     // =================================================================
     //                              Accessors
     // =================================================================
-    inline FILE* get_log( ae_log_type log_type )   const;
-    inline int8_t get_logs() const;
-    inline bool  is_logged( ae_log_type log_type ) const;
+    inline FILE* log(LogType log_type)   const;
+    inline int8_t logs() const;
+    inline bool  is_logged(LogType log_type) const;
 
     // =================================================================
     //                              Operators
@@ -80,12 +82,12 @@ class ae_logs : public ae_object
     // =================================================================
     //                            Public Methods
     // =================================================================
-    //void save( gzFile backup_file ) const;
-    void load( int8_t logs, int32_t num_gener  );
-    void print_to_file( FILE* file ) const;
-    
-    void set_logs( int8_t logs );
-    void flush( void );
+    //void save(gzFile backup_file) const;
+    void load(int8_t logs, int32_t num_gener);
+    void print_to_file(FILE* file) const;
+
+    void set_logs(int8_t logs);
+    void flush();
 
     // =================================================================
     //                           Public Attributes
@@ -100,94 +102,94 @@ class ae_logs : public ae_object
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    /*    ae_logs( void )
+    /*    Logging()
     {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     };
-    ae_logs( const ae_logs &model )
+    Logging(const Logging &model)
     {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     };*/
 
 
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    void write_headers( void ) const;
+    void write_headers() const;
 
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    int8_t  _logs; // Which logs are "turned on" (bitmap)
-    FILE*   _transfer_log;
-    FILE*   _rear_log;
-    FILE*   _barrier_log;
-    //FILE*   _param_modification_log;
+    int8_t  logs_; // Which logs are "turned on" (bitmap)
+    FILE*   transfer_log_;
+    FILE*   rear_log_;
+    FILE*   barrier_log_;
+    //FILE*   param_modification_log_;
 };
 
 
 // =====================================================================
 //                          Accessors' definitions
 // =====================================================================
-inline FILE* ae_logs::get_log( ae_log_type log_type ) const
+inline FILE*Logging::log(LogType log_type) const
 {
-  switch ( log_type )
+  switch (log_type)
   {
     case LOG_TRANSFER :
     {
-      return _transfer_log;
+      return transfer_log_;
     }
     case LOG_REAR :
     {
-      return _rear_log;
+      return rear_log_;
     }
     case LOG_BARRIER :
     {
-      return _barrier_log;
+      return barrier_log_;
     }
     /*case LOG_LOADS :
     {
-      return _param_modification_log;
+      return param_modification_log_;
     }*/
     default:
     {
-      printf( "ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     }
   }
 }
 
-inline int8_t ae_logs::get_logs() const
+inline int8_t Logging::logs() const
 {
-  return _logs;
+  return logs_;
 }
 
-inline bool ae_logs::is_logged( ae_log_type log_type ) const
+inline bool Logging::is_logged(LogType log_type) const
 {
-  switch ( log_type )
+  switch (log_type)
   {
     case LOG_TRANSFER :
     {
-      return ( _logs & LOG_TRANSFER );
+      return (logs_ & LOG_TRANSFER);
     }
     case LOG_REAR :
     {
-      return ( _logs & LOG_REAR );
+      return (logs_ & LOG_REAR);
     }
     case LOG_BARRIER :
     {
-      return ( _logs & LOG_BARRIER );
+      return (logs_ & LOG_BARRIER);
     }
     /*case LOG_LOADS :
     {
-      return ( _logs & LOG_LOADS );
+      return (logs_ & LOG_LOADS);
     }*/
     default:
     {
-      printf( "ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR: unknown log_type in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     }
   }
 }
@@ -200,5 +202,6 @@ inline bool ae_logs::is_logged( ae_log_type log_type ) const
 //                       Inline functions' definition
 // =====================================================================
 
+} // namespace aevol
 
-#endif // __AE_LOGS_H__
+#endif // AEVOL_LOGS_H_
diff --git a/src/libaevol/Makefile.am b/src/libaevol/Makefile.am
index 36c014a..b9f5065 100644
--- a/src/libaevol/Makefile.am
+++ b/src/libaevol/Makefile.am
@@ -5,19 +5,13 @@ AM_CPPFLAGS = $(AEVOLCPPFLAGS)
 AM_CXXFLAGS = $(AEVOLCXXFLAGS)
 AM_LDFLAGS = $(AEVOLLDFLAGS)
 
-if WITH_CPPUNIT
-  SUBDIRS = SFMT-src-1.4 . tests
-else # WITHOUT_CPPUNIT
-  SUBDIRS = SFMT-src-1.4 .
-endif
-
+SUBDIRS = SFMT-src-1.4 .
 
 ########################
 # Set library to build #
 ########################
 noinst_LIBRARIES = libaevol.a
 
-
 ############################################
 # C99 exact-width integer specific support #
 ############################################
@@ -26,34 +20,180 @@ noinst_LIBRARIES = libaevol.a
 # __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX
 AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
 
-
-
-common_headers = ae_align.h ae_codon.h ae_dna.h ae_dump.h ae_enums.h ae_environment.h ae_env_segment.h ae_exp_manager.h ae_exp_setup.h ae_fuzzy_set.h ae_gaussian.h ae_genetic_unit.h ae_grid_cell.h ae_individual.h ae_list.h ae_logs.h ae_macros.h ae_mutation.h ae_object.h ae_output_manager.h ae_params_mut.h ae_phenotype.h ae_population.h ae_point_1d.h ae_point_2d.h ae_protein.h ae_jumping_mt.h ae_jump_poly.h ae_replication_report.h ae_dna_replic_report.h ae_rna.h ae_stats.h ae_stat_record. [...]
-common_headers += param_loader.h f_line.h
-
-common_sources = ae_align.cpp ae_codon.cpp ae_dna.cpp ae_dump.cpp ae_environment.cpp ae_exp_manager.cpp ae_exp_setup.cpp ae_fuzzy_set.cpp ae_genetic_unit.cpp ae_grid_cell.cpp ae_individual.cpp ae_logs.cpp ae_mutation.cpp ae_output_manager.cpp ae_params_mut.cpp ae_phenotype.cpp ae_population.cpp ae_protein.cpp ae_jumping_mt.cpp ae_replication_report.cpp ae_dna_replic_report.cpp ae_rna.cpp ae_stats.cpp ae_stat_record.cpp ae_string.cpp ae_tree.cpp ae_vis_a_vis.cpp ae_selection.cpp ae_spatia [...]
-common_sources += param_loader.cpp f_line.cpp
-
-
-X11_headers = ae_fuzzy_set_X11.h ae_individual_X11.h ae_population_X11.h ae_exp_manager_X11.h ae_X11_window.h
-X11_sources = ae_fuzzy_set_X11.cpp ae_individual_X11.cpp ae_population_X11.cpp ae_exp_manager_X11.cpp ae_X11_window.cpp
-
-
-
+common_headers = \
+AbstractFuzzy.h \
+aevol.h \
+Alignment.h \
+Codon.h \
+Dna.h \
+Dump.h \
+ae_enums.h \
+PhenotypicSegment.h \
+ExpManager.h \
+ExpSetup.h \
+Fuzzy.h \
+FuzzyFactory.h \
+Gaussian.h \
+GeneticUnit.h \
+GridCell.h \
+GzHelpers.h \
+HybridFuzzy.h \
+Individual.h \
+IndividualFactory.h \
+Logging.h \
+macros.h \
+Mutation.h \
+LocalMutation.h \
+PointMutation.h \
+SmallInsertion.h \
+SmallDeletion.h \
+Rearrangement.h \
+Duplication.h \
+Deletion.h \
+Translocation.h \
+Inversion.h \
+HorizontalTransfer.h \
+InsertionHT.h \
+ReplacementHT.h \
+Observable.h \
+ObservableEvent.h \
+Observer.h \
+OutputManager.h \
+MutationParams.h \
+Phenotype.h \
+PhenotypicTarget.h \
+PhenotypicTargetHandler.h \
+Point.h \
+Protein.h \
+JumpingMT.h \
+JumpPoly.h \
+ReplicationReport.h \
+DnaReplicationReport.h \
+Rna.h \
+Stats.h \
+StatRecord.h \
+NonCodingMetrics.h \
+Metrics.h \
+ae_string.h \
+Tree.h \
+Utils.h \
+VisAVis.h \
+Selection.h \
+Habitat.h \
+ParamLoader.h \
+ParameterLine.h \
+World.h \
+AeTime.h \
+World.h \
+make_unique.h \
+ae_logger.h \
+HabitatFactory.h
+
+common_sources = \
+Alignment.cpp \
+Codon.cpp \
+Dna.cpp \
+Dump.cpp \
+ExpManager.cpp \
+ExpSetup.cpp \
+GeneticUnit.cpp \
+GridCell.cpp \
+Individual.cpp \
+IndividualFactory.cpp \
+Logging.cpp \
+Mutation.cpp \
+PointMutation.cpp \
+SmallInsertion.cpp \
+SmallDeletion.cpp \
+Duplication.cpp \
+Deletion.cpp \
+Translocation.cpp \
+Inversion.cpp \
+InsertionHT.cpp \
+ReplacementHT.cpp \
+Observable.cpp \
+OutputManager.cpp \
+MutationParams.cpp \
+PhenotypicTarget.cpp \
+PhenotypicTargetHandler.cpp \
+Point.cpp \
+Protein.cpp \
+JumpingMT.cpp \
+ReplicationReport.cpp \
+DnaReplicationReport.cpp \
+Rna.cpp \
+Stats.cpp \
+StatRecord.cpp \
+ae_string.cpp \
+Tree.cpp \
+Utils.cpp \
+VisAVis.cpp \
+Selection.cpp \
+AbstractFuzzy.cpp \
+HybridFuzzy.cpp \
+FuzzyFactory.cpp \
+Fuzzy.cpp \
+Habitat.cpp \
+ParamLoader.cpp \
+ParameterLine.cpp \
+AeTime.cpp \
+World.cpp \
+HabitatFactory.cpp
+
+raevol_headers = \
+raevol/Individual_R.h \
+raevol/Protein_R.h \
+raevol/Rna_R.h \
+raevol/PhenotypicTargetHandler_R.h \
+raevol/Habitat_R.h \
+raevol/PhenotypicTarget_R.h
+
+raevol_sources = \
+raevol/Individual_R.cpp \
+raevol/Protein_R.cpp \
+raevol/Rna_R.cpp \
+raevol/PhenotypicTargetHandler_R.cpp \
+raevol/Habitat_R.cpp \
+raevol/PhenotypicTarget_R.cpp
+
+raevol_X11_headers = \
+raevol/Individual_R_X11.h
+
+raevol_X11_sources = \
+raevol/Individual_R_X11.cpp
+
+X11_headers = \
+Individual_X11.h \
+ExpManager_X11.h \
+X11Window.h 
+
+X11_sources = \
+Individual_X11.cpp \
+ExpManager_X11.cpp \
+X11Window.cpp
 
 # The target_CPPFLAGS for each target may look useless, it is here to force automake to create
 # prefixed object files so that we don't use an object file built for another set of macrodefinitions
 # e.g. We don't want to use an object file created with NO_X when building the X11 lib
 
-libaevol_a_CPPFLAGS = $(AM_CPPFLAGS)
-
-
 if WITH_X
+if WITH_RAEVOL
+#libaevol_a_HEADERS += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers)
+  libaevol_a_SOURCES = $(common_sources) $(X11_sources) $(raevol_sources) $(raevol_X11_sources)
+  libaevol_a_SOURCES += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers)
+else
 #libaevol_a_HEADERS = $(common_headers) $(X11_headers)
   libaevol_a_SOURCES = $(common_sources) $(X11_sources)
   libaevol_a_SOURCES += $(common_headers) $(X11_headers)
+endif
 else # WITHOUT_X
+if WITH_RAEVOL
+#libaevol_a_HEADERS = $(common_headers) $(raevol_headers)
+  libaevol_a_SOURCES = $(common_sources) $(raevol_sources)
+  libaevol_a_SOURCES += $(common_headers) $(raevol_headers)
+else
 #libaevol_a_HEADERS = $(common_headers)
   libaevol_a_SOURCES = $(common_sources)
   libaevol_a_SOURCES += $(common_headers)
+endif
 endif # X
diff --git a/src/libaevol/Makefile.in b/src/libaevol/Makefile.in
index 1afc1c3..0e39e05 100644
--- a/src/libaevol/Makefile.in
+++ b/src/libaevol/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,108 +86,173 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 subdir = src/libaevol
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 AR = ar
 ARFLAGS = cru
+AM_V_AR = $(am__v_AR_ at AM_V@)
+am__v_AR_ = $(am__v_AR_ at AM_DEFAULT_V@)
+am__v_AR_0 = @echo "  AR      " $@;
+am__v_AR_1 = 
 libaevol_a_AR = $(AR) $(ARFLAGS)
 libaevol_a_LIBADD =
-am__libaevol_a_SOURCES_DIST = ae_align.cpp ae_codon.cpp ae_dna.cpp \
-	ae_dump.cpp ae_environment.cpp ae_exp_manager.cpp \
-	ae_exp_setup.cpp ae_fuzzy_set.cpp ae_genetic_unit.cpp \
-	ae_grid_cell.cpp ae_individual.cpp ae_logs.cpp ae_mutation.cpp \
-	ae_output_manager.cpp ae_params_mut.cpp ae_phenotype.cpp \
-	ae_population.cpp ae_protein.cpp ae_jumping_mt.cpp \
-	ae_replication_report.cpp ae_dna_replic_report.cpp ae_rna.cpp \
-	ae_stats.cpp ae_stat_record.cpp ae_string.cpp ae_tree.cpp \
-	ae_vis_a_vis.cpp ae_selection.cpp ae_spatial_structure.cpp \
-	ae_gene_tree.cpp ae_gene_tree_node.cpp ae_gene_mutation.cpp \
-	param_loader.cpp f_line.cpp ae_align.h ae_codon.h ae_dna.h \
-	ae_dump.h ae_enums.h ae_environment.h ae_env_segment.h \
-	ae_exp_manager.h ae_exp_setup.h ae_fuzzy_set.h ae_gaussian.h \
-	ae_genetic_unit.h ae_grid_cell.h ae_individual.h ae_list.h \
-	ae_logs.h ae_macros.h ae_mutation.h ae_object.h \
-	ae_output_manager.h ae_params_mut.h ae_phenotype.h \
-	ae_population.h ae_point_1d.h ae_point_2d.h ae_protein.h \
-	ae_jumping_mt.h ae_jump_poly.h ae_replication_report.h \
-	ae_dna_replic_report.h ae_rna.h ae_stats.h ae_stat_record.h \
-	ae_string.h ae_tree.h ae_utils.h ae_vis_a_vis.h ae_selection.h \
-	ae_spatial_structure.h ae_gene_tree.h ae_gene_tree_node.h \
-	ae_gene_mutation.h param_loader.h f_line.h \
-	ae_fuzzy_set_X11.cpp ae_individual_X11.cpp \
-	ae_population_X11.cpp ae_exp_manager_X11.cpp ae_X11_window.cpp \
-	ae_fuzzy_set_X11.h ae_individual_X11.h ae_population_X11.h \
-	ae_exp_manager_X11.h ae_X11_window.h
-am__objects_1 = libaevol_a-ae_align.$(OBJEXT) \
-	libaevol_a-ae_codon.$(OBJEXT) libaevol_a-ae_dna.$(OBJEXT) \
-	libaevol_a-ae_dump.$(OBJEXT) \
-	libaevol_a-ae_environment.$(OBJEXT) \
-	libaevol_a-ae_exp_manager.$(OBJEXT) \
-	libaevol_a-ae_exp_setup.$(OBJEXT) \
-	libaevol_a-ae_fuzzy_set.$(OBJEXT) \
-	libaevol_a-ae_genetic_unit.$(OBJEXT) \
-	libaevol_a-ae_grid_cell.$(OBJEXT) \
-	libaevol_a-ae_individual.$(OBJEXT) \
-	libaevol_a-ae_logs.$(OBJEXT) libaevol_a-ae_mutation.$(OBJEXT) \
-	libaevol_a-ae_output_manager.$(OBJEXT) \
-	libaevol_a-ae_params_mut.$(OBJEXT) \
-	libaevol_a-ae_phenotype.$(OBJEXT) \
-	libaevol_a-ae_population.$(OBJEXT) \
-	libaevol_a-ae_protein.$(OBJEXT) \
-	libaevol_a-ae_jumping_mt.$(OBJEXT) \
-	libaevol_a-ae_replication_report.$(OBJEXT) \
-	libaevol_a-ae_dna_replic_report.$(OBJEXT) \
-	libaevol_a-ae_rna.$(OBJEXT) libaevol_a-ae_stats.$(OBJEXT) \
-	libaevol_a-ae_stat_record.$(OBJEXT) \
-	libaevol_a-ae_string.$(OBJEXT) libaevol_a-ae_tree.$(OBJEXT) \
-	libaevol_a-ae_vis_a_vis.$(OBJEXT) \
-	libaevol_a-ae_selection.$(OBJEXT) \
-	libaevol_a-ae_spatial_structure.$(OBJEXT) \
-	libaevol_a-ae_gene_tree.$(OBJEXT) \
-	libaevol_a-ae_gene_tree_node.$(OBJEXT) \
-	libaevol_a-ae_gene_mutation.$(OBJEXT) \
-	libaevol_a-param_loader.$(OBJEXT) libaevol_a-f_line.$(OBJEXT)
+am__libaevol_a_SOURCES_DIST = Alignment.cpp Codon.cpp Dna.cpp Dump.cpp \
+	ExpManager.cpp ExpSetup.cpp GeneticUnit.cpp GridCell.cpp \
+	Individual.cpp IndividualFactory.cpp Logging.cpp Mutation.cpp \
+	PointMutation.cpp SmallInsertion.cpp SmallDeletion.cpp \
+	Duplication.cpp Deletion.cpp Translocation.cpp Inversion.cpp \
+	InsertionHT.cpp ReplacementHT.cpp Observable.cpp \
+	OutputManager.cpp MutationParams.cpp PhenotypicTarget.cpp \
+	PhenotypicTargetHandler.cpp Point.cpp Protein.cpp \
+	JumpingMT.cpp ReplicationReport.cpp DnaReplicationReport.cpp \
+	Rna.cpp Stats.cpp StatRecord.cpp ae_string.cpp Tree.cpp \
+	Utils.cpp VisAVis.cpp Selection.cpp AbstractFuzzy.cpp \
+	HybridFuzzy.cpp FuzzyFactory.cpp Fuzzy.cpp Habitat.cpp \
+	ParamLoader.cpp ParameterLine.cpp AeTime.cpp World.cpp \
+	HabitatFactory.cpp AbstractFuzzy.h aevol.h Alignment.h Codon.h \
+	Dna.h Dump.h ae_enums.h PhenotypicSegment.h ExpManager.h \
+	ExpSetup.h Fuzzy.h FuzzyFactory.h Gaussian.h GeneticUnit.h \
+	GridCell.h GzHelpers.h HybridFuzzy.h Individual.h \
+	IndividualFactory.h Logging.h macros.h Mutation.h \
+	LocalMutation.h PointMutation.h SmallInsertion.h \
+	SmallDeletion.h Rearrangement.h Duplication.h Deletion.h \
+	Translocation.h Inversion.h HorizontalTransfer.h InsertionHT.h \
+	ReplacementHT.h Observable.h ObservableEvent.h Observer.h \
+	OutputManager.h MutationParams.h Phenotype.h \
+	PhenotypicTarget.h PhenotypicTargetHandler.h Point.h Protein.h \
+	JumpingMT.h JumpPoly.h ReplicationReport.h \
+	DnaReplicationReport.h Rna.h Stats.h StatRecord.h \
+	NonCodingMetrics.h Metrics.h ae_string.h Tree.h Utils.h \
+	VisAVis.h Selection.h Habitat.h ParamLoader.h ParameterLine.h \
+	World.h AeTime.h make_unique.h ae_logger.h HabitatFactory.h \
+	Individual_X11.cpp ExpManager_X11.cpp X11Window.cpp \
+	Individual_X11.h ExpManager_X11.h X11Window.h \
+	raevol/Individual_R.cpp raevol/Protein_R.cpp raevol/Rna_R.cpp \
+	raevol/PhenotypicTargetHandler_R.cpp raevol/Habitat_R.cpp \
+	raevol/PhenotypicTarget_R.cpp raevol/Individual_R.h \
+	raevol/Protein_R.h raevol/Rna_R.h \
+	raevol/PhenotypicTargetHandler_R.h raevol/Habitat_R.h \
+	raevol/PhenotypicTarget_R.h raevol/Individual_R_X11.cpp \
+	raevol/Individual_R_X11.h
+am__objects_1 = Alignment.$(OBJEXT) Codon.$(OBJEXT) Dna.$(OBJEXT) \
+	Dump.$(OBJEXT) ExpManager.$(OBJEXT) ExpSetup.$(OBJEXT) \
+	GeneticUnit.$(OBJEXT) GridCell.$(OBJEXT) Individual.$(OBJEXT) \
+	IndividualFactory.$(OBJEXT) Logging.$(OBJEXT) \
+	Mutation.$(OBJEXT) PointMutation.$(OBJEXT) \
+	SmallInsertion.$(OBJEXT) SmallDeletion.$(OBJEXT) \
+	Duplication.$(OBJEXT) Deletion.$(OBJEXT) \
+	Translocation.$(OBJEXT) Inversion.$(OBJEXT) \
+	InsertionHT.$(OBJEXT) ReplacementHT.$(OBJEXT) \
+	Observable.$(OBJEXT) OutputManager.$(OBJEXT) \
+	MutationParams.$(OBJEXT) PhenotypicTarget.$(OBJEXT) \
+	PhenotypicTargetHandler.$(OBJEXT) Point.$(OBJEXT) \
+	Protein.$(OBJEXT) JumpingMT.$(OBJEXT) \
+	ReplicationReport.$(OBJEXT) DnaReplicationReport.$(OBJEXT) \
+	Rna.$(OBJEXT) Stats.$(OBJEXT) StatRecord.$(OBJEXT) \
+	ae_string.$(OBJEXT) Tree.$(OBJEXT) Utils.$(OBJEXT) \
+	VisAVis.$(OBJEXT) Selection.$(OBJEXT) AbstractFuzzy.$(OBJEXT) \
+	HybridFuzzy.$(OBJEXT) FuzzyFactory.$(OBJEXT) Fuzzy.$(OBJEXT) \
+	Habitat.$(OBJEXT) ParamLoader.$(OBJEXT) \
+	ParameterLine.$(OBJEXT) AeTime.$(OBJEXT) World.$(OBJEXT) \
+	HabitatFactory.$(OBJEXT)
 am__objects_2 =
-am__objects_3 = libaevol_a-ae_fuzzy_set_X11.$(OBJEXT) \
-	libaevol_a-ae_individual_X11.$(OBJEXT) \
-	libaevol_a-ae_population_X11.$(OBJEXT) \
-	libaevol_a-ae_exp_manager_X11.$(OBJEXT) \
-	libaevol_a-ae_X11_window.$(OBJEXT)
- at WITH_X_FALSE@am_libaevol_a_OBJECTS = $(am__objects_1) \
- at WITH_X_FALSE@	$(am__objects_2)
- at WITH_X_TRUE@am_libaevol_a_OBJECTS = $(am__objects_1) $(am__objects_3) \
- at WITH_X_TRUE@	$(am__objects_2) $(am__objects_2)
+am__objects_3 = Individual_X11.$(OBJEXT) ExpManager_X11.$(OBJEXT) \
+	X11Window.$(OBJEXT)
+am__dirstamp = $(am__leading_dot)dirstamp
+am__objects_4 = raevol/Individual_R.$(OBJEXT) \
+	raevol/Protein_R.$(OBJEXT) raevol/Rna_R.$(OBJEXT) \
+	raevol/PhenotypicTargetHandler_R.$(OBJEXT) \
+	raevol/Habitat_R.$(OBJEXT) raevol/PhenotypicTarget_R.$(OBJEXT)
+am__objects_5 = raevol/Individual_R_X11.$(OBJEXT)
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE at am_libaevol_a_OBJECTS =  \
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE@	$(am__objects_1) \
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE@	$(am__objects_2)
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE at am_libaevol_a_OBJECTS =  \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(am__objects_1) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(am__objects_3) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(am__objects_2) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(am__objects_2)
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE at am_libaevol_a_OBJECTS =  \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(am__objects_1) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(am__objects_4) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(am__objects_2) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(am__objects_2)
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE at am_libaevol_a_OBJECTS =  \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_1) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_3) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_4) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_5) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_2) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_2) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_2) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(am__objects_2)
 libaevol_a_OBJECTS = $(am_libaevol_a_OBJECTS)
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_ at AM_V@)
+am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 SOURCES = $(libaevol_a_SOURCES)
 DIST_SOURCES = $(am__libaevol_a_SOURCES_DIST)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -158,12 +260,33 @@ am__can_run_installinfo = \
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
 	distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = SFMT-src-1.4 . tests
+DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -195,19 +318,21 @@ AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -219,6 +344,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -232,6 +359,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -262,14 +390,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -285,6 +421,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -308,49 +445,194 @@ AM_CPPFLAGS = $(AEVOLCPPFLAGS) -D__STDC_FORMAT_MACROS \
 	-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
 AM_CXXFLAGS = $(AEVOLCXXFLAGS)
 AM_LDFLAGS = $(AEVOLLDFLAGS)
- at WITH_CPPUNIT_FALSE@SUBDIRS = SFMT-src-1.4 .
- at WITH_CPPUNIT_TRUE@SUBDIRS = SFMT-src-1.4 . tests
+SUBDIRS = SFMT-src-1.4 .
 
 ########################
 # Set library to build #
 ########################
 noinst_LIBRARIES = libaevol.a
-common_headers = ae_align.h ae_codon.h ae_dna.h ae_dump.h ae_enums.h \
-	ae_environment.h ae_env_segment.h ae_exp_manager.h \
-	ae_exp_setup.h ae_fuzzy_set.h ae_gaussian.h ae_genetic_unit.h \
-	ae_grid_cell.h ae_individual.h ae_list.h ae_logs.h ae_macros.h \
-	ae_mutation.h ae_object.h ae_output_manager.h ae_params_mut.h \
-	ae_phenotype.h ae_population.h ae_point_1d.h ae_point_2d.h \
-	ae_protein.h ae_jumping_mt.h ae_jump_poly.h \
-	ae_replication_report.h ae_dna_replic_report.h ae_rna.h \
-	ae_stats.h ae_stat_record.h ae_string.h ae_tree.h ae_utils.h \
-	ae_vis_a_vis.h ae_selection.h ae_spatial_structure.h \
-	ae_gene_tree.h ae_gene_tree_node.h ae_gene_mutation.h \
-	param_loader.h f_line.h
-common_sources = ae_align.cpp ae_codon.cpp ae_dna.cpp ae_dump.cpp \
-	ae_environment.cpp ae_exp_manager.cpp ae_exp_setup.cpp \
-	ae_fuzzy_set.cpp ae_genetic_unit.cpp ae_grid_cell.cpp \
-	ae_individual.cpp ae_logs.cpp ae_mutation.cpp \
-	ae_output_manager.cpp ae_params_mut.cpp ae_phenotype.cpp \
-	ae_population.cpp ae_protein.cpp ae_jumping_mt.cpp \
-	ae_replication_report.cpp ae_dna_replic_report.cpp ae_rna.cpp \
-	ae_stats.cpp ae_stat_record.cpp ae_string.cpp ae_tree.cpp \
-	ae_vis_a_vis.cpp ae_selection.cpp ae_spatial_structure.cpp \
-	ae_gene_tree.cpp ae_gene_tree_node.cpp ae_gene_mutation.cpp \
-	param_loader.cpp f_line.cpp
-X11_headers = ae_fuzzy_set_X11.h ae_individual_X11.h ae_population_X11.h ae_exp_manager_X11.h ae_X11_window.h
-X11_sources = ae_fuzzy_set_X11.cpp ae_individual_X11.cpp ae_population_X11.cpp ae_exp_manager_X11.cpp ae_X11_window.cpp
+common_headers = \
+AbstractFuzzy.h \
+aevol.h \
+Alignment.h \
+Codon.h \
+Dna.h \
+Dump.h \
+ae_enums.h \
+PhenotypicSegment.h \
+ExpManager.h \
+ExpSetup.h \
+Fuzzy.h \
+FuzzyFactory.h \
+Gaussian.h \
+GeneticUnit.h \
+GridCell.h \
+GzHelpers.h \
+HybridFuzzy.h \
+Individual.h \
+IndividualFactory.h \
+Logging.h \
+macros.h \
+Mutation.h \
+LocalMutation.h \
+PointMutation.h \
+SmallInsertion.h \
+SmallDeletion.h \
+Rearrangement.h \
+Duplication.h \
+Deletion.h \
+Translocation.h \
+Inversion.h \
+HorizontalTransfer.h \
+InsertionHT.h \
+ReplacementHT.h \
+Observable.h \
+ObservableEvent.h \
+Observer.h \
+OutputManager.h \
+MutationParams.h \
+Phenotype.h \
+PhenotypicTarget.h \
+PhenotypicTargetHandler.h \
+Point.h \
+Protein.h \
+JumpingMT.h \
+JumpPoly.h \
+ReplicationReport.h \
+DnaReplicationReport.h \
+Rna.h \
+Stats.h \
+StatRecord.h \
+NonCodingMetrics.h \
+Metrics.h \
+ae_string.h \
+Tree.h \
+Utils.h \
+VisAVis.h \
+Selection.h \
+Habitat.h \
+ParamLoader.h \
+ParameterLine.h \
+World.h \
+AeTime.h \
+World.h \
+make_unique.h \
+ae_logger.h \
+HabitatFactory.h
+
+common_sources = \
+Alignment.cpp \
+Codon.cpp \
+Dna.cpp \
+Dump.cpp \
+ExpManager.cpp \
+ExpSetup.cpp \
+GeneticUnit.cpp \
+GridCell.cpp \
+Individual.cpp \
+IndividualFactory.cpp \
+Logging.cpp \
+Mutation.cpp \
+PointMutation.cpp \
+SmallInsertion.cpp \
+SmallDeletion.cpp \
+Duplication.cpp \
+Deletion.cpp \
+Translocation.cpp \
+Inversion.cpp \
+InsertionHT.cpp \
+ReplacementHT.cpp \
+Observable.cpp \
+OutputManager.cpp \
+MutationParams.cpp \
+PhenotypicTarget.cpp \
+PhenotypicTargetHandler.cpp \
+Point.cpp \
+Protein.cpp \
+JumpingMT.cpp \
+ReplicationReport.cpp \
+DnaReplicationReport.cpp \
+Rna.cpp \
+Stats.cpp \
+StatRecord.cpp \
+ae_string.cpp \
+Tree.cpp \
+Utils.cpp \
+VisAVis.cpp \
+Selection.cpp \
+AbstractFuzzy.cpp \
+HybridFuzzy.cpp \
+FuzzyFactory.cpp \
+Fuzzy.cpp \
+Habitat.cpp \
+ParamLoader.cpp \
+ParameterLine.cpp \
+AeTime.cpp \
+World.cpp \
+HabitatFactory.cpp
+
+raevol_headers = \
+raevol/Individual_R.h \
+raevol/Protein_R.h \
+raevol/Rna_R.h \
+raevol/PhenotypicTargetHandler_R.h \
+raevol/Habitat_R.h \
+raevol/PhenotypicTarget_R.h
+
+raevol_sources = \
+raevol/Individual_R.cpp \
+raevol/Protein_R.cpp \
+raevol/Rna_R.cpp \
+raevol/PhenotypicTargetHandler_R.cpp \
+raevol/Habitat_R.cpp \
+raevol/PhenotypicTarget_R.cpp
+
+raevol_X11_headers = \
+raevol/Individual_R_X11.h
+
+raevol_X11_sources = \
+raevol/Individual_R_X11.cpp
+
+X11_headers = \
+Individual_X11.h \
+ExpManager_X11.h \
+X11Window.h 
+
+X11_sources = \
+Individual_X11.cpp \
+ExpManager_X11.cpp \
+X11Window.cpp
+
+#libaevol_a_HEADERS = $(common_headers)
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE at libaevol_a_SOURCES =  \
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE@	$(common_sources) \
+ at WITH_RAEVOL_FALSE@@WITH_X_FALSE@	$(common_headers)
+#libaevol_a_HEADERS = $(common_headers) $(X11_headers)
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE at libaevol_a_SOURCES =  \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(common_sources) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(X11_sources) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(common_headers) \
+ at WITH_RAEVOL_FALSE@@WITH_X_TRUE@	$(X11_headers)
+#libaevol_a_HEADERS = $(common_headers) $(raevol_headers)
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE at libaevol_a_SOURCES =  \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(common_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(raevol_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(common_headers) \
+ at WITH_RAEVOL_TRUE@@WITH_X_FALSE@	$(raevol_headers)
 
 # The target_CPPFLAGS for each target may look useless, it is here to force automake to create
 # prefixed object files so that we don't use an object file built for another set of macrodefinitions
 # e.g. We don't want to use an object file created with NO_X when building the X11 lib
-libaevol_a_CPPFLAGS = $(AM_CPPFLAGS)
-#libaevol_a_HEADERS = $(common_headers)
- at WITH_X_FALSE@libaevol_a_SOURCES = $(common_sources) $(common_headers)
 
-#libaevol_a_HEADERS = $(common_headers) $(X11_headers)
- at WITH_X_TRUE@libaevol_a_SOURCES = $(common_sources) $(X11_sources) \
- at WITH_X_TRUE@	$(common_headers) $(X11_headers)
+#libaevol_a_HEADERS += $(common_headers) $(X11_headers) $(raevol_headers) $(raevol_X11_headers)
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE at libaevol_a_SOURCES = $(common_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(X11_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(raevol_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(raevol_X11_sources) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(common_headers) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(X11_headers) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(raevol_headers) \
+ at WITH_RAEVOL_TRUE@@WITH_X_TRUE@	$(raevol_X11_headers)
 all: all-recursive
 
 .SUFFIXES:
@@ -367,7 +649,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libaevol/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu src/libaevol/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -388,634 +669,135 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+raevol/$(am__dirstamp):
+	@$(MKDIR_P) raevol
+	@: > raevol/$(am__dirstamp)
+raevol/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) raevol/$(DEPDIR)
+	@: > raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/Individual_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/Protein_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/Rna_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/PhenotypicTargetHandler_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/Habitat_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/PhenotypicTarget_R.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+raevol/Individual_R_X11.$(OBJEXT): raevol/$(am__dirstamp) \
+	raevol/$(DEPDIR)/$(am__dirstamp)
+
 libaevol.a: $(libaevol_a_OBJECTS) $(libaevol_a_DEPENDENCIES) $(EXTRA_libaevol_a_DEPENDENCIES) 
-	-rm -f libaevol.a
-	$(libaevol_a_AR) libaevol.a $(libaevol_a_OBJECTS) $(libaevol_a_LIBADD)
-	$(RANLIB) libaevol.a
+	$(AM_V_at)-rm -f libaevol.a
+	$(AM_V_AR)$(libaevol_a_AR) libaevol.a $(libaevol_a_OBJECTS) $(libaevol_a_LIBADD)
+	$(AM_V_at)$(RANLIB) libaevol.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f raevol/*.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_X11_window.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_align.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_codon.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_dna.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_dna_replic_report.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_dump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_environment.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_exp_manager.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_exp_manager_X11.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_exp_setup.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_fuzzy_set.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_gene_mutation.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_gene_tree.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_gene_tree_node.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_genetic_unit.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_grid_cell.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_individual.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_individual_X11.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_jumping_mt.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_logs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_mutation.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_output_manager.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_params_mut.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_phenotype.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_population.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_population_X11.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_protein.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_replication_report.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_rna.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_selection.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_spatial_structure.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_stat_record.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_stats.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_string.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_tree.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-ae_vis_a_vis.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-f_line.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libaevol_a-param_loader.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AbstractFuzzy.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AeTime.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Alignment.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Codon.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Deletion.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Dna.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DnaReplicationReport.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Duplication.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ExpManager.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ExpManager_X11.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ExpSetup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Fuzzy.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FuzzyFactory.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GeneticUnit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GridCell.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Habitat.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HabitatFactory.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HybridFuzzy.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Individual.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/IndividualFactory.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Individual_X11.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertionHT.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Inversion.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/JumpingMT.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Logging.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Mutation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MutationParams.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Observable.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OutputManager.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ParamLoader.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ParameterLine.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PhenotypicTarget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PhenotypicTargetHandler.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Point.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PointMutation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Protein.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReplacementHT.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReplicationReport.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Rna.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Selection.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SmallDeletion.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SmallInsertion.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/StatRecord.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Stats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Translocation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Tree.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Utils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/VisAVis.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/World.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/X11Window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ae_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/Habitat_R.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/Individual_R.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/Individual_R_X11.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/PhenotypicTargetHandler_R.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/PhenotypicTarget_R.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/Protein_R.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at raevol/$(DEPDIR)/Rna_R.Po at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-libaevol_a-ae_align.o: ae_align.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_align.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_align.Tpo -c -o libaevol_a-ae_align.o `test -f 'ae_align.cpp' || echo '$(srcdir)/'`ae_align.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_align.Tpo $(DEPDIR)/libaevol_a-ae_align.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_align.cpp' object='libaevol_a-ae_align.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_align.o `test -f 'ae_align.cpp' || echo '$(srcdir)/'`ae_align.cpp
-
-libaevol_a-ae_align.obj: ae_align.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_align.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_align.Tpo -c -o libaevol_a-ae_align.obj `if test -f 'ae_align.cpp'; then $(CYGPATH_W) 'ae_align.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_align.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_align.Tpo $(DEPDIR)/libaevol_a-ae_align.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_align.cpp' object='libaevol_a-ae_align.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_align.obj `if test -f 'ae_align.cpp'; then $(CYGPATH_W) 'ae_align.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_align.cpp'; fi`
-
-libaevol_a-ae_codon.o: ae_codon.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_codon.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_codon.Tpo -c -o libaevol_a-ae_codon.o `test -f 'ae_codon.cpp' || echo '$(srcdir)/'`ae_codon.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_codon.Tpo $(DEPDIR)/libaevol_a-ae_codon.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_codon.cpp' object='libaevol_a-ae_codon.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_codon.o `test -f 'ae_codon.cpp' || echo '$(srcdir)/'`ae_codon.cpp
-
-libaevol_a-ae_codon.obj: ae_codon.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_codon.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_codon.Tpo -c -o libaevol_a-ae_codon.obj `if test -f 'ae_codon.cpp'; then $(CYGPATH_W) 'ae_codon.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_codon.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_codon.Tpo $(DEPDIR)/libaevol_a-ae_codon.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_codon.cpp' object='libaevol_a-ae_codon.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_codon.obj `if test -f 'ae_codon.cpp'; then $(CYGPATH_W) 'ae_codon.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_codon.cpp'; fi`
-
-libaevol_a-ae_dna.o: ae_dna.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dna.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dna.Tpo -c -o libaevol_a-ae_dna.o `test -f 'ae_dna.cpp' || echo '$(srcdir)/'`ae_dna.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dna.Tpo $(DEPDIR)/libaevol_a-ae_dna.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dna.cpp' object='libaevol_a-ae_dna.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dna.o `test -f 'ae_dna.cpp' || echo '$(srcdir)/'`ae_dna.cpp
-
-libaevol_a-ae_dna.obj: ae_dna.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dna.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dna.Tpo -c -o libaevol_a-ae_dna.obj `if test -f 'ae_dna.cpp'; then $(CYGPATH_W) 'ae_dna.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dna.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dna.Tpo $(DEPDIR)/libaevol_a-ae_dna.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dna.cpp' object='libaevol_a-ae_dna.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dna.obj `if test -f 'ae_dna.cpp'; then $(CYGPATH_W) 'ae_dna.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dna.cpp'; fi`
-
-libaevol_a-ae_dump.o: ae_dump.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dump.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dump.Tpo -c -o libaevol_a-ae_dump.o `test -f 'ae_dump.cpp' || echo '$(srcdir)/'`ae_dump.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dump.Tpo $(DEPDIR)/libaevol_a-ae_dump.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dump.cpp' object='libaevol_a-ae_dump.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dump.o `test -f 'ae_dump.cpp' || echo '$(srcdir)/'`ae_dump.cpp
-
-libaevol_a-ae_dump.obj: ae_dump.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dump.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dump.Tpo -c -o libaevol_a-ae_dump.obj `if test -f 'ae_dump.cpp'; then $(CYGPATH_W) 'ae_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dump.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dump.Tpo $(DEPDIR)/libaevol_a-ae_dump.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dump.cpp' object='libaevol_a-ae_dump.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dump.obj `if test -f 'ae_dump.cpp'; then $(CYGPATH_W) 'ae_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dump.cpp'; fi`
-
-libaevol_a-ae_environment.o: ae_environment.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_environment.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_environment.Tpo -c -o libaevol_a-ae_environment.o `test -f 'ae_environment.cpp' || echo '$(srcdir)/'`ae_environment.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_environment.Tpo $(DEPDIR)/libaevol_a-ae_environment.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_environment.cpp' object='libaevol_a-ae_environment.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_environment.o `test -f 'ae_environment.cpp' || echo '$(srcdir)/'`ae_environment.cpp
-
-libaevol_a-ae_environment.obj: ae_environment.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_environment.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_environment.Tpo -c -o libaevol_a-ae_environment.obj `if test -f 'ae_environment.cpp'; then $(CYGPATH_W) 'ae_environment.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_environment.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_environment.Tpo $(DEPDIR)/libaevol_a-ae_environment.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_environment.cpp' object='libaevol_a-ae_environment.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_environment.obj `if test -f 'ae_environment.cpp'; then $(CYGPATH_W) 'ae_environment.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_environment.cpp'; fi`
-
-libaevol_a-ae_exp_manager.o: ae_exp_manager.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_manager.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_manager.Tpo -c -o libaevol_a-ae_exp_manager.o `test -f 'ae_exp_manager.cpp' || echo '$(srcdir)/'`ae_exp_manager.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_manager.Tpo $(DEPDIR)/libaevol_a-ae_exp_manager.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_manager.cpp' object='libaevol_a-ae_exp_manager.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_manager.o `test -f 'ae_exp_manager.cpp' || echo '$(srcdir)/'`ae_exp_manager.cpp
-
-libaevol_a-ae_exp_manager.obj: ae_exp_manager.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_manager.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_manager.Tpo -c -o libaevol_a-ae_exp_manager.obj `if test -f 'ae_exp_manager.cpp'; then $(CYGPATH_W) 'ae_exp_manager.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_manager.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_manager.Tpo $(DEPDIR)/libaevol_a-ae_exp_manager.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_manager.cpp' object='libaevol_a-ae_exp_manager.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_manager.obj `if test -f 'ae_exp_manager.cpp'; then $(CYGPATH_W) 'ae_exp_manager.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_manager.cpp'; fi`
-
-libaevol_a-ae_exp_setup.o: ae_exp_setup.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_setup.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_setup.Tpo -c -o libaevol_a-ae_exp_setup.o `test -f 'ae_exp_setup.cpp' || echo '$(srcdir)/'`ae_exp_setup.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_setup.Tpo $(DEPDIR)/libaevol_a-ae_exp_setup.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_setup.cpp' object='libaevol_a-ae_exp_setup.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_setup.o `test -f 'ae_exp_setup.cpp' || echo '$(srcdir)/'`ae_exp_setup.cpp
-
-libaevol_a-ae_exp_setup.obj: ae_exp_setup.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_setup.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_setup.Tpo -c -o libaevol_a-ae_exp_setup.obj `if test -f 'ae_exp_setup.cpp'; then $(CYGPATH_W) 'ae_exp_setup.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_setup.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_setup.Tpo $(DEPDIR)/libaevol_a-ae_exp_setup.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_setup.cpp' object='libaevol_a-ae_exp_setup.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_setup.obj `if test -f 'ae_exp_setup.cpp'; then $(CYGPATH_W) 'ae_exp_setup.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_setup.cpp'; fi`
-
-libaevol_a-ae_fuzzy_set.o: ae_fuzzy_set.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_fuzzy_set.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_fuzzy_set.Tpo -c -o libaevol_a-ae_fuzzy_set.o `test -f 'ae_fuzzy_set.cpp' || echo '$(srcdir)/'`ae_fuzzy_set.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_fuzzy_set.Tpo $(DEPDIR)/libaevol_a-ae_fuzzy_set.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_fuzzy_set.cpp' object='libaevol_a-ae_fuzzy_set.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_fuzzy_set.o `test -f 'ae_fuzzy_set.cpp' || echo '$(srcdir)/'`ae_fuzzy_set.cpp
-
-libaevol_a-ae_fuzzy_set.obj: ae_fuzzy_set.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_fuzzy_set.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_fuzzy_set.Tpo -c -o libaevol_a-ae_fuzzy_set.obj `if test -f 'ae_fuzzy_set.cpp'; then $(CYGPATH_W) 'ae_fuzzy_set.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_fuzzy_set.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_fuzzy_set.Tpo $(DEPDIR)/libaevol_a-ae_fuzzy_set.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_fuzzy_set.cpp' object='libaevol_a-ae_fuzzy_set.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_fuzzy_set.obj `if test -f 'ae_fuzzy_set.cpp'; then $(CYGPATH_W) 'ae_fuzzy_set.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_fuzzy_set.cpp'; fi`
-
-libaevol_a-ae_genetic_unit.o: ae_genetic_unit.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_genetic_unit.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_genetic_unit.Tpo -c -o libaevol_a-ae_genetic_unit.o `test -f 'ae_genetic_unit.cpp' || echo '$(srcdir)/'`ae_genetic_unit.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_genetic_unit.Tpo $(DEPDIR)/libaevol_a-ae_genetic_unit.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_genetic_unit.cpp' object='libaevol_a-ae_genetic_unit.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_genetic_unit.o `test -f 'ae_genetic_unit.cpp' || echo '$(srcdir)/'`ae_genetic_unit.cpp
-
-libaevol_a-ae_genetic_unit.obj: ae_genetic_unit.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_genetic_unit.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_genetic_unit.Tpo -c -o libaevol_a-ae_genetic_unit.obj `if test -f 'ae_genetic_unit.cpp'; then $(CYGPATH_W) 'ae_genetic_unit.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_genetic_unit.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_genetic_unit.Tpo $(DEPDIR)/libaevol_a-ae_genetic_unit.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_genetic_unit.cpp' object='libaevol_a-ae_genetic_unit.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_genetic_unit.obj `if test -f 'ae_genetic_unit.cpp'; then $(CYGPATH_W) 'ae_genetic_unit.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_genetic_unit.cpp'; fi`
-
-libaevol_a-ae_grid_cell.o: ae_grid_cell.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_grid_cell.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_grid_cell.Tpo -c -o libaevol_a-ae_grid_cell.o `test -f 'ae_grid_cell.cpp' || echo '$(srcdir)/'`ae_grid_cell.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_grid_cell.Tpo $(DEPDIR)/libaevol_a-ae_grid_cell.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_grid_cell.cpp' object='libaevol_a-ae_grid_cell.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_grid_cell.o `test -f 'ae_grid_cell.cpp' || echo '$(srcdir)/'`ae_grid_cell.cpp
-
-libaevol_a-ae_grid_cell.obj: ae_grid_cell.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_grid_cell.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_grid_cell.Tpo -c -o libaevol_a-ae_grid_cell.obj `if test -f 'ae_grid_cell.cpp'; then $(CYGPATH_W) 'ae_grid_cell.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_grid_cell.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_grid_cell.Tpo $(DEPDIR)/libaevol_a-ae_grid_cell.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_grid_cell.cpp' object='libaevol_a-ae_grid_cell.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_grid_cell.obj `if test -f 'ae_grid_cell.cpp'; then $(CYGPATH_W) 'ae_grid_cell.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_grid_cell.cpp'; fi`
-
-libaevol_a-ae_individual.o: ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_individual.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_individual.Tpo -c -o libaevol_a-ae_individual.o `test -f 'ae_individual.cpp' || echo '$(srcdir)/'`ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_individual.Tpo $(DEPDIR)/libaevol_a-ae_individual.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_individual.cpp' object='libaevol_a-ae_individual.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_individual.o `test -f 'ae_individual.cpp' || echo '$(srcdir)/'`ae_individual.cpp
-
-libaevol_a-ae_individual.obj: ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_individual.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_individual.Tpo -c -o libaevol_a-ae_individual.obj `if test -f 'ae_individual.cpp'; then $(CYGPATH_W) 'ae_individual.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_individual.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_individual.Tpo $(DEPDIR)/libaevol_a-ae_individual.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_individual.cpp' object='libaevol_a-ae_individual.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_individual.obj `if test -f 'ae_individual.cpp'; then $(CYGPATH_W) 'ae_individual.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_individual.cpp'; fi`
-
-libaevol_a-ae_logs.o: ae_logs.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_logs.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_logs.Tpo -c -o libaevol_a-ae_logs.o `test -f 'ae_logs.cpp' || echo '$(srcdir)/'`ae_logs.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_logs.Tpo $(DEPDIR)/libaevol_a-ae_logs.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_logs.cpp' object='libaevol_a-ae_logs.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_logs.o `test -f 'ae_logs.cpp' || echo '$(srcdir)/'`ae_logs.cpp
-
-libaevol_a-ae_logs.obj: ae_logs.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_logs.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_logs.Tpo -c -o libaevol_a-ae_logs.obj `if test -f 'ae_logs.cpp'; then $(CYGPATH_W) 'ae_logs.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_logs.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_logs.Tpo $(DEPDIR)/libaevol_a-ae_logs.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_logs.cpp' object='libaevol_a-ae_logs.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_logs.obj `if test -f 'ae_logs.cpp'; then $(CYGPATH_W) 'ae_logs.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_logs.cpp'; fi`
-
-libaevol_a-ae_mutation.o: ae_mutation.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_mutation.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_mutation.Tpo -c -o libaevol_a-ae_mutation.o `test -f 'ae_mutation.cpp' || echo '$(srcdir)/'`ae_mutation.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_mutation.Tpo $(DEPDIR)/libaevol_a-ae_mutation.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_mutation.cpp' object='libaevol_a-ae_mutation.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_mutation.o `test -f 'ae_mutation.cpp' || echo '$(srcdir)/'`ae_mutation.cpp
-
-libaevol_a-ae_mutation.obj: ae_mutation.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_mutation.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_mutation.Tpo -c -o libaevol_a-ae_mutation.obj `if test -f 'ae_mutation.cpp'; then $(CYGPATH_W) 'ae_mutation.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_mutation.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_mutation.Tpo $(DEPDIR)/libaevol_a-ae_mutation.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_mutation.cpp' object='libaevol_a-ae_mutation.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_mutation.obj `if test -f 'ae_mutation.cpp'; then $(CYGPATH_W) 'ae_mutation.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_mutation.cpp'; fi`
-
-libaevol_a-ae_output_manager.o: ae_output_manager.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_output_manager.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_output_manager.Tpo -c -o libaevol_a-ae_output_manager.o `test -f 'ae_output_manager.cpp' || echo '$(srcdir)/'`ae_output_manager.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_output_manager.Tpo $(DEPDIR)/libaevol_a-ae_output_manager.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_output_manager.cpp' object='libaevol_a-ae_output_manager.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_output_manager.o `test -f 'ae_output_manager.cpp' || echo '$(srcdir)/'`ae_output_manager.cpp
-
-libaevol_a-ae_output_manager.obj: ae_output_manager.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_output_manager.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_output_manager.Tpo -c -o libaevol_a-ae_output_manager.obj `if test -f 'ae_output_manager.cpp'; then $(CYGPATH_W) 'ae_output_manager.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_output_manager.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_output_manager.Tpo $(DEPDIR)/libaevol_a-ae_output_manager.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_output_manager.cpp' object='libaevol_a-ae_output_manager.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_output_manager.obj `if test -f 'ae_output_manager.cpp'; then $(CYGPATH_W) 'ae_output_manager.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_output_manager.cpp'; fi`
-
-libaevol_a-ae_params_mut.o: ae_params_mut.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_params_mut.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_params_mut.Tpo -c -o libaevol_a-ae_params_mut.o `test -f 'ae_params_mut.cpp' || echo '$(srcdir)/'`ae_params_mut.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_params_mut.Tpo $(DEPDIR)/libaevol_a-ae_params_mut.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_params_mut.cpp' object='libaevol_a-ae_params_mut.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_params_mut.o `test -f 'ae_params_mut.cpp' || echo '$(srcdir)/'`ae_params_mut.cpp
-
-libaevol_a-ae_params_mut.obj: ae_params_mut.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_params_mut.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_params_mut.Tpo -c -o libaevol_a-ae_params_mut.obj `if test -f 'ae_params_mut.cpp'; then $(CYGPATH_W) 'ae_params_mut.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_params_mut.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_params_mut.Tpo $(DEPDIR)/libaevol_a-ae_params_mut.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_params_mut.cpp' object='libaevol_a-ae_params_mut.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_params_mut.obj `if test -f 'ae_params_mut.cpp'; then $(CYGPATH_W) 'ae_params_mut.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_params_mut.cpp'; fi`
-
-libaevol_a-ae_phenotype.o: ae_phenotype.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_phenotype.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_phenotype.Tpo -c -o libaevol_a-ae_phenotype.o `test -f 'ae_phenotype.cpp' || echo '$(srcdir)/'`ae_phenotype.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_phenotype.Tpo $(DEPDIR)/libaevol_a-ae_phenotype.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_phenotype.cpp' object='libaevol_a-ae_phenotype.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_phenotype.o `test -f 'ae_phenotype.cpp' || echo '$(srcdir)/'`ae_phenotype.cpp
-
-libaevol_a-ae_phenotype.obj: ae_phenotype.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_phenotype.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_phenotype.Tpo -c -o libaevol_a-ae_phenotype.obj `if test -f 'ae_phenotype.cpp'; then $(CYGPATH_W) 'ae_phenotype.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_phenotype.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_phenotype.Tpo $(DEPDIR)/libaevol_a-ae_phenotype.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_phenotype.cpp' object='libaevol_a-ae_phenotype.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_phenotype.obj `if test -f 'ae_phenotype.cpp'; then $(CYGPATH_W) 'ae_phenotype.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_phenotype.cpp'; fi`
-
-libaevol_a-ae_population.o: ae_population.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_population.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_population.Tpo -c -o libaevol_a-ae_population.o `test -f 'ae_population.cpp' || echo '$(srcdir)/'`ae_population.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_population.Tpo $(DEPDIR)/libaevol_a-ae_population.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_population.cpp' object='libaevol_a-ae_population.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_population.o `test -f 'ae_population.cpp' || echo '$(srcdir)/'`ae_population.cpp
-
-libaevol_a-ae_population.obj: ae_population.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_population.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_population.Tpo -c -o libaevol_a-ae_population.obj `if test -f 'ae_population.cpp'; then $(CYGPATH_W) 'ae_population.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_population.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_population.Tpo $(DEPDIR)/libaevol_a-ae_population.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_population.cpp' object='libaevol_a-ae_population.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_population.obj `if test -f 'ae_population.cpp'; then $(CYGPATH_W) 'ae_population.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_population.cpp'; fi`
-
-libaevol_a-ae_protein.o: ae_protein.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_protein.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_protein.Tpo -c -o libaevol_a-ae_protein.o `test -f 'ae_protein.cpp' || echo '$(srcdir)/'`ae_protein.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_protein.Tpo $(DEPDIR)/libaevol_a-ae_protein.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_protein.cpp' object='libaevol_a-ae_protein.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_protein.o `test -f 'ae_protein.cpp' || echo '$(srcdir)/'`ae_protein.cpp
-
-libaevol_a-ae_protein.obj: ae_protein.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_protein.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_protein.Tpo -c -o libaevol_a-ae_protein.obj `if test -f 'ae_protein.cpp'; then $(CYGPATH_W) 'ae_protein.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_protein.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_protein.Tpo $(DEPDIR)/libaevol_a-ae_protein.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_protein.cpp' object='libaevol_a-ae_protein.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_protein.obj `if test -f 'ae_protein.cpp'; then $(CYGPATH_W) 'ae_protein.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_protein.cpp'; fi`
-
-libaevol_a-ae_jumping_mt.o: ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_jumping_mt.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_jumping_mt.Tpo -c -o libaevol_a-ae_jumping_mt.o `test -f 'ae_jumping_mt.cpp' || echo '$(srcdir)/'`ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_jumping_mt.Tpo $(DEPDIR)/libaevol_a-ae_jumping_mt.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_jumping_mt.cpp' object='libaevol_a-ae_jumping_mt.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_jumping_mt.o `test -f 'ae_jumping_mt.cpp' || echo '$(srcdir)/'`ae_jumping_mt.cpp
-
-libaevol_a-ae_jumping_mt.obj: ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_jumping_mt.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_jumping_mt.Tpo -c -o libaevol_a-ae_jumping_mt.obj `if test -f 'ae_jumping_mt.cpp'; then $(CYGPATH_W) 'ae_jumping_mt.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_jumping_mt.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_jumping_mt.Tpo $(DEPDIR)/libaevol_a-ae_jumping_mt.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_jumping_mt.cpp' object='libaevol_a-ae_jumping_mt.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_jumping_mt.obj `if test -f 'ae_jumping_mt.cpp'; then $(CYGPATH_W) 'ae_jumping_mt.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_jumping_mt.cpp'; fi`
-
-libaevol_a-ae_replication_report.o: ae_replication_report.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_replication_report.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_replication_report.Tpo -c -o libaevol_a-ae_replication_report.o `test -f 'ae_replication_report.cpp' || echo '$(srcdir)/'`ae_replication_report.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_replication_report.Tpo $(DEPDIR)/libaevol_a-ae_replication_report.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_replication_report.cpp' object='libaevol_a-ae_replication_report.o' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_replication_report.o `test -f 'ae_replication_report.cpp' || echo '$(srcdir)/'`ae_replication_report.cpp
-
-libaevol_a-ae_replication_report.obj: ae_replication_report.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_replication_report.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_replication_report.Tpo -c -o libaevol_a-ae_replication_report.obj `if test -f 'ae_replication_report.cpp'; then $(CYGPATH_W) 'ae_replication_report.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_replication_report.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_replication_report.Tpo $(DEPDIR)/libaevol_a-ae_replication_report.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_replication_report.cpp' object='libaevol_a-ae_replication_report.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_replication_report.obj `if test -f 'ae_replication_report.cpp'; then $(CYGPATH_W) 'ae_replication_report.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_replication_report.cpp'; fi`
-
-libaevol_a-ae_dna_replic_report.o: ae_dna_replic_report.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dna_replic_report.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dna_replic_report.Tpo -c -o libaevol_a-ae_dna_replic_report.o `test -f 'ae_dna_replic_report.cpp' || echo '$(srcdir)/'`ae_dna_replic_report.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dna_replic_report.Tpo $(DEPDIR)/libaevol_a-ae_dna_replic_report.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dna_replic_report.cpp' object='libaevol_a-ae_dna_replic_report.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dna_replic_report.o `test -f 'ae_dna_replic_report.cpp' || echo '$(srcdir)/'`ae_dna_replic_report.cpp
-
-libaevol_a-ae_dna_replic_report.obj: ae_dna_replic_report.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_dna_replic_report.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_dna_replic_report.Tpo -c -o libaevol_a-ae_dna_replic_report.obj `if test -f 'ae_dna_replic_report.cpp'; then $(CYGPATH_W) 'ae_dna_replic_report.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dna_replic_report.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_dna_replic_report.Tpo $(DEPDIR)/libaevol_a-ae_dna_replic_report.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_dna_replic_report.cpp' object='libaevol_a-ae_dna_replic_report.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_dna_replic_report.obj `if test -f 'ae_dna_replic_report.cpp'; then $(CYGPATH_W) 'ae_dna_replic_report.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_dna_replic_report.cpp'; fi`
-
-libaevol_a-ae_rna.o: ae_rna.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_rna.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_rna.Tpo -c -o libaevol_a-ae_rna.o `test -f 'ae_rna.cpp' || echo '$(srcdir)/'`ae_rna.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_rna.Tpo $(DEPDIR)/libaevol_a-ae_rna.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_rna.cpp' object='libaevol_a-ae_rna.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_rna.o `test -f 'ae_rna.cpp' || echo '$(srcdir)/'`ae_rna.cpp
-
-libaevol_a-ae_rna.obj: ae_rna.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_rna.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_rna.Tpo -c -o libaevol_a-ae_rna.obj `if test -f 'ae_rna.cpp'; then $(CYGPATH_W) 'ae_rna.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_rna.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_rna.Tpo $(DEPDIR)/libaevol_a-ae_rna.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_rna.cpp' object='libaevol_a-ae_rna.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_rna.obj `if test -f 'ae_rna.cpp'; then $(CYGPATH_W) 'ae_rna.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_rna.cpp'; fi`
-
-libaevol_a-ae_stats.o: ae_stats.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_stats.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_stats.Tpo -c -o libaevol_a-ae_stats.o `test -f 'ae_stats.cpp' || echo '$(srcdir)/'`ae_stats.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_stats.Tpo $(DEPDIR)/libaevol_a-ae_stats.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_stats.cpp' object='libaevol_a-ae_stats.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_stats.o `test -f 'ae_stats.cpp' || echo '$(srcdir)/'`ae_stats.cpp
-
-libaevol_a-ae_stats.obj: ae_stats.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_stats.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_stats.Tpo -c -o libaevol_a-ae_stats.obj `if test -f 'ae_stats.cpp'; then $(CYGPATH_W) 'ae_stats.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_stats.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_stats.Tpo $(DEPDIR)/libaevol_a-ae_stats.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_stats.cpp' object='libaevol_a-ae_stats.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_stats.obj `if test -f 'ae_stats.cpp'; then $(CYGPATH_W) 'ae_stats.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_stats.cpp'; fi`
-
-libaevol_a-ae_stat_record.o: ae_stat_record.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_stat_record.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_stat_record.Tpo -c -o libaevol_a-ae_stat_record.o `test -f 'ae_stat_record.cpp' || echo '$(srcdir)/'`ae_stat_record.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_stat_record.Tpo $(DEPDIR)/libaevol_a-ae_stat_record.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_stat_record.cpp' object='libaevol_a-ae_stat_record.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_stat_record.o `test -f 'ae_stat_record.cpp' || echo '$(srcdir)/'`ae_stat_record.cpp
-
-libaevol_a-ae_stat_record.obj: ae_stat_record.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_stat_record.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_stat_record.Tpo -c -o libaevol_a-ae_stat_record.obj `if test -f 'ae_stat_record.cpp'; then $(CYGPATH_W) 'ae_stat_record.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_stat_record.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_stat_record.Tpo $(DEPDIR)/libaevol_a-ae_stat_record.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_stat_record.cpp' object='libaevol_a-ae_stat_record.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_stat_record.obj `if test -f 'ae_stat_record.cpp'; then $(CYGPATH_W) 'ae_stat_record.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_stat_record.cpp'; fi`
-
-libaevol_a-ae_string.o: ae_string.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_string.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_string.Tpo -c -o libaevol_a-ae_string.o `test -f 'ae_string.cpp' || echo '$(srcdir)/'`ae_string.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_string.Tpo $(DEPDIR)/libaevol_a-ae_string.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_string.cpp' object='libaevol_a-ae_string.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_string.o `test -f 'ae_string.cpp' || echo '$(srcdir)/'`ae_string.cpp
-
-libaevol_a-ae_string.obj: ae_string.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_string.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_string.Tpo -c -o libaevol_a-ae_string.obj `if test -f 'ae_string.cpp'; then $(CYGPATH_W) 'ae_string.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_string.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_string.Tpo $(DEPDIR)/libaevol_a-ae_string.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_string.cpp' object='libaevol_a-ae_string.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_string.obj `if test -f 'ae_string.cpp'; then $(CYGPATH_W) 'ae_string.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_string.cpp'; fi`
-
-libaevol_a-ae_tree.o: ae_tree.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_tree.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_tree.Tpo -c -o libaevol_a-ae_tree.o `test -f 'ae_tree.cpp' || echo '$(srcdir)/'`ae_tree.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_tree.Tpo $(DEPDIR)/libaevol_a-ae_tree.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_tree.cpp' object='libaevol_a-ae_tree.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_tree.o `test -f 'ae_tree.cpp' || echo '$(srcdir)/'`ae_tree.cpp
-
-libaevol_a-ae_tree.obj: ae_tree.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_tree.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_tree.Tpo -c -o libaevol_a-ae_tree.obj `if test -f 'ae_tree.cpp'; then $(CYGPATH_W) 'ae_tree.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_tree.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_tree.Tpo $(DEPDIR)/libaevol_a-ae_tree.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_tree.cpp' object='libaevol_a-ae_tree.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_tree.obj `if test -f 'ae_tree.cpp'; then $(CYGPATH_W) 'ae_tree.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_tree.cpp'; fi`
-
-libaevol_a-ae_vis_a_vis.o: ae_vis_a_vis.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_vis_a_vis.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_vis_a_vis.Tpo -c -o libaevol_a-ae_vis_a_vis.o `test -f 'ae_vis_a_vis.cpp' || echo '$(srcdir)/'`ae_vis_a_vis.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_vis_a_vis.Tpo $(DEPDIR)/libaevol_a-ae_vis_a_vis.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_vis_a_vis.cpp' object='libaevol_a-ae_vis_a_vis.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_vis_a_vis.o `test -f 'ae_vis_a_vis.cpp' || echo '$(srcdir)/'`ae_vis_a_vis.cpp
-
-libaevol_a-ae_vis_a_vis.obj: ae_vis_a_vis.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_vis_a_vis.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_vis_a_vis.Tpo -c -o libaevol_a-ae_vis_a_vis.obj `if test -f 'ae_vis_a_vis.cpp'; then $(CYGPATH_W) 'ae_vis_a_vis.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_vis_a_vis.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_vis_a_vis.Tpo $(DEPDIR)/libaevol_a-ae_vis_a_vis.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_vis_a_vis.cpp' object='libaevol_a-ae_vis_a_vis.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_vis_a_vis.obj `if test -f 'ae_vis_a_vis.cpp'; then $(CYGPATH_W) 'ae_vis_a_vis.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_vis_a_vis.cpp'; fi`
-
-libaevol_a-ae_selection.o: ae_selection.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_selection.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_selection.Tpo -c -o libaevol_a-ae_selection.o `test -f 'ae_selection.cpp' || echo '$(srcdir)/'`ae_selection.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_selection.Tpo $(DEPDIR)/libaevol_a-ae_selection.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_selection.cpp' object='libaevol_a-ae_selection.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_selection.o `test -f 'ae_selection.cpp' || echo '$(srcdir)/'`ae_selection.cpp
-
-libaevol_a-ae_selection.obj: ae_selection.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_selection.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_selection.Tpo -c -o libaevol_a-ae_selection.obj `if test -f 'ae_selection.cpp'; then $(CYGPATH_W) 'ae_selection.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_selection.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_selection.Tpo $(DEPDIR)/libaevol_a-ae_selection.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_selection.cpp' object='libaevol_a-ae_selection.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_selection.obj `if test -f 'ae_selection.cpp'; then $(CYGPATH_W) 'ae_selection.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_selection.cpp'; fi`
-
-libaevol_a-ae_spatial_structure.o: ae_spatial_structure.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_spatial_structure.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_spatial_structure.Tpo -c -o libaevol_a-ae_spatial_structure.o `test -f 'ae_spatial_structure.cpp' || echo '$(srcdir)/'`ae_spatial_structure.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_spatial_structure.Tpo $(DEPDIR)/libaevol_a-ae_spatial_structure.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_spatial_structure.cpp' object='libaevol_a-ae_spatial_structure.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_spatial_structure.o `test -f 'ae_spatial_structure.cpp' || echo '$(srcdir)/'`ae_spatial_structure.cpp
-
-libaevol_a-ae_spatial_structure.obj: ae_spatial_structure.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_spatial_structure.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_spatial_structure.Tpo -c -o libaevol_a-ae_spatial_structure.obj `if test -f 'ae_spatial_structure.cpp'; then $(CYGPATH_W) 'ae_spatial_structure.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_spatial_structure.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_spatial_structure.Tpo $(DEPDIR)/libaevol_a-ae_spatial_structure.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_spatial_structure.cpp' object='libaevol_a-ae_spatial_structure.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_spatial_structure.obj `if test -f 'ae_spatial_structure.cpp'; then $(CYGPATH_W) 'ae_spatial_structure.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_spatial_structure.cpp'; fi`
-
-libaevol_a-ae_gene_tree.o: ae_gene_tree.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_tree.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_tree.Tpo -c -o libaevol_a-ae_gene_tree.o `test -f 'ae_gene_tree.cpp' || echo '$(srcdir)/'`ae_gene_tree.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_tree.Tpo $(DEPDIR)/libaevol_a-ae_gene_tree.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_tree.cpp' object='libaevol_a-ae_gene_tree.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_tree.o `test -f 'ae_gene_tree.cpp' || echo '$(srcdir)/'`ae_gene_tree.cpp
-
-libaevol_a-ae_gene_tree.obj: ae_gene_tree.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_tree.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_tree.Tpo -c -o libaevol_a-ae_gene_tree.obj `if test -f 'ae_gene_tree.cpp'; then $(CYGPATH_W) 'ae_gene_tree.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_tree.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_tree.Tpo $(DEPDIR)/libaevol_a-ae_gene_tree.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_tree.cpp' object='libaevol_a-ae_gene_tree.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_tree.obj `if test -f 'ae_gene_tree.cpp'; then $(CYGPATH_W) 'ae_gene_tree.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_tree.cpp'; fi`
-
-libaevol_a-ae_gene_tree_node.o: ae_gene_tree_node.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_tree_node.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_tree_node.Tpo -c -o libaevol_a-ae_gene_tree_node.o `test -f 'ae_gene_tree_node.cpp' || echo '$(srcdir)/'`ae_gene_tree_node.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_tree_node.Tpo $(DEPDIR)/libaevol_a-ae_gene_tree_node.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_tree_node.cpp' object='libaevol_a-ae_gene_tree_node.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_tree_node.o `test -f 'ae_gene_tree_node.cpp' || echo '$(srcdir)/'`ae_gene_tree_node.cpp
-
-libaevol_a-ae_gene_tree_node.obj: ae_gene_tree_node.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_tree_node.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_tree_node.Tpo -c -o libaevol_a-ae_gene_tree_node.obj `if test -f 'ae_gene_tree_node.cpp'; then $(CYGPATH_W) 'ae_gene_tree_node.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_tree_node.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_tree_node.Tpo $(DEPDIR)/libaevol_a-ae_gene_tree_node.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_tree_node.cpp' object='libaevol_a-ae_gene_tree_node.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_tree_node.obj `if test -f 'ae_gene_tree_node.cpp'; then $(CYGPATH_W) 'ae_gene_tree_node.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_tree_node.cpp'; fi`
-
-libaevol_a-ae_gene_mutation.o: ae_gene_mutation.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_mutation.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_mutation.Tpo -c -o libaevol_a-ae_gene_mutation.o `test -f 'ae_gene_mutation.cpp' || echo '$(srcdir)/'`ae_gene_mutation.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_mutation.Tpo $(DEPDIR)/libaevol_a-ae_gene_mutation.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_mutation.cpp' object='libaevol_a-ae_gene_mutation.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_mutation.o `test -f 'ae_gene_mutation.cpp' || echo '$(srcdir)/'`ae_gene_mutation.cpp
-
-libaevol_a-ae_gene_mutation.obj: ae_gene_mutation.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_gene_mutation.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_gene_mutation.Tpo -c -o libaevol_a-ae_gene_mutation.obj `if test -f 'ae_gene_mutation.cpp'; then $(CYGPATH_W) 'ae_gene_mutation.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_mutation.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_gene_mutation.Tpo $(DEPDIR)/libaevol_a-ae_gene_mutation.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_gene_mutation.cpp' object='libaevol_a-ae_gene_mutation.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_gene_mutation.obj `if test -f 'ae_gene_mutation.cpp'; then $(CYGPATH_W) 'ae_gene_mutation.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_gene_mutation.cpp'; fi`
-
-libaevol_a-param_loader.o: param_loader.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-param_loader.o -MD -MP -MF $(DEPDIR)/libaevol_a-param_loader.Tpo -c -o libaevol_a-param_loader.o `test -f 'param_loader.cpp' || echo '$(srcdir)/'`param_loader.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-param_loader.Tpo $(DEPDIR)/libaevol_a-param_loader.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='param_loader.cpp' object='libaevol_a-param_loader.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-param_loader.o `test -f 'param_loader.cpp' || echo '$(srcdir)/'`param_loader.cpp
-
-libaevol_a-param_loader.obj: param_loader.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-param_loader.obj -MD -MP -MF $(DEPDIR)/libaevol_a-param_loader.Tpo -c -o libaevol_a-param_loader.obj `if test -f 'param_loader.cpp'; then $(CYGPATH_W) 'param_loader.cpp'; else $(CYGPATH_W) '$(srcdir)/param_loader.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-param_loader.Tpo $(DEPDIR)/libaevol_a-param_loader.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='param_loader.cpp' object='libaevol_a-param_loader.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-param_loader.obj `if test -f 'param_loader.cpp'; then $(CYGPATH_W) 'param_loader.cpp'; else $(CYGPATH_W) '$(srcdir)/param_loader.cpp'; fi`
-
-libaevol_a-f_line.o: f_line.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-f_line.o -MD -MP -MF $(DEPDIR)/libaevol_a-f_line.Tpo -c -o libaevol_a-f_line.o `test -f 'f_line.cpp' || echo '$(srcdir)/'`f_line.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-f_line.Tpo $(DEPDIR)/libaevol_a-f_line.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='f_line.cpp' object='libaevol_a-f_line.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-f_line.o `test -f 'f_line.cpp' || echo '$(srcdir)/'`f_line.cpp
-
-libaevol_a-f_line.obj: f_line.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-f_line.obj -MD -MP -MF $(DEPDIR)/libaevol_a-f_line.Tpo -c -o libaevol_a-f_line.obj `if test -f 'f_line.cpp'; then $(CYGPATH_W) 'f_line.cpp'; else $(CYGPATH_W) '$(srcdir)/f_line.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-f_line.Tpo $(DEPDIR)/libaevol_a-f_line.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='f_line.cpp' object='libaevol_a-f_line.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-f_line.obj `if test -f 'f_line.cpp'; then $(CYGPATH_W) 'f_line.cpp'; else $(CYGPATH_W) '$(srcdir)/f_line.cpp'; fi`
-
-libaevol_a-ae_fuzzy_set_X11.o: ae_fuzzy_set_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_fuzzy_set_X11.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Tpo -c -o libaevol_a-ae_fuzzy_set_X11.o `test -f 'ae_fuzzy_set_X11.cpp' || echo '$(srcdir)/'`ae_fuzzy_set_X11.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Tpo $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_fuzzy_set_X11.cpp' object='libaevol_a-ae_fuzzy_set_X11.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_fuzzy_set_X11.o `test -f 'ae_fuzzy_set_X11.cpp' || echo '$(srcdir)/'`ae_fuzzy_set_X11.cpp
-
-libaevol_a-ae_fuzzy_set_X11.obj: ae_fuzzy_set_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_fuzzy_set_X11.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Tpo -c -o libaevol_a-ae_fuzzy_set_X11.obj `if test -f 'ae_fuzzy_set_X11.cpp'; then $(CYGPATH_W) 'ae_fuzzy_set_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_fuzzy_set_X11.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Tpo $(DEPDIR)/libaevol_a-ae_fuzzy_set_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_fuzzy_set_X11.cpp' object='libaevol_a-ae_fuzzy_set_X11.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_fuzzy_set_X11.obj `if test -f 'ae_fuzzy_set_X11.cpp'; then $(CYGPATH_W) 'ae_fuzzy_set_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_fuzzy_set_X11.cpp'; fi`
-
-libaevol_a-ae_individual_X11.o: ae_individual_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_individual_X11.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_individual_X11.Tpo -c -o libaevol_a-ae_individual_X11.o `test -f 'ae_individual_X11.cpp' || echo '$(srcdir)/'`ae_individual_X11.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_individual_X11.Tpo $(DEPDIR)/libaevol_a-ae_individual_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_individual_X11.cpp' object='libaevol_a-ae_individual_X11.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_individual_X11.o `test -f 'ae_individual_X11.cpp' || echo '$(srcdir)/'`ae_individual_X11.cpp
-
-libaevol_a-ae_individual_X11.obj: ae_individual_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_individual_X11.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_individual_X11.Tpo -c -o libaevol_a-ae_individual_X11.obj `if test -f 'ae_individual_X11.cpp'; then $(CYGPATH_W) 'ae_individual_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_individual_X11.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_individual_X11.Tpo $(DEPDIR)/libaevol_a-ae_individual_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_individual_X11.cpp' object='libaevol_a-ae_individual_X11.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_individual_X11.obj `if test -f 'ae_individual_X11.cpp'; then $(CYGPATH_W) 'ae_individual_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_individual_X11.cpp'; fi`
-
-libaevol_a-ae_population_X11.o: ae_population_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_population_X11.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_population_X11.Tpo -c -o libaevol_a-ae_population_X11.o `test -f 'ae_population_X11.cpp' || echo '$(srcdir)/'`ae_population_X11.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_population_X11.Tpo $(DEPDIR)/libaevol_a-ae_population_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_population_X11.cpp' object='libaevol_a-ae_population_X11.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_population_X11.o `test -f 'ae_population_X11.cpp' || echo '$(srcdir)/'`ae_population_X11.cpp
-
-libaevol_a-ae_population_X11.obj: ae_population_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_population_X11.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_population_X11.Tpo -c -o libaevol_a-ae_population_X11.obj `if test -f 'ae_population_X11.cpp'; then $(CYGPATH_W) 'ae_population_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_population_X11.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_population_X11.Tpo $(DEPDIR)/libaevol_a-ae_population_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_population_X11.cpp' object='libaevol_a-ae_population_X11.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_population_X11.obj `if test -f 'ae_population_X11.cpp'; then $(CYGPATH_W) 'ae_population_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_population_X11.cpp'; fi`
-
-libaevol_a-ae_exp_manager_X11.o: ae_exp_manager_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_manager_X11.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Tpo -c -o libaevol_a-ae_exp_manager_X11.o `test -f 'ae_exp_manager_X11.cpp' || echo '$(srcdir)/'`ae_exp_manager_X11.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Tpo $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_manager_X11.cpp' object='libaevol_a-ae_exp_manager_X11.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_manager_X11.o `test -f 'ae_exp_manager_X11.cpp' || echo '$(srcdir)/'`ae_exp_manager_X11.cpp
-
-libaevol_a-ae_exp_manager_X11.obj: ae_exp_manager_X11.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_exp_manager_X11.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Tpo -c -o libaevol_a-ae_exp_manager_X11.obj `if test -f 'ae_exp_manager_X11.cpp'; then $(CYGPATH_W) 'ae_exp_manager_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_manager_X11.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Tpo $(DEPDIR)/libaevol_a-ae_exp_manager_X11.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_exp_manager_X11.cpp' object='libaevol_a-ae_exp_manager_X11.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_exp_manager_X11.obj `if test -f 'ae_exp_manager_X11.cpp'; then $(CYGPATH_W) 'ae_exp_manager_X11.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_exp_manager_X11.cpp'; fi`
-
-libaevol_a-ae_X11_window.o: ae_X11_window.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_X11_window.o -MD -MP -MF $(DEPDIR)/libaevol_a-ae_X11_window.Tpo -c -o libaevol_a-ae_X11_window.o `test -f 'ae_X11_window.cpp' || echo '$(srcdir)/'`ae_X11_window.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_X11_window.Tpo $(DEPDIR)/libaevol_a-ae_X11_window.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_X11_window.cpp' object='libaevol_a-ae_X11_window.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_X11_window.o `test -f 'ae_X11_window.cpp' || echo '$(srcdir)/'`ae_X11_window.cpp
-
-libaevol_a-ae_X11_window.obj: ae_X11_window.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libaevol_a-ae_X11_window.obj -MD -MP -MF $(DEPDIR)/libaevol_a-ae_X11_window.Tpo -c -o libaevol_a-ae_X11_window.obj `if test -f 'ae_X11_window.cpp'; then $(CYGPATH_W) 'ae_X11_window.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_X11_window.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libaevol_a-ae_X11_window.Tpo $(DEPDIR)/libaevol_a-ae_X11_window.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='ae_X11_window.cpp' object='libaevol_a-ae_X11_window.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaevol_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libaevol_a-ae_X11_window.obj `if test -f 'ae_X11_window.cpp'; then $(CYGPATH_W) 'ae_X11_window.cpp'; else $(CYGPATH_W) '$(srcdir)/ae_X11_window.cpp'; fi`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -1030,57 +812,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -1096,12 +833,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -1113,15 +845,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -1130,6 +858,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -1220,6 +963,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f raevol/$(DEPDIR)/$(am__dirstamp)
+	-rm -f raevol/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -1229,7 +974,7 @@ clean: clean-recursive
 clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
 
 distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) raevol/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1275,7 +1020,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) raevol/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1293,22 +1038,23 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-am clean clean-generic \
-	clean-noinstLIBRARIES ctags ctags-recursive distclean \
-	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs installdirs-am \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+	check-am clean clean-generic clean-noinstLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am
+
+.PRECIOUS: Makefile
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/libaevol/Metrics.h b/src/libaevol/Metrics.h
new file mode 100644
index 0000000..5bbacd3
--- /dev/null
+++ b/src/libaevol/Metrics.h
@@ -0,0 +1,208 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_INDIV_STATS_H_
+#define AEVOL_INDIV_STATS_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include "Individual.h"
+#include "GeneticUnit.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+class Individual;
+
+
+
+
+
+
+class Metrics
+{
+  friend Individual;
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Metrics() = default; //< Default ctor
+  Metrics(const Metrics&) = default; //< Copy ctor
+  Metrics(Metrics&&) = default; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Metrics() = default; //< Destructor
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  int32_t total_genome_size() const {
+    return total_genome_size_;
+  };
+  int16_t nb_coding_RNAs() const {
+    return nb_coding_RNAs_;
+  };
+  int16_t nb_non_coding_RNAs() const {
+    return nb_non_coding_RNAs_;
+  };
+  int32_t overall_size_coding_RNAs() const {
+    return overall_size_coding_RNAs_;
+  };
+  int32_t overall_size_non_coding_RNAs() const {
+    return overall_size_non_coding_RNAs_;
+  };
+  int16_t nb_genes_activ() const {
+    return nb_genes_activ_;
+  };
+  int16_t nb_genes_inhib() const {
+    return nb_genes_inhib_;
+  };
+  int16_t nb_functional_genes() const {
+    return nb_functional_genes_;
+  };
+  int16_t nb_non_functional_genes() const {
+    return nb_non_functional_genes_;
+  };
+  int32_t overall_size_functional_genes() const {
+    return overall_size_functional_genes_;
+  };
+  int32_t overall_size_non_functional_genes() const {
+    return overall_size_non_functional_genes_;
+  };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  inline void Reset();
+  inline void Accumulate(const GeneticUnit& gen_unit);
+
+
+
+
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  /// Sum of sizes of the genetic units
+  int32_t total_genome_size_ = 0;
+  /// Number of coding RNAs (at least one gene on RNA)
+  int16_t nb_coding_RNAs_ = 0;
+  /// Number of non-coding-RNAs
+  int16_t nb_non_coding_RNAs_ = 0;
+  /// Cumulated size of all coding RNAs
+  int32_t overall_size_coding_RNAs_ = 0;
+  /// Cumulated size of all non-coding RNAs
+  int32_t overall_size_non_coding_RNAs_ = 0;
+  /// Number of genes realizing a function
+  int16_t nb_genes_activ_ = 0;
+  /// Number of genes inhibitting a function
+  int16_t nb_genes_inhib_ = 0;
+  /// Number of functional genes
+  int16_t nb_functional_genes_ = 0;
+  /// Number of non-functional genes
+  int16_t nb_non_functional_genes_ = 0;
+  /// Cumulated size of all functional genes
+  int32_t overall_size_functional_genes_ = 0;
+  /// Cumulated size of all non-functional genes
+  int32_t overall_size_non_functional_genes_ = 0;
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+void Metrics::Reset() {
+  total_genome_size_                  = 0;
+  nb_coding_RNAs_                     = 0;
+  nb_non_coding_RNAs_                 = 0;
+  overall_size_coding_RNAs_           = 0;
+  overall_size_non_coding_RNAs_       = 0;
+  nb_genes_activ_                     = 0;
+  nb_genes_inhib_                     = 0;
+  nb_functional_genes_                = 0;
+  nb_non_functional_genes_            = 0;
+  overall_size_functional_genes_      = 0;
+  overall_size_non_functional_genes_  = 0;
+}
+
+void Metrics::Accumulate(const GeneticUnit& gen_unit) {
+  total_genome_size_ += gen_unit.dna()->length();
+  nb_coding_RNAs_ += gen_unit.nb_coding_RNAs();
+  nb_non_coding_RNAs_ += gen_unit.nb_non_coding_RNAs();
+  overall_size_coding_RNAs_ += gen_unit.overall_size_coding_RNAs();
+  overall_size_non_coding_RNAs_ += gen_unit.overall_size_non_coding_RNAs();
+  nb_genes_activ_ += gen_unit.nb_genes_activ();
+  nb_genes_inhib_ += gen_unit.nb_genes_inhib();
+  nb_functional_genes_ += gen_unit.nb_functional_genes();
+  nb_non_functional_genes_ += gen_unit.nb_non_functional_genes();
+  overall_size_functional_genes_ +=
+      gen_unit.overall_size_functional_genes();
+  overall_size_non_functional_genes_ +=
+      gen_unit.overall_size_non_functional_genes();
+};
+
+} // namespace aevol
+
+#endif // AEVOL_INDIV_STATS_H_
diff --git a/src/libaevol/Mutation.cpp b/src/libaevol/Mutation.cpp
new file mode 100644
index 0000000..f180586
--- /dev/null
+++ b/src/libaevol/Mutation.cpp
@@ -0,0 +1,264 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cstdlib>
+
+#include "Mutation.h"
+#include "PointMutation.h"
+#include "SmallInsertion.h"
+#include "SmallDeletion.h"
+#include "Duplication.h"
+#include "Deletion.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "InsertionHT.h"
+#include "ReplacementHT.h"
+
+namespace aevol {
+
+
+//#############################################################################
+//
+//                                Class Mutation
+//
+//#############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Mutation* Mutation::Load(gzFile backup_file) {
+  // Retrieve mutation type
+  int8_t tmp_mut_type;
+  gzread(backup_file, &tmp_mut_type,  sizeof(tmp_mut_type));
+  MutationType mut_type = (MutationType) tmp_mut_type;
+
+  // Call the appropriate constructor accordingly
+  Mutation* mut;
+  switch (mut_type) {
+    case SWITCH :
+      mut = new PointMutation();
+      break;
+    case S_INS :
+      mut = new SmallInsertion();
+      break;
+    case S_DEL :
+      mut = new SmallDeletion();
+      break;
+    case DUPL :
+      mut = new Duplication();
+      break;
+    case DEL :
+      mut = new Deletion();
+      break;
+    case TRANS :
+      mut = new Translocation();
+      break;
+    case INV :
+      mut = new Inversion();
+      break;
+    case INS_HT :
+      mut = new InsertionHT();
+      break;
+    case REPL_HT :
+      mut = new ReplacementHT();
+      break;
+    default :
+      Utils::ExitWithDevMsg("invalid mutation type ", __FILE__, __LINE__);
+      exit(-1); // Superfluous but suppresses a warning
+  }
+
+  // Load from backup file
+  mut->load(backup_file);
+  return mut;
+}
+
+
+
+
+//Mutation::Mutation(gzFile backup_file)
+//{
+//  pos_ = NULL;
+//  length_ = NULL;
+//  seq_ = NULL;
+//  align_score_ = NULL;
+//
+//  int8_t tmp_mut_type;
+//  gzread(backup_file, &tmp_mut_type,  sizeof(tmp_mut_type));
+//  mut_type_ = (MutationType) tmp_mut_type;
+//  //~ printf("mut type %d\n", mut_type_);
+//
+//  switch (mut_type_)
+//  {
+//    case SWITCH :
+//    {
+//      pos_ = new int32_t;
+//      gzread(backup_file, pos_,  sizeof(*pos_));
+//      break;
+//    }
+//    case S_INS :
+//    {
+//      pos_ = new int32_t;
+//      gzread(backup_file, pos_,      sizeof(*pos_));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//
+//      seq_ = new char[length_[0] + 1];
+//      gzread(backup_file, seq_,  length_[0] * sizeof(seq_[0]));
+//      seq_[length_[0]] = '\0';
+//      break;
+//    }
+//    case S_DEL :
+//    {
+//      pos_ = new int32_t;
+//      gzread(backup_file, pos_,      sizeof(*pos_));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      break;
+//    }
+//    case DUPL :
+//    {
+//      pos_ = new int32_t[3];
+//      gzread(backup_file, pos_,  3 * sizeof(pos_[0]));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      align_score_ = new int16_t;
+//      gzread(backup_file, align_score_, sizeof(*align_score_));
+//
+//      break;
+//    }
+//    case DEL :
+//    {
+//      pos_ = new int32_t[2];
+//      gzread(backup_file, pos_,  2 * sizeof(pos_[0]));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      align_score_ = new int16_t;
+//      gzread(backup_file, align_score_, sizeof(*align_score_));
+//
+//      break;
+//    }
+//    case TRANS :
+//    {
+//      pos_ = new int32_t[4];
+//      gzread(backup_file, pos_,  4 * sizeof(pos_[0]));
+//      int8_t tmp_invert;
+//      gzread(backup_file, &tmp_invert,  sizeof(tmp_invert));
+//      invert_ = (tmp_invert != 0);
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      align_score_ = new int16_t[2];
+//      gzread(backup_file, align_score_, 2 * sizeof(align_score_[0]));
+//
+//      break;
+//    }
+//    case INV :
+//    {
+//      pos_ = new int32_t[2];
+//      gzread(backup_file, pos_,  2 * sizeof(pos_[0]));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      align_score_ = new int16_t;
+//      gzread(backup_file, align_score_, sizeof(*align_score_));
+//
+//      break;
+//    }
+//    case INSERT:
+//    {
+//      pos_ = new int32_t;
+//      gzread(backup_file, pos_,  sizeof(*pos_));
+//     length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      seq_ = new char[length_[0] + 1];
+//      gzread(backup_file, seq_,  length_[0] * sizeof(seq_[0]));
+//      seq_[length_[0]] = '\0';
+//    }
+//    case INS_HT:
+//    {
+//      pos_ = new int32_t[4];
+//      gzread(backup_file, pos_,  4 * sizeof(pos_[0]));
+//      length_ = new int32_t;
+//      gzread(backup_file, length_,  sizeof(*length_));
+//      seq_ = new char[length_[0] + 1];
+//      gzread(backup_file, seq_,  length_[0] * sizeof(seq_[0]));
+//      seq_[length_[0]] = '\0';
+//      align_score_ = new int16_t[2];
+//      gzread(backup_file, align_score_, 2 * sizeof(align_score_[0]));
+//      gzread(backup_file, &donor_id_,  sizeof(donor_id_));
+//      gzread(backup_file, &sense_,  sizeof(sense_));
+//      break;
+//    }
+//    case REPL_HT:
+//    {
+//      pos_ = new int32_t[4];
+//      gzread(backup_file, pos_,  4 * sizeof(pos_[0]));
+//      length_ = new int32_t[2];
+//      gzread(backup_file, length_, 2 *sizeof(length_[0]));
+//      seq_ = new char[length_[1] + 1];
+//      gzread(backup_file, seq_,  length_[1] * sizeof(seq_[0]));
+//      seq_[length_[1]] = '\0';
+//      align_score_ = new int16_t[2];
+//      gzread(backup_file, align_score_, 2 * sizeof(align_score_[0]));
+//      gzread(backup_file, &donor_id_,  sizeof(donor_id_));
+//      gzread(backup_file, &sense_,  sizeof(sense_));
+//      break;
+//    }
+//    default :
+//    {
+//      fprintf(stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", mut_type_, __FILE__, __LINE__);
+//      exit(EXIT_FAILURE);
+//      break;
+//    }
+//  }
+//
+//
+//}
+
+
+
+
+
+// =================================================================
+//                             Destructor
+// =================================================================
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_dump.h b/src/libaevol/Mutation.h
similarity index 56%
rename from src/libaevol/ae_dump.h
rename to src/libaevol/Mutation.h
index fdb64b7..332ff21 100644
--- a/src/libaevol/ae_dump.h
+++ b/src/libaevol/Mutation.h
@@ -3,118 +3,136 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_DUMP_H__
-#define  __AE_DUMP_H__
- 
- 
+
+
+#ifndef AEVOL_MUTATION_H_
+#define AEVOL_MUTATION_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
 #include <inttypes.h>
-#include <stdio.h>
+
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-
-
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "ae_enums.h"
+#include <zlib.h>
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
-
 
 
-#define _AE_DUMP_FILENAME_BUFSIZE INT32_C(256)
-
+enum MutationType {
+  // Simple mutation types.
+  SWITCH  = 0,
+  S_INS,
+  S_DEL,
+  DUPL,
+  DEL,
+  TRANS,
+  INV,
+  INSERT,
+  INS_HT,
+  REPL_HT,
+
+  // Composite mutation types follow. They represent categories of
+  // several simple mutation types. Therefore, they should not be used
+  // as array index for counters.
+  //
+  // The composite mutations should extend MutationType but
+  // C++ enums can't be inherited directly.
+  S_MUT, // SWITCH or S_INS or S_DEL
+  REARR, // DUPL or DEL or TRANS or INV
+  H_T,    // INS_HT or REPL_HT
+  INDEL  // S_INS or S_DEL
+};
 
-class ae_dump : public ae_object
-{  
+class Mutation {
  public :
-  
   // =================================================================
   //                             Constructors
   // =================================================================
-  ae_dump( ae_exp_manager* exp_m );
-  
+  Mutation() = default;
+  Mutation(const Mutation& model) = default;
+  Mutation(Mutation&& model) = default;
+
+  virtual Mutation* Clone() const = 0;
+  static Mutation* Load(gzFile backup);
+
   // =================================================================
-  //                             Destructors
+  //                             Destructor
   // =================================================================
-  virtual ~ae_dump( void )
-  {
-  }
-  
+  virtual ~Mutation() noexcept = default;
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  Mutation& operator=(const Mutation& other) = delete;
+
+  /// Move assignment
+  Mutation& operator=(Mutation&& other) = delete;
+
   // =================================================================
-  //                              Accessors
+  //                            Public Methods
   // =================================================================
-  
+  virtual void save(gzFile backup_file) const = 0;
+  virtual void load(gzFile backup_file) = 0;
+  virtual void generic_description_string(char* str) const = 0;
+
   // =================================================================
-  //                            Public Methods
+  //                        Accessors: Getters
   // =================================================================
-  void write_current_generation_dump( void );
-  void write_fitness_total( void );
-  void write_secretion_present( void );
-  void write_fitness_metabolic( void );
-  void write_secreted_amount( void );
-  void write_individual_probes( void );
-  
+  virtual MutationType mut_type() const = 0;
+  virtual bool is_local_mut() const { return false; };
+  virtual bool is_rear() const { return false; };
+  virtual bool is_ht() const { return false; };
+
   // =================================================================
-  //                           Public Attributes
+  //                        Accessors: Setters
+  // =================================================================
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
   // =================================================================
-  
-  
-  
-  protected :
-    FILE* current_file;
-    char  filename_buffer[_AE_DUMP_FILENAME_BUFSIZE];
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dump( const ae_dump &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-};
 
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+};
 
 // =====================================================================
 //                          Accessors' definitions
@@ -123,4 +141,6 @@ class ae_dump : public ae_object
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-#endif // __AE_DUMP_H__
+
+} // namespace aevol
+#endif // AEVOL_MUTATION_H_
diff --git a/src/libaevol/MutationParams.cpp b/src/libaevol/MutationParams.cpp
new file mode 100644
index 0000000..a69c6a4
--- /dev/null
+++ b/src/libaevol/MutationParams.cpp
@@ -0,0 +1,268 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "MutationParams.h"
+#include "Alignment.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                             Class MutationParams                             #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+MutationParams::MutationParams()
+{
+  // --------------------------------------------------------- Mutation rates
+  point_mutation_rate_  = 0.0;
+  small_insertion_rate_ = 0.0;
+  small_deletion_rate_  = 0.0;
+  max_indel_size_       = 0;
+
+  // -------------------------------------------- Rearrangements and Transfer
+  with_4pts_trans_            = false;
+  with_alignments_            = false;
+  with_HT_                    = false;
+  repl_HT_with_close_points_  = false;
+  HT_ins_rate_                = 0.0;
+  HT_repl_rate_               = 0.0;
+  repl_HT_detach_rate_        = 0.0;
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  duplication_rate_   = 0.0;
+  deletion_rate_      = 0.0;
+  translocation_rate_ = 0.0;
+  inversion_rate_     = 0.0;
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  neighbourhood_rate_ = 0.0;
+
+  duplication_proportion_   = 0.0;
+  deletion_proportion_      = 0.0;
+  translocation_proportion_ = 0.0;
+  inversion_proportion_     = 0.0;
+
+  // ------------------------------------------------------------ Alignements
+  align_fun_shape_    = SIGMOID;
+  align_sigm_lambda_  = 4;
+  align_sigm_mean_    = 50;
+  align_lin_min_      = 0;
+  align_lin_max_      = 100;
+
+  align_max_shift_      = 20;
+  align_w_zone_h_len_   = 50;
+  align_match_bonus_    = 1;
+  align_mismatch_cost_  = 2;
+}
+
+MutationParams::MutationParams(const MutationParams & model)
+{
+  // --------------------------------------------------------- Mutation rates
+  point_mutation_rate_  = model.point_mutation_rate_;
+  small_insertion_rate_ = model.small_insertion_rate_;
+  small_deletion_rate_  = model.small_deletion_rate_;
+  max_indel_size_       = model.max_indel_size_;
+
+  // -------------------------------------------- Rearrangements and Transfer
+  with_4pts_trans_            = model.with_4pts_trans_;
+  with_alignments_            = model.with_alignments_;
+  with_HT_                    = model.with_HT_;
+  repl_HT_with_close_points_  = model.repl_HT_with_close_points_;
+  HT_ins_rate_                = model.HT_ins_rate_;
+  HT_repl_rate_               = model.HT_repl_rate_;
+  repl_HT_detach_rate_        = model.repl_HT_detach_rate_;
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  duplication_rate_   = model.duplication_rate_;
+  deletion_rate_      = model.deletion_rate_;
+  translocation_rate_ = model.translocation_rate_;
+  inversion_rate_     = model.inversion_rate_;
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  neighbourhood_rate_ = model.neighbourhood_rate_;
+
+  duplication_proportion_   = model.duplication_proportion_;
+  deletion_proportion_      = model.deletion_proportion_;
+  translocation_proportion_ = model.translocation_proportion_;
+  inversion_proportion_     = model.inversion_proportion_;
+
+  // ------------------------------------------------------------ Alignements
+  align_fun_shape_    = model.align_fun_shape_;
+  align_sigm_lambda_  = model.align_sigm_lambda_;
+  align_sigm_mean_    = model.align_sigm_mean_;
+  align_lin_min_      = model.align_lin_min_;
+  align_lin_max_      = model.align_lin_max_;
+
+  align_max_shift_      = model.align_max_shift_;
+  align_w_zone_h_len_   = model.align_w_zone_h_len_;
+  align_match_bonus_    = model.align_match_bonus_;
+  align_mismatch_cost_  = model.align_mismatch_cost_;
+}
+
+MutationParams::MutationParams(gzFile backup_file)
+{
+  // --------------------------------------------------------- Mutation rates
+  gzread(backup_file, &point_mutation_rate_,  sizeof(point_mutation_rate_));
+  gzread(backup_file, &small_insertion_rate_, sizeof(small_insertion_rate_));
+  gzread(backup_file, &small_deletion_rate_,  sizeof(small_deletion_rate_));
+  gzread(backup_file, &max_indel_size_,       sizeof(max_indel_size_));
+
+  // -------------------------------------------- Rearrangements and Transfer
+  int8_t tmp;
+  gzread(backup_file, &tmp, sizeof(tmp));
+  with_4pts_trans_ = (tmp != 0);
+  gzread(backup_file, &tmp, sizeof(tmp));
+  with_alignments_ = (tmp != 0);
+  gzread(backup_file, &tmp, sizeof(tmp));
+  with_HT_ = (tmp != 0);
+  gzread(backup_file, &tmp, sizeof(tmp));
+  repl_HT_with_close_points_ = (tmp != 0);
+  gzread(backup_file, &HT_ins_rate_,  sizeof(HT_ins_rate_));
+  gzread(backup_file, &HT_repl_rate_, sizeof(HT_repl_rate_));
+  gzread(backup_file, &repl_HT_detach_rate_, sizeof(repl_HT_detach_rate_));
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  gzread(backup_file, &duplication_rate_,   sizeof(duplication_rate_));
+  gzread(backup_file, &deletion_rate_,      sizeof(deletion_rate_));
+  gzread(backup_file, &translocation_rate_, sizeof(translocation_rate_));
+  gzread(backup_file, &inversion_rate_,     sizeof(inversion_rate_));
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  gzread(backup_file, &neighbourhood_rate_,       sizeof(neighbourhood_rate_));
+  gzread(backup_file, &duplication_proportion_,   sizeof(duplication_proportion_));
+  gzread(backup_file, &deletion_proportion_,      sizeof(deletion_proportion_));
+  gzread(backup_file, &translocation_proportion_, sizeof(translocation_proportion_));
+  gzread(backup_file, &inversion_proportion_,     sizeof(inversion_proportion_));
+
+  // ------------------------------------------------------------ Alignements
+  gzread(backup_file, &align_fun_shape_,     sizeof(align_fun_shape_));
+  gzread(backup_file, &align_sigm_lambda_,   sizeof(align_sigm_lambda_));
+  gzread(backup_file, &align_sigm_mean_,     sizeof(align_sigm_mean_));
+  gzread(backup_file, &align_lin_min_,       sizeof(align_lin_min_));
+  gzread(backup_file, &align_lin_max_,       sizeof(align_lin_max_));
+
+  gzread(backup_file, &align_max_shift_,     sizeof(align_max_shift_));
+  gzread(backup_file, &align_w_zone_h_len_,  sizeof(align_w_zone_h_len_));
+  gzread(backup_file, &align_match_bonus_,   sizeof(align_match_bonus_));
+  gzread(backup_file, &align_mismatch_cost_, sizeof(align_mismatch_cost_));
+
+  //Alignment::align_fun_shape     = align_fun_shape_;
+  //Alignment::align_sigm_lambda   = align_sigm_lambda_;
+  //Alignment::align_sigm_mean     = align_sigm_mean_;
+  //Alignment::align_lin_min       = align_lin_min_;
+  //Alignment::align_lin_max       = align_lin_max_;
+
+  //Alignment::align_max_shift     = align_max_shift_;
+  //Alignment::align_w_zone_h_len  = align_w_zone_h_len_;
+  //Alignment::align_match_bonus   = align_match_bonus_;
+  //Alignment::align_mismatch_cost = align_mismatch_cost_;
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+MutationParams::~MutationParams()
+{
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void MutationParams::save(gzFile backup_file) const
+{
+  // --------------------------------------------------------- Mutation rates
+  gzwrite(backup_file, &point_mutation_rate_,  sizeof(point_mutation_rate_));
+  gzwrite(backup_file, &small_insertion_rate_, sizeof(small_insertion_rate_));
+  gzwrite(backup_file, &small_deletion_rate_,  sizeof(small_deletion_rate_));
+  gzwrite(backup_file, &max_indel_size_,       sizeof(max_indel_size_));
+
+  // -------------------------------------------- Rearrangements and Transfer
+  int8_t tmp = with_4pts_trans_ ? 1 : 0;
+  gzwrite(backup_file, &tmp,  sizeof(tmp));
+  tmp = with_alignments_ ? 1 : 0;
+  gzwrite(backup_file, &tmp,  sizeof(tmp));
+  tmp = with_HT_ ? 1 : 0;
+  gzwrite(backup_file, &tmp,  sizeof(tmp));
+  tmp = repl_HT_with_close_points_ ? 1 : 0;
+  gzwrite(backup_file, &tmp,  sizeof(tmp));
+  gzwrite(backup_file, &HT_ins_rate_,  sizeof(HT_ins_rate_));
+  gzwrite(backup_file, &HT_repl_rate_, sizeof(HT_repl_rate_));
+  gzwrite(backup_file, &repl_HT_detach_rate_, sizeof(repl_HT_detach_rate_));
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  gzwrite(backup_file, &duplication_rate_,   sizeof(duplication_rate_));
+  gzwrite(backup_file, &deletion_rate_,      sizeof(deletion_rate_));
+  gzwrite(backup_file, &translocation_rate_, sizeof(translocation_rate_));
+  gzwrite(backup_file, &inversion_rate_,     sizeof(inversion_rate_));
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  gzwrite(backup_file, &neighbourhood_rate_,       sizeof(neighbourhood_rate_));
+  gzwrite(backup_file, &duplication_proportion_,   sizeof(duplication_proportion_));
+  gzwrite(backup_file, &deletion_proportion_,      sizeof(deletion_proportion_));
+  gzwrite(backup_file, &translocation_proportion_, sizeof(translocation_proportion_));
+  gzwrite(backup_file, &inversion_proportion_,     sizeof(inversion_proportion_));
+
+  // ------------------------------------------------------------ Alignements
+  gzwrite(backup_file, &align_fun_shape_,     sizeof(align_fun_shape_));
+  gzwrite(backup_file, &align_sigm_lambda_,   sizeof(align_sigm_lambda_));
+  gzwrite(backup_file, &align_sigm_mean_,     sizeof(align_sigm_mean_));
+  gzwrite(backup_file, &align_lin_min_,       sizeof(align_lin_min_));
+  gzwrite(backup_file, &align_lin_max_,       sizeof(align_lin_max_));
+
+  gzwrite(backup_file, &align_max_shift_,     sizeof(align_max_shift_));
+  gzwrite(backup_file, &align_w_zone_h_len_,  sizeof(align_w_zone_h_len_));
+  gzwrite(backup_file, &align_match_bonus_,   sizeof(align_match_bonus_));
+  gzwrite(backup_file, &align_mismatch_cost_, sizeof(align_mismatch_cost_));
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/MutationParams.h b/src/libaevol/MutationParams.h
new file mode 100644
index 0000000..0148479
--- /dev/null
+++ b/src/libaevol/MutationParams.h
@@ -0,0 +1,571 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_MUTATION_PARAMS_H_
+#define AEVOL_MUTATION_PARAMS_H_
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <inttypes.h>
+#include <zlib.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "ae_enums.h"
+
+namespace aevol {
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+
+
+
+
+
+
+class MutationParams
+{
+  public :
+    // =================================================================
+    //                             Constructors
+    // =================================================================
+    MutationParams();
+    MutationParams(const MutationParams & model);
+    MutationParams(gzFile backup_file);
+
+
+    // =================================================================
+    //                             Destructors
+    // =================================================================
+    virtual ~MutationParams();
+
+    // =================================================================
+    //                        Accessors: getters
+    // =================================================================
+
+    // --------------------------------------------------------- Mutation rates
+    inline double   point_mutation_rate() const;
+    inline double   small_insertion_rate() const;
+    inline double   small_deletion_rate() const;
+    inline int16_t  max_indel_size() const;
+
+    // -------------------------------------------- Rearrangements and Transfer
+    inline bool   with_4pts_trans() const;
+    inline bool   with_alignments() const;
+    inline bool   with_HT() const;
+    inline bool   repl_HT_with_close_points() const;
+    inline double HT_ins_rate() const;
+    inline double HT_repl_rate() const;
+    inline double repl_HT_detach_rate() const;
+
+    // ------------------------------ Rearrangement rates (without alignements)
+    inline double duplication_rate() const;
+    inline double deletion_rate() const;
+    inline double translocation_rate() const;
+    inline double inversion_rate() const;
+
+    // --------------------------------- Rearrangement rates (with alignements)
+    inline double neighbourhood_rate() const;
+    inline double duplication_proportion() const;
+    inline double deletion_proportion() const;
+    inline double translocation_proportion() const;
+    inline double inversion_proportion() const;
+
+    // ------------------------------------------------------------ Alignements
+    inline AlignmentFunctionShape align_fun_shape() const;
+    inline double  align_sigm_lambda() const;
+    inline int16_t align_sigm_mean() const;
+    inline int16_t align_lin_min() const;
+    inline int16_t align_lin_max() const;
+
+    // Maximum shift of one seq on the other
+    inline int16_t align_max_shift() const;
+    // Work zone half length
+    inline int16_t align_w_zone_h_len() const;
+    // Corresponding residues match bonus
+    inline int16_t align_match_bonus() const;
+    // Corresponding residues mismatch cost
+    inline int16_t align_mismatch_cost() const;
+
+    // =================================================================
+    //                        Accessors: setters
+    // =================================================================
+
+    // --------------------------------------------------------- Mutation rates
+    inline void set_point_mutation_rate(double point_mutation_rate);
+    inline void set_small_insertion_rate(double small_insertion_rate);
+    inline void set_small_deletion_rate(double small_deletion_rate);
+    inline void set_max_indel_size(int16_t max_indel_size);
+
+    // -------------------------------------------- Rearrangements and Transfer
+    inline void set_with_4pts_trans(bool with_4pts_trans);
+    inline void set_with_alignments(bool with_alignments);
+    inline void set_with_HT(bool with_HT);
+    inline void set_repl_HT_with_close_points(bool repl_HT_with_close_points);
+    inline void set_HT_ins_rate(double HT_ins_rate);
+    inline void set_HT_repl_rate(double HT_repl_rate);
+    inline void set_repl_HT_detach_rate(double repl_HT_detach_rate);
+
+    // ------------------------------ Rearrangement rates (without alignements)
+    inline void set_duplication_rate(double duplication_rate);
+    inline void set_deletion_rate(double deletion_rate);
+    inline void set_translocation_rate(double translocation_rate);
+    inline void set_inversion_rate(double inversion_rate);
+
+    // --------------------------------- Rearrangement rates (with alignements)
+    inline void set_neighbourhood_rate(double neighbourhood_rate);
+    inline void set_duplication_proportion(double duplication_proportion);
+    inline void set_deletion_proportion(double deletion_proportion);
+    inline void set_translocation_proportion(double translocation_proportion);
+    inline void set_inversion_proportion(double inversion_proportion);
+
+    // ------------------------------------------------------------ Alignements
+    inline void set_align_fun_shape(AlignmentFunctionShape align_fun_shape);
+    inline void set_align_sigm_lambda(double align_sigm_lambda);
+    inline void set_align_sigm_mean(int16_t align_sigm_mean);
+    inline void set_align_lin_min(int16_t align_lin_min);
+    inline void set_align_lin_max(int16_t align_lin_max);
+
+    inline void set_align_max_shift(int16_t align_max_shift);
+    inline void set_align_w_zone_h_len(int16_t align_w_zone_h_len);
+    inline void set_align_match_bonus(int16_t align_match_bonus);
+    inline void set_align_mismatch_cost(int16_t align_mismatch_cost);
+
+    // =================================================================
+    //                              Operators
+    // =================================================================
+
+    // =================================================================
+    //                            Public Methods
+    // =================================================================
+    void save(gzFile backup_file) const;
+
+    // =================================================================
+    //                           Public Attributes
+    // =================================================================
+
+
+
+
+
+  protected :
+
+    // =================================================================
+    //                         Forbidden Constructors
+    // =================================================================
+    /*MutationParams()
+    {
+      printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+    };
+    MutationParams(const MutationParams &model)
+    {
+      printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+    };*/
+
+
+    // =================================================================
+    //                           Protected Methods
+    // =================================================================
+
+    // =================================================================
+    //                          Protected Attributes
+    // =================================================================
+
+    // --------------------------------------------------------- Mutation rates
+    double  point_mutation_rate_;
+    double  small_insertion_rate_;
+    double  small_deletion_rate_;
+    int16_t max_indel_size_;
+
+    // -------------------------------------------- Rearrangements and Transfer
+    bool    with_4pts_trans_;
+    bool    with_alignments_;
+    bool    with_HT_;
+    bool    repl_HT_with_close_points_;
+    double  HT_ins_rate_;
+    double  HT_repl_rate_;
+    double  repl_HT_detach_rate_;
+
+    // ------------------------------ Rearrangement rates (without alignements)
+    double duplication_rate_;
+    double deletion_rate_;
+    double translocation_rate_;
+    double inversion_rate_;
+
+    // --------------------------------- Rearrangement rates (with alignements)
+    double neighbourhood_rate_;
+    double duplication_proportion_;
+    double deletion_proportion_;
+    double translocation_proportion_;
+    double inversion_proportion_;
+
+    // ------------------------------------------------------------ Alignements
+    AlignmentFunctionShape align_fun_shape_;
+    double  align_sigm_lambda_;
+    int16_t align_sigm_mean_;
+    int16_t align_lin_min_;
+    int16_t align_lin_max_;
+
+    int16_t align_max_shift_;     // Maximum shift of one seq on the other
+    int16_t align_w_zone_h_len_;  // Work zone half length
+    int16_t align_match_bonus_;   // Corresponding residues match bonus
+    int16_t align_mismatch_cost_; // Corresponding residues mismatch cost
+};
+
+
+// =====================================================================
+//                           Getters' definitions
+// =====================================================================
+
+// ------------------------------------------------------------- Mutation rates
+inline double MutationParams::point_mutation_rate() const
+{
+  return point_mutation_rate_;
+}
+
+inline double MutationParams::small_insertion_rate() const
+{
+  return small_insertion_rate_;
+}
+
+inline double MutationParams::small_deletion_rate() const
+{
+  return small_deletion_rate_;
+}
+
+inline int16_t MutationParams::max_indel_size() const
+{
+  return max_indel_size_;
+}
+
+// ------------------------------------------------ Rearrangements and Transfer
+inline bool MutationParams::with_4pts_trans() const
+{
+  return with_4pts_trans_;
+}
+
+inline bool MutationParams::with_alignments() const
+{
+  return with_alignments_;
+}
+
+inline bool MutationParams::with_HT() const
+{
+  return with_HT_;
+}
+
+inline bool MutationParams::repl_HT_with_close_points() const
+{
+  return repl_HT_with_close_points_;
+}
+
+inline double MutationParams::HT_ins_rate() const
+{
+  return HT_ins_rate_;
+}
+
+inline double MutationParams::HT_repl_rate() const
+{
+  return HT_repl_rate_;
+}
+
+inline double MutationParams::repl_HT_detach_rate() const
+{
+  return repl_HT_detach_rate_;
+}
+
+// ---------------------------------- Rearrangement rates (without alignements)
+inline double MutationParams::duplication_rate() const
+{
+  return duplication_rate_;
+}
+
+inline double MutationParams::deletion_rate() const
+{
+  return deletion_rate_;
+}
+
+inline double MutationParams::translocation_rate() const
+{
+  return translocation_rate_;
+}
+
+inline double MutationParams::inversion_rate() const
+{
+  return inversion_rate_;
+}
+
+// ------------------------------------- Rearrangement rates (with alignements)
+inline double MutationParams::neighbourhood_rate() const
+{
+  return neighbourhood_rate_;
+}
+
+inline double MutationParams::duplication_proportion() const
+{
+  return duplication_proportion_;
+}
+
+inline double MutationParams::deletion_proportion() const
+{
+  return deletion_proportion_;
+}
+
+inline double MutationParams::translocation_proportion() const
+{
+  return translocation_proportion_;
+}
+
+inline double MutationParams::inversion_proportion() const
+{
+  return inversion_proportion_;
+}
+
+// ---------------------------------------------------------------- Alignements
+inline AlignmentFunctionShape MutationParams::align_fun_shape() const
+{
+ return align_fun_shape_;
+}
+
+inline double MutationParams::align_sigm_lambda() const
+{
+ return align_sigm_lambda_;
+}
+
+inline int16_t MutationParams::align_sigm_mean() const
+{
+ return align_sigm_mean_;
+}
+
+inline int16_t MutationParams::align_lin_min() const
+{
+ return align_lin_min_;
+}
+
+inline int16_t MutationParams::align_lin_max() const
+{
+ return align_lin_max_;
+}
+
+inline int16_t MutationParams::align_max_shift() const
+{
+ return align_max_shift_;
+}
+
+inline int16_t MutationParams::align_w_zone_h_len() const
+{
+ return align_w_zone_h_len_;
+}
+
+inline int16_t MutationParams::align_match_bonus() const
+{
+ return align_match_bonus_;
+}
+
+inline int16_t MutationParams::align_mismatch_cost() const
+{
+ return align_mismatch_cost_;
+}
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+
+// ------------------------------------------------------------- Mutation rates
+inline void MutationParams::set_point_mutation_rate(double point_mutation_rate)
+{
+  point_mutation_rate_ = point_mutation_rate;
+}
+
+inline void MutationParams::set_small_insertion_rate(double small_insertion_rate)
+{
+  small_insertion_rate_ = small_insertion_rate;
+}
+
+inline void MutationParams::set_small_deletion_rate(double small_deletion_rate)
+{
+  small_deletion_rate_ = small_deletion_rate;
+}
+
+inline void MutationParams::set_max_indel_size(int16_t max_indel_size)
+{
+  max_indel_size_ = max_indel_size;
+}
+
+// ------------------------------------------------ Rearrangements and Transfer
+inline void MutationParams::set_with_4pts_trans(bool with_4pts_trans)
+{
+  with_4pts_trans_ = with_4pts_trans;
+}
+
+inline void MutationParams::set_with_alignments(bool with_alignments)
+{
+  with_alignments_ = with_alignments;
+}
+
+inline void MutationParams::set_with_HT(bool with_HT)
+{
+  with_HT_ = with_HT;
+}
+
+inline void MutationParams::set_repl_HT_with_close_points(bool repl_HT_with_close_points)
+{
+  repl_HT_with_close_points_ = repl_HT_with_close_points;
+}
+
+inline void MutationParams::set_HT_ins_rate(double HT_ins_rate)
+{
+  HT_ins_rate_ = HT_ins_rate;
+}
+
+inline void MutationParams::set_HT_repl_rate(double HT_repl_rate)
+{
+  HT_repl_rate_ = HT_repl_rate;
+}
+
+inline void MutationParams::set_repl_HT_detach_rate(double repl_HT_detach_rate)
+{
+  repl_HT_detach_rate_ = repl_HT_detach_rate;
+}
+
+// ---------------------------------- Rearrangement rates (without alignements)
+inline void MutationParams::set_duplication_rate(double duplication_rate)
+{
+  duplication_rate_ = duplication_rate;
+}
+
+inline void MutationParams::set_deletion_rate(double deletion_rate)
+{
+  deletion_rate_ = deletion_rate;
+}
+
+inline void MutationParams::set_translocation_rate(double translocation_rate)
+{
+  translocation_rate_ = translocation_rate;
+}
+
+inline void MutationParams::set_inversion_rate(double inversion_rate)
+{
+  inversion_rate_ = inversion_rate;
+}
+
+// ------------------------------------- Rearrangement rates (with alignements)
+inline void MutationParams::set_neighbourhood_rate(double neighbourhood_rate)
+{
+  neighbourhood_rate_ = neighbourhood_rate;
+}
+
+inline void MutationParams::set_duplication_proportion(double duplication_proportion)
+{
+  duplication_proportion_ = duplication_proportion;
+}
+
+inline void MutationParams::set_deletion_proportion(double deletion_proportion)
+{
+  deletion_proportion_ = deletion_proportion;
+}
+
+inline void MutationParams::set_translocation_proportion(double translocation_proportion)
+{
+  translocation_proportion_ = translocation_proportion;
+}
+
+inline void MutationParams::set_inversion_proportion(double inversion_proportion)
+{
+  inversion_proportion_ = inversion_proportion;
+}
+
+// ---------------------------------------------------------------- Alignements
+inline void MutationParams::set_align_fun_shape(
+    AlignmentFunctionShape align_fun_shape)
+{
+  align_fun_shape_ = align_fun_shape;
+}
+
+inline void MutationParams::set_align_sigm_lambda(double align_sigm_lambda)
+{
+  align_sigm_lambda_ = align_sigm_lambda;
+}
+
+inline void MutationParams::set_align_sigm_mean(int16_t align_sigm_mean)
+{
+  align_sigm_mean_ = align_sigm_mean;
+}
+
+inline void MutationParams::set_align_lin_min(int16_t align_lin_min)
+{
+  align_lin_min_ = align_lin_min;
+}
+
+inline void MutationParams::set_align_lin_max(int16_t align_lin_max)
+{
+  align_lin_max_ = align_lin_max;
+}
+
+inline void MutationParams::set_align_max_shift(int16_t align_max_shift)
+{
+  align_max_shift_ = align_max_shift;
+}
+
+inline void MutationParams::set_align_w_zone_h_len(int16_t align_w_zone_h_len)
+{
+  align_w_zone_h_len_ = align_w_zone_h_len;
+}
+
+inline void MutationParams::set_align_match_bonus(int16_t align_match_bonus)
+{
+  align_match_bonus_ = align_match_bonus;
+}
+
+inline void MutationParams::set_align_mismatch_cost(int16_t align_mismatch_cost)
+{
+  align_mismatch_cost_ = align_mismatch_cost;
+}
+
+// =====================================================================
+//                          Operators' definitions
+// =====================================================================
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_MUTATION_PARAMS_H_
diff --git a/src/libaevol/NonCodingMetrics.h b/src/libaevol/NonCodingMetrics.h
new file mode 100644
index 0000000..fd03ce6
--- /dev/null
+++ b/src/libaevol/NonCodingMetrics.h
@@ -0,0 +1,174 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_NON_CODING_STATS_H_
+#define AEVOL_NON_CODING_STATS_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include "GeneticUnit.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+
+// TODO <david.parsons at inria.fr> Not used ?
+class NonCodingMetrics
+{
+  friend Individual;
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  NonCodingMetrics() = default; //< Default ctor
+  NonCodingMetrics(const NonCodingMetrics&) = default; //< Copy ctor
+  NonCodingMetrics(NonCodingMetrics&&) = default; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~NonCodingMetrics() = default; //< Destructor
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  int32_t nb_bases_in_0_CDS() const {
+    return nb_bases_in_0_CDS_;
+  };
+  int32_t nb_bases_in_0_functional_CDS() const {
+    return nb_bases_in_0_functional_CDS_;
+  };
+  int32_t nb_bases_in_0_non_functional_CDS() const {
+    return nb_bases_in_0_non_functional_CDS_;
+  };
+  int32_t nb_bases_in_0_RNA() const {
+    return nb_bases_in_0_RNA_;
+  };
+  int32_t nb_bases_in_0_coding_RNA() const {
+    return nb_bases_in_0_coding_RNA_;
+  };
+  int32_t nb_bases_in_0_non_coding_RNA() const {
+    return nb_bases_in_0_non_coding_RNA_;
+  };
+  int32_t nb_bases_in_neutral_regions() const {
+    return nb_bases_in_neutral_regions_;
+  };
+  int32_t nb_neutral_regions() const {
+    return nb_neutral_regions_;
+  };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  inline void Accumulate(const GeneticUnit& gen_unit);
+
+
+
+
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  /// Number of bases that are not included in any gene
+  int32_t nb_bases_in_0_CDS_;
+  /// Number of bases that are not included in any functional gene
+  int32_t nb_bases_in_0_functional_CDS_;
+  /// Number of bases that are not included in any degenerated gene
+  int32_t nb_bases_in_0_non_functional_CDS_;
+  /// Number of bases that are not included in any RNA
+  int32_t nb_bases_in_0_RNA_;
+  /// Number of bases that are not included in any coding RNA
+  /// (RNAs containing at least one CDS)
+  int32_t nb_bases_in_0_coding_RNA_;
+  /// Number of bases that are not included in any non coding RNA
+  int32_t nb_bases_in_0_non_coding_RNA_;
+  /// Number of bases that are in a neutral region
+  /// A base is considered neutral when neither itself NOR its corresponding base on the other
+  /// strand belongs to a coding promoter->terminator region (both included)
+  int32_t nb_bases_in_neutral_regions_;
+  /// Number of neutral regions
+  int32_t nb_neutral_regions_;
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+void NonCodingMetrics::Accumulate(const GeneticUnit& gen_unit) {
+  nb_bases_in_0_CDS_ += gen_unit.nb_bases_in_0_CDS();
+  nb_bases_in_0_functional_CDS_ += gen_unit.nb_bases_in_0_functional_CDS();
+  nb_bases_in_0_non_functional_CDS_ +=
+      gen_unit.nb_bases_in_0_non_functional_CDS();
+  nb_bases_in_0_RNA_ += gen_unit.nb_bases_in_0_RNA();
+  nb_bases_in_0_coding_RNA_ += gen_unit.nb_bases_in_0_coding_RNA();
+  nb_bases_in_0_non_coding_RNA_ += gen_unit.nb_bases_in_0_non_coding_RNA();
+  nb_bases_in_neutral_regions_ += gen_unit.nb_bases_in_neutral_regions();
+  nb_neutral_regions_ += gen_unit.nb_neutral_regions();
+}
+} // namespace aevol
+
+#endif // AEVOL_NON_CODING_STATS_H_
diff --git a/src/libaevol/tests/run_tests.cpp b/src/libaevol/Observable.cpp
similarity index 56%
rename from src/libaevol/tests/run_tests.cpp
rename to src/libaevol/Observable.cpp
index b142dfd..9c8dd61 100644
--- a/src/libaevol/tests/run_tests.cpp
+++ b/src/libaevol/Observable.cpp
@@ -3,85 +3,56 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <cppunit/TestCase.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include "Test_ae_jumping_mt.h"
-#include "Test_ae_individual.h"
-#include "Test_ae_list.h"
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-using namespace CppUnit;
-
-
-
-// ===========================================================================
-//                         Declare Miscellaneous Functions
-// ===========================================================================
-
-
-
-int main( int argc, char* argv[] )
-{
-  // Print message
-  cout << "Running regression tests";
-
-  // Get the top level suite from the registry
-  Test *suite = TestFactoryRegistry::getRegistry().makeTest();
-
-  // Adds the test to the list of test to run
-  TextUi::TestRunner runner;
-  runner.addTest( suite );
-
-  // Change the default outputter to a compiler error format outputter
-  runner.setOutputter( new CompilerOutputter( &runner.result(), cerr ) );
-  
-  // Run the tests.
-  bool wasSucessful = runner.run();
+//
+// ****************************************************************************
 
-  // Return error code 1 if the one of test failed.
-  return wasSucessful ? 0 : 1;
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Observable.h"
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+/**
+ * Notify all observers of event e providing optional argument
+ */
+void Observable::notifyObservers(ObservableEvent e, void* arg) {
+  for (auto& o : observers_[e]) {
+    o->update(*this, e, arg);
+  }
 }
 
-
-
-// ===========================================================================
-//                         Define Miscellaneous Functions
-// ===========================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
diff --git a/src/libaevol/Observable.h b/src/libaevol/Observable.h
new file mode 100644
index 0000000..1622736
--- /dev/null
+++ b/src/libaevol/Observable.h
@@ -0,0 +1,101 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_OBSERVABLE_H_
+#define AEVOL_OBSERVABLE_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "ObservableEvent.h"
+#include "Observer.h"
+
+#include <list>
+#include <map>
+
+using std::list;
+using std::map;
+
+
+
+
+/**
+ *
+ */
+  class Observable {
+   public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Observable() = default; //< Default ctor
+  Observable(const Observable&) = delete; //< Copy ctor
+  Observable(Observable&&) = delete; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+
+  virtual ~Observable() = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  Observable& operator=(const Observable& other); //< Copy assignment
+  Observable& operator=(const Observable&& other); //< Move assignment
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void addObserver(Observer* o, ObservableEvent e) {
+    observers_[e].emplace_back(o);
+  };
+  void deleteObserver(Observer* o, ObservableEvent e) {
+    observers_[e].remove(o);
+  };
+  void notifyObservers(ObservableEvent e, void* arg = nullptr);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  map<ObservableEvent, list<Observer*> > observers_;
+};
+
+
+#endif // AEVOL_OBSERVABLE_H_
diff --git a/src/libaevol/ae_object.h b/src/libaevol/ObservableEvent.h
similarity index 70%
copy from src/libaevol/ae_object.h
copy to src/libaevol/ObservableEvent.h
index 9a0bf94..0ecd123 100644
--- a/src/libaevol/ae_object.h
+++ b/src/libaevol/ObservableEvent.h
@@ -3,50 +3,38 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
-#ifndef __AE_OBJECT_H__
-#define __AE_OBJECT_H__
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-class ae_object
-{
-  public :
-    ae_object( void ){};
-    virtual ~ae_object( void ){};
-    
-  protected :
-    ae_object( const ae_object &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      assert( false );
-      exit( EXIT_FAILURE );
-    };
+#ifndef AEVOL_OBSERVABLEEVENT_H_
+#define AEVOL_OBSERVABLEEVENT_H_
 
+/**
+ *
+ */
+enum ObservableEvent {
+  NEW_INDIV,
+  MUTATION,
+  END_REPLICATION,
+  END_GENERATION
 };
 
-#endif // __AE_OBJECT_H__
+#endif //AEVOL_OBSERVABLEEVENT_H_
diff --git a/src/libaevol/Observer.h b/src/libaevol/Observer.h
new file mode 100644
index 0000000..02bbe18
--- /dev/null
+++ b/src/libaevol/Observer.h
@@ -0,0 +1,89 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_OBSERVER_H_
+#define AEVOL_OBSERVER_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "ObservableEvent.h"
+
+class Observable;
+
+
+/**
+ *
+ */
+class Observer {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Observer() = default; //< Default ctor
+  Observer(const Observer&) = delete; //< Copy ctor
+  Observer(Observer&&) = delete; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+
+  virtual ~Observer() = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  Observer& operator=(const Observer& other); //< Copy assignment
+  Observer& operator=(const Observer&& other); //< Move assignment
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  /// This method is called whenever the observed object is changed.
+  virtual void update(Observable& o, ObservableEvent e, void* arg) = 0;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+
+#endif // AEVOL_OBSERVER_H_
diff --git a/src/libaevol/OutputManager.cpp b/src/libaevol/OutputManager.cpp
new file mode 100644
index 0000000..b9cf5b4
--- /dev/null
+++ b/src/libaevol/OutputManager.cpp
@@ -0,0 +1,252 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "OutputManager.h"
+
+#include <err.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fstream>
+#include <string>
+
+#include "ExpManager.h"
+#include "AeTime.h"
+
+using std::string;
+using std::endl;
+
+namespace aevol {
+
+
+
+//##############################################################################
+//                                                                             #
+//                           Class OutputManager                           #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+OutputManager::OutputManager(ExpManager * exp_m) {
+  exp_m_  = exp_m;
+  stats_  = nullptr;
+  tree_   = nullptr;
+  dump_   = nullptr;
+  compute_phen_contrib_by_GU_ = false;
+  record_tree_ = false;
+  make_dumps_ = false;
+  dump_step_ = 0;
+  logs_ = new Logging();
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+OutputManager::~OutputManager() {
+  delete stats_;
+  delete tree_;
+  delete dump_;
+  delete logs_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void OutputManager::InitStats() {
+  stats_ = new Stats(exp_m_);
+}
+
+void OutputManager::WriteSetupFile(gzFile setup_file) const {
+  // Write the backup steps
+  gzwrite(setup_file, &backup_step_,      sizeof(backup_step_));
+  gzwrite(setup_file, &big_backup_step_,  sizeof(big_backup_step_));
+
+  // Stats
+  gzwrite(setup_file, &compute_phen_contrib_by_GU_,  sizeof(compute_phen_contrib_by_GU_));
+
+  // Tree
+  int8_t record_tree = record_tree_;
+  gzwrite(setup_file, &record_tree, sizeof(record_tree));
+  if (record_tree_)
+  {
+    auto tmp_tree_step = tree_->tree_step();
+    gzwrite(setup_file, &tmp_tree_step, sizeof(tmp_tree_step));
+  }
+
+  // Dumps
+  int8_t make_dumps = make_dumps_;
+  gzwrite(setup_file, &make_dumps,  sizeof(make_dumps));
+  gzwrite(setup_file, &dump_step_,  sizeof(dump_step_));
+
+  // Logs
+  int8_t logs = logs_->logs();
+  gzwrite(setup_file, &logs,  sizeof(logs));
+}
+
+/**
+ * This is a temporary patch for experiment propagation, it shall become
+ * obsolete or need to be adapted when in/out dirs are managed properly
+ */
+void OutputManager::PropagateStats(const std::string& outdir,
+                                   int64_t propagated_timestep) const {
+  Stats stats("stat");
+  stats.Propagate(outdir, propagated_timestep);
+}
+
+void OutputManager::load(gzFile setup_file, bool verbose, bool to_be_run) {
+  // Write the backup steps
+  gzread(setup_file, &backup_step_,      sizeof(backup_step_));
+  gzread(setup_file, &big_backup_step_,  sizeof(big_backup_step_));
+
+  // Stats
+  if (to_be_run) {
+    delete stats_;
+    stats_ = new Stats(exp_m_, AeTime::time());
+  }
+  gzread(setup_file, &compute_phen_contrib_by_GU_,  sizeof(compute_phen_contrib_by_GU_));
+
+  // Tree
+  int8_t record_tree;
+  gzread(setup_file, &record_tree, sizeof(record_tree));
+  record_tree_ = record_tree;
+  if (record_tree_) {
+    int32_t tmp_tree_step;
+    gzread(setup_file, &tmp_tree_step, sizeof(tmp_tree_step));
+
+    tree_ = new Tree(exp_m_, tmp_tree_step);
+  }
+
+  // Dumps
+  int8_t make_dumps;
+  gzread(setup_file, &make_dumps, sizeof(make_dumps));
+  make_dumps_ = make_dumps;
+  gzread(setup_file, &dump_step_,  sizeof(dump_step_));
+  if(make_dumps_) {
+    dump_ = new Dump(exp_m_);
+  }
+
+  // Logs
+  int8_t logs;
+  gzread(setup_file, &logs, sizeof(logs));
+  if (to_be_run) {
+    logs_->load(logs, AeTime::time());
+  }
+}
+
+void OutputManager::write_current_generation_outputs() const {
+  // Write stats
+  stats_->write_current_generation_statistics();
+
+  // Manage tree
+  if (record_tree_ &&
+      AeTime::time() > 0 &&
+      (AeTime::time() % tree_->tree_step() == 0)) {
+    write_tree();
+  }
+
+  // Write backup
+  if (AeTime::time() % backup_step_ == 0) {
+    stats_->flush();
+    exp_m_->WriteDynamicFiles();
+
+    WriteLastGenerFile();
+  }
+
+  // Write dumps
+  if (make_dumps_) {
+    if(AeTime::time() % dump_step_ == 0) {
+      dump_->write_current_generation_dump();
+    }
+  }
+}
+
+// TODO <david.parsons at inria.fr> we need an output_dir attribute in this class !
+void OutputManager::WriteLastGenerFile(const string& output_dir) const {
+  std::ofstream last_gener_file(output_dir + "/" + LAST_GENER_FNAME,
+                                std::ofstream::out);
+  if (last_gener_file.fail()) {
+    Utils::ExitWithUsrMsg(string("could not open file ") + LAST_GENER_FNAME);
+  }
+  else {
+    last_gener_file << AeTime::time() << endl;
+    last_gener_file.close();
+  }
+}
+
+// TODO <david.parsons at inria.fr> we need an input_dir attribute in this class !
+int64_t OutputManager::last_gener() {
+  int64_t time;
+  FILE* lg_file = fopen(LAST_GENER_FNAME, "r");
+  if (lg_file != NULL) {
+    if (fscanf(lg_file, "%" PRId64 "\n", &time) == EOF) {
+      Utils::ExitWithDevMsg("failed to read last generation", __FILE__,
+                            __LINE__);
+    }
+    fclose(lg_file);
+  }
+  return time;
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void OutputManager::write_tree() const
+{
+  // Create the tree directory if it doesn't exist
+  int status;
+  status = mkdir(TREE_DIR, 0755);
+  if ((status == -1) && (errno != EEXIST))
+  {
+    err(EXIT_FAILURE, "Impossible to create the directory %s", TREE_DIR);
+  }
+
+  char tree_file_name[50];
+
+  sprintf(tree_file_name, "tree/tree_" TIMESTEP_FORMAT ".ae", AeTime::time());
+
+  
+  gzFile tree_file = gzopen( tree_file_name, "w" );
+  // Write phylogenetic data (tree)
+  tree_->write_to_tree_file(tree_file);
+
+  gzclose(tree_file);
+}
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/OutputManager.h b/src/libaevol/OutputManager.h
new file mode 100644
index 0000000..6cbbab8
--- /dev/null
+++ b/src/libaevol/OutputManager.h
@@ -0,0 +1,244 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_OUPUT_MANAGER_H_
+#define AEVOL_OUPUT_MANAGER_H_
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <inttypes.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "ae_enums.h"
+#include "Stats.h"
+#include "Tree.h"
+#include "Dump.h"
+#include "Logging.h"
+
+
+namespace aevol {
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+
+
+
+
+
+
+class OutputManager {
+ public :
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  OutputManager() = delete;
+  OutputManager(const OutputManager&) = delete;
+  OutputManager(ExpManager* exp_m);
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~OutputManager();
+
+  // =================================================================
+  //                        Accessors: getters
+  // =================================================================
+
+  // Backup
+  inline int64_t	backup_step() const;
+  inline int64_t	big_backup_step() const;
+
+  // Tree
+  inline bool record_tree() const;
+  inline int64_t tree_step() const;
+  inline Tree* tree() const;
+
+  // Logs
+  inline FILE* log(LogType log_type) const;
+  inline bool is_logged(LogType log_type) const;
+
+  // Stats
+  inline bool compute_phen_contrib_by_GU() const;
+
+  // =================================================================
+  //                        Accessors: setters
+  // =================================================================
+  inline void set_backup_step(int64_t backup_step);
+  inline void set_big_backup_step(int64_t big_backup_step);
+  inline void init_tree(ExpManager* exp_m, int64_t tree_step_);
+  inline void set_dump_step(int64_t dump_step);
+  inline void set_compute_phen_contrib_by_GU(bool compute_phen_contrib_by_GU);
+  inline void set_logs (int8_t logs);
+
+  // =================================================================
+  //                              Operators
+  // =================================================================
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void InitStats();
+  void WriteSetupFile(gzFile setup_file) const;
+  void WriteLastGenerFile(const std::string& input_dir = ".") const;
+  void PropagateStats(const std::string& outdir,
+                      int64_t propagated_timestep) const;
+  void load(gzFile file, bool verbose, bool to_be_run);
+  void write_current_generation_outputs() const;
+  inline void flush();
+
+  static int64_t last_gener();
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  void write_tree() const;
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  ExpManager* exp_m_;
+
+  // Backups
+  int64_t backup_step_;
+  int64_t big_backup_step_;
+
+  // Stats
+  Stats* stats_;
+  bool compute_phen_contrib_by_GU_;
+
+  // Tree
+  bool record_tree_;
+  Tree* tree_;
+
+  // Dumps
+  bool make_dumps_;
+  int64_t dump_step_;
+  Dump* dump_;
+
+  // Logs
+  Logging* logs_;
+};
+
+
+// =====================================================================
+//                           Getters' definitions
+// =====================================================================
+
+// Backup
+inline int64_t OutputManager::backup_step() const {
+  return backup_step_;
+}
+
+inline int64_t OutputManager::big_backup_step() const {
+  return big_backup_step_;
+}
+
+// Tree
+inline bool OutputManager::record_tree() const {
+  return record_tree_;
+}
+
+inline int64_t OutputManager::tree_step() const {
+  return tree_->tree_step();
+}
+
+inline Tree *OutputManager::tree() const {
+  return tree_;
+}
+
+// Logs
+inline FILE* OutputManager::log(LogType log_type) const {
+  return logs_->log(log_type);
+}
+
+inline bool  OutputManager::is_logged(LogType log_type) const {
+  return logs_->is_logged(log_type);
+}
+
+// Stats
+inline bool OutputManager::compute_phen_contrib_by_GU() const {
+  return compute_phen_contrib_by_GU_;
+}
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+void OutputManager::set_backup_step(int64_t backup_step) {
+  backup_step_ = backup_step;
+}
+
+void OutputManager::set_big_backup_step(int64_t big_backup_step) {
+  big_backup_step_ = big_backup_step;
+}
+
+void OutputManager::init_tree(ExpManager* exp_m, int64_t tree_step_) {
+  record_tree_ = true;
+  tree_ = new Tree(exp_m, tree_step_);
+}
+
+void OutputManager::set_dump_step(int64_t dump_step) {
+  make_dumps_ = true;
+  dump_step_  = dump_step;
+}
+
+void OutputManager::set_compute_phen_contrib_by_GU(
+    bool compute_phen_contrib_by_GU) {
+  compute_phen_contrib_by_GU_ = compute_phen_contrib_by_GU;
+}
+
+void OutputManager::set_logs(int8_t logs) {
+  logs_->set_logs(logs);
+}
+
+// =====================================================================
+//                          Operators' definitions
+// =====================================================================
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+inline void OutputManager::flush() {
+  stats_->flush();
+}
+
+} // namespace aevol
+
+#endif // AEVOL_OUPUT_MANAGER_H_
diff --git a/src/libaevol/ParamLoader.cpp b/src/libaevol/ParamLoader.cpp
new file mode 100644
index 0000000..0f0b040
--- /dev/null
+++ b/src/libaevol/ParamLoader.cpp
@@ -0,0 +1,2104 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdlib>
+#include <cstring>
+#include <cassert>
+#include <cerrno>
+#include <climits>
+#include <ctime>
+
+#include <list>
+
+#include "ParamLoader.h"
+
+#include "FuzzyFactory.h"
+
+#if __cplusplus == 201103L
+  #include "make_unique.h"
+#endif
+
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "OutputManager.h"
+#include "Individual.h"
+#include "IndividualFactory.h"
+#include "ExpManager.h"
+
+#ifdef __REGUL
+  #include "raevol/Individual_R.h"
+#endif
+
+#include "JumpingMT.h"
+#include "Gaussian.h"
+#include "PhenotypicSegment.h"
+#include "Point.h"
+#include "Alignment.h"
+#include "World.h"
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                             Class ParamLoader                               #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+static const int8_t STRAIN_NAME_DEFAULT_SIZE  = 20;
+static const int8_t STRAIN_NAME_LOGIN_SIZE    = 10;
+#ifndef LOGIN_NAME_MAX
+#define LOGIN_NAME_MAX 256
+#endif
+
+const char kTabChar = 0x09;
+
+// =================================================================
+//                             Constructors
+// =================================================================
+ParamLoader::ParamLoader(const char* file_name)
+{
+  // Give default values to parameters
+
+  // ----------------------------------------- PseudoRandom Number Generators
+  seed_           = 0;
+  mut_seed_       = 0;
+  stoch_seed_     = 0;
+  env_var_seed_   = 0;
+  env_noise_seed_ = 0;
+
+  // ------------------------------------------------------------ Constraints
+  min_genome_length_  = 10;
+  max_genome_length_  = 10000000;
+  w_max_              = 0.033333333;
+
+  // ----------------------------------------------------- Initial conditions
+  chromosome_initial_length_  = 5000;
+  init_method_            = ONE_GOOD_GENE | CLONE;
+  init_pop_size_          = 1024;
+  strain_name_ = new char[STRAIN_NAME_DEFAULT_SIZE + 1];
+
+
+  // ------------------------------------------------------------- Strain name
+  char* login_name = new char[LOGIN_NAME_MAX+1];
+  // Try get user login. If fail, replace by default value
+  if(getlogin_r(login_name, LOGIN_NAME_MAX) != 0)
+    strcpy(login_name, "anon");
+
+  // Copy login into strain name with at most STRAIN_NAME_LOGIN_SIZE + 1 characters
+  strncpy(strain_name_, login_name, STRAIN_NAME_LOGIN_SIZE + 1);
+  delete [] login_name;
+
+  // Null-terminate the c-string if the max number of characters were copied
+  if (strain_name_[STRAIN_NAME_LOGIN_SIZE] != 0)
+    strain_name_[STRAIN_NAME_LOGIN_SIZE + 1] = 0;
+
+  // Append with a hyphen and a series of random digits
+  int strain_name_len = strlen(strain_name_);
+  strain_name_[strain_name_len++] = '-';
+  srand(std::time(nullptr));
+  while (strain_name_len < STRAIN_NAME_DEFAULT_SIZE)
+  {
+    // Don't care for uniform distrib, using simple and ugly rand() % X
+    strain_name_[strain_name_len++] = '0' + rand() % 10;
+  }
+
+  // -------------------------------------------------------- Phenotypic target
+  env_sampling_ = 300;
+
+  // ------------------------------------ Phenotypic target x-axis segmentation
+  env_axis_nb_segments_         = 1;
+  env_axis_segment_boundaries_  = NULL;
+  env_axis_features_            = NULL;
+  env_axis_separate_segments_   = false;
+
+  // ---------------------------------------------- Phenotypic target variation
+  env_var_method_ = NO_VAR;
+  env_var_sigma_  = 0;
+  env_var_tau_    = 0;
+
+  // -------------------------------------------------- Phenotypic target noise
+  env_noise_method_       = NO_NOISE;
+  env_noise_alpha_        = 0;
+  env_noise_sigma_        = 0;
+  env_noise_prob_         = 0;
+  env_noise_sampling_log_ = 0;
+
+  // --------------------------------------------------------- Mutation rates
+  point_mutation_rate_  = 1e-5;
+  small_insertion_rate_ = 1e-5;
+  small_deletion_rate_  = 1e-5;
+  max_indel_size_       = 6;
+
+  // -------------------------------------------- Rearrangements and Transfer
+  with_4pts_trans_            = true;
+  with_alignments_            = false;
+  with_HT_                    = false;
+  repl_HT_with_close_points_  = false;
+  HT_ins_rate_                = 0.0;
+  HT_repl_rate_               = 0.0;
+  repl_HT_detach_rate_        = 0.0;
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  duplication_rate_   = 1e-5;
+  deletion_rate_      = 1e-5;
+  translocation_rate_ = 1e-5;
+  inversion_rate_     = 1e-5;
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  neighbourhood_rate_       = 5e-5;
+  duplication_proportion_   = 0.3;
+  deletion_proportion_      = 0.3;
+  translocation_proportion_ = 0.3;
+  inversion_proportion_     = 0.3;
+
+  // ------------------------------------------------------------ Alignements
+  align_fun_shape_    = SIGMOID;
+  align_sigm_lambda_  = 4;
+  align_sigm_mean_    = 50;
+  align_lin_min_      = 0;
+  align_lin_max_      = 100;
+
+  align_max_shift_      = 20;
+  align_w_zone_h_len_   = 50;
+  align_match_bonus_    = 1;
+  align_mismatch_cost_  = 2;
+
+  // ----------------------------------------------- Phenotypic Stochasticity
+  with_stochasticity_ = false;
+
+  // -------------------------------------------------------------- Selection
+  selection_scheme_   = RANK_EXPONENTIAL;
+  selection_pressure_ = 0.998;
+
+  // -------------------------------------------------------------- Secretion
+  with_secretion_               = false;
+  secretion_contrib_to_fitness_ = 0;
+  secretion_diffusion_prop_     = 0;
+  secretion_degradation_prop_   = 0;
+  secretion_cost_               = 0;
+  secretion_init_               = 0;
+
+  // --------------------------------------------------------------- Plasmids
+  allow_plasmids_             = false;
+  plasmid_initial_length_     = -1;
+  plasmid_initial_gene_       = 0;
+  plasmid_minimal_length_     = -1;
+  plasmid_maximal_length_     = -1;
+  chromosome_minimal_length_  = -1;
+  chromosome_maximal_length_  = -1;
+  prob_plasmid_HT_            = 0;
+  tune_donor_ability_         = 0;
+  tune_recipient_ability_     = 0;
+  donor_cost_                 = 0;
+  recipient_cost_             = 0;
+  compute_phen_contrib_by_GU_ = false;
+  swap_GUs_         = false;
+
+  // ------------------------------------------------------- Translation cost
+  translation_cost_ = 0;
+
+  // ---------------------------------------------------------------- Outputs
+  stats_            = 0;
+  delete_old_stats_ = false;
+
+  // Backups
+  backup_step_      = 500;
+  big_backup_step_  = 10000;
+
+  // Tree
+  record_tree_  = false;
+  tree_step_    = 100;
+
+  // Dumps
+  make_dumps_ = false;
+  dump_step_  = 1000;
+
+  // Logs
+  logs_ = 0;
+
+  // Other
+  more_stats_ = false;
+
+  _fuzzy_flavor = 0;
+
+#ifdef __REGUL
+    // ------------------------------------------------------- Binding matrix
+    _binding_zeros_percentage = 75;
+
+    _protein_presence_limit = 1e-2;
+    _degradation_rate  = 1;
+    _nb_degradation_step  = 10;
+    _nb_indiv_age         = 20;
+    _with_heredity          = false;
+
+    _hill_shape_n      = 4;
+    _hill_shape_theta  = 0.5;
+    _hill_shape        = std::pow( _hill_shape_theta, _hill_shape_n );
+
+    _list_eval_step.insert(_nb_indiv_age);
+    _env_switch_probability = 0.1;
+#endif
+
+  first_regul_ = true;
+
+  // Read parameter file
+  param_file_name_ = strdup(file_name);
+  param_file_  = fopen(param_file_name_,  "r");
+
+  if (param_file_ == NULL)
+  {
+    printf("ERROR : couldn't open file %s\n", file_name);
+    exit(EXIT_FAILURE);
+  }
+
+  assert(param_file_);
+
+  read_file();
+}
+
+// =================================================================
+//                             Destructor
+// =================================================================
+ParamLoader::~ParamLoader()
+{
+  free(param_file_name_);
+  fclose(param_file_);
+
+  delete [] env_axis_segment_boundaries_;
+  delete [] env_axis_features_;
+  delete [] strain_name_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void ParamLoader::interpret_line(ParameterLine * line, int32_t cur_line)
+{
+  if (strcmp(line->words[0], "STRAIN_NAME") == 0)
+  {
+    delete [] strain_name_;
+    strain_name_ = new char[strlen(line->words[1])+1];
+    strcpy(strain_name_, line->words[1]);
+  }
+  else if (strcmp(line->words[0], "MIN_TRIANGLE_WIDTH") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "its value is fixed to 0.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "MAX_TRIANGLE_WIDTH") == 0)
+  {
+    w_max_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ENV_AXIS_FEATURES") == 0)
+  {
+    // Set general segmentation data
+    env_axis_nb_segments_ = line->nb_words / 2;
+
+    // Set segmentation boundaries
+    env_axis_segment_boundaries_ = new double [env_axis_nb_segments_ + 1];
+    env_axis_segment_boundaries_[0] = X_MIN;
+    for (int16_t i = 1 ; i < env_axis_nb_segments_ ; i++)
+    {
+      env_axis_segment_boundaries_[i] = atof(line->words[2*i]);
+    }
+    env_axis_segment_boundaries_[env_axis_nb_segments_] = X_MAX;
+
+    // Set segment features
+    env_axis_features_ = new PhenotypicFeature[env_axis_nb_segments_];
+    for (int16_t i = 0 ; i < env_axis_nb_segments_ ; i++)
+    {
+      if (strcmp(line->words[2*i+1], "NEUTRAL") == 0)
+      {
+        env_axis_features_[i] = NEUTRAL;
+      }
+      else if (strcmp(line->words[2*i+1], "METABOLISM") == 0)
+      {
+        env_axis_features_[i] = METABOLISM;
+      }
+      else if (strcmp(line->words[2*i+1], "SECRETION") == 0)
+      {
+        with_secretion_ = true;
+        env_axis_features_[i] = SECRETION;
+      }
+      else if (strcmp(line->words[2*i+1], "DONOR") == 0)
+      {
+        env_axis_features_[i] = DONOR;
+      }
+      else if (strcmp(line->words[2*i+1], "RECIPIENT") == 0)
+      {
+        env_axis_features_[i] = RECIPIENT;
+      }
+      else
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": unknown axis feature \"%s\".\n",
+               param_file_name_, cur_line, line->words[2*i+1]);
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+  else if (strcmp(line->words[0], "ENV_SEPARATE_SEGMENTS") == 0)
+  {
+    env_axis_separate_segments_ = true;
+  }
+  else if (strcmp(line->words[0], "RECORD_TREE") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      record_tree_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      record_tree_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown tree recording option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "TREE_MODE") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32 ": "
+           "Tree mode management has been removed.\n",
+           param_file_name_, cur_line);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "MORE_STATS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      more_stats_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      more_stats_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown more stats option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "DUMP_PERIOD") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use DUMP_STEP instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "DUMP_STEP") == 0)
+  {
+    dump_step_ = atol(line->words[1]);
+    if (dump_step_>0) make_dumps_ = true;
+  }
+  else if (strcmp(line->words[0], "BACKUP_STEP") == 0)
+  {
+    backup_step_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "BIG_BACKUP_STEP") == 0)
+  {
+    big_backup_step_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TREE_STEP") == 0)
+  {
+    tree_step_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "NB_GENER") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use command line arguments of aevol_run instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "INITIAL_GENOME_LENGTH") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use CHROMOSOME_INITIAL_LENGTH (and optionally "
+               "PLASMID_INITIAL_LENGTH) instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "CHROMOSOME_INITIAL_LENGTH") == 0)
+  {
+    chromosome_initial_length_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "MIN_GENOME_LENGTH") == 0)
+  {
+    if (strncmp(line->words[1], "NONE", 4) == 0)
+    {
+      min_genome_length_ = 1; // Must not be 0
+    }
+    else
+    {
+      min_genome_length_ = atol(line->words[1]);
+      if (min_genome_length_ == 0)
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32 " : MIN_GENOME_LENGTH must be > 0.\n",
+               param_file_name_, cur_line);
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+  else if (strcmp(line->words[0], "MAX_GENOME_LENGTH") == 0)
+  {
+    if (strncmp(line->words[1], "NONE", 4) == 0)
+    {
+      max_genome_length_ = INT32_MAX;
+    }
+    else
+    {
+      max_genome_length_ = atol(line->words[1]);
+    }
+  }
+  else if (strcmp(line->words[0], "INIT_POP_SIZE") == 0)
+  {
+    init_pop_size_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "WORLD_SIZE") == 0)
+  {
+    grid_width_ = atoi(line->words[1]);
+    grid_height_ = atoi(line->words[2]);
+  }
+  else if (strcmp(line->words[0], "POP_STRUCTURE") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use WORLD_SIZE <width> <height> instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "MIGRATION_NUMBER") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use INDIV_MIXING instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    printf("usage: INDIV_MIXING WELL_MIXED|NONE|PARTIAL <n>\n");
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "INDIV_MIXING") == 0)
+  {
+    if (strcmp(line->words[1], "WELL_MIXED") == 0)
+      well_mixed = true;
+    else if (strcmp(line->words[1], "NONE") == 0)
+      well_mixed = false;
+    else if (strcmp(line->words[1], "PARTIAL") == 0)
+      partial_mix_nb_permutations = atol(line->words[2]);
+    else {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown mixing option.\n", param_file_name_, cur_line);
+      printf("usage: INDIV_MIXING WELL_MIXED|NONE|PARTIAL <n>\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "INIT_METHOD") == 0)
+  {
+    for (int8_t i = 1 ; i < line->nb_words ; i++)
+    {
+      if (strcmp(line->words[i], "ONE_GOOD_GENE") == 0)
+      {
+        init_method_ |= ONE_GOOD_GENE;
+      }
+      else if (strcmp(line->words[i], "CLONE") == 0)
+      {
+        init_method_ |= CLONE;
+      }
+      else if (strcmp(line->words[i], "WITH_INS_SEQ") == 0)
+      {
+        init_method_ |= WITH_INS_SEQ;
+      }
+      else
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": unknown initialization method %s.\n",
+               param_file_name_, cur_line, line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+  else if (strcmp(line->words[0], "POINT_MUTATION_RATE") == 0)
+  {
+    point_mutation_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "SMALL_INSERTION_RATE") == 0)
+  {
+    small_insertion_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "SMALL_DELETION_RATE") == 0)
+  {
+    small_deletion_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "MAX_INDEL_SIZE") == 0)
+  {
+    max_indel_size_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "DUPLICATION_RATE") == 0)
+  {
+    duplication_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "DELETION_RATE") == 0)
+  {
+    deletion_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TRANSLOCATION_RATE") == 0)
+  {
+    translocation_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "INVERSION_RATE") == 0)
+  {
+    inversion_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "NEIGHBOURHOOD_RATE") == 0)
+  {
+    neighbourhood_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "DUPLICATION_PROPORTION") == 0)
+  {
+    duplication_proportion_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "DELETION_PROPORTION") == 0)
+  {
+    deletion_proportion_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TRANSLOCATION_PROPORTION") == 0)
+  {
+    translocation_proportion_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "INVERSION_PROPORTION") == 0)
+  {
+    inversion_proportion_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ALIGN_FUNCTION") == 0)
+  {
+    if (line->nb_words != 2 && line->nb_words != 4)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": incorrect number of parameters for keyword \"%s\".\n",
+             param_file_name_, cur_line, line->words[0]);
+      exit(EXIT_FAILURE);
+    }
+
+    if (strcmp(line->words[1], "LINEAR") == 0)
+    {
+      align_fun_shape_ = LINEAR;
+
+      if (line->nb_words == 4)
+      {
+        align_lin_min_ = atol(line->words[2]);
+        align_lin_max_ = atol(line->words[3]);
+      }
+    }
+    else if (strcmp(line->words[1], "SIGMOID") == 0)
+    {
+      align_fun_shape_ = SIGMOID;
+
+      if (line->nb_words == 4)
+      {
+        align_sigm_lambda_ = atol(line->words[2]);
+        align_sigm_mean_ = atol(line->words[3]);
+      }
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown align function shape \"%s\".\n",
+             param_file_name_, cur_line, line->words[1]);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "ALIGN_MAX_SHIFT") == 0)
+  {
+    align_max_shift_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ALIGN_W_ZONE_H_LEN") == 0)
+  {
+    align_w_zone_h_len_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ALIGN_MATCH_BONUS") == 0)
+  {
+    align_match_bonus_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ALIGN_MISMATCH_COST") == 0)
+  {
+    align_mismatch_cost_ = atol(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "STOCHASTICITY") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      with_stochasticity_ = true;
+    }
+  }
+  else if (strcmp(line->words[0], "SELECTION_SCHEME") == 0)
+  {
+    if (strncmp(line->words[1], "lin", 3) == 0)
+    {
+      if (line->nb_words != 3)
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": selection pressure parameter is missing.\n",
+               param_file_name_, cur_line);
+        exit(EXIT_FAILURE);
+      }
+
+      selection_scheme_ = RANK_LINEAR;
+      selection_pressure_ = atof(line->words[2]);
+    }
+    else if (strncmp(line->words[1], "exp", 3) == 0)
+    {
+      if (line->nb_words != 3)
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": selection pressure parameter is missing.\n",
+               param_file_name_, cur_line);
+        exit(EXIT_FAILURE);
+      }
+
+      selection_scheme_ = RANK_EXPONENTIAL;
+      selection_pressure_ = atof(line->words[2]);
+    }
+    else if (strncmp(line->words[1], "fitness", 7) == 0)
+    {
+      if (line->nb_words != 3)
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": selection pressure parameter is missing.\n",
+               param_file_name_, cur_line);
+        exit(EXIT_FAILURE);
+      }
+
+      selection_scheme_ = FITNESS_PROPORTIONATE;
+      selection_pressure_ = atof(line->words[2]);
+    }
+    else if (strcmp(line->words[1], "fittest") == 0)
+    {
+      selection_scheme_ = FITTEST;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown selection scheme \"%s\".\n",
+             param_file_name_, cur_line, line->words[1]);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "SEED") == 0)
+  {
+    static bool seed_already_set = false;
+    if (seed_already_set)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": duplicate entry for SEED.\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+    seed_ = atol(line->words[1]);
+    seed_already_set = true;
+  }
+  else if (strcmp(line->words[0], "MUT_SEED") == 0)
+  {
+    static bool mut_seed_already_set = false;
+    if (mut_seed_already_set)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": duplicate entry for MUT_SEED.\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+    mut_seed_ = atol(line->words[1]);
+    mut_seed_already_set = true;
+  }
+  else if (strcmp(line->words[0], "STOCH_SEED") == 0)
+  {
+    static bool stoch_seed_already_set = false;
+    if (stoch_seed_already_set)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": duplicate entry for STOCH_SEED.\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+    stoch_seed_ = atol(line->words[1]);
+    stoch_seed_already_set = true;
+  }
+  else if (strcmp(line->words[0], "WITH_4PTS_TRANS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      with_4pts_trans_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      printf("ERROR: 3 points_ translocation hasn't been implemented yet\n");
+      exit(EXIT_FAILURE);
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown 4pts_trans option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "WITH_ALIGNMENTS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      with_alignments_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      with_alignments_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown alignement option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "WITH_TRANSFER") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      with_HT_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      with_HT_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown transfer option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "REPL_TRANSFER_WITH_CLOSE_POINTS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      repl_HT_with_close_points_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      repl_HT_with_close_points_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown transfer option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "SWAP_GUS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      swap_GUs_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      swap_GUs_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown swap option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "TRANSFER_INS_RATE") == 0)
+  {
+    HT_ins_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TRANSFER_REPL_RATE") == 0)
+  {
+    HT_repl_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "REPL_TRANSFER_DETACH_RATE") == 0)
+  {
+    repl_HT_detach_rate_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TRANSLATION_COST") == 0)
+  {
+    translation_cost_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ENV_ADD_POINT") == 0)
+  {
+    // custom_points
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": Custom points management has been removed.\n",
+        param_file_name_, cur_line);
+    exit(EXIT_FAILURE);
+  }
+  else if ((strcmp(line->words[0], "ENV_ADD_GAUSSIAN") == 0) ||
+      (strcmp(line->words[0], "ENV_GAUSSIAN") == 0))
+  {
+    #ifdef __REGUL
+      // le premier chiffre est l'indice d'environment en convention humaine ( le premier a 1)
+      // On vérifie que cet indice n'est pas trop élevé ni négatif pour éviter les crash
+      if ( atoi(line->words[1]) - 1 < _env_gaussians_list.size() && atoi(line->words[1]) > 0)
+      {
+        (_env_gaussians_list.at( atoi(line->words[1]) - 1)).push_back
+        ( Gaussian(  atof( line->words[2] ), atof( line->words[3] ), atof( line->words[4] ) ) );
+      }
+      else
+      {
+        printf( " ERROR in param file \"%s\" on line %" PRId32 " : There is only %ld environment.\n",
+         param_file_name_, cur_line, _env_gaussians_list.size() );
+        exit( EXIT_FAILURE );
+      }
+      
+    #else
+          std_env_gaussians.push_back(
+        Gaussian(atof(line->words[1]), atof(line->words[2]), atof(line->words[3])));
+    #endif
+  }
+  else if (strcmp(line->words[0], "ENV_SAMPLING") == 0)
+  {
+    env_sampling_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ENV_VARIATION") == 0)
+  {
+    static bool env_var_already_set = false;
+    if (env_var_already_set)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32 " : "
+                 "duplicate entry for %s.\n",
+             param_file_name_, cur_line, line->words[0]);
+      exit(EXIT_FAILURE);
+    }
+    env_var_already_set = true;
+
+    if (strcmp(line->words[1], "none") == 0)
+    {
+      if (line->nb_words != 2) {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": wrong number of parameters.\n",
+               param_file_name_, cur_line);
+        printf("usage: %s %s\n", line->words[0], line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_method_ = NO_VAR;
+    }
+    else if (strcmp(line->words[1], "autoregressive_mean_variation") == 0)
+    {
+      if (line->nb_words != 5) {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": wrong number of parameters.\n",
+               param_file_name_, cur_line);
+        printf("usage: %s %s sigma tau prng_seed\n",
+               line->words[0], line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_method_ = AUTOREGRESSIVE_MEAN_VAR;
+      env_var_sigma_ = atof(line->words[2]);
+      env_var_tau_ = atol(line->words[3]);
+      env_var_seed_ = atoi(line->words[4]);
+    }
+    else if (strcmp(line->words[1], "autoregressive_height_variation") == 0)
+    {
+      if (line->nb_words != 5) {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": wrong number of parameters.\n",
+               param_file_name_, cur_line);
+        printf("usage: %s %s sigma tau prng_seed\n",
+               line->words[0], line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_method_ = AUTOREGRESSIVE_HEIGHT_VAR;
+      env_var_sigma_ = atof(line->words[2]);
+      env_var_tau_ = atol(line->words[3]);
+      env_var_seed_ = atoi(line->words[4]);
+    }
+    else if (strcmp(line->words[1], "add_local_gaussians") == 0)
+    {
+      if (line->nb_words != 3) {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": wrong number of parameters.\n",
+               param_file_name_, cur_line);
+        printf("usage: %s %s prng_seed\n",
+               line->words[0], line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_method_ = LOCAL_GAUSSIANS_VAR;
+      env_var_seed_ = atoi(line->words[2]);
+    }
+      #ifdef __REGUL
+    else if (strcmp(line->words[1], "switch_in_a_list") == 0)
+    {
+      if (line->nb_words != 3) {
+        printf("ERROR in param file \"%s\" on line %" PRId32
+                   ": wrong number of parameters.\n",
+               param_file_name_, cur_line);
+        printf("usage: %s %s probability to switch between different environments\n",
+               line->words[0], line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+      env_var_method_ = SWITCH_IN_A_LIST;
+      _env_switch_probability = atof(line->words[2]);
+    }
+    #endif
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 " : unknown phenotypic target variation method.\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "ENV_NOISE") == 0)
+  {
+    static bool env_noise_already_set = false;
+    if (env_noise_already_set)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 " : duplicate entry for %s.\n",
+             param_file_name_, cur_line, line->words[0]);
+      exit(EXIT_FAILURE);
+    }
+    env_noise_already_set = true;
+
+    if (strcmp(line->words[1], "none") == 0)
+    {
+      assert(line->nb_words == 2);
+      env_noise_method_ = NO_NOISE;
+    }
+    else if (strcmp(line->words[1], "FRACTAL") == 0)
+    {
+      assert(line->nb_words == 6);
+      env_noise_method_ = FRACTAL;
+      env_noise_sampling_log_ = atoi(line->words[2]);
+      env_noise_sigma_ = atof(line->words[3]);
+      env_noise_alpha_ = atof(line->words[4]);
+      env_noise_prob_ = atof(line->words[5]);
+      env_noise_seed_ = atoi(line->words[6]);
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 " : unknown phenotypic target noise method.\n",
+             param_file_name_,
+             cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "SECRETION_FITNESS_CONTRIB") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "use SECRETION_CONTRIB_TO_FITNESS instead.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "SECRETION_CONTRIB_TO_FITNESS") == 0)
+  {
+    secretion_contrib_to_fitness_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "SECRETION_DIFFUSION_PROP") == 0)
+  {
+    secretion_diffusion_prop_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "SECRETION_DEGRADATION_PROP") == 0)
+  {
+    secretion_degradation_prop_ = atof(line->words[1]);
+    if (secretion_degradation_prop_ > 1 || secretion_degradation_prop_ < 0)
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": degradation must be in (0,1).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "SECRETION_INITIAL") == 0)
+  {
+    secretion_init_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "SECRETION_COST") == 0)
+  {
+    secretion_cost_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "ALLOW_PLASMIDS") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      allow_plasmids_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      allow_plasmids_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32
+                 ": unknown allow_plasmids option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "PLASMID_INITIAL_LENGTH") == 0)
+  {
+    plasmid_initial_length_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "PLASMID_INITIAL_GENE") == 0)
+  {
+    plasmid_initial_gene_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "PLASMID_MINIMAL_LENGTH") == 0)
+  {
+    plasmid_minimal_length_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "PLASMID_MAXIMAL_LENGTH") == 0)
+  {
+    plasmid_maximal_length_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "CHROMOSOME_MINIMAL_LENGTH") == 0)
+  {
+    chromosome_minimal_length_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "CHROMOSOME_MAXIMAL_LENGTH") == 0)
+  {
+    chromosome_maximal_length_ = atoi(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "PROB_HORIZONTAL_TRANS") == 0)
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32
+               ": %s is no longer a valid option, "
+               "did you mean PROB_PLASMID_HT ?.\n",
+           param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+  else if (strcmp(line->words[0], "PROB_PLASMID_HT") == 0)
+  {
+    prob_plasmid_HT_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TUNE_DONOR_ABILITY") == 0)
+  {
+    tune_donor_ability_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "TUNE_RECIPIENT_ABILITY") == 0)
+  {
+    tune_recipient_ability_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "DONOR_COST") == 0)
+  {
+    donor_cost_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "RECIPIENT_COST") == 0)
+  {
+    recipient_cost_ = atof(line->words[1]);
+  }
+  else if (strcmp(line->words[0], "COMPUTE_PHEN_CONTRIB_BY_GU") == 0)
+  {
+    if (strncmp(line->words[1], "true", 4) == 0)
+    {
+      compute_phen_contrib_by_GU_ = true;
+    }
+    else if (strncmp(line->words[1], "false", 5) == 0)
+    {
+      compute_phen_contrib_by_GU_ = false;
+    }
+    else
+    {
+      printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown compute_phen_contrib_by_GU option (use true/false).\n",
+             param_file_name_, cur_line);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else if (strcmp(line->words[0], "LOG") == 0)
+  {
+    for (int8_t i = 1 ; i < line->nb_words ; i++)
+    {
+      if (strcmp(line->words[i], "TRANSFER") == 0)
+      {
+        logs_ |= LOG_TRANSFER;
+      }
+      else if (strcmp(line->words[i], "REAR") == 0)
+      {
+        logs_ |= LOG_REAR;
+      }
+      else if (strcmp(line->words[i], "BARRIER") == 0)
+      {
+        logs_ |= LOG_BARRIER;
+      }
+        /*else if (strcmp(line->words[i], "LOADS") == 0)
+        {
+          tmp_to_be_logged |= LOG_LOADS;
+        }   */
+      else
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown log option %s.\n",
+               param_file_name_, cur_line, line->words[1]);
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+  else if (strcmp(line->words[0], "FUZZY_FLAVOR") == 0)
+  {
+    _fuzzy_flavor = atoi(line->words[1]);
+  }
+
+#ifdef __REGUL
+    else if (strcmp(line->words[0], "HILL_SHAPE_N") == 0)
+    {
+      _hill_shape_n = atof(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "HILL_SHAPE_THETA") == 0)
+    {
+      _hill_shape_theta = atof(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "DEGRADATION_RATE") == 0)
+    {
+      _degradation_rate = atof(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "NB_DEGRADATION_STEP") == 0)
+    {
+      _nb_degradation_step = atoi(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "NB_INDIV_AGE") == 0)
+    {
+      _nb_indiv_age = atoi(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "RANDOM_BINDING_MATRIX") == 0)
+    {
+        if (strncmp(line->words[1], "true", 4) == 0)
+        {
+        	_random_binding_matrix = true;
+        }
+        else if (strncmp(line->words[1], "false", 5) == 0)
+        {
+        	_random_binding_matrix = false;
+        }
+        else
+        {
+          printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown more random_binding_matrix option (use true/false).\n",
+                 param_file_name_, cur_line);
+          exit(EXIT_FAILURE);
+        }
+    }
+    else if (strcmp(line->words[0], "BINDING_ZEROS_PERCENTAGE") == 0)
+    {
+      _binding_zeros_percentage = atof(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "INDIVIDUAL_EVALUATION_AGES") == 0)
+    {
+      _list_eval_step.clear();
+      for (int i = 1; i < line->nb_words; i++) _list_eval_step.insert(atoi(line->words[i]));
+    }
+    else if (strcmp(line->words[0], "WITH_HEREDITY") == 0)
+    {
+      if (strncmp(line->words[1], "true", 4) == 0)
+      {
+        _with_heredity = true;
+      }
+      else if (strncmp(line->words[1], "false", 5) == 0)
+      {
+        _with_heredity = false;
+      }
+      else
+      {
+        printf("ERROR in param file \"%s\" on line %" PRId32 " : unknown with_heredity option (use true/false).\n",
+               param_file_name_, cur_line);
+        exit(EXIT_FAILURE);
+      }
+    }
+    else if (strcmp(line->words[0], "PROTEIN_PRESENCE_LIMIT") == 0)
+    {
+      _protein_presence_limit = atof(line->words[1]);
+    }
+    else if (strcmp(line->words[0], "NB_ENVIRONMENTS") == 0)
+    {
+      int16_t nb_env = atoi( line->words[1] );
+      
+      if( nb_env < 1 )
+      {
+        printf( "ERROR in param file \"%s\" on line %" PRId32 " : you must have at least one environment\n", param_file_name_, cur_line );
+        printf("you put %" PRId16 "\n", nb_env);
+        exit( EXIT_FAILURE );
+      }
+
+      // Utile uniquement en cas de reprise sur backup
+      // Je ne sais pas comment ça va se passer avec cette version ...
+      if( _env_gaussians_list.size() > 0 )
+      {
+        _env_gaussians_list.clear();
+      }
+
+      
+      if( _env_signals_list.size() > 0 )
+      {
+        _env_signals_list.clear();
+      }
+      
+
+      for( int16_t i = 0; i < nb_env; i++)
+      {
+        _env_gaussians_list.push_back(std::list<Gaussian>());
+        _env_signals_list.push_back(std::list<int8_t>());
+      }
+    }
+    else if (strcmp(line->words[0], "CREATE_SIGNAL") == 0)
+    {
+      int signal_lenght = line->nb_words - 1;     
+
+      std::list<Codon*> codon_list;
+      Codon* codon = NULL;
+      for (int8_t i = 0; i < signal_lenght; i++)
+      {
+        if(strcmp(line->words[i+1], "h0")==0)
+        {
+          codon = new Codon(CODON_H0);
+        }
+        else if(strcmp(line->words[i+1], "h1")==0)
+        {
+          codon = new Codon(CODON_H1);
+        }
+        else if(strcmp(line->words[i+1], "w0")==0)
+        {
+          codon = new Codon(CODON_W0);
+        }
+        else if(strcmp(line->words[i+1], "w1")==0)
+        {
+          codon = new Codon(CODON_W1);
+        }
+        else if(strcmp(line->words[i+1], "m0")==0)
+        {
+          codon = new Codon(CODON_M0);
+        }
+        else if(strcmp(line->words[i+1], "m1")==0)
+        {
+          codon = new Codon(CODON_M1);
+        }
+        else
+        {
+          printf("Error this codon doesn't exist\n");
+          exit( EXIT_FAILURE );
+        }
+        codon_list.push_back(codon);
+      }
+      _signals_models.push_back(new Protein_R(codon_list, 0.5, w_max_));
+
+      for (auto cod : codon_list) delete cod;
+
+      codon_list.clear();
+    }
+    else if (strcmp(line->words[0], "ENV_ADD_SIGNAL") == 0)
+    {
+      // le premier chiffre est l'indice d'environment en convention humaine ( le premier a 1)
+      // On vérifie que cet indice n'est pas trop élevé ni négatif pour éviter les crash
+      if ( atoi(line->words[1]) - 1 < _env_signals_list.size() && atoi(line->words[1]) > 0)
+      {
+        (_env_signals_list.at( atoi(line->words[1]) - 1)).push_back(atoi(line->words[2]) - 1);
+      }
+      else
+      {
+        printf( " ERROR in param file \"%s\" on line %" PRId32 " : There are only %ld environment.\n",
+         param_file_name_, cur_line, _env_gaussians_list.size() );
+        exit( EXIT_FAILURE );
+      }
+    } else if (strcmp(line->words[0], "REGUL_FIRST") == 0)
+    {
+        if (strncmp(line->words[1], "true", 4) == 0)
+        {
+        	first_regul_ = true;
+        }
+        else if (strncmp(line->words[1], "false", 5) == 0)
+        {
+        	first_regul_ = false;
+        }
+    }
+  #endif
+
+  else
+  {
+    printf("ERROR in param file \"%s\" on line %" PRId32 " : undefined key word \"%s\"\n", param_file_name_, cur_line, line->words[0]);
+    exit(EXIT_FAILURE);
+  }
+}
+
+void ParamLoader::read_file()
+{
+  // The rewind is only necessary when using multiple param files
+  rewind(param_file_);
+
+  int32_t cur_line = 0;
+  ParameterLine* parameter_line;
+
+  // TODO : write parameter_line = new ParameterLine(param_file_) => ParameterLine::ParameterLine(char*)
+  while ((parameter_line = line(&cur_line)) != NULL)
+  {
+    interpret_line(parameter_line, cur_line);
+    delete parameter_line;
+  }
+}
+
+void ParamLoader::CheckConsistency() {
+  if (allow_plasmids_) {
+    if (plasmid_initial_gene_ != 1) { // the plasmid will be copied from the chromosome
+      if (plasmid_initial_length_ != -1) {
+        printf(
+            "WARNING: PLASMID_INITIAL_LENGTH is not taken into account because PLASMID_INITIAL_GENE is set to 0 (copy from chromosome)\n");
+        plasmid_initial_length_ = chromosome_initial_length_;
+      }
+    }
+    else if (compute_phen_contrib_by_GU_ == false) {
+      printf("ERROR: when using PLASMID_INITIAL_GENE==1, the paramater COMPUTE_PHEN_CONTRIB_BY_GU should be set to true.\n");
+      exit(EXIT_FAILURE);
+    }
+
+    if (plasmid_maximal_length_ == -1)
+      plasmid_maximal_length_ = max_genome_length_;
+    if (plasmid_minimal_length_ == -1)
+      plasmid_minimal_length_ = min_genome_length_;
+    if(plasmid_minimal_length_ > plasmid_initial_length_) {
+      printf("ERROR: PLASMID_INITIAL_LENGTH is lower than PLASMID_MINIMAL_LENGTH\n");
+      exit(EXIT_FAILURE);
+    }
+    if (plasmid_maximal_length_ < plasmid_initial_length_) {
+      printf("ERROR: PLASMID_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  if (chromosome_maximal_length_ == -1)
+    chromosome_maximal_length_ = max_genome_length_;
+  if (chromosome_minimal_length_ == -1)
+    chromosome_minimal_length_ = min_genome_length_;
+  if (chromosome_minimal_length_ > chromosome_initial_length_) {
+    printf("ERROR: CHROMOSOME_INITIAL_LENGTH is lower than CHROMOSOME_MINIMAL_LENGTH\n");
+    exit(EXIT_FAILURE);
+  }
+  if (chromosome_maximal_length_ < chromosome_initial_length_) {
+    printf("ERROR: CHROMOSOME_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n");
+    exit(EXIT_FAILURE);
+  }
+  // Check that the population fits in the spatial structure
+  if (init_pop_size_ != grid_width_ * grid_height_)
+  {
+    printf("ERROR: the number of individuals (%" PRId32
+               ") does not match the size of the grid  (%" PRId16
+               " * %" PRId16 ")\n",
+           init_pop_size_,
+           grid_width_,
+           grid_height_);
+    exit(EXIT_FAILURE);
+  }
+}
+
+FuzzyFactory* FuzzyFactory::fuzzyFactory = NULL;
+
+void ParamLoader::load(ExpManager* exp_m, bool verbose,
+                       char* chromosome, int32_t lchromosome,
+                       char* plasmid, int32_t lplasmid) {
+  // Check consistency of min, max and initial length of chromosome and plasmid
+  // Default for by GU minimal or maximal size is -1.
+  // If equal to -1, maximal sizes of each GU will be replaced by total maximal size for the whole genome
+  CheckConsistency();
+
+  // Initialize prng_
+  // This one will be used to create the initial genome(s) and to generate seeds for other prng
+  prng_ = std::make_shared<JumpingMT>(seed_);
+
+  // Initialize mut_prng, stoch_prng, world_prng :
+  // if mut_seed (respectively stoch_seed) not given in param.in, choose it at random
+  if (mut_seed_ == 0) {
+    mut_seed_ = prng_->random(1000000);
+  }
+  if (stoch_seed_ == 0) {
+    stoch_seed_ = prng_->random(1000000);
+  }
+  auto mut_prng   = std::make_shared<JumpingMT>(mut_seed_);
+  auto stoch_prng = std::make_shared<JumpingMT>(stoch_seed_);
+  auto world_prng = std::make_shared<JumpingMT>(prng_->random(1000000));
+
+  // Create aliases
+  ExpSetup* exp_s = exp_m->exp_s();
+  Selection* sel = exp_m->sel();
+  OutputManager* output_m = exp_m->output_m();
+  output_m->InitStats();
+
+
+  // 1) ------------------------------------- Initialize the experimental setup
+#if __cplusplus == 201103L
+  sel->set_prng(make_unique<JumpingMT>(prng_->random(1000000)));
+#else
+  sel->set_prng(std::make_unique<JumpingMT>(prng_->random(1000000)));
+#endif
+
+  // ---------------------------------------------------------------- Selection
+  sel->set_selection_scheme(selection_scheme_);
+  sel->set_selection_pressure(selection_pressure_);
+
+  // ----------------------------------------------------------------- Transfer
+  exp_s->set_with_HT(with_HT_);
+  exp_s->set_repl_HT_with_close_points(repl_HT_with_close_points_);
+  exp_s->set_HT_ins_rate(HT_ins_rate_);
+  exp_s->set_HT_repl_rate(HT_repl_rate_);
+  exp_s->set_repl_HT_detach_rate(repl_HT_detach_rate_);
+
+  // ----------------------------------------------------------------- Plasmids
+  exp_s->set_with_plasmids(allow_plasmids_);
+  exp_s->set_prob_plasmid_HT(prob_plasmid_HT_);
+  exp_s->set_tune_donor_ability(tune_donor_ability_);
+  exp_s->set_tune_recipient_ability(tune_recipient_ability_);
+  exp_s->set_donor_cost(donor_cost_);
+  exp_s->set_recipient_cost(recipient_cost_);
+  exp_s->set_swap_GUs(swap_GUs_);
+  output_m->set_compute_phen_contrib_by_GU(compute_phen_contrib_by_GU_);
+
+  // ---------------------------------------------------------------- Secretion
+  exp_s->set_with_secretion(with_secretion_);
+  exp_s->set_secretion_contrib_to_fitness(secretion_contrib_to_fitness_);
+  exp_s->set_secretion_cost(secretion_cost_);
+
+  exp_s->set_fuzzy_flavor(_fuzzy_flavor);
+
+#ifdef __REGUL
+  exp_s->set_with_heredity(_with_heredity);
+  exp_s->set_degradation_rate(_degradation_rate);
+  exp_s->set_nb_degradation_step(_nb_degradation_step);
+  exp_s->set_nb_indiv_age(_nb_indiv_age);
+  exp_s->set_list_eval_step(_list_eval_step);
+  exp_s->set_protein_presence_limit(_protein_presence_limit);
+  exp_s->set_hill_shape(pow( _hill_shape_theta, _hill_shape_n ));
+  exp_s->set_hill_shape_n( _hill_shape_n );
+
+  exp_s->init_binding_matrix(_random_binding_matrix,_binding_zeros_percentage,prng_);
+#endif
+  exp_s->set_first_regul(first_regul_);
+
+  if (FuzzyFactory::fuzzyFactory == NULL)
+    FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s);
+
+  // 2) --------------------------------------------- Create and init a Habitat
+  #ifndef __REGUL
+  Habitat habitat;
+  #else
+  Habitat_R habitat;
+  #endif
+
+  // Shorthand for phenotypic target handler
+  #ifndef __REGUL
+  PhenotypicTargetHandler& phenotypic_target_handler =
+      habitat.phenotypic_target_handler_nonconst();
+  #else
+  PhenotypicTargetHandler_R& phenotypic_target_handler =
+      habitat.phenotypic_target_handler_nonconst();
+  #endif
+
+  // Move the gaussian list from the parameters to the phen target handler
+  #ifndef __REGUL  
+  phenotypic_target_handler.set_gaussians(std_env_gaussians);
+  #else
+  phenotypic_target_handler.set_gaussians(_env_gaussians_list);
+  phenotypic_target_handler.set_signals_models(_signals_models);
+  phenotypic_target_handler.set_signals(_env_signals_list);
+  #endif
+
+  // Copy the sampling
+  phenotypic_target_handler.set_sampling(env_sampling_);
+
+  // Set phenotypic target segmentation
+
+  if((env_axis_features_ != NULL) && (env_axis_segment_boundaries_ != NULL)) {
+    // if param.in contained a line starting with ENV_AXIS_FEATURES,
+    // we use the values indicated on this line
+    phenotypic_target_handler.set_segmentation(env_axis_nb_segments_,
+                                               env_axis_segment_boundaries_,
+                                               env_axis_features_,
+                                               env_axis_separate_segments_);
+  }
+  // else we leave the segmentation as it is by default
+  // (one "metabolic" segment from X_MIN to X_MAX)
+
+
+  // Set phenotypic target variation
+  if (env_var_method_ != NO_VAR)
+  {
+    phenotypic_target_handler.set_var_method(env_var_method_);
+    phenotypic_target_handler.set_var_prng(std::make_shared<JumpingMT>(env_var_seed_));
+    phenotypic_target_handler.set_var_sigma_tau(env_var_sigma_, env_var_tau_);
+#ifdef __REGUL
+    phenotypic_target_handler.set_switch_probability(_env_switch_probability);
+#endif
+  }
+
+  // Set phenotypic target noise
+  if (env_noise_method_ != NO_NOISE)
+  {
+    phenotypic_target_handler.set_noise_method(env_noise_method_);
+    phenotypic_target_handler.set_noise_sampling_log(env_noise_sampling_log_);
+    phenotypic_target_handler.set_noise_prng(std::make_shared<JumpingMT>(env_noise_seed_));
+    phenotypic_target_handler.set_noise_alpha(env_noise_alpha_);
+    phenotypic_target_handler.set_noise_sigma(env_noise_sigma_);
+    phenotypic_target_handler.set_noise_prob(env_noise_prob_);
+  }
+
+  // Build the phenotypic target
+  #ifndef __REGUL
+  phenotypic_target_handler.BuildPhenotypicTarget();
+  #else
+  phenotypic_target_handler.InitPhenotypicTargetsAndModels( _nb_indiv_age );
+  #endif
+
+  if (verbose) {
+    #ifndef __REGUL 
+    printf("Entire geometric area of the phenotypic target : %f\n",
+           phenotypic_target_handler.get_geometric_area());
+    #else
+    phenotypic_target_handler.print_geometric_areas();
+    #endif
+  }
+
+
+  // 3) --------------------------------------------- Create the new population
+  list<Individual *> indivs;
+  // Generate a model ae_mut_param object
+  auto param_mut = std::make_shared<MutationParams>();
+  param_mut->set_point_mutation_rate(point_mutation_rate_);
+  param_mut->set_small_insertion_rate(small_insertion_rate_);
+  param_mut->set_small_deletion_rate(small_deletion_rate_);
+  param_mut->set_max_indel_size(max_indel_size_);
+  param_mut->set_with_4pts_trans(with_4pts_trans_);
+  param_mut->set_with_alignments(with_alignments_);
+  param_mut->set_with_HT(with_HT_);
+  param_mut->set_repl_HT_with_close_points(repl_HT_with_close_points_);
+  param_mut->set_HT_ins_rate(HT_ins_rate_);
+  param_mut->set_HT_repl_rate(HT_repl_rate_);
+  param_mut->set_repl_HT_detach_rate(repl_HT_detach_rate_);
+  param_mut->set_duplication_rate(duplication_rate_);
+  param_mut->set_deletion_rate(deletion_rate_);
+  param_mut->set_translocation_rate(translocation_rate_);
+  param_mut->set_inversion_rate(inversion_rate_);
+  param_mut->set_neighbourhood_rate(neighbourhood_rate_);
+  param_mut->set_duplication_proportion(duplication_proportion_);
+  param_mut->set_deletion_proportion(deletion_proportion_);
+  param_mut->set_translocation_proportion(translocation_proportion_);
+  param_mut->set_inversion_proportion(inversion_proportion_);
+
+  Individual* indiv = nullptr;
+  int32_t id_new_indiv = 0;
+
+  if (chromosome != NULL) {
+    #ifndef __REGUL
+      Individual* indiv = new Individual(exp_m,
+                                         mut_prng,
+                                         stoch_prng,
+                                         param_mut,
+                                         w_max_,
+                                         min_genome_length_,
+                                         max_genome_length_,
+                                         allow_plasmids_,
+                                         id_new_indiv++,
+                                         strain_name_,
+                                         0);
+    #else
+      Individual_R* indiv = new Individual_R(exp_m,
+                                             mut_prng,
+                                             stoch_prng,
+                                             param_mut,
+                                             w_max_,
+                                             min_genome_length_,
+                                             max_genome_length_,
+                                             allow_plasmids_,
+                                             id_new_indiv++,
+                                             strain_name_,
+                                             0);
+    #endif
+
+    indiv->add_GU(chromosome, lchromosome);
+    indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_);
+    indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_);
+
+    if (plasmid != NULL) {
+      if (! allow_plasmids_) {
+        printf("ERROR: plasmid sequence provided but plasmids not allowed\n");
+        exit(EXIT_FAILURE);
+      }
+      indiv->add_GU(plasmid, lplasmid);
+      indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_);
+      indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_);
+    }
+    else if (allow_plasmids_) {
+      printf("ERROR: please provide both the chromosome and plasmid sequences"
+                 "or none of them\n");
+      exit(EXIT_FAILURE);
+    }
+
+    indiv->set_with_stochasticity(with_stochasticity_);
+    indiv->compute_statistical_data();
+    indiv->EvaluateInContext(habitat);
+    printf("Starting with a clonal population of individual with metabolic error %f and secretion error %f \n",indiv->dist_to_target_by_feature(METABOLISM),indiv->dist_to_target_by_feature(SECRETION));
+    indivs.push_back(indiv);
+
+    // Make the clones and add them to the list of individuals
+    for (int32_t i = 1 ; i < init_pop_size_ ; i++)
+    {
+      #ifndef __REGUL
+      Individual * clone = Individual::CreateClone(indiv, id_new_indiv++);
+      #else
+      Individual_R * clone = Individual_R::CreateClone(indiv, id_new_indiv++);
+      #endif
+      clone->EvaluateInContext(habitat);
+      indivs.push_back(clone);
+    }
+  }
+  else if (plasmid != NULL) {
+    printf("ERROR: please provide both the chromosome and plasmid sequences"
+               "or none of them\n");
+    exit(EXIT_FAILURE);
+  }
+  else if (init_method_ & ONE_GOOD_GENE) {
+    if (init_method_ & CLONE) {
+      // Create an individual with a "good" gene (in fact, make an indiv whose
+      // fitness is better than that corresponding to a flat phenotype)
+      // and set its id
+      indiv = IndividualFactory::create_random_individual(
+          exp_m,
+          id_new_indiv++,
+          param_mut,
+          mut_prng,
+          stoch_prng,
+          habitat,
+          w_max_,
+          min_genome_length_,
+          max_genome_length_,
+          chromosome_initial_length_,
+          allow_plasmids_,
+          plasmid_initial_gene_,
+          plasmid_initial_length_,
+          strain_name_,
+          prng_,
+          true);
+      indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_);
+      indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_);
+
+      if (allow_plasmids_)
+      {
+        indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_);
+        indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_);
+      }
+
+      indiv->set_with_stochasticity(with_stochasticity_);
+
+      // Add it to the list
+      indivs.push_back(indiv);
+
+      // Make the clones and add them to the list of individuals
+      for (int32_t i = 1 ; i < init_pop_size_ ; i++)
+      {
+        // Add new clone to the list
+        #ifndef __REGUL
+        Individual * clone = Individual::CreateClone(indiv, id_new_indiv++);
+        #else
+        Individual_R * clone = Individual_R::CreateClone(dynamic_cast<Individual_R*>(indiv), id_new_indiv++);
+        #endif
+        clone->EvaluateInContext(habitat);
+        indivs.push_back(clone);
+      }
+    }
+    else // if (! CLONE)
+    {
+      for (int32_t i = 0 ; i < init_pop_size_ ; i++)
+      {
+        // Create an individual and set its id
+        indiv = IndividualFactory::create_random_individual(
+            exp_m,
+            id_new_indiv++,
+            param_mut,
+            mut_prng,
+            stoch_prng,
+            habitat,
+            w_max_,
+            min_genome_length_,
+            max_genome_length_,
+            chromosome_initial_length_,
+            allow_plasmids_,
+            plasmid_initial_gene_,
+            plasmid_initial_length_,
+            strain_name_,
+            prng_,
+            true);
+        indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_);
+        indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_);
+        if (allow_plasmids_)
+        {
+          indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_);
+          indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_);
+        }
+
+        // Add it to the list
+        indivs.push_back(indiv);
+      }
+    }
+  }
+  else // if (! ONE_GOOD_GENE)
+  {
+    if (init_method_ & CLONE)
+    {
+      // Create a random individual and set its id
+      indiv = IndividualFactory::create_random_individual(
+          exp_m,
+          id_new_indiv++,
+          param_mut,
+          mut_prng,
+          stoch_prng,
+          habitat,
+          w_max_,
+          min_genome_length_,
+          max_genome_length_,
+          chromosome_initial_length_,
+          allow_plasmids_,
+          plasmid_initial_gene_,
+          plasmid_initial_length_,
+          strain_name_,
+          prng_,
+          false);
+      indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_);
+      indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_);
+      if (allow_plasmids_)
+      {
+        indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_);
+        indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_);
+      }
+
+      // Add it to the list
+      indivs.push_back(indiv);
+
+      // Make the clones and add them to the list of individuals
+      for (int32_t i = 1 ; i < init_pop_size_ ; i++)
+      {
+        // Add clone to the list
+        #ifndef __REGUL
+        Individual * clone = Individual::CreateClone(indiv, id_new_indiv++);
+        #else
+        Individual_R * clone = Individual_R::CreateClone(dynamic_cast<Individual_R*>(indiv), id_new_indiv++);
+        #endif
+        clone->EvaluateInContext(habitat);
+        indivs.push_back(clone);
+      }
+    }
+    else // if (! CLONE)
+    {
+      for (int32_t i = 0 ; i < init_pop_size_ ; i++)
+      {
+        // Create a random individual and set its id
+        indiv = IndividualFactory::create_random_individual(
+            exp_m,
+            id_new_indiv++,
+            param_mut,
+            mut_prng,
+            stoch_prng,
+            habitat,
+            w_max_,
+            min_genome_length_,
+            max_genome_length_,
+            chromosome_initial_length_,
+            allow_plasmids_,
+            plasmid_initial_gene_,
+            plasmid_initial_length_,
+            strain_name_,
+            prng_,
+            false);
+        indiv->genetic_unit_nonconst(0).set_min_gu_length(chromosome_minimal_length_);
+        indiv->genetic_unit_nonconst(0).set_max_gu_length(chromosome_maximal_length_);
+        if (allow_plasmids_)
+        {
+          indiv->genetic_unit_nonconst(1).set_min_gu_length(plasmid_minimal_length_);
+          indiv->genetic_unit_nonconst(1).set_max_gu_length(plasmid_maximal_length_);
+        }
+
+        // Add it to the list
+        indivs.push_back(indiv);
+      }
+    }
+  }
+
+  // -------------------------------------------------------- Spatial structure
+  exp_m->InitializeWorld(grid_width_, grid_height_,
+                         world_prng,mut_prng,stoch_prng,
+                         habitat,
+                         true);
+  World* world = exp_m->world();
+  world->set_secretion_degradation_prop(secretion_degradation_prop_);
+  world->set_secretion_diffusion_prop(secretion_diffusion_prop_);
+  world->set_is_well_mixed(well_mixed);
+  world->set_partial_mix_nb_permutations(partial_mix_nb_permutations);
+
+  // Set each individual's position on the grid
+  int16_t x, y;
+  int16_t x_max = exp_m->grid_width();
+  int16_t y_max = exp_m->grid_height();
+
+  for (const auto& indiv: indivs) {
+    do {
+      x = exp_m->world()->prng()->random(x_max);
+      y = exp_m->world()->prng()->random(y_max);
+    } while (world->indiv_at(x, y) != NULL);
+
+    world->PlaceIndiv(indiv, x, y);
+  }
+
+  world->set_best(0, 0);
+
+
+
+  // 4) ------------------------------------------ Set the recording parameters
+  output_m->set_backup_step(backup_step_);
+  output_m->set_big_backup_step(big_backup_step_);
+
+  if (record_tree_)
+  {
+    output_m->init_tree(exp_m, tree_step_);
+  }
+
+  if (make_dumps_)
+  {
+    output_m->set_dump_step(dump_step_);
+  }
+  output_m->set_logs(logs_);
+}
+
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+/*!
+  \brief Format a line by parsing it and the words inside
+
+  \param formated_line the resulted formated line
+  \param line original line in char*
+  \param line_is_interpretable boolean with about the possible intrepretation of the line
+*/
+void ParamLoader::format_line(ParameterLine * formated_line, char* line,
+                              bool* line_is_interpretable) {
+  int16_t i = 0;
+  int16_t j;
+
+  // Parse line
+  while (line[i] != '\n' && line[i] != '\0' && line[i] != '\r') {
+    j = 0;
+
+    // Flush white spaces and tabs
+    while (line[i] == ' ' || line[i] == kTabChar) i++;
+
+    // Check comments
+    if (line[i] == '#') break;
+
+    // If we got this far, there is content in the line
+    *line_is_interpretable = true;
+
+    // Parse word
+    while (line[i] != ' ' && line[i] != kTabChar && line[i] != '\n' &&
+        line[i] != '\0' && line[i] != '\r') {
+      formated_line->words[formated_line->nb_words][j++] = line[i++];
+    }
+
+    // Add '\0' at end of word if it's not empty (line ending with space or tab)
+    if (j != 0) {
+      formated_line->words[formated_line->nb_words++][j] = '\0';
+    }
+  }
+}
+
+/*!
+  \brief Get a line in a file and format it
+
+  \return line (pointer)
+
+  \see format_line(ParameterLine* formated_line, char* line, bool* line_is_interpretable)
+*/
+ParameterLine *ParamLoader::line(int32_t* cur_line_ptr) // void
+{
+  char line[255];
+  ParameterLine * formated_line = new ParameterLine();
+
+  bool found_interpretable_line = false; // Found line that is neither a comment nor empty
+
+  while (!feof(param_file_) && !found_interpretable_line)
+  {
+    if (!fgets(line, 255, param_file_))
+    {
+      delete formated_line;
+      return NULL;
+    }
+    (*cur_line_ptr)++;
+    format_line(formated_line, line, &found_interpretable_line);
+  }
+
+  if (found_interpretable_line)
+  {
+    return formated_line;
+  }
+  else
+  {
+    delete formated_line;
+    return NULL;
+  }
+}
+
+void ParamLoader::print_to_file(FILE* file)
+{
+  // ------------------------------------------------------------ Constraints
+  fprintf(file, "\nConstraints ---------------------------------------------\n");
+  fprintf(file, "min_genome_length :          %" PRId32 "\n", min_genome_length_);
+  fprintf(file, "max_genome_length :          %" PRId32 "\n", max_genome_length_);
+  fprintf(file, "W_MAX :                      %f\n",        w_max_);
+
+  // --------------------------------------------------------- Mutation rates
+  fprintf(file, "\nMutation rates ------------------------------------------\n");
+  fprintf(file, "point_mutation_rate :        %e\n",  point_mutation_rate_);
+  fprintf(file, "small_insertion_rate :       %e\n",  small_insertion_rate_);
+  fprintf(file, "small_deletion_rate :        %e\n",  small_deletion_rate_);
+  fprintf(file, "max_indel_size :             %" PRId16 "\n", max_indel_size_);
+
+  // -------------------------------------------- Rearrangements and Transfer
+  fprintf(file, "\nRearrangements and Transfer -----------------------------\n");
+  fprintf(file, "with_4pts_trans :            %s\n",  with_4pts_trans_? "true" : "false");
+  fprintf(file, "with_alignments :            %s\n",  with_alignments_? "true" : "false");
+  fprintf(file, "with_HT :                    %s\n",  with_HT_? "true" : "false");
+  fprintf(file, "repl_HT_with_close_points :  %s\n",  repl_HT_with_close_points_? "true" : "false");
+  fprintf(file, "HT_ins_rate :                %e\n",  HT_ins_rate_);
+  fprintf(file, "HT_repl_rate :               %e\n",  HT_repl_rate_);
+
+  // ---------------------------------------------------- Rearrangement rates
+  if (with_alignments_)
+  {
+    fprintf(file, "\nRearrangement rates (with alignements) ------------------\n");
+    fprintf(file, "neighbourhood_rate :         %e\n",  neighbourhood_rate_);
+    fprintf(file, "duplication_proportion :     %e\n",  duplication_proportion_);
+    fprintf(file, "deletion_proportion :        %e\n",  deletion_proportion_);
+    fprintf(file, "translocation_proportion :   %e\n",  translocation_proportion_);
+    fprintf(file, "inversion_proportion :       %e\n",  inversion_proportion_);
+  }
+  else
+  {
+    fprintf(file, "\nRearrangement rates (without alignements) ----------------\n");
+    fprintf(file, "duplication_rate :           %e\n",  duplication_rate_);
+    fprintf(file, "deletion_rate :              %e\n",  deletion_rate_);
+    fprintf(file, "translocation_rate :         %e\n",  translocation_rate_);
+    fprintf(file, "inversion_rate :             %e\n",  inversion_rate_);
+  }
+
+  // ------------------------------------------------------------ Alignements
+  fprintf(file, "\nAlignements ---------------------------------------------\n");
+  fprintf(file, "align_fun_shape :            %" PRId16 "\n", (int16_t) align_fun_shape_);
+  fprintf(file, "align_sigm_lambda :          %f\n",        align_sigm_lambda_);
+  fprintf(file, "align_sigm_mean :            %" PRId16 "\n", align_sigm_mean_);
+  fprintf(file, "align_lin_min :              %" PRId16 "\n", align_lin_min_);
+  fprintf(file, "align_lin_max :              %" PRId16 "\n", align_lin_max_);
+  fprintf(file, "align_max_shift :            %" PRId16 "\n", align_max_shift_);
+  fprintf(file, "align_w_zone_h_len :         %" PRId16 "\n", align_w_zone_h_len_);
+  fprintf(file, "align_match_bonus :          %" PRId16 "\n", align_match_bonus_);
+  fprintf(file, "align_mismatch_cost :        %" PRId16 "\n", align_mismatch_cost_);
+
+  // -------------------------------------------------------------- Selection
+  fprintf(file, "\nSelection -----------------------------------------------\n");
+  switch (selection_scheme_)
+  {
+    case RANK_LINEAR :
+    {
+      fprintf(file, "selection_scheme :           RANK_LINEAR\n");
+      break;
+    }
+    case RANK_EXPONENTIAL :
+    {
+      fprintf(file, "selection_scheme :           RANK_EXPONENTIAL\n");
+      break;
+    }
+    case FITNESS_PROPORTIONATE :
+    {
+      fprintf(file, "selection_scheme :           FITNESS_PROPORTIONATE\n");
+      break;
+    }
+    case FITTEST :
+    {
+      fprintf(file, "selection_scheme :           FITTEST\n");
+      break;
+    }
+    default :
+    {
+      fprintf(file, "selection_scheme :           UNKNOWN\n");
+      break;
+    }
+  }
+  fprintf(file, "selection_pressure :         %e\n",  selection_pressure_);
+
+
+  // -------------------------------------------------------------- Secretion
+  fprintf(file, "\nSecretion -----------------------------------------------\n");
+  fprintf(file, "with_secretion :                %s\n", with_secretion_? "true" : "false");
+  fprintf(file, "secretion_contrib_to_fitness :  %e\n", secretion_contrib_to_fitness_);
+  fprintf(file, "secretion_diffusion_prop :      %e\n", secretion_diffusion_prop_);
+  fprintf(file, "secretion_degradation_prop :    %e\n", secretion_degradation_prop_);
+  fprintf(file, "secretion_cost :                %e\n", secretion_cost_);
+
+  // --------------------------------------------------------------- Plasmids
+  fprintf(file, "\nPlasmids ------------------------------------------------\n");
+  fprintf(file, "allow_plasmids :             %s\n", allow_plasmids_? "true" : "false");
+  fprintf(file, "plasmid_minimal_length :     %" PRId32 "\n", plasmid_minimal_length_);
+  fprintf(file, "plasmid_maximal_length :     %" PRId32 "\n", plasmid_maximal_length_);
+  fprintf(file, "chromosome_minimal_length :  %" PRId32 "\n", chromosome_minimal_length_);
+  fprintf(file, "chromosome_maximal_length :  %" PRId32 "\n", chromosome_maximal_length_);
+  fprintf(file, "prob_plasmid_HT :            %e\n", prob_plasmid_HT_);
+  fprintf(file, "tune_donor_ability :         %e\n", tune_donor_ability_);
+  fprintf(file, "tune_recipient_ability :     %e\n", tune_recipient_ability_);
+  fprintf(file, "donor_cost :                 %e\n", donor_cost_);
+  fprintf(file, "recipient_cost :             %e\n", recipient_cost_);
+  fprintf(file, "compute_phen_contrib_by_GU : %s\n", compute_phen_contrib_by_GU_? "true" : "false");
+  fprintf(file, "swap_GUs :                   %s\n",  swap_GUs_? "true" : "false");
+
+  // ------------------------------------------------------- Translation cost
+  fprintf(file, "\nTranslation cost ----------------------------------------\n");
+  fprintf(file, "translation_cost :           %e\n",  translation_cost_);
+}
+
+} // namespace aevol
diff --git a/src/libaevol/ParamLoader.h b/src/libaevol/ParamLoader.h
new file mode 100644
index 0000000..4d5c939
--- /dev/null
+++ b/src/libaevol/ParamLoader.h
@@ -0,0 +1,321 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_PARAM_LOADER_H_
+#define AEVOL_PARAM_LOADER_H_
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <list>
+#include <vector>
+#include <set>
+#include <memory>
+
+#include <zlib.h>
+
+#include "ParameterLine.h"
+#include "MutationParams.h"
+#include "JumpingMT.h"
+#include "macros.h"
+#include "ae_enums.h"
+#include "Gaussian.h"
+#include "Point.h"
+#include "Habitat.h"
+#ifdef __REGUL
+#include "raevol/Protein_R.h"
+#endif
+
+namespace aevol {
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+class Individual;
+
+
+class ParamLoader {
+ public :
+  // =========================================================================
+  //                          Constructors & Destructor
+  // =========================================================================
+    ParamLoader() = delete; //< Default ctor
+    ParamLoader(const ParamLoader&) = delete; //< Copy ctor
+    ParamLoader(ParamLoader&&) = delete; //< Move ctor
+    ParamLoader(const char* file_name);
+    virtual ~ParamLoader(); //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  ParamLoader& operator=(const ParamLoader& other) = delete;
+  /// Move assignment
+  ParamLoader& operator=(ParamLoader&& other) = delete;
+
+  // =========================================================================
+  //                             Public Methods
+  // =========================================================================
+  void load(ExpManager * exp_m, bool verbose = false,
+            char* chromosome = nullptr, int32_t lchromosome = 0,
+            char* plasmid = nullptr, int32_t lplasmid = 0);
+  void print_to_file(FILE* file);
+
+  // =========================================================================
+  //                                  Getters
+  // =========================================================================
+
+  // =========================================================================
+  //                                  Setters
+  // =========================================================================
+
+  ParameterLine * get_line( int32_t* );
+
+ protected :
+  // =========================================================================
+  //                            Protected Methods
+  // =========================================================================
+  void CheckConsistency();
+  void read_file();
+  ParameterLine* line(int32_t*);
+  static void format_line(ParameterLine *, char*, bool*);
+  void interpret_line(ParameterLine * line, int32_t cur_line);
+
+  // =========================================================================
+  //                               Attributes
+  // =========================================================================
+  std::shared_ptr<JumpingMT> prng_;
+
+  char*   param_file_name_;
+  FILE*   param_file_;
+
+  // ----------------------------------------- PseudoRandom Number Generators
+  // Seed for the selection random generator
+  int32_t seed_;
+  // Seed for the mutations random generator
+  int32_t mut_seed_;
+  // Seed for the stochasticity random generator
+  int32_t stoch_seed_;
+  // Seed for the phenotypic target variation random generator
+  int32_t env_var_seed_;
+  // Seed for the phenotypic target noise random generator
+  int32_t env_noise_seed_;
+
+  // ------------------------------------------------------------ Constraints
+  int32_t min_genome_length_;
+  int32_t max_genome_length_;
+  double  w_max_;
+
+  // ----------------------------------------------------- Initial conditions
+  int32_t  chromosome_initial_length_;
+  int8_t   init_method_;
+  int32_t  init_pop_size_;
+  char*    strain_name_;
+
+  // -------------------------------------------------------- Phenotypic target
+  std::list<Gaussian> std_env_gaussians;
+  int16_t  env_sampling_;
+
+  // ------------------------------------ Phenotypic target x-axis segmentation
+  /// Number of x-axis segments
+  int16_t env_axis_nb_segments_;
+  /// x-axis segment boundaries (sorted -- including MIN_X and MAX_X)
+  double* env_axis_segment_boundaries_;
+  /// x-axis segment features
+  PhenotypicFeature * env_axis_features_;
+  /// Whether to automatically separate segments
+  bool env_axis_separate_segments_;
+
+  // ---------------------------------------------- Phenotypic target variation
+  PhenotypicTargetVariationMethod env_var_method_;
+  double      env_var_sigma_;
+  int32_t     env_var_tau_;
+
+  // -------------------------------------------------- Phenotypic target noise
+  PhenotypicTargetNoiseMethod env_noise_method_;   // Method... TODO
+  double  env_noise_alpha_;         // Alpha value (variance coefficient)
+  double  env_noise_sigma_;         // Variance of the noise
+  double  env_noise_prob_;          // Probability of variation.
+  int32_t env_noise_sampling_log_;  // Log2 of the number of points in the noise fuzzy_set
+
+  // --------------------------------------------------------- Mutation rates
+  double  point_mutation_rate_;
+  double  small_insertion_rate_;
+  double  small_deletion_rate_;
+  int16_t max_indel_size_;
+
+  // -------------------------------------------- Rearrangements and Transfer
+  bool    with_4pts_trans_;
+  bool    with_alignments_;
+  bool    with_HT_;
+  bool    repl_HT_with_close_points_;
+  double  HT_ins_rate_;
+  double  HT_repl_rate_;
+  double  repl_HT_detach_rate_;
+
+  // ------------------------------ Rearrangement rates (without alignements)
+  double duplication_rate_;
+  double deletion_rate_;
+  double translocation_rate_;
+  double inversion_rate_;
+
+  // --------------------------------- Rearrangement rates (with alignements)
+  double neighbourhood_rate_;
+  double duplication_proportion_;
+  double deletion_proportion_;
+  double translocation_proportion_;
+  double inversion_proportion_;
+
+  // ------------------------------------------------------------ Alignements
+  AlignmentFunctionShape align_fun_shape_;
+  double  align_sigm_lambda_;
+  int16_t align_sigm_mean_;
+  int16_t align_lin_min_;
+  int16_t align_lin_max_;
+
+  int16_t align_max_shift_;     // Maximum shift of one seq on the other
+  int16_t align_w_zone_h_len_;  // Work zone half length
+  int16_t align_match_bonus_;   // Corresponding residues match bonus
+  int16_t align_mismatch_cost_; // Corresponding residues mismatch cost
+
+  // ----------------------------------------------- Phenotypic Stochasticity
+  bool with_stochasticity_;
+
+  // -------------------------------------------------------------- Selection
+  SelectionScheme selection_scheme_;
+  double               selection_pressure_;
+
+  // ------------------------------------------------------ Spatial structure
+  int16_t grid_width_  = 32;
+  int16_t grid_height_ = 32;
+  bool    well_mixed = false;
+  int32_t partial_mix_nb_permutations = 0;
+
+  // -------------------------------------------------------------- Secretion
+  bool   with_secretion_;
+  // Proportion of the fitness contributed by secretion
+  double secretion_contrib_to_fitness_;      // (0,1)
+  // Proportion that diffuses into each cell, every generation
+  // (0 for no diffusion)
+  double secretion_diffusion_prop_;
+  // Proportion of secreted substance that degrades every generation
+  double secretion_degradation_prop_;
+  // Cost of secreting the compound, as a proportion of the amount secreted
+  double secretion_cost_;
+  // Starting configuration of secretion grid
+  // 0, all are 0; 1, point source of secreted compund
+  double secretion_init_;
+
+  // --------------------------------------------------------------- Plasmids
+  bool      allow_plasmids_;
+  int32_t   plasmid_initial_length_;
+  int32_t   plasmid_initial_gene_;
+  int32_t   plasmid_minimal_length_;
+  int32_t   plasmid_maximal_length_;
+  int32_t   chromosome_minimal_length_;
+  int32_t   chromosome_maximal_length_;
+  double    prob_plasmid_HT_;
+  double    tune_donor_ability_;
+  double    tune_recipient_ability_;
+  double    donor_cost_;
+  double    recipient_cost_;
+  bool      compute_phen_contrib_by_GU_;
+  bool      swap_GUs_;
+
+  // ------------------------------------------------------- Translation cost
+  double translation_cost_;
+
+  // ---------------------------------------------------------------- Outputs
+  // Stats
+  int8_t stats_;
+  // Whether to delete the existing statistics file
+  // (otherwise kept with the suffix ".old")
+  bool delete_old_stats_;
+
+  // Backups
+  int32_t backup_step_;
+  int32_t big_backup_step_;
+
+  // Tree
+  bool record_tree_;
+  int32_t tree_step_;
+
+  // Dumps // TODO : explain
+  bool    make_dumps_;
+  int32_t dump_step_;
+
+  // Logs
+  int8_t logs_;
+
+  // Fuzzy set flavor
+  int _fuzzy_flavor;
+
+  // Other
+  bool more_stats_;  // TODO : explain
+
+  #ifdef __REGUL
+    // Regulation factors
+    double  _hill_shape_n;
+    double  _hill_shape_theta;
+    double  _hill_shape;
+
+    // Degradation equation
+    double  _degradation_rate;
+    int     _nb_degradation_step;
+
+    // Individual life
+    int     _nb_indiv_age;
+
+    // List of evaluation step
+    std::set<int>  _list_eval_step;
+
+    // Binding matrix
+    double _binding_zeros_percentage;
+    bool   _random_binding_matrix;
+
+    // Heredity
+    bool    _with_heredity;
+    double  _protein_presence_limit;
+
+    //Specific variatio method
+    double _env_switch_probability;
+    std::vector<std::list<Gaussian>> _env_gaussians_list;
+    std::vector<std::list<int8_t>> _env_signals_list;
+    std::vector<Protein_R*> _signals_models;
+  #endif
+
+  bool first_regul_;
+};
+
+} // namespace aevol
+#endif // AEVOL_PARAM_LOADER_H_
diff --git a/src/libaevol/f_line.cpp b/src/libaevol/ParameterLine.cpp
similarity index 91%
copy from src/libaevol/f_line.cpp
copy to src/libaevol/ParameterLine.cpp
index 710c0a4..b1d0685 100644
--- a/src/libaevol/f_line.cpp
+++ b/src/libaevol/ParameterLine.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -37,7 +37,9 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <f_line.h>
+#include "ParameterLine.h"
+
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
@@ -46,7 +48,7 @@
 
 //##############################################################################
 //                                                                             #
-//                             Class f_line                                    #
+//                             Class ParameterLine                                    #
 //                                                                             #
 //##############################################################################
 
@@ -57,7 +59,7 @@
 // =================================================================
 
 
-f_line::f_line( void )
+ParameterLine::ParameterLine()
 {
   nb_words = 0;
 }
@@ -74,3 +76,4 @@ f_line::f_line( void )
 // =================================================================
 //                           Protected Methods
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/f_line.h b/src/libaevol/ParameterLine.h
similarity index 93%
rename from src/libaevol/f_line.h
rename to src/libaevol/ParameterLine.h
index 9daf7a7..f2d032c 100644
--- a/src/libaevol/f_line.h
+++ b/src/libaevol/ParameterLine.h
@@ -3,30 +3,30 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
-#ifndef __F_LINE_H__
-#define __F_LINE_H__
+#ifndef AEVOL_PARAMETER_LINE_H_
+#define AEVOL_PARAMETER_LINE_H_
 
 
 // =================================================================
@@ -35,6 +35,8 @@
 #include <inttypes.h>
 #include <stdio.h>
 
+namespace aevol {
+
 // =================================================================
 //                            Project Files
 // =================================================================
@@ -44,19 +46,19 @@
 //                          Class declarations
 // =================================================================
 
-class f_line
+class ParameterLine
 {
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    f_line( void );
-    
+    ParameterLine();
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    
+
     // =================================================================
     //                              Accessors
     // =================================================================
@@ -64,11 +66,11 @@ class f_line
     // =================================================================
     //                            Public Methods
     // =================================================================
-    
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-    
+
     int16_t nb_words;
     char    words[50][255];
 
@@ -77,11 +79,11 @@ class f_line
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    
+
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
@@ -96,4 +98,6 @@ class f_line
 //                       Inline functions' definition
 // =====================================================================
 
-#endif // __f_line_H__
+} // namespace aevol
+
+#endif // AEVOL_PARAMETER_LINE_H_
diff --git a/src/libaevol/ae_utils.h b/src/libaevol/Phenotype.h
similarity index 52%
rename from src/libaevol/ae_utils.h
rename to src/libaevol/Phenotype.h
index 6db3528..aabc8c3 100644
--- a/src/libaevol/ae_utils.h
+++ b/src/libaevol/Phenotype.h
@@ -3,100 +3,49 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
-#ifndef __AE_UTILS_H__
-#define __AE_UTILS_H__
+#ifndef AEVOL_PHENOTYPE_H_
+#define AEVOL_PHENOTYPE_H_
 
 
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
-#include <assert.h>
+#include <cinttypes>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
+#include "AbstractFuzzy.h"
 
+namespace aevol {
 
+// A phenotype is nothing more than a fuzzy set
+using Phenotype = AbstractFuzzy;
 
+} // namespace aevol
 
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_utils
-{
-  public :
-    static inline int32_t mod( int32_t a, int32_t b );
-    static inline int32_t min( int32_t a, int32_t b );
-    static inline int32_t max( int32_t a, int32_t b );
-    static inline void    exchange( int32_t &a, int32_t &b );
-    static inline int16_t hamming( const char* str1, const char* str2 );
-
-  protected :
-    ae_utils( const ae_utils &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  
-};
-
-
-inline int32_t ae_utils::mod( int32_t a, int32_t b )
-{
-  assert( b > 0 );
-  
-  while ( a < 0 )  a += b;
-  while ( a >= b ) a -= b;
-  
-  return a;
-}
-
-inline int32_t ae_utils::min( int32_t a, int32_t b )
-{
-  return ((a < b)? a : b);
-}
-
-inline int32_t ae_utils::max( int32_t a, int32_t b )
-{
-  return ((a > b)? a : b);
-}
-
-inline void ae_utils::exchange( int32_t &a, int32_t &b )
-{
-  int32_t tmp = a;
-  a = b;
-  b = tmp;
-}
-
-#endif // __AE_UTILS_H__
+#endif // AEVOL_PHENOTYPE_H_
diff --git a/src/libaevol/ae_point_1d.h b/src/libaevol/PhenotypicSegment.h
similarity index 68%
rename from src/libaevol/ae_point_1d.h
rename to src/libaevol/PhenotypicSegment.h
index 2851fc9..26d909a 100644
--- a/src/libaevol/ae_point_1d.h
+++ b/src/libaevol/PhenotypicSegment.h
@@ -3,45 +3,45 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_POINT_1D_H__
-#define __AE_POINT_1D_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
 
 
+#ifndef AEVOL_PHENOTYPIC_SEGMENT_H_
+#define AEVOL_PHENOTYPIC_SEGMENT_H_
+
 
 // =================================================================
-//                            Project Files
+//                              Includes
 // =================================================================
+#include <cinttypes>
+
+#include <zlib.h>
 
+#include "macros.h"
+#include "ae_enums.h"
 
 
+namespace aevol {
+
 
 // =================================================================
 //                          Class declarations
@@ -51,63 +51,50 @@
 
 
 
- 
-class ae_point_1d : public ae_object
-{  
+
+class PhenotypicSegment
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    inline ae_point_1d( void );
-    inline ae_point_1d( double x );
-    inline ae_point_1d( const ae_point_1d& source );
-    inline ae_point_1d( gzFile backup_file );
-  
+    PhenotypicSegment() = delete;
+    inline PhenotypicSegment(double start, double stop, PhenotypicFeature feature);
+    inline PhenotypicSegment(const PhenotypicSegment & source);
+    inline PhenotypicSegment(gzFile backup_file);
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    inline virtual ~ae_point_1d( void );
-  
+    inline virtual ~PhenotypicSegment();
+
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+
     // =================================================================
     //                            Public Methods
     // =================================================================
-    inline void save( gzFile backup_file );
-  
+    inline void save(gzFile backup_file) const;
+    inline void load(gzFile backup_file);
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-    double x;
-  
-  
-  
-  
-  
+    double start;
+    double stop;
+    PhenotypicFeature feature;
+
+
+
+
+
   protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    //~ ae_point_1d( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    /*    ae_point_1d( const ae_point_1d &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      };*/
-
-  
     // =================================================================
     //                           Protected Methods
     // =================================================================
-  
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
@@ -118,41 +105,43 @@ class ae_point_1d : public ae_object
 
 //##############################################################################
 //                                                                             #
-//                              Class ae_point_1d                              #
+//                             Class PhenotypicSegment                            #
 //                                                                             #
 //##############################################################################
 
 // =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
 //                             Constructors
 // =================================================================
-inline ae_point_1d::ae_point_1d( void )
-{
-  x = -1;
-}
+//~ inline PhenotypicSegment::PhenotypicSegment()
+//~ {
+  //~ start   = X_MIN;
+  //~ stop    = X_MAX;
+  //~ feature = NEUTRAL;
+//~ }
 
-inline ae_point_1d::ae_point_1d( double x )
+inline PhenotypicSegment::PhenotypicSegment(double start, double stop, PhenotypicFeature feature)
 {
-  this->x = x;
+  this->start   = start;
+  this->stop    = stop;
+  this->feature = feature;
 }
 
-inline ae_point_1d::ae_point_1d( const ae_point_1d& source )
+inline PhenotypicSegment::PhenotypicSegment(const PhenotypicSegment & source)
 {
-  this->x = source.x;
+  this->start   = source.start;
+  this->stop    = source.stop;
+  this->feature = source.feature;
 }
 
-inline ae_point_1d::ae_point_1d( gzFile backup_file )
+inline PhenotypicSegment::PhenotypicSegment(gzFile backup_file)
 {
-  gzread( backup_file, &x, sizeof(x) );
+  load(backup_file);
 }
 
 // =================================================================
 //                             Destructors
 // =================================================================
-inline ae_point_1d::~ae_point_1d( void )
+inline PhenotypicSegment::~PhenotypicSegment()
 {
 }
 
@@ -163,9 +152,21 @@ inline ae_point_1d::~ae_point_1d( void )
 // =================================================================
 //                            Public Methods
 // =================================================================
-inline void ae_point_1d::save( gzFile backup_file )
+inline void PhenotypicSegment::save(gzFile backup_file) const
 {
-  gzwrite( backup_file, &x, sizeof(x) );
+  gzwrite(backup_file, &start, sizeof(start));
+  gzwrite(backup_file, &stop,  sizeof(stop));
+  int8_t tmp_feature = feature;
+  gzwrite(backup_file, &tmp_feature, sizeof(tmp_feature));
+}
+
+inline void PhenotypicSegment::load(gzFile backup_file)
+{
+  gzread(backup_file, &start,  sizeof(start));
+  gzread(backup_file, &stop,   sizeof(stop));
+  int8_t tmp_feature;
+  gzread(backup_file, &tmp_feature, sizeof(tmp_feature));
+  feature = (PhenotypicFeature) tmp_feature;
 }
 
 // =================================================================
@@ -173,5 +174,5 @@ inline void ae_point_1d::save( gzFile backup_file )
 // =================================================================
 
 
-
-#endif // __AE_POINT_1D_H__
+} // namespace aevol
+#endif // AEVOL_PHENOTYPIC_SEGMENT_H_
diff --git a/src/libaevol/PhenotypicTarget.cpp b/src/libaevol/PhenotypicTarget.cpp
new file mode 100644
index 0000000..8eecba4
--- /dev/null
+++ b/src/libaevol/PhenotypicTarget.cpp
@@ -0,0 +1,148 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "PhenotypicTarget.h"
+#include "FuzzyFactory.h"
+
+#include <cstring>
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                           Class PhenotypicTarget                            #
+//                                                                             #
+//##############################################################################
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+PhenotypicTarget::PhenotypicTarget() {
+  fuzzy_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  nb_segments_     = 1;
+  segments_        = new PhenotypicSegment * [1];
+  segments_[0]     = new PhenotypicSegment(X_MIN, X_MAX, METABOLISM);
+  area_by_feature_ = new double [NB_FEATURES];
+}
+
+PhenotypicTarget::PhenotypicTarget(const PhenotypicTarget& rhs) {
+  fuzzy_ = FuzzyFactory::fuzzyFactory->create_fuzzy(*(rhs.fuzzy()));
+  nb_segments_     = rhs.nb_segments_;
+  segments_        = new PhenotypicSegment * [nb_segments_];
+  for (int8_t i = 0 ; i < nb_segments_ ; i++)
+    segments_[i] = new PhenotypicSegment(*(rhs.segments_[i]));
+  area_by_feature_ = new double [NB_FEATURES];
+  memcpy(area_by_feature_,
+         rhs.area_by_feature_,
+         NB_FEATURES * sizeof(*area_by_feature_));
+}
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+PhenotypicTarget::~PhenotypicTarget() {
+  if (segments_ != NULL) {
+    for (int8_t i = 0 ; i < nb_segments_ ; i++)
+      delete segments_[i];
+    delete [] segments_;
+  }
+  delete [] area_by_feature_;
+  delete fuzzy_;
+}
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void PhenotypicTarget::set_segmentation(int8_t nb_segments,
+                                        double *boundaries,
+                                        PhenotypicFeature *features,
+                                        bool separate_segments) {
+  // Delete the data to be replaced
+  for (int8_t i = 0 ; i < nb_segments_ ; i++)
+    delete segments_[i];
+  delete[] segments_;
+
+  // Now replace with the new data
+  nb_segments_  = nb_segments;
+  segments_     = new PhenotypicSegment * [nb_segments_];
+
+  for (int8_t i = 0 ; i < nb_segments_; i++)
+    segments_[i] = new PhenotypicSegment(boundaries[i], boundaries[i+1], features[i]);
+
+  // TODO <dpa>: Manage separate_segments
+}
+
+void PhenotypicTarget::ComputeArea() {
+  for (int8_t i = 0 ; i < NB_FEATURES ; i++)
+    area_by_feature_[i] = 0.0;
+
+  // TODO <dpa>: We should take into account that we compute the areas in a specific order (from the leftmost segment, rightwards)
+  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have
+  //      already been through them!)
+  for (int8_t i = 0 ; i < nb_segments_ ; i++) {
+    area_by_feature_[segments_[i]->feature] +=
+      fuzzy_->get_geometric_area(segments_[i]->start, segments_[i]->stop);
+  }
+}
+
+void PhenotypicTarget::SaveSegmentation(gzFile backup_file) const {
+  // --------------------------------------------------------------------------
+  //  Write x-axis segmentation
+  gzwrite(backup_file, &nb_segments_, sizeof(nb_segments_));
+
+  for (int8_t i = 0 ; i < nb_segments_; i++) // TODO <david.parsons at inria.fr> suppress warning
+    segments_[i]->save(backup_file);
+}
+
+void PhenotypicTarget::LoadSegmentation(gzFile backup_file) {
+  // Delete obsolete segmentation data
+  for (int8_t i = 0 ; i < nb_segments_ ; i++)
+    delete segments_[i];
+  delete [] segments_;
+
+  // Replace by data from the backup
+  gzread(backup_file, &nb_segments_, sizeof(nb_segments_));
+  segments_ = new PhenotypicSegment * [nb_segments_];
+  for (int8_t i = 0 ; i < nb_segments_; i++)
+    segments_[i] = new PhenotypicSegment(backup_file);
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+} // namespace aevol
diff --git a/src/libaevol/PhenotypicTarget.h b/src/libaevol/PhenotypicTarget.h
new file mode 100644
index 0000000..03650fc
--- /dev/null
+++ b/src/libaevol/PhenotypicTarget.h
@@ -0,0 +1,152 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_PHENOTYPIC_TARGET_H_
+#define AEVOL_PHENOTYPIC_TARGET_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include "Fuzzy.h"
+#include "PhenotypicSegment.h"
+#include "ae_enums.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+
+
+class PhenotypicTarget
+{
+  friend class PhenotypicTargetHandler;
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  PhenotypicTarget(); //< Default ctor
+  PhenotypicTarget(const PhenotypicTarget&); //< Copy ctor
+  PhenotypicTarget(PhenotypicTarget&&) = delete; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~PhenotypicTarget(); //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void ComputeArea();
+
+  void SaveSegmentation(gzFile backup_file) const;
+  void LoadSegmentation(gzFile backup_file);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  double area_by_feature(int8_t feature) const {
+    return area_by_feature_[feature];
+  }
+  int8_t nb_segments() const {
+    return nb_segments_;
+  }
+  PhenotypicSegment ** segments() const {
+    return segments_;
+  }
+
+  AbstractFuzzy* fuzzy() const {
+    return fuzzy_;
+  }
+// ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+  void set_segmentation(int8_t nb_segments,
+                        double* boundaries,
+                        PhenotypicFeature * features,
+                        bool separate_segments);
+
+
+
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  /// Number segments.
+  int8_t nb_segments_;
+  /// Ordered array of segments.
+  /// Each PhenotypicSegment knows its boundaries and corresponding feature.
+  /// When the phenotypic target is not segmented, this array contains a single
+  /// segment with feature METABOLIC and boundaries MIN_X and MAX_X
+  PhenotypicSegment ** segments_;
+  /// Geometric area of each feature
+  double* area_by_feature_;
+
+  AbstractFuzzy* fuzzy_;
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_PHENOTYPIC_TARGET_H_
diff --git a/src/libaevol/PhenotypicTargetHandler.cpp b/src/libaevol/PhenotypicTargetHandler.cpp
new file mode 100644
index 0000000..ee4b347
--- /dev/null
+++ b/src/libaevol/PhenotypicTargetHandler.cpp
@@ -0,0 +1,395 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include "PhenotypicTargetHandler.h"
+#include "ExpSetup.h"
+#include "HybridFuzzy.h"
+#include "Utils.h"
+
+#include <iostream>
+
+
+using std::cout;
+using std::endl;
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                        Class PhenotypicTargetHandler                        #
+//                                                                             #
+//##############################################################################
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+PhenotypicTargetHandler::PhenotypicTargetHandler() {
+  // The phenotypic target
+#if __cplusplus == 201103L
+  phenotypic_target_ = make_unique<PhenotypicTarget>();
+#else
+  phenotypic_target_ = std::make_unique<PhenotypicTarget>();
+#endif
+
+  // Sampling
+  sampling_ = 0;
+
+  // Variation
+  var_prng_   = NULL;
+  var_method_ = NO_VAR;
+  var_sigma_  = 0.0;
+  var_tau_    = 0;
+
+  // Noise
+  cur_noise_          = NULL;
+  noise_method_       = NO_NOISE;
+  noise_prng_         = NULL;
+  noise_prob_         = 0.0;
+  noise_alpha_        = 0.0;
+  noise_sigma_        = 0.0;
+  noise_sampling_log_ = 8;
+}
+
+PhenotypicTargetHandler::PhenotypicTargetHandler(
+    const PhenotypicTargetHandler& rhs) {
+  // ------------------------------------------------ Current Phenotypic Target
+#if __cplusplus == 201103L
+  phenotypic_target_ = make_unique<PhenotypicTarget>(*(rhs.phenotypic_target_));
+#else
+  phenotypic_target_ = std::make_unique<PhenotypicTarget>(*(rhs.phenotypic_target_));
+#endif
+
+  // ---------------------------------------------------------------- Gaussians
+  initial_gaussians_ = rhs.initial_gaussians_;
+  current_gaussians_ = rhs.current_gaussians_;
+
+  // ----------------------------------------------------------------- Sampling
+  sampling_ = rhs.sampling_;
+
+  // ---------------------------------------------------------------- Variation
+  var_method_ = rhs.var_method_;
+  var_prng_ = rhs.var_prng_;
+  var_sigma_ = rhs.var_sigma_;
+  var_tau_ = rhs.var_tau_;
+
+  // -------------------------------------------------------------------- Noise
+  cur_noise_ = rhs.cur_noise_;
+  noise_prng_ = rhs.noise_prng_;
+  noise_method_ = rhs.noise_method_;
+  noise_alpha_ = rhs.noise_alpha_;
+  noise_sigma_ = rhs.noise_sigma_;
+  noise_prob_ = rhs.noise_prob_;
+  noise_sampling_log_ = rhs.noise_sampling_log_;
+}
+
+PhenotypicTargetHandler::PhenotypicTargetHandler(gzFile backup_file) {
+  load(backup_file);
+}
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+PhenotypicTargetHandler::~PhenotypicTargetHandler() {
+  delete cur_noise_;
+}
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void PhenotypicTargetHandler::BuildPhenotypicTarget() {
+  // NB : Extreme points (at abscissa X_MIN and X_MAX) will be generated, we need to erase the list first
+  phenotypic_target_->fuzzy()->reset();
+
+  // Generate sample points from gaussians
+  if (not current_gaussians_.empty()) {
+    for (int16_t i = 0; i <= sampling_; i++) {
+      Point new_point = Point(
+          X_MIN + (double) i * (X_MAX - X_MIN) / (double) sampling_, 0.0);
+      for (const Gaussian& g: current_gaussians_)
+        new_point.y += g.compute_y(new_point.x);
+      phenotypic_target_->fuzzy()->add_point(new_point.x, new_point.y);
+    }
+
+    if (FuzzyFactory::fuzzyFactory->get_fuzzy_flavor() == 1) {
+      HybridFuzzy* fuz = (HybridFuzzy*) phenotypic_target_->fuzzy();
+
+      for (int i = 1; i < fuz->get_pheno_size(); i++) {
+        if (fuz->points()[i] == 0.0) {
+          int minL = i - 1;
+          int maxL = i + 1;
+          int dist = 1;
+
+          while (fuz->points()[maxL] == 0.0) {
+            maxL++;
+            dist++;
+          }
+          double inc = 0.0;
+          if (fuz->points()[maxL] > fuz->points()[minL]) {
+            inc = (fuz->points()[maxL] - fuz->points()[minL]) / dist;
+          } else {
+            inc = (fuz->points()[minL] - fuz->points()[maxL]) / dist;
+            minL = maxL;
+          }
+
+          for (int j = i; j < maxL; j++) {
+            fuz->points()[j] = fuz->points()[minL] + inc;
+            inc += inc;
+          }
+
+        }
+      }
+    }
+  }
+
+
+  // Add lower and upper bounds
+  phenotypic_target_->fuzzy()->clip(AbstractFuzzy::min, Y_MIN);
+  phenotypic_target_->fuzzy()->clip(AbstractFuzzy::max, Y_MAX);
+
+  // Simplify (get rid of useless points)
+  phenotypic_target_->fuzzy()->simplify();
+
+  // Compute areas (total and by feature)
+  phenotypic_target_->ComputeArea();
+}
+
+void PhenotypicTargetHandler::ApplyVariation() {
+  switch (var_method_) {
+    case NO_VAR :
+      return;
+    case AUTOREGRESSIVE_MEAN_VAR :
+      ApplyAutoregressiveMeanVariation();
+      break;
+    case AUTOREGRESSIVE_HEIGHT_VAR :
+      ApplyAutoregressiveHeightVariation();
+      break;
+    default :
+      Utils::ExitWithDevMsg("Unknown variation method", __FILE__, __LINE__);
+  }
+
+  // Phenotypic target has changed, recompute its area
+  phenotypic_target_->ComputeArea();
+}
+
+void PhenotypicTargetHandler::ApplyAutoregressiveMeanVariation() {
+  // For each gaussian :
+  // current_mean = ref_mean + delta_m, where
+  // delta_m follows an autoregressive stochastic process
+  // with the parameters var_sigma_ and var_tau_
+  for (auto cur_gaussian = current_gaussians_.begin(),
+           initial_gaussian = initial_gaussians_.begin() ;
+       cur_gaussian != current_gaussians_.end() ;
+       cur_gaussian++, initial_gaussian++) {
+    // Find the current delta_mean = current_mean - ref_mean
+    double delta_mean = cur_gaussian->mean() - initial_gaussian->mean();
+
+    // Compute the next value :
+    // Dm(t+1) = Dm(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random()
+    Utils::ApplyAutoregressiveStochasticProcess(delta_mean,
+                                                var_sigma_,
+                                                var_tau_,
+                                                *var_prng_);
+
+    // Deduce the new value of the mean : ref_mean + delta_m
+    cur_gaussian->set_mean(initial_gaussian->mean() + delta_mean);
+  }
+
+  BuildPhenotypicTarget();
+}
+
+void PhenotypicTargetHandler::ApplyAutoregressiveHeightVariation() {
+  // For each gaussian :
+  // current_height = ref_height + delta_h, where
+  // delta_h follows an autoregressive stochastic process
+  // with the parameters var_sigma_ and var_tau_
+  for (auto cur_gaussian = current_gaussians_.begin(),
+           initial_gaussian = initial_gaussians_.begin() ;
+       cur_gaussian != current_gaussians_.end() ;
+       cur_gaussian++, initial_gaussian++) {
+    // Find the current delta_height = current_height - ref_height
+    double delta_height = cur_gaussian->height() -
+      initial_gaussian->height();
+
+    // Compute the next value :
+    // Dm(t+1) = Dm(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random()
+    Utils::ApplyAutoregressiveStochasticProcess(delta_height,
+                                                var_sigma_,
+                                                var_tau_,
+                                                *var_prng_);
+
+    // Deduce the new value of the height : ref_height + delta_h
+    cur_gaussian->set_height(initial_gaussian->height() + delta_height);
+  }
+
+  BuildPhenotypicTarget();
+}
+
+void PhenotypicTargetHandler::save(gzFile backup_file) const {
+  //printf("Appel a la sauvegarde de PhenotypicTargetHandler\n");
+  // --------------------------------------------------------------------------
+  //  Write phenotypic target segmentation
+  phenotypic_target_->SaveSegmentation(backup_file);
+
+  // --------------------------------------------------------------------------
+  //  Write current gaussians (initial gaussians will be stored later if
+  // necessary)
+  int8_t nb_gaussians = current_gaussians_.size();
+  gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+  for (const Gaussian & g: current_gaussians_)
+    g.save(backup_file);
+
+  // --------------------------------------------------------------------------
+  //  Write sampling
+  gzwrite(backup_file, &sampling_, sizeof(sampling_));
+
+  // --------------------------------------------------------------------------
+  //  Write variation data
+  int8_t tmp_var_method = var_method_;
+  gzwrite(backup_file, &tmp_var_method,  sizeof(tmp_var_method));
+
+  if (var_method_ != NO_VAR) {
+    var_prng_->save(backup_file);
+    gzwrite(backup_file, &var_sigma_, sizeof(var_sigma_));
+    gzwrite(backup_file, &var_tau_,   sizeof(var_tau_));
+  }
+
+  // --------------------------------------------------------------------------
+  //  Write noise data
+  int8_t tmp_noise_method = noise_method_;
+  gzwrite(backup_file, &tmp_noise_method, sizeof(tmp_noise_method));
+
+  if (noise_method_ != NO_NOISE) {
+    int8_t tmp_save_cur_noise = (cur_noise_ != NULL);
+    gzwrite(backup_file, &tmp_save_cur_noise,  sizeof(tmp_save_cur_noise));
+    if (tmp_save_cur_noise) cur_noise_->save(backup_file);
+
+    noise_prng_->save(backup_file);
+    gzwrite(backup_file, &noise_alpha_,  sizeof(noise_alpha_));
+    gzwrite(backup_file, &noise_sigma_,  sizeof(noise_sigma_));
+    gzwrite(backup_file, &noise_prob_,   sizeof(noise_prob_));
+    gzwrite(backup_file, &noise_sampling_log_, sizeof(noise_sampling_log_));
+  }
+
+  // ---------------------------------------------------------------
+  //  If needed, keep a copy of the initial state of the gaussians
+  // ---------------------------------------------------------------
+  if (var_method_ != NO_VAR || noise_method_ != NO_NOISE) {
+    size_t nb_gaussians = initial_gaussians_.size();
+    gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+    for (const Gaussian & g: initial_gaussians_)
+      g.save(backup_file);
+  }
+}
+
+void PhenotypicTargetHandler::load(gzFile backup_file) {
+  //printf("Appel au chargement de PhenotypicTargetHandler\n");
+  // --------------------------------------------------------------------------
+  //  Retrieve phenotypic target segmentation
+#if __cplusplus == 201103L
+  phenotypic_target_ = make_unique<PhenotypicTarget>();
+#else
+  phenotypic_target_ = std::make_unique<PhenotypicTarget>();
+#endif
+
+  phenotypic_target_->LoadSegmentation(backup_file);
+
+  // --------------------------------------------------------------------------
+  //  Retrieve current gaussians
+  int8_t nb_gaussians;
+  gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+  for (int8_t i = 0 ; i < nb_gaussians ; i++)
+    current_gaussians_.push_back(Gaussian(backup_file));
+
+  // --------------------------------------------------------------------------
+  //  Retrieve sampling
+  gzread(backup_file, &sampling_, sizeof(sampling_));
+
+  // --------------------------------------------------------------------------
+  //  Retrieve variation data
+  int8_t tmp_var_method;
+  gzread(backup_file, &tmp_var_method, sizeof(tmp_var_method));
+  var_method_ = (PhenotypicTargetVariationMethod) tmp_var_method;
+
+  if (var_method_ != NO_VAR) {
+    var_prng_ = std::make_shared<JumpingMT>(backup_file);
+    gzread(backup_file, &var_sigma_, sizeof(var_sigma_));
+    gzread(backup_file, &var_tau_, sizeof(var_tau_));
+  }
+
+  // --------------------------------------------------------------------------
+  //  Retrieve noise data
+  int8_t tmp_noise_method;
+  gzread(backup_file, &tmp_noise_method, sizeof(tmp_noise_method));
+  noise_method_ = (PhenotypicTargetNoiseMethod) tmp_noise_method;
+
+  if (noise_method_ != NO_NOISE) {
+    int8_t tmp_cur_noise_saved;
+    gzread(backup_file, &tmp_cur_noise_saved,  sizeof(tmp_cur_noise_saved));
+    if (tmp_cur_noise_saved)
+      cur_noise_ = FuzzyFactory::fuzzyFactory->create_fuzzy(backup_file);
+
+    noise_prng_ = std::make_shared<JumpingMT>(backup_file);
+    gzread(backup_file, &noise_alpha_, sizeof(noise_alpha_));
+    gzread(backup_file, &noise_sigma_, sizeof(noise_sigma_));
+    gzread(backup_file, &noise_prob_,  sizeof(noise_prob_));
+    gzread(backup_file, &noise_sampling_log_, sizeof(noise_sampling_log_));
+  }
+
+  // --------------------------------------------------------------------------
+  //  If needed, retrieve a copy of the initial state of the gaussians
+  if (var_method_ != NO_VAR || noise_method_ != NO_NOISE) {
+    size_t nb_gaussians;
+    gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+    for (size_t i = 0 ; i < nb_gaussians ; i++)
+      initial_gaussians_.emplace_back(backup_file);
+  }
+
+  // --------------------------------------------------------------------------
+  //  Build the phenotypic target
+  BuildPhenotypicTarget();
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/PhenotypicTargetHandler.h b/src/libaevol/PhenotypicTargetHandler.h
new file mode 100644
index 0000000..317c065
--- /dev/null
+++ b/src/libaevol/PhenotypicTargetHandler.h
@@ -0,0 +1,228 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_PHENOTYPIC_TARGET_HANDLER_H_
+#define AEVOL_PHENOTYPIC_TARGET_HANDLER_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
+#include <list>
+
+#include "PhenotypicTarget.h"
+#include "Gaussian.h"
+#include "ae_enums.h"
+#include "JumpingMT.h"
+#include "AbstractFuzzy.h"
+
+using std::list;
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+/**
+ * Manages a phenotypic target and its "evolution" over time
+ *
+ * Handles a phenotypic target, the variation and/or noise that may be applied
+ * to it as well as the set of possible phenotypic targets and the rules that
+ * define how and when we switch from one to another
+ */
+class PhenotypicTargetHandler
+{
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  PhenotypicTargetHandler(); //< Default ctor
+  PhenotypicTargetHandler(const PhenotypicTargetHandler&); //< Copy ctor
+  PhenotypicTargetHandler(PhenotypicTargetHandler&&) = delete; //< Move ctor
+  PhenotypicTargetHandler(gzFile backup_file);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~PhenotypicTargetHandler(); //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void BuildPhenotypicTarget();
+  virtual void ApplyVariation();
+
+  virtual void save(gzFile backup_file) const;
+  virtual void load(gzFile backup_file);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  const PhenotypicTarget& phenotypic_target() const {
+    return *phenotypic_target_;
+  }
+  double get_geometric_area() const {
+    return phenotypic_target_->fuzzy()->get_geometric_area();
+  }
+  double area_by_feature(int8_t feature) const {
+    return phenotypic_target_->area_by_feature(feature);
+  }
+  const list<Gaussian>& gaussians() const {
+    return initial_gaussians_;
+  }
+  const PhenotypicTargetVariationMethod& var_method() const {
+    return var_method_;
+  }
+
+  virtual double mean_environmental_area() const {
+    return phenotypic_target_->area_by_feature(METABOLISM);
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+  void set_gaussians(const list<Gaussian>& gaussians) {
+    current_gaussians_ = initial_gaussians_ = gaussians;
+  }
+  void set_sampling(int16_t val){
+    sampling_ = val;
+  }
+  virtual void set_segmentation(int8_t nb_segments,
+                        double* boundaries,
+                        PhenotypicFeature * features,
+                        bool separate_segments = false) {
+    phenotypic_target_->set_segmentation(nb_segments,
+                                         boundaries,
+                                         features,
+                                         separate_segments);
+  }
+  void set_var_method(PhenotypicTargetVariationMethod var_method) {
+    var_method_ = var_method;
+  }
+  void set_var_prng(std::shared_ptr<JumpingMT> prng) {
+    var_prng_ = prng;
+  }
+  void set_var_sigma(double sigma) {
+    var_sigma_ = sigma;
+  }
+  void set_var_tau(int32_t tau) {
+    var_tau_ = tau;
+  }
+  void set_var_sigma_tau(double sigma, int32_t tau) {
+    var_sigma_  = sigma;
+    var_tau_    = tau;
+  }
+  void set_noise_method(PhenotypicTargetNoiseMethod noise_method) {
+    noise_method_ = noise_method;
+  }
+  void set_noise_prng(std::shared_ptr<JumpingMT> prng) {
+    noise_prng_ = prng;
+  }
+  void set_noise_sigma(double sigma) {
+    noise_sigma_ = sigma;
+  }
+  void set_noise_alpha(double alpha) {
+    noise_alpha_ = alpha;
+  }
+  void set_noise_prob(double prob) {
+    noise_prob_ = prob;
+  }
+  void set_noise_sampling_log(int8_t sampling_log) {
+    noise_sampling_log_ = sampling_log;
+  }
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+  void ApplyAutoregressiveMeanVariation();
+  void ApplyAutoregressiveHeightVariation();
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  // ------------------------------------------------ Current Phenotypic Target
+  std::unique_ptr<PhenotypicTarget> phenotypic_target_;
+
+  // ---------------------------------------------------------------- Gaussians
+  /// Phenotypic target's constitutive Gaussians in their initial state
+  std::list<Gaussian> initial_gaussians_;
+    /// Phenotypic target's constitutive Gaussians in their current state
+  std::list<Gaussian> current_gaussians_;
+
+  // ----------------------------------------------------------------- Sampling
+  /// Number of points to be generated from the gaussians.
+  int16_t sampling_;
+
+  // ---------------------------------------------------------------- Variation
+  /// Variation method
+  PhenotypicTargetVariationMethod var_method_;
+  /// PRNG used for variation
+  std::shared_ptr<JumpingMT> var_prng_;
+  /// Autoregressive mean variation sigma parameter
+  double var_sigma_;
+  /// Autoregressive mean variation tau parameter
+  int16_t var_tau_;
+
+  // -------------------------------------------------------------------- Noise
+  /// Current noise (pure noise that is added to the phenotypic target)
+  AbstractFuzzy* cur_noise_ = NULL;
+  /// PRNG used for noise
+  std::shared_ptr<JumpingMT> noise_prng_;
+  PhenotypicTargetNoiseMethod noise_method_;
+  /// Alpha value (variance coefficient)
+  double noise_alpha_;
+  /// Variance of the noise
+  double noise_sigma_;
+  /// Probability of variation.
+  double noise_prob_;
+  /// Log2 of the number of points in the noise fuzzy_set
+  int8_t noise_sampling_log_;
+};
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_PHENOTYPIC_TARGET_HANDLER_H_
diff --git a/src/libaevol/ae_object.h b/src/libaevol/Point.cpp
similarity index 70%
copy from src/libaevol/ae_object.h
copy to src/libaevol/Point.cpp
index 9a0bf94..0298df5 100644
--- a/src/libaevol/ae_object.h
+++ b/src/libaevol/Point.cpp
@@ -3,50 +3,41 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
-#ifndef __AE_OBJECT_H__
-#define __AE_OBJECT_H__
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#include "Point.h"
 
+namespace aevol {
 
-class ae_object
-{
-  public :
-    ae_object( void ){};
-    virtual ~ae_object( void ){};
-    
-  protected :
-    ae_object( const ae_object &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      assert( false );
-      exit( EXIT_FAILURE );
-    };
+Point readpoint(gzFile backup_file) {
+  Point p;
+  gzread(backup_file, &p.x, sizeof(p.x));
+  gzread(backup_file, &p.y, sizeof(p.y));
+  return p;
+}
 
-};
+void writepoint(const Point& p, gzFile backup_file) {
+  gzwrite(backup_file, &p.x, sizeof(p.x));
+  gzwrite(backup_file, &p.y, sizeof(p.y));
+}
 
-#endif // __AE_OBJECT_H__
+} // namespace aevol
diff --git a/src/libaevol/ae_object.h b/src/libaevol/Point.h
similarity index 71%
copy from src/libaevol/ae_object.h
copy to src/libaevol/Point.h
index 9a0bf94..8ed229e 100644
--- a/src/libaevol/ae_object.h
+++ b/src/libaevol/Point.h
@@ -3,50 +3,45 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
-#ifndef __AE_OBJECT_H__
-#define __AE_OBJECT_H__
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#ifndef AEVOL_POINT_H_
+#define AEVOL_POINT_H_
 
+#include <zlib.h>
+#include <utility>
 
-class ae_object
-{
-  public :
-    ae_object( void ){};
-    virtual ~ae_object( void ){};
-    
-  protected :
-    ae_object( const ae_object &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      assert( false );
-      exit( EXIT_FAILURE );
-    };
+namespace aevol {
 
+struct Point {
+  double x;
+  double y;
+  Point(double x_, double y_): x(x_), y(y_) {};
+  Point() {};
+  Point(Point* p): x(p->x), y(p->y) {};
 };
 
-#endif // __AE_OBJECT_H__
+Point readpoint(const gzFile backup_file);
+void writepoint(const Point& p, gzFile backup_file);
+
+} // namespace aevol
+#endif // AEVOL_POINT_H_
diff --git a/src/libaevol/f_line.cpp b/src/libaevol/PointMutation.cpp
similarity index 60%
copy from src/libaevol/f_line.cpp
copy to src/libaevol/PointMutation.cpp
index 710c0a4..a021532 100644
--- a/src/libaevol/f_line.cpp
+++ b/src/libaevol/PointMutation.cpp
@@ -3,74 +3,69 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-
-// =================================================================
-//                          Class declarations
-// =================================================================
+//
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "PointMutation.h"
 
-//##############################################################################
-//                                                                             #
-//                             Class f_line                                    #
-//                                                                             #
-//##############################################################################
 
+namespace aevol {
 
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
-// =================================================================
-//                             Constructors
-// =================================================================
+// ============================================================================
+//                                Constructors
+// ============================================================================
+PointMutation::PointMutation(int32_t pos) : pos_(pos) {}
 
+// ============================================================================
+//                                 Destructor
+// ============================================================================
 
-f_line::f_line( void )
-{
-  nb_words = 0;
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void PointMutation::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = SWITCH;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos_, sizeof(pos_));
 }
 
+void PointMutation::load(gzFile backup_file) {
+  gzread(backup_file, &pos_, sizeof(pos_));
+}
 
-// =================================================================
-//                             Destructors
-// =================================================================
+void PointMutation::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos_, -1, -1, -1, -1, -1, -1, -1, -1);
+}
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/PointMutation.h b/src/libaevol/PointMutation.h
new file mode 100644
index 0000000..0c6c9e2
--- /dev/null
+++ b/src/libaevol/PointMutation.h
@@ -0,0 +1,103 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_POINTMUTATION_H_
+#define AEVOL_POINTMUTATION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdint>
+
+#include "LocalMutation.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class PointMutation : public LocalMutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  PointMutation() = default; //< Default ctor
+  PointMutation(const PointMutation&) = default; //< Copy ctor
+  PointMutation(PointMutation&&) = delete; //< Move ctor
+  PointMutation(int32_t pos);
+
+  virtual Mutation* Clone() const override { return new PointMutation(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~PointMutation() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  PointMutation& operator=(const PointMutation& other) = default;
+  /// Move assignment
+  PointMutation& operator=(PointMutation&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return SWITCH;
+  };
+
+  int32_t pos() const {
+    return pos_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos_;
+};
+
+} // namespace aevol
+#endif //AEVOL_POINTMUTATION_H_
diff --git a/src/libaevol/Protein.cpp b/src/libaevol/Protein.cpp
new file mode 100644
index 0000000..d1a0971
--- /dev/null
+++ b/src/libaevol/Protein.cpp
@@ -0,0 +1,703 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <math.h>
+
+#include <list>
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Protein.h"
+
+#include "ExpManager.h"
+#include "Codon.h"
+#include "Individual.h"
+#include "GeneticUnit.h"
+#include "Rna.h"
+#include "Utils.h"
+
+namespace aevol {
+
+
+
+//##############################################################################
+//                                                                             #
+//                              Class Protein                               #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+/**
+ * Copy constructor.
+ *
+ * Copies the protein but does nothing regarding the RNAs transcribing it (creates an empty list).
+ */
+Protein::Protein(GeneticUnit* gen_unit, const Protein &model)
+{
+  gen_unit_  = gen_unit;
+
+  strand_                 = model.strand_;
+  shine_dal_pos_          = model.shine_dal_pos_;
+  first_translated_pos_   = model.first_translated_pos_;
+  last_translated_pos_    = model.last_translated_pos_;
+  length_                 = model.length_;
+  concentration_          = model.concentration_;
+  is_functional_          = model.is_functional_;
+
+  // Copy the list of amino-acids
+
+  // TODO vld: check if deep copy needed
+  AA_list_ = model.AA_list_;
+
+  // Copy triangle parameters
+  mean_   = model.mean_;
+  width_  = model.width_;
+  height_ = model.height_;
+}
+
+Protein::Protein(GeneticUnit* gen_unit,
+                 const std::list<Codon*>& codon_list,
+                 Strand strand,
+                 int32_t shine_dal_pos,
+                 Rna* rna,
+                 double w_max)
+{
+  assert(shine_dal_pos >= 0);
+  assert(shine_dal_pos < gen_unit->seq_length());
+
+  gen_unit_       = gen_unit;
+  strand_         = strand;
+  shine_dal_pos_  = shine_dal_pos;
+  length_         = codon_list.size();
+
+  #ifndef __REGUL
+    // In Aevol the concentration of a new protein is set at the basal level
+    concentration_  = rna->basal_level();
+  #else
+    // In Raevol, there is two case, depending on the heredity
+    if (gen_unit_->exp_m()->exp_s()->get_with_heredity() )
+    {
+      // With heredity the new protein has a concentration set at 0, because there are inherited proteins which allow the regulation
+      concentration_ = 0;
+    }
+    else
+    {
+      // Without heredity, we use the same concentration as in Aevol (No inherited proteins)
+      concentration_ = rna->basal_level();
+    }
+  #endif
+
+  // TODO : make this cleaner...
+  AA_list_ = codon_list;
+
+  rna_list_.push_back(rna);
+
+  if (strand_ == LEADING)
+  {
+    first_translated_pos_ = Utils::mod(shine_dal_pos_ + (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE),
+                                        gen_unit_->dna()->length());
+    last_translated_pos_  = Utils::mod(first_translated_pos_ + (length_ * CODON_SIZE - 1),
+                                        gen_unit_->dna()->length());
+  }
+  else
+  {
+    first_translated_pos_ = Utils::mod(shine_dal_pos_ - (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE),
+                                        gen_unit_->dna()->length());
+    last_translated_pos_ = Utils::mod(first_translated_pos_ - (length_ * CODON_SIZE - 1),
+                                       gen_unit_->dna()->length());
+  }
+
+
+
+  // ============================================================================
+  // Folding process (compute phenotypic contribution parameters from codon list)
+  // ============================================================================
+  //  1) Compute values for M, W and H
+  //  2) Normalize M, W and H values according to number of codons of each kind
+  //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
+
+
+  //  --------------------------------
+  //  1) Compute values for M, W and H
+  //  --------------------------------
+  long double M = 0.0;
+  long double W = 0.0;
+  long double H = 0.0;
+
+  int32_t nb_m = 0;
+  int32_t nb_w = 0;
+  int32_t nb_h = 0;
+
+  bool bin_m = false; // Initializing to false will yield a conservation of the high weight bit
+  bool bin_w = false; // when applying the XOR operator for the Gray to standard conversion
+  bool bin_h = false;
+
+  for (const auto& codon: codon_list) {
+    switch (codon->value())
+    {
+      case CODON_M0 :
+      {
+        // M codon found
+        nb_m++;
+
+        // Convert Gray code to "standard" binary code
+        bin_m ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+        //~ M <<= 1;
+        M *= 2;
+
+        // Add this nucleotide's contribution to M
+        if (bin_m) M += 1;
+
+        break;
+      }
+      case CODON_M1 :
+      {
+        // M codon found
+        nb_m++;
+
+        // Convert Gray code to "standard" binary code
+        bin_m ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest bit was found, make a left bitwise shift
+        //~ M <<= 1;
+        M *= 2;
+
+        // Add this nucleotide's contribution to M
+        if (bin_m) M += 1;
+
+        break;
+      }
+      case CODON_W0 :
+      {
+        // W codon found
+        nb_w++;
+
+        // Convert Gray code to "standard" binary code
+        bin_w ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+        //~ W <<= 1;
+        W *= 2;
+
+        // Add this nucleotide's contribution to W
+        if (bin_w) W += 1;
+
+        break;
+      }
+      case CODON_W1 :
+      {
+        // W codon found
+        nb_w++;
+
+        // Convert Gray code to "standard" binary code
+        bin_w ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+        //~ W <<= 1;
+        W *= 2;
+
+        // Add this nucleotide's contribution to W
+        if (bin_w) W += 1;
+
+        break;
+      }
+      case CODON_H0 :
+      case CODON_START : // Start codon codes for the same amino-acid as H0 codon
+      {
+        // H codon found
+        nb_h++;
+
+        // Convert Gray code to "standard" binary code
+        bin_h ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+        //~ H <<= 1;
+        H *= 2;
+
+        // Add this nucleotide's contribution to H
+        if (bin_h) H += 1;
+
+        break;
+      }
+      case CODON_H1 :
+      {
+        // H codon found
+        nb_h++;
+
+        // Convert Gray code to "standard" binary code
+        bin_h ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+        //~ H <<= 1;
+        H *= 2;
+
+        // Add this nucleotide's contribution to H
+        if (bin_h) H += 1;
+
+        break;
+      }
+    }
+  }
+
+
+
+  //  ----------------------------------------------------------------------------------
+  //  2) Normalize M, W and H values in [0;1] according to number of codons of each kind
+  //  ----------------------------------------------------------------------------------
+  if (nb_m != 0)  mean_ = M / (pow(2, nb_m) - 1);
+  else              mean_ = 0.5;
+  if (nb_w != 0)  width_ = W / (pow(2, nb_w) - 1);
+  else              width_ = 0.0;
+  if (nb_h != 0)  height_ = H / (pow(2, nb_h) - 1);
+  else              height_ = 0.5;
+
+  assert(mean_ >= 0.0 && mean_ <= 1.0);
+  assert(width_ >= 0.0 && width_ <= 1.0);
+  assert(height_ >= 0.0 && height_ <= 1.0);
+
+
+
+  //  ------------------------------------------------------------------------------------
+  //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
+  //  ------------------------------------------------------------------------------------
+  // x_min <= M <= x_max
+  // w_min <= W <= w_max
+  // h_min <= H <= h_max
+  mean_   = (X_MAX - X_MIN) * mean_ + X_MIN;
+  width_  = (w_max - W_MIN) * width_ + W_MIN;
+  height_ = (H_MAX - H_MIN) * height_ + H_MIN;
+
+  if (nb_m == 0 || nb_w == 0 || nb_h == 0 || width_ == 0.0 || height_ == 0.0)
+  {
+    is_functional_ = false;
+  }
+  else
+  {
+    is_functional_ = true;
+  }
+
+  assert(mean_ >= X_MIN && mean_ <= X_MAX);
+  assert(width_ >= W_MIN && width_ <= indiv()->w_max());
+  assert(height_ >= H_MIN && height_ <= H_MAX);
+}
+
+/*
+Protein::Protein(Protein* parent)
+{
+  gen_unit_             = parent->gen_unit_;
+  strand_               = parent->strand_;
+  shine_dal_pos_        = parent->shine_dal_pos_;
+  first_translated_pos_ = parent->first_translated_pos_;
+  last_translated_pos_  = parent->last_translated_pos_;
+  length_               = parent->length_;
+  concentration_        = parent->concentration_;
+  mean_                 = parent->mean_;
+  width_                = parent->width_;
+  height_               = parent->height_;
+}
+*/
+
+//Constructor for the signal proteins
+//modif raevol_yo_3 : now we really copy the codon list
+Protein::Protein(const std::list<Codon*> codon_list, double concentration, double w_max)
+// WARNING this constructor should not being used for other purpose
+// In particular codon list should be destroyer by the caller of this constructor
+// since we will copy the list to be sure to own it
+{
+  gen_unit_             = NULL;
+  strand_               = LEADING;
+  shine_dal_pos_        = 0;
+  length_               = codon_list.size();
+  first_translated_pos_ = 0;
+  last_translated_pos_  = 0;
+  concentration_        = concentration;
+
+  // Copy the list of amino-acids
+  for(Codon* c : codon_list) {
+    AA_list_.push_back(new Codon(*c));
+  }
+
+
+
+  // ============================================================================
+  // Folding process (compute phenotypic contribution parameters from codon list)
+  // ============================================================================
+  //  1) Compute values for M, W and H
+  //  2) Normalize M, W and H values according to number of codons of each kind
+  //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
+
+
+  //  --------------------------------
+   //  1) Compute values for M, W and H
+   //  --------------------------------
+   long double M = 0.0;
+   long double W = 0.0;
+   long double H = 0.0;
+
+   int32_t nb_m = 0;
+   int32_t nb_w = 0;
+   int32_t nb_h = 0;
+
+   bool bin_m = false; // Initializing to false will yield a conservation of the high weight bit
+   bool bin_w = false; // when applying the XOR operator for the Gray to standard conversion
+   bool bin_h = false;
+
+   for (const auto& codon: codon_list) {
+     switch ( codon->value() )
+     {
+       case CODON_M0 :
+       {
+         // M codon found
+         nb_m++;
+
+         // Convert Gray code to "standard" binary code
+         bin_m ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+         //~ M <<= 1;
+         M *= 2;
+
+         // Add this nucleotide's contribution to M
+         if ( bin_m ) M += 1;
+
+         break;
+       }
+       case CODON_M1 :
+       {
+         // M codon found
+         nb_m++;
+
+         // Convert Gray code to "standard" binary code
+         bin_m ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest bit was found, make a left bitwise shift
+         //~ M <<= 1;
+         M *= 2;
+
+         // Add this nucleotide's contribution to M
+         if ( bin_m ) M += 1;
+
+         break;
+       }
+       case CODON_W0 :
+       {
+         // W codon found
+         nb_w++;
+
+         // Convert Gray code to "standard" binary code
+         bin_w ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+         //~ W <<= 1;
+         W *= 2;
+
+         // Add this nucleotide's contribution to W
+         if ( bin_w ) W += 1;
+
+         break;
+       }
+       case CODON_W1 :
+       {
+         // W codon found
+         nb_w++;
+
+         // Convert Gray code to "standard" binary code
+         bin_w ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+         //~ W <<= 1;
+         W *= 2;
+
+         // Add this nucleotide's contribution to W
+         if ( bin_w ) W += 1;
+
+         break;
+       }
+       case CODON_H0 :
+       case CODON_START : // Start codon codes for the same amino-acid as H0 codon
+       {
+         // H codon found
+         nb_h++;
+
+         // Convert Gray code to "standard" binary code
+         bin_h ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+         //~ H <<= 1;
+         H *= 2;
+
+         // Add this nucleotide's contribution to H
+         if ( bin_h ) H += 1;
+
+         break;
+       }
+       case CODON_H1 :
+       {
+         // H codon found
+         nb_h++;
+
+         // Convert Gray code to "standard" binary code
+         bin_h ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
+
+         // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
+         //~ H <<= 1;
+         H *= 2;
+
+         // Add this nucleotide's contribution to H
+         if ( bin_h ) H += 1;
+
+         break;
+       }
+     }
+   }
+
+
+
+   //  ----------------------------------------------------------------------------------
+   //  2) Normalize M, W and H values in [0;1] according to number of codons of each kind
+   //  ----------------------------------------------------------------------------------
+   if ( nb_m != 0 )  mean_ = M / (pow(2, nb_m) - 1);
+   else              mean_ = 0.5;
+   if ( nb_w != 0 )  width_ = W / (pow(2, nb_w) - 1);
+   else              width_ = 0.0;
+   if ( nb_h != 0 )  height_ = H / (pow(2, nb_h) - 1);
+   else              height_ = 0.5;
+
+   assert( mean_ >= 0.0 && mean_ <= 1.0 );
+   assert( width_ >= 0.0 && width_ <= 1.0 );
+   assert( height_ >= 0.0 && height_ <= 1.0 );
+
+
+
+   //  ------------------------------------------------------------------------------------
+   //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
+   //  ------------------------------------------------------------------------------------
+   // x_min <= M <= x_max
+   // w_min <= W <= w_max
+   // h_min <= H <= h_max
+   mean_   = (X_MAX - X_MIN) * mean_ + X_MIN;
+   width_  = (w_max - W_MIN) * width_ + W_MIN;
+   height_ = (H_MAX - H_MIN) * height_ + H_MIN;
+
+   if ( nb_m == 0 || nb_w == 0 || nb_h == 0 || width_ == 0.0 || height_ == 0.0 )
+   {
+     is_functional_ = false;
+   }
+   else
+   {
+     is_functional_ = true;
+   }
+
+   assert( mean_ >= X_MIN && mean_ <= X_MAX );
+   //NOT WORKING if indiv is nullptr
+  // assert( width_ >= W_MIN && width_ <= indiv()->w_max() );
+   assert( height_ >= H_MIN && height_ <= H_MAX );
+}
+
+
+Protein::Protein(gzFile backup_file)
+{
+  gen_unit_ = NULL;
+  int8_t tmp_strand;
+  gzread(backup_file, &tmp_strand, sizeof(tmp_strand));
+  strand_ = (Strand) tmp_strand;
+  gzread(backup_file, &shine_dal_pos_,			    sizeof(shine_dal_pos_));
+  gzread(backup_file, &first_translated_pos_, 	sizeof(first_translated_pos_));
+  gzread(backup_file, &last_translated_pos_,  	sizeof(last_translated_pos_));
+  gzread(backup_file, &length_,     			      sizeof(length_));
+  gzread(backup_file, &concentration_,     		sizeof(concentration_));
+  gzread(backup_file, &is_functional_,         sizeof(is_functional_));
+  gzread(backup_file, &mean_,  			          sizeof(mean_));
+  gzread(backup_file, &width_,    			        sizeof(width_));
+  gzread(backup_file, &height_,                sizeof(height_));
+
+  // Retreive the AA
+  int16_t nb_AA = 0;
+  gzread(backup_file, &nb_AA,  sizeof(nb_AA));
+
+  for (int16_t i = 0 ; i < nb_AA ; i++)
+    AA_list_.push_back(new Codon(backup_file));
+
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Protein::~Protein()
+{
+  for (const auto& AA: AA_list_)
+    delete AA;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+int32_t Protein::last_STOP_base_pos() const
+{
+  if (strand_ == LEADING)
+  {
+    return Utils::mod(last_translated_pos_ + 3, gen_unit_->dna()->length());
+  }
+  else
+  {
+    return Utils::mod(last_translated_pos_ - 3, gen_unit_->dna()->length());
+  }
+}
+
+void Protein::add_RNA(Rna * rna)
+{
+  rna_list_.push_back(rna);
+
+#ifndef __REGUL
+  concentration_ += rna->basal_level();
+#else
+	if ( gen_unit_->exp_m()->exp_s()->get_with_heredity() )
+	{
+	  // With heredity the new protein has a concentration set at 0, because there are inherited proteins which allow the regulation
+	 concentration_ = 0;
+	}
+	else
+	{
+	  // Without heredity, we use the same concentration as in Aevol (No inherited proteins)
+	  concentration_ += rna->basal_level();
+	}
+#endif
+}
+
+char* Protein::AA_sequence(char separator /*= ' '*/) const
+{
+  char* seq = new char[3*length_]; // + 1 (for the '\0')  - 1 (length_ - 1 spaces)
+
+  int32_t i = 0;
+  for (const auto& codon: AA_list_) {
+    if (i != 0) seq[i++] = separator;
+    switch (codon->value())
+    {
+      case CODON_START :
+      {
+        seq[i++] = 'S';
+        seq[i++] = 'T';
+        break;
+      }
+      case CODON_M0 :
+      {
+        seq[i++] = 'M';
+        seq[i++] = '0';
+        break;
+      }
+      case CODON_M1 :
+      {
+        seq[i++] = 'M';
+        seq[i++] = '1';
+        break;
+      }
+      case CODON_W0 :
+      {
+        seq[i++] = 'W';
+        seq[i++] = '0';
+        break;
+      }
+      case CODON_W1 :
+      {
+        seq[i++] = 'W';
+        seq[i++] = '1';
+        break;
+      }
+      case CODON_H0 :
+      {
+        seq[i++] = 'H';
+        seq[i++] = '0';
+        break;
+      }
+      case CODON_H1 :
+      {
+        seq[i++] = 'H';
+        seq[i++] = '1';
+        break;
+      }
+    }
+  }
+
+  seq[3*length_-1] = '\0';
+  return seq;
+}
+
+void Protein::save(gzFile backup_file)
+{
+  // The rna_list_ is not write because there is no need to, it is an empty list.
+  int8_t tmp_strand = strand_;
+  gzwrite(backup_file, &tmp_strand,            sizeof(tmp_strand));
+  gzwrite(backup_file, &shine_dal_pos_,        sizeof(shine_dal_pos_));
+  gzwrite(backup_file, &first_translated_pos_, sizeof(first_translated_pos_));
+  gzwrite(backup_file, &last_translated_pos_,  sizeof(last_translated_pos_));
+  gzwrite(backup_file, &length_,     			    sizeof(length_));
+  gzwrite(backup_file, &concentration_,     		sizeof(concentration_));
+  gzwrite(backup_file, &is_functional_,        sizeof(is_functional_));
+  gzwrite(backup_file, &mean_,  			          sizeof(mean_));
+  gzwrite(backup_file, &width_,    			      sizeof(width_));
+  gzwrite(backup_file, &height_,		     	      sizeof(height_));
+
+  // Write the Acide Amino in the backup file
+  int16_t nb_AA = AA_list_.size();
+  gzwrite(backup_file, &nb_AA,  sizeof(nb_AA));
+
+  for (const auto& AA: AA_list_)
+    AA->save(backup_file);
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+Individual *Protein::indiv() const
+{
+  return gen_unit_->indiv();
+}
+
+
+GeneticUnit* Protein::get_gen_unit( void ) const
+{
+  return gen_unit_;
+}
+} // namespace aevol
diff --git a/src/libaevol/ae_protein.h b/src/libaevol/Protein.h
similarity index 51%
rename from src/libaevol/ae_protein.h
rename to src/libaevol/Protein.h
index 62a9b59..a17f638 100644
--- a/src/libaevol/ae_protein.h
+++ b/src/libaevol/Protein.h
@@ -3,30 +3,30 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
-#ifndef __AE_PROTEIN_H__
-#define __AE_PROTEIN_H__
+#ifndef AEVOL_PROTEIN_H_
+#define AEVOL_PROTEIN_H_
 
 
 // =================================================================
@@ -34,96 +34,95 @@
 // =================================================================
 #include <inttypes.h>
 
-
-
+#include <list>
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_list.h>
-#include <ae_object.h>
-#include <ae_macros.h>
-#include <ae_dna.h>
-#include <ae_codon.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "macros.h"
+#include "Dna.h"
+#include "Codon.h"
 
+namespace aevol {
 
 
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_individual;
-class ae_rna;
+class Individual;
+class Rna;
 
 
 
 
 
-class ae_protein : public ae_object
+class Protein
 {
   public :
 
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_protein( ae_genetic_unit* gen_unit, const ae_protein &model );
-    ae_protein( ae_genetic_unit* gen_unit, ae_list<ae_codon*>* codon_list, ae_strand strand, int32_t shine_dal, ae_rna* rna );
-    //ae_protein( ae_protein* parent );
-    ae_protein( gzFile backup_file );
+
+    Protein() = delete;
+    Protein(const Protein &model) = delete;
+    Protein(GeneticUnit* gen_unit, const Protein &model);
+    Protein(GeneticUnit* gen_unit,
+               const std::list<Codon*>& codon_list,
+               Strand strand,
+               int32_t shine_dal_pos,
+               Rna * rna,
+               double w_max);
+    Protein( const std::list<Codon*> codon_list, double concentration, double w_max);
+    //Protein(Protein* parent);
+    Protein(gzFile backup_file);
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_protein( void );
+    virtual ~Protein();
 
     // =================================================================
     //                              Accessors
     // =================================================================
-    inline ae_strand          get_strand( void )                const;
-    inline ae_list<ae_rna*>*  get_rna_list( void )              const;
-    inline int32_t            get_shine_dal_pos( void )         const;
-    inline int32_t            get_first_translated_pos( void )  const;
-    inline int32_t            get_last_translated_pos( void )   const;
-           int32_t            get_last_STOP_base_pos( void )    const;
-    inline double             get_mean( void )                  const;
-    inline double             get_width( void )                 const; // returns the half-width
-    inline double             get_height( void )                const;
-    inline int32_t            get_length( void )                const; // Number of Amino-Acids (not including START and STOP)
-    inline double             get_concentration( void )         const;
-    inline  bool              get_is_functional( void )         const;
-    
-    ae_individual* get_indiv( void ) const;
+    GeneticUnit*       get_gen_unit( void )              const;
+    inline std::list<Codon*>     AA_list() const;
+
+    inline Strand strand()                const;
+    inline const std::list<Rna *> rna_list()          const;
+    inline int32_t            shine_dal_pos()         const;
+    inline int32_t            first_translated_pos()  const;
+    inline int32_t            last_translated_pos()   const;
+           int32_t            last_STOP_base_pos()    const;
+    inline double             mean()                  const;
+    inline double             width()                 const; // returns the half-width
+    inline double             height()                const;
+    inline int32_t            length()                const; // Number of Amino-Acids (not including START and STOP)
+    inline double             concentration()         const;
+    inline  bool              is_functional()         const;
+
+    Individual * indiv() const;
 
     // =================================================================
     //                            Public Methods
     // =================================================================
-            void  add_RNA( ae_rna* rna );
-            char* get_AA_sequence( void ) const; // WARNING : creates a new char[...] (up to you to delete it!)
-    virtual void  save( gzFile backup_file );
+    void  add_RNA(Rna * rna);
+    char* AA_sequence(char separator = ' ') const; // WARNING : creates a new char[...] (up to you to delete it!)
+    virtual void  save(gzFile backup_file);
 
     // =================================================================
     //                           Public Attributes
     // =================================================================
 
-
+    double            concentration_;
 
 
 
   protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_protein( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_protein( const ae_protein &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
     // =================================================================
     //                           Protected Methods
     // =================================================================
@@ -131,86 +130,89 @@ class ae_protein : public ae_object
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    ae_genetic_unit*  _gen_unit;
-    ae_strand         _strand;
-    ae_list<ae_rna*>* _rna_list;              // RNAs transcribing this protein
-    int32_t           _shine_dal_pos;         // Index of the corresponding shine dalgarno sequence in the genome
-    int32_t           _first_translated_pos;  // Index of the first base following the START codon
-    int32_t           _last_translated_pos;   // Index of the last base before the STOP codon
-    int32_t           _length;                // Number of Amino-Acids (START and STOP codon do NOT produce AAs)
-    double            _concentration;
-    bool              _is_functional;
-    
-    ae_list<ae_codon*>* _AA_list;
+    GeneticUnit*  gen_unit_;
+    Strand strand_;
+    std::list<Rna *>  rna_list_;              // RNAs transcribing this protein
+    int32_t           shine_dal_pos_;         // Index of the corresponding shine dalgarno sequence in the genome
+    int32_t           first_translated_pos_;  // Index of the first base following the START codon
+    int32_t           last_translated_pos_;   // Index of the last base before the STOP codon
+    int32_t           length_;                // Number of Amino-Acids (START and STOP codon do NOT produce AAs)
+
+    bool              is_functional_;
+
+    std::list<Codon *> AA_list_;
 
     // Phenotypic contribution (triangle) parameters
-    double _mean;
-    double _width;   // in fact, half-width
-    double _height;
+    double mean_;
+    double width_;   // in fact, half-width
+    double height_;
 };
 
 
 // =====================================================================
 //                          Accessors definitions
 // =====================================================================
-inline ae_strand ae_protein::get_strand( void ) const
+inline Strand Protein::strand() const
 {
-  return _strand;
+  return strand_;
 }
 
-inline ae_list<ae_rna*>* ae_protein::get_rna_list( void ) const
-{
-  return _rna_list;
+inline const std::list<Rna *> Protein::rna_list() const {
+  return rna_list_;
 }
 
-int32_t ae_protein::get_shine_dal_pos( void ) const
+int32_t Protein::shine_dal_pos() const
 {
-  return _shine_dal_pos;
+  return shine_dal_pos_;
 }
 
-int32_t ae_protein::get_first_translated_pos( void ) const
+int32_t Protein::first_translated_pos() const
 {
-  return _first_translated_pos;
+  return first_translated_pos_;
 }
 
-int32_t ae_protein::get_last_translated_pos( void ) const
+int32_t Protein::last_translated_pos() const
 {
-  return _last_translated_pos;
+  return last_translated_pos_;
 }
 
-double ae_protein::get_mean( void ) const
+double Protein::mean() const
 {
-  return _mean;
+  return mean_;
 }
 
-double ae_protein::get_width( void ) const
+double Protein::width() const
 {
-  return _width;
+  return width_;
 }
 
-double ae_protein::get_height( void ) const
+double Protein::height() const
 {
-  return _height;
+  return height_;
 }
 
-int32_t ae_protein::get_length( void ) const
+int32_t Protein::length() const
 {
-  return _length;
+  return length_;
 }
 
-double ae_protein::get_concentration( void ) const
+double Protein::concentration() const
 {
-  return _concentration;
+  return concentration_;
 }
 
-bool ae_protein::get_is_functional( void ) const
+bool Protein::is_functional() const
 {
-  return _is_functional;
+  return is_functional_;
 }
 
 
+std::list<Codon*>     Protein::AA_list() const {
+  return AA_list_;
+}
+
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-
-#endif // __AE_PROTEIN_H__
+} // namespace aevol
+#endif // AEVOL_PROTEIN_H_
diff --git a/src/libaevol/Rearrangement.h b/src/libaevol/Rearrangement.h
new file mode 100644
index 0000000..cda41fa
--- /dev/null
+++ b/src/libaevol/Rearrangement.h
@@ -0,0 +1,83 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_REARRANGEMENT_H_
+#define AEVOL_REARRANGEMENT_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Mutation.h"
+
+namespace aevol {
+
+/**
+ * Abstract base class for local mutations
+ */
+class Rearrangement : public Mutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  virtual Mutation* Clone() const override = 0;
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override = 0;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override = 0;
+  bool is_rear() const override final { return true; };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+} // namespace aevol
+#endif //AEVOL_REARRANGEMENT_H_
diff --git a/src/libaevol/ae_phenotype.cpp b/src/libaevol/ReplacementHT.cpp
similarity index 52%
copy from src/libaevol/ae_phenotype.cpp
copy to src/libaevol/ReplacementHT.cpp
index 958b8ff..7905986 100644
--- a/src/libaevol/ae_phenotype.cpp
+++ b/src/libaevol/ReplacementHT.cpp
@@ -3,105 +3,82 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_phenotype.h>
-#include <ae_individual.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_phenotype                             #
-//                                                                             #
-//##############################################################################
+//
+// ****************************************************************************
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "ReplacementHT.h"
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+ReplacementHT::ReplacementHT(const VisAVis& align1, const VisAVis& align2,
+                             int32_t length, int32_t replaced_seq_length,
+                             char* seq, int32_t donor_id)
+    : align1_(align1), align2_(align2),
+      length_(length), replaced_seq_length_(replaced_seq_length),
+      donor_id_(donor_id) {
+  seq_ = new char[length_ + 1];
+  memcpy(seq_, seq, length_ + 1);
+}
 
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_phenotype::ae_phenotype( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = NULL;
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+ReplacementHT::~ReplacementHT() noexcept {
+  delete seq_;
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv, const ae_phenotype &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set( model )
-#elif defined __X11
-  ae_fuzzy_set_X11( model )
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void ReplacementHT::save(gzFile backup_file) const {
+  Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+void ReplacementHT::load(gzFile backup_file) {
+  Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_phenotype::~ae_phenotype( void )
-{
+void ReplacementHT::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32 " ",
+          mut_type(),
+          donor_pos1(), donor_pos2(),
+          receiver_pos1(), receiver_pos2(),
+          sense(),
+          align1_.score(), align2_.score(),
+          length_, replaced_seq_length_);
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ReplacementHT.h b/src/libaevol/ReplacementHT.h
new file mode 100644
index 0000000..1f0d6d4
--- /dev/null
+++ b/src/libaevol/ReplacementHT.h
@@ -0,0 +1,141 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_REPLACEMENT_HT_H_
+#define AEVOL_REPLACEMENT_HT_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "HorizontalTransfer.h"
+#include "VisAVis.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class ReplacementHT : public HorizontalTransfer {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  ReplacementHT() = default; //< Default ctor
+  ReplacementHT(const ReplacementHT&) = default; //< Copy ctor
+  ReplacementHT(ReplacementHT&&) = delete; //< Move ctor
+  ReplacementHT(const VisAVis& align1, const VisAVis& align2,
+                int32_t length, int32_t replaced_seq_length,
+                char* seq, int32_t donor_id);
+
+  virtual Mutation* Clone() const override { return new ReplacementHT(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~ReplacementHT() noexcept; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  ReplacementHT& operator=(const ReplacementHT& other) = default;
+
+  /// Move assignment
+  ReplacementHT& operator=(ReplacementHT&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return REPL_HT;
+  };
+
+  int32_t donor_pos1() const {
+    return align1_.i_2();
+  }
+
+  int32_t donor_pos2() const {
+    return align2_.i_2();
+  }
+
+  int32_t receiver_pos1() const {
+    return align1_.i_1();
+  }
+
+  int32_t receiver_pos2() const {
+    return align2_.i_1();
+  }
+
+  AlignmentSense sense() const {
+    return align2_.sense();
+  }
+
+  char* seq() const {
+    return seq_;
+  }
+
+  int32_t length() const {
+    return length_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  /**
+   * Alignments between the receiver and the donor
+   *
+   * The first point of each alignment corresponds to the receiver, the sequence
+   * that will be replaced lies between align1_->i1 and align2_->i1. It will be
+   * replaced by the seq. btw align1_->i2 and align2_->i2 on the donor.
+   */
+  VisAVis align1_, align2_;
+  int32_t length_;
+  int32_t replaced_seq_length_;
+  char* seq_ = nullptr;
+  int32_t donor_id_ = -1;
+};
+
+} // namespace aevol
+#endif //AEVOL_REPLACEMENT_HT_H_
diff --git a/src/libaevol/ReplicationReport.cpp b/src/libaevol/ReplicationReport.cpp
new file mode 100644
index 0000000..37dbfb2
--- /dev/null
+++ b/src/libaevol/ReplicationReport.cpp
@@ -0,0 +1,270 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "ReplicationReport.h"
+#include "DnaReplicationReport.h"
+#include "Mutation.h"
+#include "Individual.h"
+#include "AeTime.h"
+#include "Observable.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                         Class ReplicationReport                         #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+ReplicationReport::ReplicationReport(Individual* indiv,
+                                     const Individual* parent,
+                                     Individual* donor /*= NULL*/)
+{
+  indiv_ = indiv;
+
+  id_   = indiv->id();
+  rank_ = indiv->rank();
+
+  parent_id_ = parent->id();
+  // donor_id_ is set further down
+
+  genome_size_        = 0;
+  metabolic_error_    = 0.0;
+  nb_genes_activ_     = 0;
+  nb_genes_inhib_     = 0;
+  nb_non_fun_genes_   = 0;
+  nb_coding_RNAs_     = 0;
+  nb_non_coding_RNAs_ = 0;
+
+  parent_metabolic_error_ = parent->dist_to_target_by_feature(METABOLISM);
+  parent_secretion_error_ = parent->dist_to_target_by_feature(SECRETION);
+  parent_genome_size_     = parent->total_genome_size();
+  mean_align_score_       = 0.0;
+
+  if (donor == NULL)
+  {
+    donor_id_               = -1;
+    donor_metabolic_error_  = 0.0;
+    donor_secretion_error_	= 0.0;
+    donor_genome_size_      = 0;
+  }
+  else
+  {
+    donor_id_              = donor->id();
+    donor_metabolic_error_ = donor->dist_to_target_by_feature(METABOLISM);
+    donor_secretion_error_ = donor->dist_to_target_by_feature(SECRETION);
+    donor_genome_size_     = donor->total_genome_size();
+  }
+}
+
+
+// Creates an independent copy of the original report
+ReplicationReport::ReplicationReport(const ReplicationReport& other) :
+    dna_replic_report_(other.dna_replic_report_)
+{
+  parent_id_  = other.parent_id_;
+  donor_id_   = other.donor_id_;
+
+  id_   = other.id_;
+  rank_ = other.rank_;
+
+  genome_size_        = other.genome_size_;
+  metabolic_error_    = other.metabolic_error_;
+  nb_genes_activ_     = other.nb_genes_activ_;
+  nb_genes_inhib_     = other.nb_genes_inhib_;
+  nb_non_fun_genes_   = other.nb_non_fun_genes_;
+  nb_coding_RNAs_     = other.nb_coding_RNAs_;
+  nb_non_coding_RNAs_ = other.nb_non_coding_RNAs_;
+
+  parent_metabolic_error_ = other.parent_metabolic_error_;
+  parent_secretion_error_ = other.parent_secretion_error_;
+  donor_metabolic_error_  = other.donor_metabolic_error_;
+  donor_secretion_error_  = other.donor_secretion_error_;
+  parent_genome_size_     = other.parent_genome_size_;
+  donor_genome_size_      = other.donor_genome_size_;
+  mean_align_score_       = other.mean_align_score_;
+}
+
+
+ReplicationReport::ReplicationReport(gzFile tree_file, Individual* indiv)
+{
+  indiv_ = indiv;
+
+  gzread(tree_file, &id_,        sizeof(id_));
+  gzread(tree_file, &rank_,      sizeof(rank_));
+  gzread(tree_file, &parent_id_, sizeof(parent_id_));
+  gzread(tree_file, &donor_id_,  sizeof(donor_id_));
+
+  gzread(tree_file, &genome_size_,         sizeof(genome_size_));
+  gzread(tree_file, &metabolic_error_,     sizeof(metabolic_error_));
+  gzread(tree_file, &nb_genes_activ_,      sizeof(nb_genes_activ_));
+  gzread(tree_file, &nb_genes_inhib_,      sizeof(nb_genes_inhib_));
+  gzread(tree_file, &nb_non_fun_genes_,    sizeof(nb_non_fun_genes_));
+  gzread(tree_file, &nb_coding_RNAs_,      sizeof(nb_coding_RNAs_));
+  gzread(tree_file, &nb_non_coding_RNAs_,  sizeof(nb_non_coding_RNAs_));
+
+  dna_replic_report_.read_from_tree_file(tree_file);
+
+  dna_replic_report_.compute_stats();
+
+  parent_metabolic_error_ = -1;
+  parent_secretion_error_ = -1;
+  donor_metabolic_error_  = -1;
+  parent_genome_size_     = -1;
+  donor_genome_size_      = -1;
+  mean_align_score_       = 0.0;
+}
+
+
+// =================================================================
+//                             Destructors
+// =================================================================
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+/**
+ * Set the individual corresponding to this replication report and
+ * the characteristics of its parent
+ *
+ * This should be called as soon as a replication is started (just after calling
+ * the offspring constructor and before doing the mutations)
+ */
+void ReplicationReport::init(Individual* offspring, Individual* parent)
+{
+  indiv_ = offspring;
+
+  id_ = indiv_->id();
+  parent_id_ = parent->id();
+
+  genome_size_        = 0;
+  metabolic_error_    = 0.0;
+  nb_genes_activ_     = 0;
+  nb_genes_inhib_     = 0;
+  nb_non_fun_genes_   = 0;
+  nb_coding_RNAs_     = 0;
+  nb_non_coding_RNAs_ = 0;
+
+  parent_metabolic_error_ = parent->dist_to_target_by_feature(METABOLISM);
+  parent_secretion_error_ = parent->dist_to_target_by_feature(SECRETION);
+  parent_genome_size_     = parent->total_genome_size();
+  mean_align_score_       = 0.0;
+
+  // Set ourselves an observer of indiv_'s MUTATION and END_REPLICATION
+  indiv_->addObserver(this, MUTATION);
+  indiv_->addObserver(this, END_REPLICATION);
+}
+
+/**
+ * Method called at the end of the replication of an individual.
+ * Actions such as finalize the calculation of average values can be done here.
+ */
+void ReplicationReport::signal_end_of_replication(Individual* indiv) {
+  // TODO <david.parsons at inria.fr> tmp patch
+  if (indiv_ == NULL) indiv_ = indiv;
+
+  // Retrieve data from the individual
+  genome_size_        = indiv_->total_genome_size();
+  metabolic_error_    = indiv_->dist_to_target_by_feature(METABOLISM);
+  nb_genes_activ_     = indiv_->nb_genes_activ();
+  nb_genes_inhib_     = indiv_->nb_genes_inhib();
+  nb_non_fun_genes_   = indiv_->nb_functional_genes();
+  nb_coding_RNAs_     = indiv_->nb_coding_RNAs();
+  nb_non_coding_RNAs_ = indiv_->nb_non_coding_RNAs();
+}
+
+/**
+ * Method called at the end of a generation.
+ * Actions such as update the individuals' ranks can be done here.
+ */
+void ReplicationReport::signal_end_of_generation() {
+  rank_ = indiv_->rank();
+}
+
+void ReplicationReport::write_to_tree_file(gzFile tree_file) const
+{
+  // Store individual identifiers and rank
+  gzwrite(tree_file, &id_,         sizeof(id_));
+  assert(rank_ != -1);
+  gzwrite(tree_file, &rank_,       sizeof(rank_));
+  gzwrite(tree_file, &parent_id_,  sizeof(parent_id_));
+  gzwrite(tree_file, &donor_id_,   sizeof(donor_id_));
+
+  gzwrite(tree_file, &genome_size_,         sizeof(genome_size_));
+  gzwrite(tree_file, &metabolic_error_,     sizeof(metabolic_error_));
+  gzwrite(tree_file, &nb_genes_activ_,      sizeof(nb_genes_activ_));
+  gzwrite(tree_file, &nb_genes_inhib_,      sizeof(nb_genes_inhib_));
+  gzwrite(tree_file, &nb_non_fun_genes_,    sizeof(nb_non_fun_genes_));
+  gzwrite(tree_file, &nb_coding_RNAs_,      sizeof(nb_coding_RNAs_));
+  gzwrite(tree_file, &nb_non_coding_RNAs_,  sizeof(nb_non_coding_RNAs_));
+
+  dna_replic_report_.write_to_tree_file(tree_file);
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+
+
+
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+void ReplicationReport::update(Observable& o, ObservableEvent e, void* arg) {
+  switch (e) {
+    case END_REPLICATION :
+      signal_end_of_replication(dynamic_cast<Individual*>(&o));
+      break;
+    case MUTATION :
+      dna_replic_report_.add_mut(reinterpret_cast<Mutation*>(arg));
+      break;
+    default :
+      Utils::ExitWithDevMsg("Event not handled", __FILE__, __LINE__);
+  }
+}
+} // namespace aevol
diff --git a/src/libaevol/ReplicationReport.h b/src/libaevol/ReplicationReport.h
new file mode 100644
index 0000000..66fa0bd
--- /dev/null
+++ b/src/libaevol/ReplicationReport.h
@@ -0,0 +1,275 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_REPLICATION_REPORT_H_
+#define AEVOL_REPLICATION_REPORT_H_
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <inttypes.h>
+#include <zlib.h>
+
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include "DnaReplicationReport.h"
+#include "ae_enums.h"
+#include "Observer.h"
+#include "ObservableEvent.h"
+#include "Individual.h"
+
+namespace aevol {
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class Individual;
+
+
+
+
+
+class ReplicationReport : public Observer {
+  public :
+
+    // =================================================================
+    //                             Constructors
+    // =================================================================
+    ReplicationReport() = default;
+    ReplicationReport(Individual* indiv,
+                      const Individual* parent,
+                      Individual* donor = NULL);
+
+    // Creates a completely independent copy of the original report
+    ReplicationReport(const ReplicationReport& other);
+
+    ReplicationReport(gzFile tree_file, Individual * indiv);
+
+    // =================================================================
+    //                             Destructors
+    // =================================================================
+    virtual ~ReplicationReport() = default;
+
+    // =================================================================
+    //                              Accessors
+    // =================================================================
+    inline Individual * indiv() const;
+    int32_t id() { return id_; };
+    int32_t rank() { return rank_; };
+    inline int32_t  genome_size() const;
+    inline int32_t  parent_id() const;
+    inline double   parent_metabolic_error() const;
+    inline double   parent_secretion_error() const;
+    inline int32_t  parent_genome_size() const;
+
+    inline double   mean_align_score() const;
+    inline int32_t	donor_id() const;
+    inline double   donor_metabolic_error() const;
+    inline int32_t  donor_genome_size() const;
+    int32_t nb(MutationType t) const {
+      return dna_replic_report_.nb(t);
+    }
+
+    // TODO <david.parsons at inria.fr> re-constify
+    // => const DnaReplicationReport& dna_replic_report() const
+    DnaReplicationReport& dna_replic_report() {
+      return dna_replic_report_;
+    }
+
+    void            set_indiv(Individual * indiv);
+    inline void     set_parent_id(int32_t parent_id);
+    inline void     set_parent_metabolic_error(double parent_metabolic_error);
+    inline void     set_parent_secretion_error(double parent_secretion_error);
+    inline void     set_parent_genome_size(int32_t parent_genome_size);
+    inline void     set_donor_id(int32_t donor_id);
+    inline void     set_donor_metabolic_error(double donor_metabolic_error);
+    inline void     set_donor_secretion_error(double donor_secretion_error);
+    inline void     set_donor_genome_size(int32_t donor_genome_size);
+
+    // =================================================================
+    //                            Public Methods
+    // =================================================================
+    void init(Individual* offspring, Individual* parent);
+    void signal_end_of_replication(Individual* indiv);
+    void signal_end_of_generation();
+    void write_to_tree_file(gzFile tree_file) const;
+
+
+  void update(Observable& o, ObservableEvent e, void* arg) override;
+
+
+
+
+
+  protected :
+    // =================================================================
+    //                           Protected Methods
+    // =================================================================
+
+    // =================================================================
+    //                          Protected Attributes
+    // =================================================================
+    Individual* indiv_ = nullptr;
+    int32_t id_ = -1;
+    int32_t parent_id_ = -1;
+
+    int32_t rank_ = -1;
+
+    int32_t genome_size_ = -1;
+    double metabolic_error_ = -1;
+    int16_t nb_genes_activ_ = -1;
+    int16_t nb_genes_inhib_ = -1;
+    int16_t nb_non_fun_genes_ = -1;
+    int16_t nb_coding_RNAs_ = -1;
+    int16_t nb_non_coding_RNAs_ = -1;
+
+    // List of each genetic unit's replication report
+    DnaReplicationReport dna_replic_report_;
+
+    double parent_metabolic_error_ = -1;
+    double parent_secretion_error_ = -1;
+    int32_t parent_genome_size_ = -1;
+
+    int32_t	donor_id_ = -1;
+    double donor_metabolic_error_ = -1;
+    double donor_secretion_error_ = -1;
+    int32_t donor_genome_size_ = -1;
+
+    // CK: I think that the attributes below are obsolete
+    // (HT events are now stored in the ae_dna_replic_reports)
+
+    double mean_align_score_;
+};
+
+
+// =====================================================================
+//                          Accessors' definitions
+// =====================================================================
+inline Individual *ReplicationReport::indiv() const
+{
+  return indiv_;
+}
+
+inline int32_t ReplicationReport::genome_size() const
+{
+  return genome_size_;
+}
+
+int32_t ReplicationReport::parent_id() const
+{
+  return parent_id_;
+}
+
+double ReplicationReport::parent_metabolic_error() const
+{
+  return parent_metabolic_error_;
+}
+
+double ReplicationReport::parent_secretion_error() const
+{
+  return parent_secretion_error_;
+}
+
+int32_t ReplicationReport::parent_genome_size() const
+{
+  return parent_genome_size_;
+}
+
+inline int32_t	ReplicationReport::donor_id() const
+{
+  return donor_id_;
+}
+
+inline double   ReplicationReport::donor_metabolic_error() const
+{
+  return donor_metabolic_error_;
+}
+
+inline int32_t  ReplicationReport::donor_genome_size() const
+{
+  return donor_genome_size_;
+}
+
+
+
+inline double ReplicationReport::mean_align_score() const
+{
+  return mean_align_score_;
+}
+
+inline void ReplicationReport::set_indiv(Individual * indiv)
+{
+  indiv_ = indiv;
+}
+
+void ReplicationReport::set_parent_id(int32_t parent_id)
+{
+  parent_id_ = parent_id;
+}
+
+void ReplicationReport::set_parent_metabolic_error(double parent_metabolic_error)
+{
+  parent_metabolic_error_ = parent_metabolic_error;
+}
+
+void ReplicationReport::set_parent_secretion_error(double parent_secretion_error)
+{
+  parent_secretion_error_ = parent_secretion_error;
+}
+
+void ReplicationReport::set_parent_genome_size(int32_t parent_genome_size)
+{
+  parent_genome_size_ = parent_genome_size;
+}
+
+inline void ReplicationReport::set_donor_id(int32_t donor_id)
+{
+  donor_id_ = donor_id;
+}
+
+inline void  ReplicationReport::set_donor_metabolic_error(double donor_metabolic_error)
+{
+  donor_metabolic_error_ = donor_metabolic_error;
+}
+
+inline void ReplicationReport::set_donor_secretion_error(double donor_secretion_error)
+{
+  donor_secretion_error_ = donor_secretion_error;
+}
+
+inline void ReplicationReport::set_donor_genome_size(int32_t donor_genome_size)
+{
+  donor_genome_size_ = donor_genome_size;
+}
+
+} // namespace aevol
+
+#endif // AEVOL_REPLICATION_REPORT_H_
diff --git a/src/libaevol/ae_codon.cpp b/src/libaevol/Rna.cpp
similarity index 59%
copy from src/libaevol/ae_codon.cpp
copy to src/libaevol/Rna.cpp
index ea2dbf9..c62953b 100644
--- a/src/libaevol/ae_codon.cpp
+++ b/src/libaevol/Rna.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -30,22 +30,23 @@
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <math.h>
-
 
+#include <list>
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_codon.h>
-#include <ae_utils.h>
+#include "Rna.h"
+#include "GeneticUnit.h"
+#include "Individual.h"
 
+namespace aevol {
 
 
 
 //##############################################################################
 //                                                                             #
-//                                Class ae_codon                               #
+//                                 Class Rna                                #
 //                                                                             #
 //##############################################################################
 
@@ -56,71 +57,83 @@
 // =================================================================
 //                             Constructors
 // =================================================================
-ae_codon::ae_codon( void )
+Rna::Rna(GeneticUnit* gen_unit, const Rna &model)
 {
-  _value = -1;
-}
+  // Copy "trivial" attributes
+  gen_unit_  = gen_unit;
 
-ae_codon::ae_codon( const ae_codon &model )
-{
-  _value = model._value;
-}
+  strand_             = model.strand_;
+  pos_                = model.pos_;
+  transcript_length_  = model.transcript_length_;
+  basal_level_        = model.basal_level_;
 
-ae_codon::ae_codon( int8_t value )
-{
-  _value = value;
+  // Copy transcribed proteins
+  // WARNING : Since this list do not "own" the proteins (they will not be deleted)
+  //            proteins must NOT be CREATED here.
+
+  // TODO : Not needed for the moment...
+  // for (const auto& protein: model.transcribed_proteins_)
+  //   transcribed_proteins_.push_back(protein);
 }
 
-ae_codon::ae_codon( ae_dna* dna, ae_strand strand, int32_t index )
+Rna::Rna(GeneticUnit* gen_unit, Strand strand, int32_t pos, int8_t diff)
 {
-  const char* gen = dna->get_data();
-  int32_t     len = dna->get_length();
+  gen_unit_  = gen_unit;
+  strand_ = strand;
+  pos_    = pos;
 
-  _value = 0;
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index+i),len)] == '1' )
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index-i),len)] != '1' ) // == and not != because we are on the complementary strand...
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
+  transcript_length_  = -1;
+  basal_level_        = 1 - (double)diff / (PROM_MAX_DIFF + 1);
 }
 
-ae_codon::ae_codon( gzFile backup_file )
+/*
+Rna::Rna(Rna* parent)
 {
-  gzread( backup_file, &_value,   			sizeof(_value) );
+  gen_unit_           = parent->gen_unit_;
+  strand_             = parent->strand_;
+  pos_                = parent->pos_;
+  transcript_length_  = parent->transcript_length_;
+  basal_level_        = parent->basal_level_;
 }
+*/
 
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_codon::~ae_codon( void )
+Rna::~Rna()
 {
 }
 
 // =================================================================
 //                            Public Methods
 // =================================================================
-void ae_codon::save( gzFile backup_file )
+int32_t Rna::first_transcribed_pos() const
+{
+  if (strand_ == LEADING)
+  {
+    return Utils::mod(pos_ + PROM_SIZE, gen_unit_->dna()->length());
+  }
+  else
+  {
+    return Utils::mod(pos_ - PROM_SIZE, gen_unit_->dna()->length());
+  }
+}
+
+int32_t Rna::last_transcribed_pos() const
 {
-  gzwrite( backup_file, &_value,   			sizeof(_value) );
+  if (strand_ == LEADING)
+  {
+    return Utils::mod(pos_ +  PROM_SIZE + transcript_length_ - 1,
+                       gen_unit_->dna()->length());
+  }
+  else
+  {
+    return Utils::mod(pos_ - (PROM_SIZE + transcript_length_ - 1),
+                       gen_unit_->dna()->length());
+  }
 }
+
 // =================================================================
 //                           Protected Methods
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_codon.h b/src/libaevol/Rna.h
similarity index 54%
rename from src/libaevol/ae_codon.h
rename to src/libaevol/Rna.h
index 7b5d216..7f9cbf7 100644
--- a/src/libaevol/ae_codon.h
+++ b/src/libaevol/Rna.h
@@ -3,30 +3,30 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
- #ifndef __AE_CODON_H__
-#define  __AE_CODON_H__
+#ifndef AEVOL_RNA_H_
+#define AEVOL_RNA_H_
 
 
 // =================================================================
@@ -37,56 +37,75 @@
 
 
 
-
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-#include <ae_dna.h>
-#include <ae_macros.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "Dna.h"
+#include "Utils.h"
+#include "Protein.h"
 
+namespace aevol {
 
 
 
 // =================================================================
 //                          Class declarations
 // =================================================================
+class Individual;
+class GeneticUnit;
 
-
-
-
-
-
-class ae_codon : public ae_object
+class Rna
 {
   public :
 
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_codon( void );
-    ae_codon( const ae_codon &model );
-    ae_codon( int8_t value );
-    ae_codon( ae_dna* genome, ae_strand strand, int32_t index );
-    ae_codon( gzFile backup_file );
+    Rna() = delete;
+    Rna(const GeneticUnit&) = delete;
+    Rna(GeneticUnit* gen_unit, const Rna &model);
+    Rna(GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff);
+    //Rna(Rna* parent);
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_codon( void );
+    virtual ~Rna();
 
     // =================================================================
     //                              Accessors
     // =================================================================
-    inline int8_t get_value( void );
+
+    // <DEBUG>
+    void check(GeneticUnit* gen_unit) { assert(gen_unit == gen_unit_); };
+    //~ void* indiv() const { return (void*)indiv_; };
+    // </DEBUG>
+
+    inline const GeneticUnit * genetic_unit() const;
+    inline void set_genetic_unit(const GeneticUnit*  gen_unit);
+    inline Strand strand() const;
+    inline void       set_strand(Strand strand);
+    inline int32_t    promoter_pos() const;
+    inline void       set_promoter_pos(int32_t pos);
+    inline double     basal_level() const;
+    inline int32_t    transcript_length() const; // The promoter is NOT transcribed.
+    inline void       set_transcript_length(int32_t length);
+    inline bool       is_coding() const;
+
+    inline const std::list<Protein *>& transcribed_proteins() const;
+    inline void clear_transcribed_proteins() { transcribed_proteins_.clear(); };
 
     // =================================================================
     //                            Public Methods
     // =================================================================
-    inline bool is_start( void );
-    inline bool is_stop( void );
-    inline ae_codon* copy( void );
-    void   save( gzFile backup_file );
+    int32_t first_transcribed_pos() const;   // The promoter is NOT transcribed.
+    int32_t last_transcribed_pos() const;    // The terminator is transcribed.
+    inline void add_transcribed_protein(Protein * prot);
+    inline void shift_position(int32_t delta_pos, int32_t genome_length);
 
     // =================================================================
     //                           Public Attributes
@@ -97,20 +116,9 @@ class ae_codon : public ae_object
 
 
   protected :
-
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    //~ ae_codon( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    //~ ae_codon( const ae_codon &model )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
 
     // =================================================================
     //                           Protected Methods
@@ -119,34 +127,88 @@ class ae_codon : public ae_object
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    int8_t _value;
+    const GeneticUnit*  gen_unit_;
+    Strand strand_;
+    int32_t pos_; // Index of the promoter on the genome.
+                  // The promoter itself is NOT transcribed
+                  // The terminator is transcribed.
+    int32_t transcript_length_;
+    double basal_level_;
+
+    // Access list to the proteins transcribed by this rna
+    std::list<Protein*> transcribed_proteins_;
 };
 
 
 // =====================================================================
 //                          Accessors' definitions
 // =====================================================================
-int8_t ae_codon::get_value( void )
+inline const GeneticUnit*Rna::genetic_unit() const
 {
-  return _value;
+  return gen_unit_;
 }
 
-bool ae_codon::is_start( void )
+inline void Rna::set_genetic_unit(const GeneticUnit*  gen_unit)
 {
-  return _value == CODON_START;
+  gen_unit_ = gen_unit;
 }
 
-bool ae_codon::is_stop( void )
+inline Strand Rna::strand() const
 {
-  return _value == CODON_STOP;
+  return strand_;
+}
+
+inline void Rna::set_strand(Strand strand)
+{
+  strand_ = strand;
+}
+
+void Rna::set_promoter_pos(int32_t pos)
+{
+  pos_ = pos;
+}
+
+inline int32_t Rna::promoter_pos() const
+{
+  return pos_;
+}
+
+inline double Rna::basal_level() const
+{
+  return basal_level_;
+}
+
+inline int32_t Rna::transcript_length() const
+{
+  return transcript_length_;
+}
+
+inline void Rna::set_transcript_length(int32_t transcript_length)
+{
+  transcript_length_ = transcript_length;
+}
+
+inline const std::list<Protein *>&Rna::transcribed_proteins() const {
+  return transcribed_proteins_;
+}
+
+inline bool Rna::is_coding() const
+{
+  return (not transcribed_proteins_.empty());
 }
 
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-ae_codon* ae_codon::copy( void )
+void Rna::add_transcribed_protein(Protein * prot)
+{
+  transcribed_proteins_.push_back(prot);
+}
+
+void Rna::shift_position(int32_t delta_pos, int32_t genome_length)
 {
-  return new ae_codon( _value );
+  pos_ = Utils::mod(pos_ + delta_pos, genome_length);
 }
 
-#endif // __AE_CODON_H__
+} // namespace aevol
+#endif // AEVOL_RNA_H_
diff --git a/src/libaevol/SFMT-src-1.4/Makefile.in b/src/libaevol/SFMT-src-1.4/Makefile.in
index 9cdc9f4..9fe5878 100644
--- a/src/libaevol/SFMT-src-1.4/Makefile.in
+++ b/src/libaevol/SFMT-src-1.4/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -20,23 +19,61 @@
 ############################################
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -53,18 +90,29 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 subdir = src/libaevol/SFMT-src-1.4
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 AR = ar
 ARFLAGS = cru
+AM_V_AR = $(am__v_AR_ at AM_V@)
+am__v_AR_ = $(am__v_AR_ at AM_DEFAULT_V@)
+am__v_AR_0 = @echo "  AR      " $@;
+am__v_AR_1 = 
 libsfmt_a_AR = $(AR) $(ARFLAGS)
 libsfmt_a_LIBADD =
 am__dirstamp = $(am__leading_dot)dirstamp
@@ -72,19 +120,51 @@ am__objects_1 =
 am_libsfmt_a_OBJECTS = libsfmt_a-SFMT.$(OBJEXT) \
 	jump/libsfmt_a-SFMT-jump.$(OBJEXT) $(am__objects_1)
 libsfmt_a_OBJECTS = $(am_libsfmt_a_OBJECTS)
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
+AM_V_lt = $(am__v_lt_ at AM_V@)
+am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_ at AM_V@)
+am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(libsfmt_a_SOURCES)
 DIST_SOURCES = $(libsfmt_a_SOURCES)
 am__can_run_installinfo = \
@@ -92,27 +172,47 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -124,6 +224,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -137,6 +239,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -167,14 +270,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -190,6 +301,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -235,7 +347,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libaevol/SFMT-src-1.4/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu src/libaevol/SFMT-src-1.4/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -264,14 +375,15 @@ jump/$(DEPDIR)/$(am__dirstamp):
 	@: > jump/$(DEPDIR)/$(am__dirstamp)
 jump/libsfmt_a-SFMT-jump.$(OBJEXT): jump/$(am__dirstamp) \
 	jump/$(DEPDIR)/$(am__dirstamp)
+
 libsfmt.a: $(libsfmt_a_OBJECTS) $(libsfmt_a_DEPENDENCIES) $(EXTRA_libsfmt_a_DEPENDENCIES) 
-	-rm -f libsfmt.a
-	$(libsfmt_a_AR) libsfmt.a $(libsfmt_a_OBJECTS) $(libsfmt_a_LIBADD)
-	$(RANLIB) libsfmt.a
+	$(AM_V_at)-rm -f libsfmt.a
+	$(AM_V_AR)$(libsfmt_a_AR) libsfmt.a $(libsfmt_a_OBJECTS) $(libsfmt_a_LIBADD)
+	$(AM_V_at)$(RANLIB) libsfmt.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
-	-rm -f jump/libsfmt_a-SFMT-jump.$(OBJEXT)
+	-rm -f jump/*.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
@@ -280,85 +392,74 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
 @am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
 @am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 libsfmt_a-SFMT.o: SFMT.c
- at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.o -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='SFMT.c' object='libsfmt_a-SFMT.o' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.o -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='SFMT.c' object='libsfmt_a-SFMT.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.o `test -f 'SFMT.c' || echo '$(srcdir)/'`SFMT.c
 
 libsfmt_a-SFMT.obj: SFMT.c
- at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.obj -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi`
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='SFMT.c' object='libsfmt_a-SFMT.obj' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsfmt_a-SFMT.obj -MD -MP -MF $(DEPDIR)/libsfmt_a-SFMT.Tpo -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsfmt_a-SFMT.Tpo $(DEPDIR)/libsfmt_a-SFMT.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='SFMT.c' object='libsfmt_a-SFMT.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsfmt_a-SFMT.obj `if test -f 'SFMT.c'; then $(CYGPATH_W) 'SFMT.c'; else $(CYGPATH_W) '$(srcdir)/SFMT.c'; fi`
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
 @am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
 @am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 jump/libsfmt_a-SFMT-jump.o: jump/SFMT-jump.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.o -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.o' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.o -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.o `test -f 'jump/SFMT-jump.cpp' || echo '$(srcdir)/'`jump/SFMT-jump.cpp
 
 jump/libsfmt_a-SFMT-jump.obj: jump/SFMT-jump.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.obj -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.obj' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT jump/libsfmt_a-SFMT-jump.obj -MD -MP -MF jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Tpo jump/$(DEPDIR)/libsfmt_a-SFMT-jump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='jump/SFMT-jump.cpp' object='jump/libsfmt_a-SFMT-jump.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsfmt_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jump/libsfmt_a-SFMT-jump.obj `if test -f 'jump/SFMT-jump.cpp'; then $(CYGPATH_W) 'jump/SFMT-jump.cpp'; else $(CYGPATH_W) '$(srcdir)/jump/SFMT-jump.cpp'; fi`
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -370,15 +471,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -387,6 +484,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -528,19 +640,21 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-noinstLIBRARIES ctags distclean distclean-compile \
-	distclean-generic distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+	clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
 	uninstall-am
 
+.PRECIOUS: Makefile
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/libaevol/Selection.cpp b/src/libaevol/Selection.cpp
new file mode 100644
index 0000000..e1fe4a1
--- /dev/null
+++ b/src/libaevol/Selection.cpp
@@ -0,0 +1,759 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "Selection.h"
+
+#include <math.h>
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#ifdef __TBB
+#include <tbb/task_group.h>
+#include <tbb/parallel_sort.h>
+#endif
+
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include "ExpManager.h"
+#include "VisAVis.h"
+
+#ifdef __NO_X
+  #ifndef __REGUL
+    #include "Individual.h"
+  #else
+    #include "raevol/Individual_R.h"
+  #endif
+#elif defined __X11
+  #ifndef __REGUL
+    #include "Individual_X11.h"
+  #else
+    #include "raevol/Individual_R_X11.h"
+  #endif
+#endif
+
+
+namespace aevol {
+
+
+//##############################################################################
+//
+//                              Class Selection
+//
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Selection::Selection(ExpManager* exp_m) {
+  exp_m_ = exp_m;
+
+  // ----------------------------------------- Pseudo-random number generator
+  prng_ = NULL;
+
+  // -------------------------------------------------------------- Selection
+  selection_scheme_   = RANK_EXPONENTIAL;
+  selection_pressure_ = 0.998;
+
+  // --------------------------- Probability of reproduction of each organism
+  prob_reprod_ = NULL;
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Selection::~Selection() {
+  delete [] prob_reprod_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void Selection::step_to_next_generation() {
+  // To create the new generation, we must create nb_indivs new individuals
+  // (offspring) and "kill" the existing ones.
+  // The number of offspring on a given individual will be given by a stochastic
+  // process biased on it's fitness value (the selection process).
+  // There are 3 possible selection schemes :
+  //    * Linear Ranking
+  //    * Exponential Ranking
+  //    * Fitness proportionate
+  //
+  // Whichever method is chosen, we will
+  // 1) Compute the probability of reproduction of each individual in the population
+  // 2) Simulate the stochastic process by a multinomial drawing (based upon the probabilities computed in 1)
+  // 3) Make the selected individuals reproduce, thus creating the new generation
+  // 4) Replace the current generation by the newly created one.
+  // 5) Sort the newly created population*
+
+  if (prng_ == NULL) {
+    printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+
+  // -------------------------------------------------------------------------------
+  // 1) Compute the probability of reproduction of each individual in the population
+  // -------------------------------------------------------------------------------
+  #ifndef FIXED_POPULATION_SIZE
+    #error this method is not ready for variable population size
+    compute_local_prob_reprod();
+  #else
+    // The function compute_local_prob_reprod creates and fills the array prob_reprod_, which is telling us the probability of being picked for reproduction according to the rank of an individual in its neighboorhood.
+    // It is only usefull when selection is rank based. When selection scheme is FITNESS_PROPORTIONATE, we do not need to call it.
+    // It shoud only be called once in the simulation and not at each generation. So if prob_reprod_ already exists we do not need to call it.
+    if ((selection_scheme_ != FITNESS_PROPORTIONATE) && (prob_reprod_ == NULL)) {
+      compute_local_prob_reprod();
+    }
+  #endif
+
+  if (prng_ == NULL) {
+    printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+
+  // Create proxies
+  World* world = exp_m_->world();
+  int16_t grid_width  = world->width();
+  int16_t grid_height = world->height();
+  GridCell*** pop_grid = exp_m_->grid();
+
+  // create a temporary grid to store the reproducers
+  Individual *** reproducers = new Individual ** [grid_width];
+  for (int16_t i = 0 ; i < grid_width ; i++) {
+    reproducers[i] = new Individual* [grid_height];
+  }
+
+
+  // Do local competitions
+  for (int16_t x = 0 ; x < grid_width ; x++) {
+    for (int16_t y = 0 ; y < grid_height ; y++) {
+      reproducers[x][y] = do_local_competition(x, y);
+    }
+  }
+
+
+  // TODO : Why is that not *after* the creation of the new population ?
+  // Add the compound secreted by the individuals
+  if (exp_m_->with_secretion()) {
+    for (int16_t x = 0 ; x < grid_width ; x++) {
+      for (int16_t y = 0 ; y < grid_height ; y++) {
+        pop_grid[x][y]->set_compound_amount(
+            pop_grid[x][y]->compound_amount() +
+            pop_grid[x][y]->individual()->fitness_by_feature(SECRETION));
+      }
+    }
+
+    // Diffusion and degradation of compound in the habitat
+    world->update_secretion_grid();
+  }
+
+
+  // Create the new generation
+  std::list<Individual*> old_generation = exp_m_->indivs();;
+
+  #ifndef __TBB
+  std::list<Individual*> new_generation;
+  #ifdef _OPENMP
+  #pragma omp parallel for collapse(2) schedule(dynamic)
+  #endif
+  for (int16_t x = 0 ; x < grid_width ; x++)
+    for (int16_t y = 0 ; y < grid_height ; y++)
+      do_replication(reproducers[x][y], x * grid_height + y, x, y);
+
+  for (int16_t x = 0 ; x < grid_width ; x++)
+    for (int16_t y = 0 ; y < grid_height ; y++)
+      new_generation.emplace_back(pop_grid[x][y]->individual());
+  #else
+  std::vector<Individual*> new_generation;
+  tbb::task_group tgroup;
+
+  for (int16_t x = 0 ; x < grid_width ; x++)
+    for (int16_t y = 0 ; y < grid_height ; y++)
+      tgroup.run([=] {do_replication(reproducers[x][y], x * grid_height + y, x, y);});
+  tgroup.wait();
+
+  for (int16_t x = 0 ; x < grid_width ; x++)
+    for (int16_t y = 0 ; y < grid_height ; y++)
+      new_generation.push_back(pop_grid[x][y]->get_individual());
+
+  #endif
+
+  // delete the temporary grid and the parental generation
+  for (int16_t x = 0 ; x < grid_width ; x++) {
+    delete [] reproducers[x];
+  }
+  delete [] reproducers;
+  for (auto indiv : old_generation) {
+    delete indiv;
+  }
+
+  // Compute the rank of each individual
+  #ifndef __TBB
+  new_generation.sort([](Individual* lhs, Individual* rhs) {
+                       return lhs->fitness() < rhs->fitness();
+                     });
+  #else
+  tbb::parallel_sort(new_generation.begin(),new_generation.end(), [](Individual* lhs, Individual* rhs) {
+      return lhs->get_fitness() < rhs->get_fitness();
+  });
+  #endif
+  int rank = 1;
+  for (Individual* indiv : new_generation) {
+    indiv->set_rank(rank++);
+  }
+
+  // randomly migrate some organisms, if necessary
+  world->MixIndivs();
+
+  PerformPlasmidTransfers();
+
+  // Update the best individual
+  exp_m_->update_best();
+
+  // Notify observers of the end of the generation
+  notifyObservers(END_GENERATION);
+}
+
+void Selection::PerformPlasmidTransfers() {
+  if (exp_m_->with_plasmids() &&
+      ((exp_m_->prob_plasmid_HT() != 0.0) ||
+        (exp_m_->tune_donor_ability() != 0.0) ||
+        (exp_m_->tune_recipient_ability() != 0.0))) {
+    // Create proxies
+    World* world = exp_m_->world();
+    int16_t grid_width  = world->width();
+    int16_t grid_height = world->height();
+
+    int16_t x_offset, y_offset, new_x, new_y;
+
+    // Shuffle the grid:
+    int16_t total_size = ((grid_width)*(grid_height));
+    int16_t** shuffled_table = new int16_t* [total_size];
+    for (int16_t z = 0 ; z < total_size ; z++) {
+      shuffled_table[z] = new int16_t[2];
+      int16_t quotient = z / grid_width;
+      int16_t remainder = z % grid_width;
+      shuffled_table[z][0] = (int16_t) remainder;
+      shuffled_table[z][1] = (int16_t) quotient;
+    }
+
+    for (int16_t z = 0 ;z < total_size - 1 ; z++) {
+      int16_t rand_nb = prng_->random((int16_t) (total_size-z));
+      int16_t* tmp=shuffled_table[z+rand_nb];
+      shuffled_table[z+rand_nb]=shuffled_table[z];
+      shuffled_table[z]=tmp;
+    }
+
+
+    // First transfer all the plasmids, but just add them at the end of the list of the GUs
+    for (int16_t z = 0 ; z < total_size ; z++) { // for each individual x
+      int16_t x=shuffled_table[z][0];
+      int16_t y=shuffled_table[z][1];
+
+      for (int16_t n = 0 ; n < 9 ; n++) { // for each neighbour n of x
+        x_offset = (n / 3) - 1;
+        y_offset = (n % 3) - 1;
+
+        new_x = (x+x_offset+grid_width) % grid_width;
+        new_y = (y+y_offset+grid_height) % grid_height;
+
+        if ((new_x != x)||(new_y != y)) {
+          double ptransfer = exp_m_->prob_plasmid_HT() + exp_m_->tune_donor_ability()
+                            * world->indiv_at(x, y)->fitness_by_feature(DONOR)
+                            +
+            exp_m_->tune_recipient_ability() * world->indiv_at(new_x, new_y)->fitness_by_feature(RECIPIENT) ;
+          if (prng_->random() < ptransfer) { // will x give a plasmid to n ?
+            if (exp_m_->swap_GUs()) {
+              world->indiv_at(new_x, new_y)->inject_2GUs(world->indiv_at(x, y));
+            }
+            else {
+              world->indiv_at(new_x, new_y)->inject_GU(world->indiv_at(x, y));
+            }
+          }
+        }
+      }
+    }
+
+    for(int16_t z=0;z <total_size;z++) {
+      delete [] shuffled_table[z];
+    }
+    delete [] shuffled_table;
+
+
+
+    // If an individual has more than 2 GUs, we keep only the first (main chromosome) and the last one
+    // and re-evaluate the individual
+    for (int16_t x = 0 ; x < grid_width ; x++) {
+      for (int16_t y = 0 ; y < grid_height ; y++) {
+        bool reevaluate = (world->indiv_at(x, y)->nb_genetic_units() > 2);
+        world->indiv_at(x, y)->drop_nested_genetic_units();
+        if (reevaluate)
+          world->indiv_at(x, y)->Reevaluate();
+      }
+    }
+  }
+}
+
+/*!
+*/
+void Selection::write_setup_file(gzFile exp_setup_file) const {
+  // ---------------------------------------------------- Selection Parameters
+  int8_t tmp_sel_scheme = selection_scheme_;
+  gzwrite(exp_setup_file, &tmp_sel_scheme,      sizeof(tmp_sel_scheme));
+  gzwrite(exp_setup_file, &selection_pressure_, sizeof(selection_pressure_));
+}
+
+/*!
+*/
+void Selection::save(gzFile& backup_file) const {
+  if (prng_ == NULL) {
+    printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+
+  // ----------------------------------------- Pseudo-random number generator
+  prng_->save(backup_file);
+}
+
+void Selection::load(gzFile& exp_setup_file,
+                     gzFile& backup_file,
+                     bool verbose) {
+  // ---------------------------------------------------- Selection parameters
+  int8_t tmp_sel_scheme;
+  gzread(exp_setup_file, &tmp_sel_scheme, sizeof(tmp_sel_scheme));
+  selection_scheme_ = (SelectionScheme) tmp_sel_scheme;
+  gzread(exp_setup_file, &selection_pressure_, sizeof(selection_pressure_));
+
+  // ----------------------------------------- Pseudo-random number generator
+#if __cplusplus == 201103L
+  prng_ = make_unique<JumpingMT>(backup_file);
+#else
+  prng_ = std::make_unique<JumpingMT>(backup_file);
+#endif
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void Selection::compute_prob_reprod() { // non spatially structured only
+  if (prob_reprod_ != NULL) { // TODO <david.parsons at inria.fr> remove
+    delete [] prob_reprod_;
+  }
+
+  int32_t nb_indivs = exp_m_->nb_indivs();
+  prob_reprod_ = new double[nb_indivs];
+
+  if (selection_scheme_ == RANK_LINEAR) {
+    // The probability of reproduction for an individual is given by
+    // (2-SP + 2 * (SP-1) * (R-1)/(N-1)) / N
+    // With :
+    //      SP : selective pressure. Linear ranking allows values of SP in [1.0, 2.0].
+    //      R  : the rank of the individual in the population (1 for the worst individual)
+    //      N  : the number of individuals in the population
+    //
+    // We can transform this expression into (2-SP)/N + ((2*(SP-1)) / (N*(N-1))) * (R-1)
+    // Furthermore, (R-1) is given directly by <i> (the index of our probability table)
+    //
+    // probs[0] will hence be given by (2-SP)/N
+    // probs[i+1] can then be expressed by probs[i] + (2*(SP-1)) / (N*(N-1))
+
+    double increment = (2 * (selection_pressure_-1)) / (nb_indivs * (nb_indivs-1));
+    prob_reprod_[0]  = (2 - selection_pressure_) / nb_indivs;
+
+    for (int32_t i = 1 ; i < nb_indivs ; i++) {
+      prob_reprod_[i] = prob_reprod_[i-1] + increment;
+    }
+
+    // No need to normalize: The sum is always 1 for linear ranking
+  }
+  else if (selection_scheme_ == RANK_EXPONENTIAL) {
+    // The probability of reproduction for an individual is given by
+    // ((SP-1) * SP^(N-R)) / (SP^N - 1)
+    // Which is equivalent to
+    // ((SP-1) * SP^N) / ((SP^N - 1) * SP^R)
+    // With :
+    //      SP : selective pressure. Exponential ranking allows values of SP in ]0.0, 1.0[
+    //      R  : the rank of the individual in the population (1 for the worst individual)
+    //      N  : the number of individuals in the population
+    //
+    // NB : The only rank-dependent term is SP^R
+    //
+    // Because we don't allow ex-aequo,
+    // probs[i+1] can hence be expressed as (probs[i] / SP)
+    // We will hence compute probs[0] with the original formula and infer the remaining values
+
+    double SP_N = pow(selection_pressure_, nb_indivs); // SP^N
+    prob_reprod_[0] = ((selection_pressure_ - 1) * SP_N) /
+                      ((SP_N - 1) * selection_pressure_);
+
+    for (int32_t i = 1 ; i < nb_indivs ; i++) {
+      prob_reprod_[i] = prob_reprod_[i-1] / selection_pressure_;
+    }
+
+    // No need to normalize: We don't allow ex-aequo
+  }
+  else if (selection_scheme_ == FITNESS_PROPORTIONATE) {
+    // The probability of reproduction for an individual is given by
+    // exp(-SP * gap) / sum of this measure on all individuals
+    //    SP : selective pressure. Fitness proportionate allows values of SP in ]0, +inf[
+    //                             The closer SP to 0, the closer the selection to being linear.
+
+    double* fitnesses = new double[nb_indivs];
+    double  sum       = 0;
+
+    size_t i = 0;
+    for (const auto& indiv: exp_m_->indivs()) {
+      fitnesses[i] = indiv->fitness();
+      sum += fitnesses[i];
+      ++i;
+    }
+
+    for (int32_t i = 0 ; i < nb_indivs ; i++) {
+      prob_reprod_[i] = fitnesses[i] / sum;
+    }
+
+    delete [] fitnesses;
+  }
+  else if (selection_scheme_ == FITTEST) {
+    printf("ERROR, fittest selection scheme is meant to be used for spatially structured populations %s:%d\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+  else {
+    printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+}
+
+void Selection::compute_local_prob_reprod() {
+  int16_t neighborhood_size = 9;
+
+  if (prob_reprod_ != NULL) {
+    printf ("Warning, already defined %s:%d\n", __FILE__, __LINE__);
+    delete [] prob_reprod_;
+  }
+
+  prob_reprod_ = new double[neighborhood_size];
+
+  if (selection_scheme_ == RANK_LINEAR) {
+    double increment = (2 * (selection_pressure_-1)) / (neighborhood_size * (neighborhood_size-1));
+    double init_prob = (2 - selection_pressure_) / neighborhood_size;
+
+    for (int16_t i = 0 ; i < neighborhood_size ; i++) {
+      prob_reprod_[i] = init_prob + increment * i;
+    }
+  }
+  else if (selection_scheme_ == RANK_EXPONENTIAL) {
+    double SP_N = pow(selection_pressure_, neighborhood_size);
+    prob_reprod_[0] = ((selection_pressure_ - 1) * SP_N) /
+    ((SP_N - 1) * selection_pressure_);
+
+    for (int16_t i = 1 ; i < neighborhood_size ; i++) {
+      prob_reprod_[i] =  prob_reprod_[i-1] /  selection_pressure_;
+    }
+  }
+  else if (selection_scheme_ == FITTEST) {
+    for (int16_t i = 0 ; i < neighborhood_size-1 ; i++) {
+      prob_reprod_[i] = 0.;
+    }
+    prob_reprod_[neighborhood_size-1] = 1.;
+  }
+  else if (selection_scheme_ == FITNESS_PROPORTIONATE) {
+    printf("ERROR, this function is not intented to be use with this selection scheme %s:%d\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+  else {
+    printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+}
+
+Individual* Selection::do_replication(Individual* parent, int32_t index) {
+  //Individual* new_indiv = NULL;
+  // ===========================================================================
+  // Copy parent
+  // ===========================================================================
+  #ifdef __NO_X
+    #ifndef __REGUL
+      Individual* new_indiv = new Individual(parent, index, parent->mut_prng(), parent->stoch_prng() );
+    #else
+      Individual_R* new_indiv = new Individual_R(dynamic_cast<Individual_R*>(parent), index, parent->mut_prng(), parent->stoch_prng() );
+    #endif
+  #elif defined __X11
+    #ifndef __REGUL
+      Individual_X11* new_indiv = new Individual_X11(dynamic_cast<Individual_X11 *>(parent), index, parent->mut_prng(), parent->stoch_prng() );
+    #else
+      Individual_R_X11* new_indiv = new Individual_R_X11(dynamic_cast<Individual_R_X11*>(parent), index, parent->mut_prng(), parent->stoch_prng() );
+    #endif
+  #endif
+
+  // Notify observers that a new individual was created from <parent>
+  {
+    Individual* msg[2] = {new_indiv, parent};
+    notifyObservers(NEW_INDIV, msg);
+  }
+
+  // Perform transfer, rearrangements and mutations
+  if (not new_indiv->allow_plasmids()) {
+    const GeneticUnit* chromosome = &new_indiv->genetic_unit_list().front();
+
+    chromosome->dna()->perform_mutations(parent->id());
+  }
+  else { // For each GU, apply mutations
+    // Randomly determine the order in which the GUs will undergo mutations
+    bool inverse_order = (prng_->random((int32_t) 2) < 0.5);
+
+    if (not inverse_order) { // Apply mutations in normal GU order
+      for (const auto& gen_unit: new_indiv->genetic_unit_list()) {
+        gen_unit.dna()->perform_mutations(parent->id());
+      }
+    }
+    else { // Apply mutations in inverse GU order
+      const auto& gul = new_indiv->genetic_unit_list();
+      for (auto gen_unit = gul.crbegin(); gen_unit != gul.crend(); ++gen_unit) {
+        gen_unit->dna()->perform_mutations(parent->id());
+      }
+    }
+  }
+
+  return new_indiv;
+}
+
+Individual* Selection::do_replication(Individual* parent, int32_t index,
+                                      int16_t x, int16_t y) {
+  Individual* new_indiv = do_replication(parent, index);
+
+  // Set the new individual's location on the grid
+  exp_m_->world()->PlaceIndiv(new_indiv, x, y);
+
+  // Evaluate new individual
+  new_indiv->Evaluate();
+
+  // Compute statistics
+  new_indiv->compute_statistical_data();
+
+  // Tell observers the replication is finished
+  new_indiv->notifyObservers(END_REPLICATION, nullptr);
+
+  return new_indiv;
+}
+
+Individual *Selection::do_local_competition (int16_t x, int16_t y) {
+  // This function uses the array prob_reprod_ when selection scheme is
+  // RANK_LINEAR, RANK_EXPONENTIAL, or FITTEST. For these selection schemes,
+  // the function compute_local_prob_reprod (creating the array prob_reprod_)
+  // must have been called before.
+  // When selection scheme is FITNESS_PROPORTIONATE, this function only uses
+  // the fitness values
+
+  World* world = exp_m_->world();
+
+  int16_t neighborhood_size = 9;
+  int16_t grid_width  = world->width();
+  int16_t grid_height = world->height();
+  int16_t cur_x;
+  int16_t cur_y;
+
+  // Build a temporary local array of fitness values
+  double *  local_fit_array   = new double[neighborhood_size];
+  double *  sort_fit_array    = new double[neighborhood_size];
+  int16_t * initial_location  = new int16_t[neighborhood_size];
+  double *  probs             = new double[neighborhood_size];
+  int16_t   count             = 0;
+  double    sum_local_fit     = 0.0;
+
+  for (int8_t i = -1 ; i < 2 ; i++) {
+    for (int8_t j = -1 ; j < 2 ; j++) {
+      cur_x = (x + i + grid_width)  % grid_width;
+      cur_y = (y + j + grid_height) % grid_height;
+      local_fit_array[count]  = world->indiv_at(cur_x, cur_y)->fitness();
+      sort_fit_array[count]   = local_fit_array[count];
+      initial_location[count] = count;
+      sum_local_fit += local_fit_array[count];
+      count++;
+    }
+  }
+
+  // Do the competitions between the individuals, based on one of the 4 methods:
+  // 1. Rank linear
+  // 2. Rank exponential
+  // 3. Fitness proportionate
+  // 4. Fittest individual
+
+  // Any rank based selection
+  switch (selection_scheme_) {
+    case RANK_LINEAR :
+    case RANK_EXPONENTIAL :
+    case FITTEST : {
+      assert(prob_reprod_);
+      // First we sort the local fitness values using bubble sort :
+      // we sort by increasing order, so the first element will have the worst fitness.
+      bool swaped = true;
+      int16_t loop_length = 8;
+      double  tmp_holder;
+      int16_t tmp_holder2;
+      while (swaped == true) {
+        swaped = false;
+        for (int16_t i = 0 ; i < loop_length ; i++) {
+          //if the first is higher than the second,  exchange them
+          if (sort_fit_array[i] > sort_fit_array[i+1]) {
+            tmp_holder = sort_fit_array[i];
+            sort_fit_array[i] = sort_fit_array[i+1];
+            sort_fit_array[i+1] = tmp_holder;
+
+            tmp_holder2 = initial_location[i];
+            initial_location[i] = initial_location[i+1];
+            initial_location[i+1] = tmp_holder2;
+
+            swaped = true;
+          }
+        }
+
+        loop_length = loop_length - 1;
+      }
+
+
+      // Then we use the already computed probabilities
+      for (int16_t i = 0 ; i < neighborhood_size ; i++) {
+        probs[initial_location[i]] = prob_reprod_[i];
+      }
+
+      break;
+    }
+    // Fitness proportionate selection
+    case FITNESS_PROPORTIONATE : {
+      for(int16_t i = 0 ; i < neighborhood_size ; i++) {
+        probs[i] = local_fit_array[i]/sum_local_fit;
+      }
+
+      break;
+    }
+    default : {
+      printf("ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+    }
+  }
+
+
+  // pick one organism to reproduce, based on probs[] calculated above, using roulette selection
+  int8_t found_org = prng_->roulette_random(probs, 9);
+
+  int16_t x_offset = (found_org / 3) - 1;
+  int16_t y_offset = (found_org % 3) - 1;
+
+  delete [] local_fit_array;
+  delete [] sort_fit_array;
+  delete [] initial_location;
+  delete [] probs;
+
+  return world->indiv_at((x+x_offset+grid_width)  % grid_width,
+                             (y+y_offset+grid_height) % grid_height);
+}
+
+#ifdef __TBB
+Individual* Selection::do_replication_tbb(Individual* parent, int32_t index, int16_t x /*= -1 */, int16_t y /*= -1 */ )
+{
+  // ===========================================================================
+  //  1) Copy parent
+  // ===========================================================================
+#ifdef __NO_X
+    #ifndef __REGUL
+      Individual* new_indiv = new Individual(parent, index, parent->get_mut_prng(), parent->get_stoch_prng() );
+    #else
+      Individual_R* new_indiv = new Individual_R(dynamic_cast<Individual_R*>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
+    #endif
+  #elif defined __X11
+#ifndef __REGUL
+      Individual_X11* new_indiv = new Individual_X11(dynamic_cast<Individual_X11 *>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
+    #else
+  Individual_R_X11* new_indiv = new Individual_R_X11(dynamic_cast<Individual_R_X11*>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
+#endif
+#endif
+
+  // Notify observers that a new individual was created from <parent>
+  {
+    Individual* msg[2] = {new_indiv, parent};
+    notifyObservers(NEW_INDIV, msg);
+  }
+
+  // Set the new individual's location on the grid
+  _exp_m->world()->PlaceIndiv(new_indiv, x, y);
+
+  // Perform transfer, rearrangements and mutations
+  if (not new_indiv->get_allow_plasmids())
+  {
+    const GeneticUnit* chromosome = &new_indiv->get_genetic_unit_list().front();
+
+    chromosome->get_dna()->perform_mutations(parent->get_id());
+  }
+  else
+  { // For each GU, apply mutations
+    // Randomly determine the order in which the GUs will undergo mutations
+    bool inverse_order = (new_indiv->get_mut_prng()->random((int32_t) 2) < 0.5);
+
+    if (not inverse_order) { // Apply mutations in normal GU order
+      for (const auto& gen_unit: new_indiv->get_genetic_unit_list()) {
+        gen_unit.get_dna()->perform_mutations(parent->get_id() );
+      }
+    }
+    else { // Apply mutations in inverse GU order
+      const auto& gul = new_indiv->get_genetic_unit_list();
+      for (auto gen_unit = gul.crbegin(); gen_unit != gul.crend(); ++gen_unit) {
+        gen_unit->get_dna()->perform_mutations(parent->get_id());
+      }
+    }
+  }
+
+  // Evaluate new individual
+  new_indiv->Evaluate();
+
+  // Compute statistics
+  new_indiv->compute_statistical_data();
+
+  // Tell observers the replication is finished
+  new_indiv->notifyObservers(END_REPLICATION, nullptr);
+
+  return new_indiv;
+}
+#endif
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_selection.h b/src/libaevol/Selection.h
similarity index 59%
rename from src/libaevol/ae_selection.h
rename to src/libaevol/Selection.h
index 8fecfdf..7e628aa 100644
--- a/src/libaevol/ae_selection.h
+++ b/src/libaevol/Selection.h
@@ -3,89 +3,97 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
-#ifndef __AE_SELECTION_H__
-#define __AE_SELECTION_H__
+#ifndef AEVOL_SELECTION_H_
+#define AEVOL_SELECTION_H_
 
 
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-#include <ae_spatial_structure.h>
+#include "World.h"
+#include "Observable.h"
 
 
+namespace aevol {
 
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
+class ExpManager;
 
 
 
 
 
 
-class ae_selection : public ae_object
+class Selection : public Observable
 {
   public :
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_selection( ae_exp_manager* exp_m );
-    ae_selection( ae_exp_manager* exp_m, gzFile backup_file );
+    Selection() = delete;
+    Selection(const Selection&) = delete;
+    Selection(ExpManager* exp_m);
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_selection( void );
+
+    virtual ~Selection();
 
     // =================================================================
     //                        Accessors: getters
     // =================================================================
-    inline ae_selection_scheme  get_selection_scheme( void ) const;
-    inline double               get_selection_pressure( void ) const;
-    inline double*              get_prob_reprod(void) const;
-    inline ae_jumping_mt*       get_prng(void) const;
+    inline SelectionScheme selection_scheme() const;
+    inline double               selection_pressure() const;
+    inline double*              prob_reprod() const;
+    // inline std::unique_ptr<JumpingMT> prng() const;
 
     // =================================================================
     //                        Accessors: setters
     // =================================================================
     // ----------------------------------------- Pseudo-random number generator
-    inline void set_prng( ae_jumping_mt* prng );
+    inline void set_prng(std::unique_ptr<JumpingMT>&& prng);
 
     // -------------------------------------------------------------- Selection
-    inline void set_selection_scheme( ae_selection_scheme sel_scheme );
-    inline void set_selection_pressure( double sel_pressure );
+    inline void set_selection_scheme(SelectionScheme sel_scheme);
+    inline void set_selection_pressure(double sel_pressure);
 
     // =================================================================
     //                              Operators
@@ -94,19 +102,18 @@ class ae_selection : public ae_object
     // =================================================================
     //                            Public Methods
     // =================================================================
-    void step_to_next_generation( void );
-    void step_to_next_generation_grid( void );
-    void write_setup_file( gzFile setup_file ) const;
-    void write_setup_file( FILE* setup_file ) const;
-    void save( gzFile& backup_file ) const;
-    void load( gzFile& exp_setup_file, gzFile& backup_file, bool verbose );
-    void load( FILE*&  exp_setup_file, gzFile& backup_file, bool verbose );
-    
-    ae_individual* do_replication( ae_individual* parent,
-                                   int32_t index,
-                                   int16_t x = -1,
-                                   int16_t y = -1 );
-    void compute_prob_reprod( void );
+    void step_to_next_generation();
+    void PerformPlasmidTransfers();
+    void write_setup_file(gzFile setup_file) const;
+    void save(gzFile& backup_file) const;
+    void load(gzFile& exp_setup_file, gzFile& backup_file, bool verbose);
+
+    Individual* do_replication(Individual* parent, int32_t index = -1);
+    Individual* do_replication(Individual* parent,
+                               int32_t index,
+                               int16_t x,
+                               int16_t y);
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
@@ -116,94 +123,76 @@ class ae_selection : public ae_object
 
 
   protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_selection( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_selection( const ae_selection &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    //void compute_prob_reprod( void );
-    void compute_local_prob_reprod( void );
-    //ae_individual* do_replication( ae_individual* parent, int32_t index, int16_t x = -1, int16_t y = -1 );
-    ae_individual* calculate_local_competition ( int16_t x, int16_t y );
+    void compute_prob_reprod();
+    void compute_local_prob_reprod();
+    Individual* do_local_competition(int16_t x, int16_t y);
 
     // =======================================================================
     //                             Protected Attributes
     // =======================================================================
-    ae_exp_manager* _exp_m;
-    
+    ExpManager* exp_m_;
+
     // ----------------------------------------- Pseudo-random number generator
-    ae_jumping_mt* _prng;
+    std::unique_ptr<JumpingMT> prng_;
 
     // -------------------------------------------------------------- Selection
-    ae_selection_scheme  _selection_scheme;
-    double               _selection_pressure;
+    SelectionScheme selection_scheme_;
+    double selection_pressure_;
 
     // --------------------------- Probability of reproduction of each organism
-    double* _prob_reprod;
+    double* prob_reprod_;
 };
 
 
 // =====================================================================
 //                           Getters' definitions
 // =====================================================================
-inline ae_jumping_mt* ae_selection::get_prng(void) const
-{
-  return _prng;
-}
+// inline std::unique_ptr<JumpingMT> Selection::prng() const
+// {
+//   return prng_;
+// }
 
-inline ae_selection_scheme ae_selection::get_selection_scheme( void ) const
+inline SelectionScheme Selection::selection_scheme() const
 {
-  return _selection_scheme;
+  return selection_scheme_;
 }
 
-inline double ae_selection::get_selection_pressure( void ) const
+inline double Selection::selection_pressure() const
 {
-  return _selection_pressure;
+  return selection_pressure_;
 }
 
-inline double* ae_selection::get_prob_reprod(void) const
+inline double*Selection::prob_reprod() const
 {
-  if ( _prob_reprod == NULL )
+  if (prob_reprod_ == NULL)
   {
-    printf( "ERROR, _prob_reprod has not been computed %s:%d\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
+    printf("ERROR, prob_reprod_ has not been computed %s:%d\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
   }
-  return _prob_reprod;
+  return prob_reprod_;
 }
 
 // =====================================================================
 //                           Setters' definitions
 // =====================================================================
 // ----------------------------------------- Pseudo-random number generator
-inline void ae_selection::set_prng( ae_jumping_mt* prng )
+inline void Selection::set_prng(std::unique_ptr<JumpingMT>&& prng)
 {
-  if (_prng != NULL) delete _prng;
-  _prng = prng;
+  prng_ = std::move(prng);
 }
 
 // -------------------------------------------------------------- Selection
-inline void ae_selection::set_selection_scheme( ae_selection_scheme sel_scheme )
+inline void Selection::set_selection_scheme(SelectionScheme sel_scheme)
 {
-  _selection_scheme = sel_scheme;
+  selection_scheme_ = sel_scheme;
 }
 
-inline void ae_selection::set_selection_pressure( double sel_pressure )
+inline void Selection::set_selection_pressure(double sel_pressure)
 {
-  _selection_pressure = sel_pressure;
+  selection_pressure_ = sel_pressure;
 }
 
 
@@ -215,5 +204,5 @@ inline void ae_selection::set_selection_pressure( double sel_pressure )
 //                       Inline functions' definition
 // =====================================================================
 
-
-#endif // __AE_SELECTION_H__
+} // namespace aevol
+#endif // AEVOL_SELECTION_H_
diff --git a/src/libaevol/f_line.cpp b/src/libaevol/SmallDeletion.cpp
similarity index 57%
rename from src/libaevol/f_line.cpp
rename to src/libaevol/SmallDeletion.cpp
index 710c0a4..331c239 100644
--- a/src/libaevol/f_line.cpp
+++ b/src/libaevol/SmallDeletion.cpp
@@ -3,74 +3,73 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-//##############################################################################
-//                                                                             #
-//                             Class f_line                                    #
-//                                                                             #
-//##############################################################################
+//
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "SmallDeletion.h"
 
+namespace aevol {
 
-// =================================================================
-//                             Constructors
-// =================================================================
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
+// ============================================================================
+//                                Constructors
+// ============================================================================
+SmallDeletion::SmallDeletion(int32_t pos, int16_t length) :
+    pos_(pos),
+    length_(length) {
+}
 
-f_line::f_line( void )
-{
-  nb_words = 0;
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void SmallDeletion::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = S_DEL;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos_, sizeof(pos_));
+  gzwrite(backup_file, &length_, sizeof(length_));
 }
 
+void SmallDeletion::load(gzFile backup_file) {
+  gzread(backup_file, &pos_, sizeof(pos_));
+  gzread(backup_file, &length_, sizeof(length_));
+}
 
-// =================================================================
-//                             Destructors
-// =================================================================
+void SmallDeletion::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos_, -1, -1, -1, -1, -1, -1, length_, -1);
+}
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/SmallDeletion.h b/src/libaevol/SmallDeletion.h
new file mode 100644
index 0000000..e2517ed
--- /dev/null
+++ b/src/libaevol/SmallDeletion.h
@@ -0,0 +1,109 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_SMALLDELETION_H_
+#define AEVOL_SMALLDELETION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdint>
+
+#include "LocalMutation.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class SmallDeletion : public LocalMutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  SmallDeletion() = default; //< Default ctor
+  SmallDeletion(const SmallDeletion&) = default; //< Copy ctor
+  SmallDeletion(SmallDeletion&&) = default; //< Move ctor
+  SmallDeletion(int32_t pos, int16_t length);
+
+  virtual Mutation* Clone() const override { return new SmallDeletion(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~SmallDeletion() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  SmallDeletion& operator=(const SmallDeletion& other) = default;
+
+  /// Move assignment
+  SmallDeletion& operator=(SmallDeletion&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return S_DEL;
+  };
+
+  int32_t pos() const {
+    return pos_;
+  };
+
+  int16_t length() const {
+    return length_;
+  };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos_;
+  int16_t length_;
+};
+
+} // namespace aevol
+#endif //AEVOL_SMALLDELETION_H_
diff --git a/src/libaevol/SmallInsertion.cpp b/src/libaevol/SmallInsertion.cpp
new file mode 100644
index 0000000..c72ce8a
--- /dev/null
+++ b/src/libaevol/SmallInsertion.cpp
@@ -0,0 +1,107 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "SmallInsertion.h"
+
+#include <cstring>
+
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+SmallInsertion::SmallInsertion(const SmallInsertion& other) :
+    pos_(other.pos_),
+    length_(other.length_) {
+  seq_ = new char[length_ + 1];
+  memcpy(seq_, other.seq_, length_ + 1);
+}
+
+SmallInsertion::SmallInsertion(int32_t pos, int32_t length, const char* seq) :
+    pos_(pos),
+    length_(length) {
+  seq_ = new char[length_ + 1];
+  memcpy(seq_, seq, length_);
+  seq_[length_] = '\0';
+}
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+SmallInsertion::~SmallInsertion() noexcept {
+  delete [] seq_;
+}
+
+// ============================================================================
+//                                 Operators
+// ============================================================================
+/// Copy assignment
+SmallInsertion& SmallInsertion::operator=(const SmallInsertion& other) {
+  pos_ = other.pos_;
+  length_ = other.length_;
+  seq_ = new char[length_ + 1];
+  memcpy(seq_, other.seq_, length_ + 1);
+
+  return *this;
+}
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void SmallInsertion::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = S_INS;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos_, sizeof(pos_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, seq_, length_ * sizeof(seq_[0]));
+}
+
+void SmallInsertion::load(gzFile backup_file) {
+  gzread(backup_file, &pos_, sizeof(pos_));
+  gzread(backup_file, &length_, sizeof(length_));
+  seq_ = new char[length_ + 1];
+  gzread(backup_file, seq_, length_ * sizeof(seq_[0]));
+}
+
+void SmallInsertion::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos_, -1, -1, -1, -1, -1, -1, length_, -1);
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/SmallInsertion.h b/src/libaevol/SmallInsertion.h
new file mode 100644
index 0000000..7379b72
--- /dev/null
+++ b/src/libaevol/SmallInsertion.h
@@ -0,0 +1,114 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_SMALLINSERTION_H_
+#define AEVOL_SMALLINSERTION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdint>
+
+#include "LocalMutation.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class SmallInsertion : public LocalMutation {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  SmallInsertion() = default; //< Default ctor
+  SmallInsertion(const SmallInsertion&); //< Copy ctor
+  SmallInsertion(SmallInsertion&&) = delete; //< Move ctor
+  SmallInsertion(int32_t pos, int32_t length, const char* seq);
+
+  virtual Mutation* Clone() const override { return new SmallInsertion(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~SmallInsertion() noexcept; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  SmallInsertion& operator=(const SmallInsertion& other);
+
+  /// Move assignment
+  SmallInsertion& operator=(SmallInsertion&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return S_INS;
+  };
+
+  int32_t pos() const {
+    return pos_;
+  };
+
+  int32_t length() const {
+    return length_;
+  };
+
+  char* seq() const {
+    return seq_;
+  };
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos_;
+  int32_t length_;
+  char* seq_;
+};
+
+} // namespace aevol
+#endif //AEVOL_SMALLINSERTION_H_
diff --git a/src/libaevol/StatRecord.cpp b/src/libaevol/StatRecord.cpp
new file mode 100644
index 0000000..db51762
--- /dev/null
+++ b/src/libaevol/StatRecord.cpp
@@ -0,0 +1,939 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <list>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "StatRecord.h"
+
+#include "AeTime.h"
+#include "ExpSetup.h"
+#include "Individual.h"
+#include "GeneticUnit.h"
+#include "ReplicationReport.h"
+#include "DnaReplicationReport.h"
+
+#ifdef __REGUL
+#include "raevol/Rna_R.h"
+#include "raevol/Protein_R.h"
+#include "raevol/Individual_R.h"
+#endif
+
+using std::list;
+
+
+namespace aevol {
+
+
+
+//##############################################################################
+//                                                                             #
+//                             Class StatRecord                            #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+StatRecord::StatRecord(const StatRecord &model) {
+  pop_size_  = model.pop_size_;
+
+  metabolic_error_         = model.metabolic_error_;
+  metabolic_fitness_       = model.metabolic_fitness_;
+  parent_metabolic_error_  = model.parent_metabolic_error_;
+
+  secretion_error_         = model.secretion_error_;
+  secretion_fitness_       = model.secretion_fitness_;
+  parent_secretion_error_  = model.parent_secretion_error_;
+
+  compound_amount_   = model.compound_amount_;
+
+  fitness_ = model.fitness_;
+
+  amount_of_dna_                = model.amount_of_dna_;
+  nb_coding_rnas_               = model.nb_coding_rnas_;
+  nb_non_coding_rnas_           = model.nb_non_coding_rnas_;
+  av_size_coding_rnas_          = model.av_size_coding_rnas_;
+  av_size_non_coding_rnas_      = model.av_size_non_coding_rnas_;
+  nb_functional_genes_          = model.nb_functional_genes_;
+  nb_non_functional_genes_      = model.nb_non_functional_genes_;
+  av_size_functional_gene_      = model.av_size_functional_gene_;
+  av_size_non_functional_gene_  = model.av_size_non_functional_gene_;
+
+  nb_mut_    = model.nb_mut_;
+  nb_rear_   = model.nb_rear_;
+  nb_switch_ = model.nb_switch_;
+  nb_indels_ = model.nb_indels_;
+  nb_dupl_   = model.nb_dupl_;
+  nb_del_    = model.nb_del_;
+  nb_trans_  = model.nb_trans_;
+  nb_inv_    = model.nb_inv_;
+
+  dupl_rate_        = model.dupl_rate_;
+  del_rate_         = model.del_rate_;
+  trans_rate_       = model.trans_rate_;
+  inv_rate_         = model.inv_rate_;
+  mean_align_score_ = model.mean_align_score_;
+
+  nb_bases_in_0_CDS_                = model.nb_bases_in_0_CDS_;
+  nb_bases_in_0_functional_CDS_     = model.nb_bases_in_0_functional_CDS_;
+  nb_bases_in_0_non_functional_CDS_ = model.nb_bases_in_0_non_functional_CDS_;
+  nb_bases_in_0_RNA_                = model.nb_bases_in_0_RNA_;
+  nb_bases_in_0_coding_RNA_         = model.nb_bases_in_0_coding_RNA_;
+  nb_bases_in_0_non_coding_RNA_     = model.nb_bases_in_0_non_coding_RNA_;
+
+  nb_bases_non_essential_                     = model.nb_bases_non_essential_;
+  nb_bases_non_essential_including_nf_genes_  = model.nb_bases_non_essential_including_nf_genes_;
+
+  #ifdef __REGUL
+    nb_influences_                 = model.nb_influences_;
+    nb_enhancing_influences_       = model.nb_enhancing_influences_;
+    nb_operating_influences_       = model.nb_operating_influences_;
+    av_value_influences_           = model.av_value_influences_;
+    av_value_enhancing_influences_ = model.av_value_enhancing_influences_;
+    av_value_operating_influences_ = model.av_value_operating_influences_;
+  #endif
+}
+
+StatRecord::StatRecord(ExpSetup* exp_s,
+                       Individual* indiv,
+                       ReplicationReport* replic_report,
+                       chrom_or_gen_unit chrom_or_gu,
+                       bool compute_non_coding) {
+  record_type_ = INDIV;
+
+  // ---------------
+  // Simulation data
+  // ---------------
+  pop_size_ = 0; // The pop_size value is irrelevant when dealing with a single
+                 // individual. It is present for column alignment.
+
+  #ifdef __REGUL
+  int32_t nb_activators = 0;
+  int32_t nb_operators = 0;
+  double mean_activator_activity = 0.0;
+  double mean_operator_activity = 0.0;
+
+  Individual_R* indiv_r = dynamic_cast<Individual_R*>(indiv);
+
+  for (auto& rna: indiv_r->get_rna_list_coding()) {
+    for (unsigned int i = 0; i < ((Rna_R*)rna)->nb_influences(); i++) {
+      //compute the activity
+      if (((Rna_R*)rna)->_enhancing_coef_list[i] > 0)
+      {
+        nb_activators++;
+	      mean_activator_activity += ((Rna_R*)rna)->_enhancing_coef_list[i];
+      }
+
+      if (((Rna_R*)rna)->_operating_coef_list[i] > 0)
+      {
+	      nb_operators++;
+	      mean_operator_activity += ((Rna_R*)rna)->_operating_coef_list[i];
+      }
+    }
+  }
+
+
+  nb_enhancing_influences_       = nb_activators;
+  nb_operating_influences_       = nb_operators;
+  nb_influences_                 = nb_operating_influences_ + nb_enhancing_influences_;
+  av_value_influences_           = ( mean_activator_activity + mean_operator_activity ) / double ( nb_activators + nb_operators);
+  av_value_enhancing_influences_ = ( mean_activator_activity ) / double ( nb_activators );
+  av_value_operating_influences_ = ( mean_operator_activity ) / double ( nb_operators);
+
+  //ajout raevol_yo_2
+  int32_t nb_TF = 0;
+  int32_t nb_pure_TF = 0;
+
+  for (auto& prot: indiv_r->protein_list()) {
+    if(prot->is_functional())
+    {
+      if(!((Protein_R*)prot)->is_TF_)
+      {
+				nb_TF+=1;
+      }
+    }
+    else
+    {
+      if(((Protein_R*)prot)->is_TF_)
+      {
+				nb_TF+=1;
+				nb_pure_TF+=1;
+      }
+    }
+  }
+
+	nb_TF_ = nb_TF;
+	nb_pure_TF_ = nb_pure_TF;
+  #endif  
+    
+  // TODO : These conditions are not well managed!!!
+  if (indiv->nb_genetic_units() == 1) {
+    // -------------------------------------------------
+    // Compute statistical data for the given individual
+    // -------------------------------------------------
+    if (compute_non_coding)
+      indiv->compute_non_coding();
+
+    const GeneticUnit& gen_unit = *indiv->genetic_unit_list().begin();
+
+    // Metabolic error stats
+    metabolic_error_ = indiv->dist_to_target_by_feature(METABOLISM);
+    metabolic_fitness_ = indiv->fitness_by_feature(METABOLISM);
+    parent_metabolic_error_ = (replic_report != NULL) ?
+                              replic_report->parent_metabolic_error() :
+                              0.0;
+
+    // Fitness
+    fitness_ = indiv->fitness();
+
+    // Secretion stats
+    if (exp_s->with_secretion()) {
+       secretion_error_   = indiv->dist_to_target_by_feature(SECRETION);
+       secretion_fitness_ = indiv->fitness_by_feature(SECRETION);
+       compound_amount_   = indiv->grid_cell()->compound_amount();
+       parent_secretion_error_ = 0.0;
+
+      if (replic_report != NULL)
+      {
+        parent_secretion_error_ = replic_report->parent_secretion_error();
+      }
+    }
+    else
+    {
+      secretion_error_   = 0.0;
+      secretion_fitness_ = 0.0;
+      compound_amount_   = 0.0;
+      parent_secretion_error_ = 0.0;
+    }
+
+    // Genes and RNA stats
+    amount_of_dna_               = gen_unit.dna()->length();
+    nb_coding_rnas_              = gen_unit.nb_coding_RNAs();
+    nb_non_coding_rnas_          = gen_unit.nb_non_coding_RNAs();
+    av_size_coding_rnas_         = gen_unit.av_size_coding_RNAs();
+    av_size_non_coding_rnas_     = gen_unit.av_size_non_coding_RNAs();
+    nb_functional_genes_         = gen_unit.nb_functional_genes();
+    nb_non_functional_genes_     = gen_unit.nb_non_functional_genes();
+    av_size_functional_gene_     = gen_unit.av_size_functional_genes();
+    av_size_non_functional_gene_ = gen_unit.av_size_non_functional_genes();
+
+    // Non coding stats
+    if (compute_non_coding) {
+      nb_bases_in_0_CDS_                = gen_unit.nb_bases_in_0_CDS();
+      nb_bases_in_0_functional_CDS_     = gen_unit.nb_bases_in_0_functional_CDS();
+      nb_bases_in_0_non_functional_CDS_ = gen_unit.nb_bases_in_0_non_functional_CDS();
+      nb_bases_in_0_RNA_                = gen_unit.nb_bases_in_0_RNA();
+      nb_bases_in_0_coding_RNA_         = gen_unit.nb_bases_in_0_coding_RNA();
+      nb_bases_in_0_non_coding_RNA_     = gen_unit.nb_bases_in_0_non_coding_RNA();
+
+      nb_bases_non_essential_                     = gen_unit.nb_bases_non_essential();
+      nb_bases_non_essential_including_nf_genes_  = gen_unit.nb_bases_non_essential_including_nf_genes();
+    }
+
+    // Mutation stats
+    if (replic_report != NULL)
+    {
+      nb_mut_    = replic_report->nb(S_MUT);
+      nb_rear_   = replic_report->nb(REARR);
+      nb_switch_ = replic_report->nb(SWITCH);
+      nb_indels_ = replic_report->nb(INDEL);
+      nb_dupl_   = replic_report->nb(DUPL);
+      nb_del_    = replic_report->nb(DEL);
+      nb_trans_  = replic_report->nb(TRANS);
+      nb_inv_    = replic_report->nb(INV);
+
+      // Rearrangement rate stats
+      int32_t parent_genome_size = replic_report->parent_genome_size();
+      dupl_rate_  = nb_dupl_  / parent_genome_size;
+      del_rate_   = nb_del_   / parent_genome_size;
+      trans_rate_ = nb_trans_ / parent_genome_size;
+      inv_rate_   = nb_inv_   / parent_genome_size;
+
+      //~ // <DEBUG>
+      //~ if (nb_dupl_ + nb_del_ + nb_trans_ + nb_inv_ != 0)
+      //~ {
+        //~ printf("nb_dupl_ : %"PRId32"\n_nb_del : %"PRId32"\n_nb_trans : %"PRId32"\n_nb_inv : %"PRId32"\n",
+                //~ (int32_t) nb_dupl_, (int32_t) nb_del_, (int32_t) nb_trans_, (int32_t) nb_inv_);
+        //~ printf("parent genome size : %"PRId32"\n", parent_genome_size);
+        //~ printf("dupl_rate_ : %f\n_del_rate : %f\n_trans_rate : %f\n_inv_rate : %f\n",
+                //~ dupl_rate_, del_rate_, trans_rate_, inv_rate_);
+        //~ getchar();
+      //~ }
+      //~ // </DEBUG>
+
+      mean_align_score_ = replic_report->mean_align_score();
+    }
+  }
+  else if (chrom_or_gu == ALL_GU)
+  {
+    // -------------------------------------------------
+    // Compute statistical data for the given individual
+    // -------------------------------------------------
+    // Metabolic error stats
+    metabolic_error_ = (double) indiv->dist_to_target_by_feature(METABOLISM);
+    metabolic_fitness_ = (double) indiv->fitness_by_feature(METABOLISM);
+    parent_metabolic_error_ = (replic_report != NULL) ? replic_report->parent_metabolic_error() : 0.0;
+
+    // Fitness
+    fitness_ = indiv->fitness();
+
+    // Secretion stats
+    if (exp_s->with_secretion()) {
+       secretion_error_ = (double) indiv->dist_to_target_by_feature(SECRETION);
+       secretion_fitness_ = (double) indiv->fitness_by_feature(SECRETION);
+       compound_amount_   = (double) indiv->grid_cell()->compound_amount();
+       parent_secretion_error_ = 0.0;
+
+      if (replic_report != NULL)
+      {
+        parent_secretion_error_ = replic_report->parent_secretion_error();
+      }
+    }
+    else
+    {
+      secretion_error_   = 0.0;
+      secretion_fitness_ = 0.0;
+      compound_amount_   = 0.0;
+      parent_secretion_error_ = 0.0;
+    }
+
+    for (auto& gen_unit: indiv->genetic_unit_list_nonconst()) {
+      // Genes and RNA stats
+      amount_of_dna_               += gen_unit.dna()->length();
+      nb_coding_rnas_              += gen_unit.nb_coding_RNAs();
+      nb_non_coding_rnas_          += gen_unit.nb_non_coding_RNAs();
+      av_size_coding_rnas_         += gen_unit.av_size_coding_RNAs();
+      av_size_non_coding_rnas_     += gen_unit.av_size_non_coding_RNAs();
+      nb_functional_genes_         += gen_unit.nb_functional_genes();
+      nb_non_functional_genes_     += gen_unit.nb_non_functional_genes();
+      av_size_functional_gene_     += gen_unit.av_size_functional_genes();
+      av_size_non_functional_gene_ += gen_unit.av_size_non_functional_genes();
+
+      // Non coding stats
+      if (compute_non_coding)
+      {
+        nb_bases_in_0_CDS_                += gen_unit.nb_bases_in_0_CDS();
+        nb_bases_in_0_functional_CDS_     += gen_unit.nb_bases_in_0_functional_CDS();
+        nb_bases_in_0_non_functional_CDS_ += gen_unit.nb_bases_in_0_non_functional_CDS();
+        nb_bases_in_0_RNA_                += gen_unit.nb_bases_in_0_RNA();
+        nb_bases_in_0_coding_RNA_         += gen_unit.nb_bases_in_0_coding_RNA();
+        nb_bases_in_0_non_coding_RNA_     += gen_unit.nb_bases_in_0_non_coding_RNA();
+
+        nb_bases_non_essential_                     += gen_unit.nb_bases_non_essential();
+        nb_bases_non_essential_including_nf_genes_  += gen_unit.nb_bases_non_essential_including_nf_genes();
+      }
+
+      // Mutation stats
+      if (replic_report != NULL)
+      {
+        nb_mut_    += replic_report->nb(S_MUT);
+        nb_rear_   += replic_report->nb(REARR);
+        nb_switch_ += replic_report->nb(SWITCH);
+        nb_indels_ += replic_report->nb(INDEL);
+        nb_dupl_   += replic_report->nb(DUPL);
+        nb_del_    += replic_report->nb(DEL);
+        nb_trans_  += replic_report->nb(TRANS);
+        nb_inv_    += replic_report->nb(INV);
+      }
+    }
+
+    // Rearrangement rate stats
+    if (replic_report != NULL)
+    {
+      int32_t parent_genome_size = replic_report->parent_genome_size();
+      dupl_rate_  = nb_dupl_  / parent_genome_size;
+      del_rate_   = nb_del_   / parent_genome_size;
+      trans_rate_ = nb_trans_ / parent_genome_size;
+      inv_rate_   = nb_inv_   / parent_genome_size;
+      mean_align_score_ = replic_report->mean_align_score();
+    }
+  }
+  else // => We have a multi-GU individual and we want only the main chromosome or only the plasmids
+  // WARNING (TODO) As it is coded, this will work only if there is ONE SINGLE PLASMID!
+  {
+    if (chrom_or_gu != PLASMIDS and chrom_or_gu != CHROM) {
+      printf("%s: error: StatRecord called with inappropriate `chrom_or_gu`\n", __FILE__);
+      exit(EXIT_FAILURE);
+    }
+
+    GeneticUnit& gen_unit = (chrom_or_gu == PLASMIDS) ?
+        *std::next(indiv->genetic_unit_list_nonconst().begin()) :
+        indiv->genetic_unit_list_nonconst().front();
+
+    // -------------------------------------------------
+    // Compute statistical data for the given individual
+    // -------------------------------------------------
+    // Metabolic error stats
+    metabolic_error_ = (double) gen_unit.dist_to_target_by_feature(METABOLISM);
+    metabolic_fitness_ = (double) gen_unit.fitness_by_feature(METABOLISM);
+    parent_metabolic_error_ = (replic_report != NULL) ? replic_report->parent_metabolic_error() : 0.0;
+
+    // Fitness
+    fitness_ = indiv->fitness();
+
+    // Secretion stats
+    if (exp_s->with_secretion()) {
+       secretion_error_ = (double) gen_unit.dist_to_target_by_feature(SECRETION);
+       secretion_fitness_ = (double) gen_unit.fitness_by_feature(SECRETION);
+       compound_amount_   = (double) indiv->grid_cell()->compound_amount();
+       parent_secretion_error_ = 0.0;
+
+      if (replic_report != NULL)
+      {
+        parent_secretion_error_ = replic_report->parent_secretion_error();
+      }
+    }
+    else
+    {
+      secretion_error_   = 0.0;
+      secretion_fitness_ = 0.0;
+      compound_amount_   = 0.0;
+      parent_secretion_error_ = 0.0;
+    }
+
+      // Genes and RNA stats
+    amount_of_dna_               = gen_unit.dna()->length();
+    nb_coding_rnas_              = gen_unit.nb_coding_RNAs();
+    nb_non_coding_rnas_          = gen_unit.nb_non_coding_RNAs();
+    av_size_coding_rnas_         = gen_unit.av_size_coding_RNAs();
+    av_size_non_coding_rnas_     = gen_unit.av_size_non_coding_RNAs();
+    nb_functional_genes_         = gen_unit.nb_functional_genes();
+    nb_non_functional_genes_     = gen_unit.nb_non_functional_genes();
+    av_size_functional_gene_     = gen_unit.av_size_functional_genes();
+    av_size_non_functional_gene_ = gen_unit.av_size_non_functional_genes();
+
+      // Non coding stats
+    if (compute_non_coding)
+    {
+      nb_bases_in_0_CDS_                  = gen_unit.nb_bases_in_0_CDS();
+      nb_bases_in_0_functional_CDS_       = gen_unit.nb_bases_in_0_functional_CDS();
+      nb_bases_in_0_non_functional_CDS_   = gen_unit.nb_bases_in_0_non_functional_CDS();
+      nb_bases_in_0_RNA_                  = gen_unit.nb_bases_in_0_RNA();
+      nb_bases_in_0_coding_RNA_           = gen_unit.nb_bases_in_0_coding_RNA();
+      nb_bases_in_0_non_coding_RNA_       = gen_unit.nb_bases_in_0_non_coding_RNA();
+
+      nb_bases_non_essential_                     = gen_unit.nb_bases_non_essential();
+      nb_bases_non_essential_including_nf_genes_  = gen_unit.nb_bases_non_essential_including_nf_genes();
+    }
+
+    // Mutation stats
+    // TODO <david.parsons at inria.fr> Disabled
+//    if (gen_unit.dna()->replication_report() != NULL)
+//    {
+//      nb_mut_    = gen_unit.dna()->replication_report()->nb(S_MUT);
+//      nb_rear_   = gen_unit.dna()->replication_report()->nb(REARR);
+//      nb_switch_ = gen_unit.dna()->replication_report()->nb(SWITCH);
+//      nb_indels_ = gen_unit.dna()->replication_report()->nb(INDEL);
+//      nb_dupl_   = gen_unit.dna()->replication_report()->nb(DUPL);
+//      nb_del_    = gen_unit.dna()->replication_report()->nb(DEL);
+//      nb_trans_  = gen_unit.dna()->replication_report()->nb(TRANS);
+//      nb_inv_    = gen_unit.dna()->replication_report()->nb(INV);
+//    }
+
+    // Rearrangement rate stats
+    if (replic_report != NULL)
+    {
+      int32_t parent_genome_size = replic_report->parent_genome_size();
+      dupl_rate_  = nb_dupl_  / parent_genome_size;
+      del_rate_   = nb_del_   / parent_genome_size;
+      trans_rate_ = nb_trans_ / parent_genome_size;
+      inv_rate_   = nb_inv_   / parent_genome_size;
+      mean_align_score_ = replic_report->mean_align_score();
+    }
+  }
+}
+
+// Calculate average statistics for all the recorded values
+StatRecord::StatRecord(ExpSetup* exp_s,
+                       std::list<std::pair<Individual*,
+                           ReplicationReport*>> annotated_indivs,
+                       chrom_or_gen_unit chrom_or_gu) {
+  record_type_ = POP;
+
+  // ---------------
+  // Simulation data
+  // ---------------
+  pop_size_ = static_cast<int32_t>(annotated_indivs.size());
+
+  // ------------------------------------------------------------------
+  // Compute statistical data for the each individual in the population
+  // ------------------------------------------------------------------
+  for (const auto& annotated_indiv : annotated_indivs) {
+    StatRecord indiv_stat_record(exp_s,
+                                 annotated_indiv.first,
+                                 annotated_indiv.second,
+                                 chrom_or_gu, false);
+    this->add(&indiv_stat_record, annotated_indiv.first->id());
+  }
+
+
+  // ------------------------------------------------------------------
+  // Divide every accumulator by the number of indivs in the population
+  // ------------------------------------------------------------------
+  this->divide(pop_size_);
+}
+
+// Calculate standard deviation for all the recorded values
+StatRecord::StatRecord(ExpSetup* exp_s,
+                       std::list<std::pair<Individual*,
+                           ReplicationReport*>> annotated_indivs,
+                       const StatRecord * means,
+                       chrom_or_gen_unit chrom_or_gu) {
+  record_type_ = STDEVS;
+
+  // ---------------
+  // Simulation data
+  // ---------------
+  pop_size_ = static_cast<int32_t>(annotated_indivs.size());
+
+  // ------------------------------------------------------------------
+  // Compute statistical data for the each individual in the population
+  // ------------------------------------------------------------------
+  for (const auto& annotated_indiv : annotated_indivs) {
+    StatRecord indiv_stat_record(exp_s,
+                                 annotated_indiv.first,
+                                 annotated_indiv.second,
+                                 chrom_or_gu, false);
+    this->substract_power(means, &indiv_stat_record, 2);
+  }
+
+  // ---------------------------------------------------------------------------------
+  // Divide every accumulator by the square root of number of indivs in the population
+  // ---------------------------------------------------------------------------------
+  this->divide(pow((pop_size_-1), 0.5));
+}
+
+ // Calculate skewness for all the recorded values
+StatRecord::StatRecord(ExpSetup* exp_s,
+                       std::list<std::pair<Individual*,
+                           ReplicationReport*>> annotated_indivs,
+                       const StatRecord* means,
+                       const StatRecord* stdevs,
+                       chrom_or_gen_unit chrom_or_gu) {
+  record_type_ = SKEWNESS;
+
+  // ---------------
+  // Simulation data
+  // ---------------
+  pop_size_ = static_cast<int32_t>(annotated_indivs.size());
+
+  // ------------------------------------------------------------------
+  // Compute statistical data for the each individual in the population
+  // ------------------------------------------------------------------
+  for (const auto& annotated_indiv : annotated_indivs) {
+    StatRecord indiv_stat_record(exp_s,
+                                 annotated_indiv.first,
+                                 annotated_indiv.second,
+                                 chrom_or_gu, false);
+    this->substract_power(means, &indiv_stat_record, 3);
+  }
+
+  this->divide(-pop_size_);
+
+  this->divide_record(stdevs, 3/2);
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+StatRecord::~StatRecord()
+{
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void StatRecord::write_to_file(FILE* stat_file, stats_type stat_type_to_print) const
+{
+  if (stat_type_to_print == FITNESS_STATS)
+  {
+    fprintf(stat_file,
+        "%" PRId64 " %" PRId32 " %e %" PRId32 " %e %e %e %e %e %e %e",
+        AeTime::time(),
+        pop_size_,
+        fitness_,
+        amount_of_dna_,
+        metabolic_error_,
+        parent_metabolic_error_,
+        metabolic_fitness_,
+        secretion_error_,
+        parent_secretion_error_,
+        secretion_fitness_,
+        compound_amount_);
+    #ifdef __REGUL
+      fprintf(stat_file,
+          " %" PRId32 " %" PRId32 " %" PRId32 " %f %f %f",
+          nb_influences_,
+          nb_enhancing_influences_,
+          nb_operating_influences_,
+          av_value_influences_,
+          av_value_enhancing_influences_,
+          av_value_operating_influences_);
+    #endif
+  }
+  if (stat_type_to_print == MUTATION_STATS)
+  {
+    fprintf(stat_file,
+        "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "",
+        AeTime::time(),
+        nb_mut_,
+        nb_rear_,
+        nb_switch_,
+        nb_indels_,
+        nb_dupl_,
+        nb_del_,
+        nb_trans_,
+        nb_inv_);
+  }
+  if (stat_type_to_print == GENES_STATS)
+  {
+    fprintf(stat_file,
+        "%" PRId64 " %" PRId32 " %" PRId32 " %f %f %" PRId32 " %" PRId32 " %f %f ",
+        AeTime::time(),
+        nb_coding_rnas_,
+        nb_non_coding_rnas_,
+        av_size_coding_rnas_,
+        av_size_non_coding_rnas_,
+        nb_functional_genes_,
+        nb_non_functional_genes_,
+        av_size_functional_gene_,
+        av_size_non_functional_gene_);
+  }
+  if (stat_type_to_print == BP_STATS) {
+    if (record_type_ == INDIV) {
+      fprintf(stat_file,
+              "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "",
+              AeTime::time(),
+              nb_bases_in_0_CDS_,
+              nb_bases_in_0_functional_CDS_,
+              nb_bases_in_0_non_functional_CDS_,
+              nb_bases_in_0_RNA_,
+              nb_bases_in_0_coding_RNA_,
+              nb_bases_in_0_non_coding_RNA_,
+              nb_bases_non_essential_,
+              nb_bases_non_essential_including_nf_genes_);
+    }
+    else // if record_type_ == POP
+    {
+      // TO DO (if needed) : base-pair stats for all individuals, not just for the best one.
+      //
+      // fprintf(stat_file, "%" PRId64 " %f %f %f %f %f %f %f %f",
+      //         AeTime::time(),
+      //         nb_bases_in_0_CDS_,
+      //         nb_bases_in_0_functional_CDS_,
+      //         nb_bases_in_0_non_functional_CDS_,
+      //         nb_bases_in_0_RNA_,
+      //         nb_bases_in_0_coding_RNA_,
+      //         nb_bases_in_0_non_coding_RNA_,
+      //         nb_bases_non_essential_,
+      //         nb_bases_non_essential_including_nf_genes_);
+    }
+  }
+  if (stat_type_to_print == REAR_STATS)
+  {
+    fprintf(stat_file,
+        "%" PRId64 " %e %e %e %e %f",
+        AeTime::time(),
+        dupl_rate_,
+        del_rate_,
+        trans_rate_,
+        inv_rate_,
+        mean_align_score_);
+  }
+
+  fprintf(stat_file, "\n");
+}
+
+void StatRecord::divide(double divisor)
+{
+  // NB : pop_size is a "global" value and must not be divided.
+
+  fitness_                 /= divisor;
+
+  metabolic_error_         /= divisor;
+  parent_metabolic_error_  /= divisor;
+  metabolic_fitness_       /= divisor;
+
+  secretion_error_         /= divisor;
+  parent_secretion_error_  /= divisor;
+
+  secretion_fitness_       /= divisor;
+  compound_amount_         /= divisor;
+
+  amount_of_dna_               /= divisor;
+  nb_coding_rnas_              /= divisor;
+  nb_non_coding_rnas_          /= divisor;
+  av_size_coding_rnas_         /= divisor;
+  av_size_non_coding_rnas_     /= divisor;
+  nb_functional_genes_          /= divisor;
+  nb_non_functional_genes_      /= divisor;
+  av_size_functional_gene_      /= divisor;
+  av_size_non_functional_gene_  /= divisor;
+
+  nb_mut_    /= divisor;
+  nb_rear_   /= divisor;
+  nb_switch_ /= divisor;
+  nb_indels_ /= divisor;
+  nb_dupl_   /= divisor;
+  nb_del_    /= divisor;
+  nb_trans_  /= divisor;
+  nb_inv_    /= divisor;
+
+  //~ printf("PREFINAL %f %f %f %f\n", dupl_rate_, del_rate_, trans_rate_, inv_rate_);
+  dupl_rate_  /= divisor;
+  del_rate_   /= divisor;
+  trans_rate_ /= divisor;
+  inv_rate_   /= divisor;
+  //~ printf("FINAL %f %f %f %f\n", dupl_rate_, del_rate_, trans_rate_, inv_rate_);
+  //~ getchar();
+  mean_align_score_ /= divisor;
+
+  nb_bases_in_0_CDS_                /= divisor;
+  nb_bases_in_0_functional_CDS_     /= divisor;
+  nb_bases_in_0_non_functional_CDS_ /= divisor;
+  nb_bases_in_0_RNA_                /= divisor;
+  nb_bases_in_0_coding_RNA_         /= divisor;
+  nb_bases_in_0_non_coding_RNA_     /= divisor;
+
+  nb_bases_non_essential_                     /= divisor;
+  nb_bases_non_essential_including_nf_genes_  /= divisor;
+
+  #ifdef __REGUL
+    nb_influences_                 /= divisor;
+    nb_enhancing_influences_       /= divisor;
+    nb_operating_influences_       /= divisor;
+    av_value_influences_           /= divisor;
+    av_value_enhancing_influences_ /= divisor;
+    av_value_operating_influences_ /= divisor;
+  #endif
+}
+
+
+void StatRecord::divide_record(const StatRecord* to_divide, double power) {
+  // NB : pop_size is a "global" value and must not be divided.
+
+  if (to_divide->fitness_ != 0) { fitness_    /= pow(to_divide->fitness_, power); }
+
+  if (to_divide->metabolic_error_ != 0)        { metabolic_error_         /= pow(to_divide->metabolic_error_, power); }
+  if (to_divide->parent_metabolic_error_ != 0) { parent_metabolic_error_  /= pow(to_divide->parent_metabolic_error_, power); }
+  if (to_divide->metabolic_fitness_ != 0)        { metabolic_fitness_         /= pow(to_divide->metabolic_fitness_, power); }
+
+  if (to_divide->secretion_error_ != 0)        { secretion_error_         /= pow(to_divide->secretion_error_, power); }
+  if (to_divide->parent_secretion_error_ != 0) { parent_secretion_error_  /= pow(to_divide->parent_secretion_error_, power); }
+
+  if (to_divide->secretion_fitness_ != 0)       { secretion_fitness_       /= pow(to_divide->secretion_fitness_, power); }
+  if (to_divide->compound_amount_ != 0)        { compound_amount_         /= pow(to_divide->compound_amount_, power); }
+
+  if (to_divide->amount_of_dna_ != 0)               { amount_of_dna_               /= pow(to_divide->amount_of_dna_, power); }
+  if (to_divide->nb_coding_rnas_ != 0)              { nb_coding_rnas_              /= pow(to_divide->nb_coding_rnas_, power); }
+  if (to_divide->nb_non_coding_rnas_ != 0)          { nb_non_coding_rnas_          /= pow(to_divide->nb_non_coding_rnas_, power); }
+  if (to_divide->av_size_coding_rnas_ != 0)         { av_size_coding_rnas_         /= pow(to_divide->av_size_coding_rnas_, power); }
+  if (to_divide->av_size_non_coding_rnas_ != 0)     { av_size_non_coding_rnas_     /= pow(to_divide->av_size_non_coding_rnas_, power); }
+  if (to_divide->nb_functional_genes_ != 0)         { nb_functional_genes_         /= pow(to_divide->nb_functional_genes_, power); }
+  if (to_divide->nb_non_functional_genes_ != 0)     { nb_non_functional_genes_     /= pow(to_divide->nb_non_functional_genes_, power); }
+  if (to_divide->av_size_functional_gene_ != 0)     { av_size_functional_gene_     /= pow(to_divide->av_size_functional_gene_, power); }
+  if (to_divide->av_size_non_functional_gene_ != 0) { av_size_non_functional_gene_ /= pow(to_divide->av_size_non_functional_gene_, power); }
+
+  if (to_divide->nb_mut_ != 0)     { nb_mut_    /= pow(to_divide->nb_mut_, power); }
+  if (to_divide->nb_rear_ != 0)    { nb_rear_   /= pow(to_divide->nb_rear_, power); }
+  if (to_divide->nb_switch_ != 0)  { nb_switch_ /= pow(to_divide->nb_switch_, power); }
+  if (to_divide->nb_indels_ != 0)  { nb_indels_ /= pow(to_divide->nb_indels_, power); }
+  if (to_divide->nb_dupl_ != 0)    { nb_dupl_   /= pow(to_divide->nb_dupl_, power); }
+  if (to_divide->nb_del_ != 0)     { nb_del_    /= pow(to_divide->nb_del_, power); }
+  if (to_divide->nb_trans_ != 0)   { nb_trans_  /= pow(to_divide->nb_trans_, power); }
+  if (to_divide->nb_inv_ != 0)     { nb_inv_    /= pow(to_divide->nb_inv_, power); }
+
+  if (to_divide->dupl_rate_ != 0)        { dupl_rate_  /= pow(to_divide->dupl_rate_, power); }
+  if (to_divide->del_rate_ != 0)         { del_rate_   /= pow(to_divide->del_rate_, power); }
+  if (to_divide->trans_rate_ != 0)       { trans_rate_ /= pow(to_divide->trans_rate_, power); }
+  if (to_divide->inv_rate_ != 0)         { inv_rate_   /= pow(to_divide->inv_rate_, power); }
+  if (to_divide->mean_align_score_ != 0) { mean_align_score_ /= pow(to_divide->mean_align_score_, power); }
+
+  if (to_divide->nb_bases_in_0_CDS_ != 0)                { nb_bases_in_0_CDS_                /= pow(to_divide->nb_bases_in_0_CDS_, power); }
+  if (to_divide->nb_bases_in_0_functional_CDS_ != 0)     { nb_bases_in_0_functional_CDS_     /= pow(to_divide->nb_bases_in_0_functional_CDS_, power); }
+  if (to_divide->nb_bases_in_0_non_functional_CDS_ != 0) { nb_bases_in_0_non_functional_CDS_ /= pow(to_divide->nb_bases_in_0_non_functional_CDS_, power); }
+  if (to_divide->nb_bases_in_0_RNA_ != 0)                { nb_bases_in_0_RNA_                /= pow(to_divide->nb_bases_in_0_RNA_, power); }
+  if (to_divide->nb_bases_in_0_coding_RNA_ != 0)         { nb_bases_in_0_coding_RNA_         /= pow(to_divide->nb_bases_in_0_coding_RNA_, power); }
+  if (to_divide->nb_bases_in_0_non_coding_RNA_ != 0)     { nb_bases_in_0_non_coding_RNA_     /= pow(to_divide->nb_bases_in_0_non_coding_RNA_, power); }
+
+  if (to_divide->nb_bases_non_essential_ != 0)                    { nb_bases_non_essential_                     /= pow(to_divide->nb_bases_non_essential_, power); }
+  if (to_divide->nb_bases_non_essential_including_nf_genes_ != 0) { nb_bases_non_essential_including_nf_genes_  /= pow(to_divide->nb_bases_non_essential_including_nf_genes_, power); }
+
+  #ifdef __REGUL
+    if (to_divide->nb_influences_ != 0)                 { nb_influences_                 /= pow(to_divide->nb_influences_, power); }
+    if (to_divide->nb_enhancing_influences_ != 0)       { nb_enhancing_influences_       /= pow(to_divide->nb_enhancing_influences_, power); }
+    if (to_divide->nb_operating_influences_ != 0)       { nb_operating_influences_       /= pow(to_divide->nb_operating_influences_, power); }
+    if (to_divide->av_value_influences_ != 0)           { av_value_influences_           /= pow(to_divide->av_value_influences_, power); }
+    if (to_divide->av_value_enhancing_influences_ != 0) { av_value_enhancing_influences_ /= pow(to_divide->av_value_enhancing_influences_, power); }
+    if (to_divide->av_value_operating_influences_ != 0) { av_value_operating_influences_ /= pow(to_divide->av_value_operating_influences_, power); }
+  #endif
+}
+
+void StatRecord::add(StatRecord * to_add, int32_t index)
+{
+  // NB : pop_size is a global values and must not be summed.
+
+  fitness_                 += to_add->fitness_;
+
+  metabolic_error_         += to_add->metabolic_error_;
+  parent_metabolic_error_  += to_add->parent_metabolic_error_;
+  metabolic_fitness_       += to_add->metabolic_fitness_;
+
+  secretion_error_         += to_add->secretion_error_;
+  parent_secretion_error_  += to_add->parent_secretion_error_;
+
+  secretion_fitness_       += to_add->secretion_fitness_;
+  compound_amount_         += to_add->compound_amount_;
+
+  amount_of_dna_               += to_add->amount_of_dna_;
+  nb_coding_rnas_              += to_add->nb_coding_rnas_;
+  nb_non_coding_rnas_          += to_add->nb_non_coding_rnas_;
+  av_size_coding_rnas_         += to_add->av_size_coding_rnas_;
+  av_size_non_coding_rnas_     += to_add->av_size_non_coding_rnas_;
+  nb_functional_genes_         += to_add->nb_functional_genes_;
+  nb_non_functional_genes_     += to_add->nb_non_functional_genes_;
+  av_size_functional_gene_     += to_add->av_size_functional_gene_;
+  av_size_non_functional_gene_ += to_add->av_size_non_functional_gene_;
+
+  nb_mut_    += to_add->nb_mut_;
+  nb_rear_   += to_add->nb_rear_;
+  nb_switch_ += to_add->nb_switch_;
+  nb_indels_ += to_add->nb_indels_;
+  nb_dupl_   += to_add->nb_dupl_;
+  nb_del_    += to_add->nb_del_;
+  nb_trans_  += to_add->nb_trans_;
+  nb_inv_    += to_add->nb_inv_;
+
+  dupl_rate_  += to_add->dupl_rate_;
+  del_rate_   += to_add->del_rate_;
+  trans_rate_ += to_add->trans_rate_;
+  inv_rate_   += to_add->inv_rate_;
+  //~ printf("%f %f %f %f\n", to_add->dupl_rate_, to_add->del_rate_, to_add->trans_rate_, to_add->inv_rate_);
+  mean_align_score_ += to_add->mean_align_score_;
+
+  nb_bases_in_0_CDS_                += to_add->nb_bases_in_0_CDS_;
+  nb_bases_in_0_functional_CDS_     += to_add->nb_bases_in_0_functional_CDS_;
+  nb_bases_in_0_non_functional_CDS_ += to_add->nb_bases_in_0_non_functional_CDS_;
+  nb_bases_in_0_RNA_                += to_add->nb_bases_in_0_RNA_;
+  nb_bases_in_0_coding_RNA_         += to_add->nb_bases_in_0_coding_RNA_;
+  nb_bases_in_0_non_coding_RNA_     += to_add->nb_bases_in_0_non_coding_RNA_;
+
+  nb_bases_non_essential_                     += to_add->nb_bases_non_essential_;
+  nb_bases_non_essential_including_nf_genes_  += to_add->nb_bases_non_essential_including_nf_genes_;
+
+  #ifdef __REGUL
+    nb_influences_                 += to_add->nb_influences_;
+    nb_enhancing_influences_       += to_add->nb_enhancing_influences_;
+    nb_operating_influences_       += to_add->nb_operating_influences_;
+    av_value_influences_           += to_add->av_value_influences_;
+    av_value_enhancing_influences_ += to_add->av_value_enhancing_influences_;
+    av_value_operating_influences_ += to_add->av_value_operating_influences_;
+  #endif
+}
+
+void StatRecord::substract_power(const StatRecord * means,
+                                     const StatRecord * to_substract,
+                                     double power)
+{
+  // NB : pop_size is a "global" value and must not be summed.
+  fitness_                 += pow(means->fitness_ - to_substract->fitness_, power);
+
+  metabolic_error_         += pow(means->metabolic_error_ - to_substract->metabolic_error_, power);
+  parent_metabolic_error_  += pow(means->parent_metabolic_error_ - to_substract->parent_metabolic_error_, power);
+  metabolic_fitness_         += pow(means->metabolic_fitness_ - to_substract->metabolic_fitness_, power);
+
+  secretion_error_         += pow(means->secretion_error_ - to_substract->secretion_error_, power);
+  parent_secretion_error_  += pow(means->parent_secretion_error_ - to_substract->parent_secretion_error_, power);
+
+  secretion_fitness_       += pow(means->secretion_fitness_ - to_substract->secretion_fitness_, power);
+  compound_amount_         += pow(means->compound_amount_ - to_substract->compound_amount_, power);
+
+  amount_of_dna_               += pow(means->amount_of_dna_ - to_substract->amount_of_dna_, power);
+  nb_coding_rnas_              += pow(means->nb_coding_rnas_ - to_substract->nb_coding_rnas_, power);
+  nb_non_coding_rnas_          += pow(means->nb_non_coding_rnas_ - to_substract->nb_non_coding_rnas_, power);
+  av_size_coding_rnas_         += pow(means->av_size_coding_rnas_ - to_substract->av_size_coding_rnas_, power);
+  av_size_non_coding_rnas_     += pow(means->av_size_non_coding_rnas_ - to_substract->av_size_non_coding_rnas_, power);
+  nb_functional_genes_         += pow(means->nb_functional_genes_ - to_substract->nb_functional_genes_, power);
+  nb_non_functional_genes_     += pow(means->nb_non_functional_genes_ - to_substract->nb_non_functional_genes_, power);
+  av_size_functional_gene_     += pow(means->av_size_functional_gene_ - to_substract->av_size_functional_gene_, power);
+  av_size_non_functional_gene_ += pow(means->av_size_non_functional_gene_ - to_substract->av_size_non_functional_gene_, power);
+
+  nb_mut_    += pow(means->nb_mut_ - to_substract->nb_mut_, power);
+  nb_rear_   += pow(means->nb_rear_ - to_substract->nb_rear_, power);
+  nb_switch_ += pow(means->nb_switch_ - to_substract->nb_switch_, power);
+  nb_indels_ += pow(means->nb_indels_ - to_substract->nb_indels_, power);
+  nb_dupl_   += pow(means->nb_dupl_ - to_substract->nb_dupl_, power);
+  nb_del_    += pow(means->nb_del_ - to_substract->nb_del_, power);
+  nb_trans_  += pow(means->nb_trans_ - to_substract->nb_trans_, power);
+  nb_inv_    += pow(means->nb_inv_ - to_substract->nb_inv_, power);
+
+  dupl_rate_  += pow(means->dupl_rate_ - to_substract->dupl_rate_, power);
+  del_rate_   += pow(means->del_rate_ - to_substract->del_rate_, power);
+  trans_rate_ += pow(means->trans_rate_ - to_substract->trans_rate_, power);
+  inv_rate_   += pow(means->inv_rate_ - to_substract->inv_rate_, power);
+
+  mean_align_score_ += pow(means->mean_align_score_ - to_substract->mean_align_score_, power);
+
+  nb_bases_in_0_CDS_                += pow(means->nb_bases_in_0_CDS_ - to_substract->nb_bases_in_0_CDS_, power);
+  nb_bases_in_0_functional_CDS_     += pow(means->nb_bases_in_0_functional_CDS_ - to_substract->nb_bases_in_0_functional_CDS_, power);
+  nb_bases_in_0_non_functional_CDS_ += pow(means->nb_bases_in_0_non_functional_CDS_ - to_substract->nb_bases_in_0_non_functional_CDS_, power);
+  nb_bases_in_0_RNA_                += pow(means->nb_bases_in_0_RNA_ - to_substract->nb_bases_in_0_RNA_, power);
+  nb_bases_in_0_coding_RNA_         += pow(means->nb_bases_in_0_coding_RNA_ - to_substract->nb_bases_in_0_coding_RNA_, power);
+  nb_bases_in_0_non_coding_RNA_     += pow(means->nb_bases_in_0_non_coding_RNA_ - to_substract->nb_bases_in_0_non_coding_RNA_, power);
+
+  nb_bases_non_essential_                     += pow(means->nb_bases_non_essential_ - to_substract->nb_bases_non_essential_, power);
+  nb_bases_non_essential_including_nf_genes_  += pow(means->nb_bases_non_essential_including_nf_genes_ - to_substract->nb_bases_non_essential_including_nf_genes_, power);
+
+  #ifdef __REGUL
+    nb_influences_                 += pow(means->nb_influences_ - to_substract->nb_influences_, power);
+    nb_enhancing_influences_       += pow(means->nb_enhancing_influences_ - to_substract->nb_enhancing_influences_, power);
+    nb_operating_influences_       += pow(means->nb_operating_influences_ - to_substract->nb_operating_influences_, power);
+    av_value_influences_           += pow(means->av_value_influences_ - to_substract->av_value_influences_, power);
+    av_value_enhancing_influences_ += pow(means->av_value_enhancing_influences_ - to_substract->av_value_enhancing_influences_, power);
+    av_value_operating_influences_ += pow(means->av_value_operating_influences_ - to_substract->av_value_operating_influences_, power);
+  #endif
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_stat_record.h b/src/libaevol/StatRecord.h
similarity index 52%
rename from src/libaevol/ae_stat_record.h
rename to src/libaevol/StatRecord.h
index ffe50a3..098d37c 100644
--- a/src/libaevol/ae_stat_record.h
+++ b/src/libaevol/StatRecord.h
@@ -3,54 +3,62 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
-#ifndef __AE_STAT_RECORD_H__
-#define __AE_STAT_RECORD_H__
+#ifndef AEVOL_STAT_RECORD_H_
+#define AEVOL_STAT_RECORD_H_
 
 
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <list>
+#include "ReplicationReport.h"
+#include "ExpSetup.h"
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
 
 
+namespace aevol {
 
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_exp_manager;
-class ae_stats;
-class ae_individual;
+class ExpManager;
+class Stats;
+class Individual;
 class ae_population;
+class ReplicationReport;
 
 enum indiv_or_pop
 {
@@ -93,25 +101,41 @@ enum stats_type
 
 
 
-class ae_stat_record : public ae_object
+class StatRecord
 {
-  friend class ae_stats;
+  friend class Stats;
   public :
 
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_stat_record( ae_exp_manager* exp_m );
-    ae_stat_record( const ae_stat_record &model );
-    ae_stat_record( ae_exp_manager* exp_m, ae_individual const * indiv, chrom_or_gen_unit chrom_or_gu = CHROM, bool compute_non_coding = true, int32_t num_gener = -1 );
-    ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, chrom_or_gen_unit chrom_or_gu = CHROM );
-    ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, ae_stat_record const * means, chrom_or_gen_unit chrom_or_gu = CHROM );
-    ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, ae_stat_record const * means, ae_stat_record const * stdevs, chrom_or_gen_unit chrom_or_gu = CHROM );
+    StatRecord() = delete;
+    StatRecord(const StatRecord &model);
+    StatRecord(ExpSetup* exp_s,
+               Individual * indiv,
+               ReplicationReport* replic_report,
+               chrom_or_gen_unit chrom_or_gu = CHROM,
+               bool compute_non_coding = true);
+    StatRecord(ExpSetup* exp_s,
+               std::list<std::pair<Individual*,
+                   ReplicationReport*>> annotated_indivs,
+               chrom_or_gen_unit chrom_or_gu = CHROM);
+    StatRecord(ExpSetup* exp_s,
+               std::list<std::pair<Individual*,
+                   ReplicationReport*>> annotated_indivs,
+               const StatRecord * means,
+               chrom_or_gen_unit chrom_or_gu = CHROM);
+    StatRecord(ExpSetup* exp_s,
+               std::list<std::pair<Individual*,
+                   ReplicationReport*>> annotated_indivs,
+               const StatRecord * means,
+               const StatRecord* stdevs,
+               chrom_or_gen_unit chrom_or_gu = CHROM);
 
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_stat_record( void );
+    virtual ~StatRecord();
 
     // =================================================================
     //                              Accessors
@@ -120,15 +144,15 @@ class ae_stat_record : public ae_object
     // =================================================================
     //                            Public Methods
     // =================================================================
-    void initialize_data( void );
-    void write_to_file( FILE* stat_file, stats_type stat_type_to_print ) const;
-    
-    void divide( double divisor );
-    void divide_record( ae_stat_record const * means, double power );
-
-    void add( ae_stat_record* to_add, int32_t index );
-    void substract_power( ae_stat_record const * means, ae_stat_record const * to_substract, double power );
-    
+    void initialize_data();
+    void write_to_file(FILE* stat_file, stats_type stat_type_to_print) const;
+
+    void divide(double divisor);
+    void divide_record(StatRecord const * means, double power);
+
+    void add(StatRecord * to_add, int32_t index);
+    void substract_power(StatRecord const * means, StatRecord const * to_substract, double power);
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
@@ -138,22 +162,6 @@ class ae_stat_record : public ae_object
 
 
   protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_stat_record( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    /*ae_stat_record( const ae_stat_record &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
     // =================================================================
     //                           Protected Methods
     // =================================================================
@@ -161,70 +169,74 @@ class ae_stat_record : public ae_object
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    ae_exp_manager* _exp_m;
-    
     // NB : All the attributes are doubles because they will be used to
     //      compute averages over the population.
-    indiv_or_pop _record_type;
-    
-    double  _num_gener;
-    double  _pop_size;
-
-    double  _fitness;
-
-    double  _metabolic_error;
-    double  _parent_metabolic_error;
-    double  _metabolic_fitness;
-
-    double  _secretion_error;
-    double  _parent_secretion_error;
-    double  _secretion_fitness;
-  
-    double  _compound_amount;
-    
-    double  _amount_of_dna;
-    double  _nb_coding_rnas;
-    double  _nb_non_coding_rnas;
-    double  _av_size_coding_rnas;      // NOT including promoter but including terminator
-    double  _av_size_non_coding_rnas;  // NOT including promoter but including terminator
-    double  _nb_functional_genes;
-    double  _nb_non_functional_genes;
-    double  _av_size_functional_gene;     // NOT including START and STOP codons
-    double  _av_size_non_functional_gene; // NOT including START and STOP codons
-
-    double  _nb_mut;
-    double  _nb_rear;
-    double  _nb_switch;
-    double  _nb_indels;
-    double  _nb_dupl;
-    double  _nb_del;
-    double  _nb_trans;
-    double  _nb_inv;
-    
-    double  _dupl_rate;
-    double  _del_rate;
-    double  _trans_rate;
-    double  _inv_rate;
-    double  _mean_align_score;
-    
-    double  _nb_bases_in_0_CDS;
-    double  _nb_bases_in_0_functional_CDS;
-    double  _nb_bases_in_0_non_functional_CDS;
-    double  _nb_bases_in_0_RNA;
-    double  _nb_bases_in_0_coding_RNA;
-    double  _nb_bases_in_0_non_coding_RNA;
-    
-    double  _nb_bases_non_essential;
-    double  _nb_bases_non_essential_including_nf_genes;
-    
+    indiv_or_pop record_type_;
+
+    int32_t pop_size_ = 0.0;
+
+    double  fitness_ = 0.0;
+
+    double  metabolic_error_ = 0.0;
+    double  parent_metabolic_error_ = 0.0;
+    double  metabolic_fitness_ = 0.0;
+
+    double  secretion_error_ = 0.0;
+    double  parent_secretion_error_ = 0.0;
+    double  secretion_fitness_ = 0.0;
+
+    double  compound_amount_ = 0.0;
+
+    int32_t  amount_of_dna_ = 0.0;
+    int32_t  nb_coding_rnas_ = 0.0;
+    int32_t  nb_non_coding_rnas_ = 0.0;
+
+    // NOT including promoter but including terminator
+    double  av_size_coding_rnas_ = 0.0;
+    double  av_size_non_coding_rnas_ = 0.0;
+
+    int32_t  nb_functional_genes_ = 0.0;
+    int32_t  nb_non_functional_genes_ = 0.0;
+
+    // NOT including START and STOP codons
+    double  av_size_functional_gene_ = 0.0;
+    double  av_size_non_functional_gene_ = 0.0;
+
+    int32_t  nb_mut_ = 0.0;
+    int32_t  nb_rear_ = 0.0;
+    int32_t  nb_switch_ = 0.0;
+    int32_t  nb_indels_ = 0.0;
+    int32_t  nb_dupl_ = 0.0;
+    int32_t  nb_del_ = 0.0;
+    int32_t  nb_trans_ = 0.0;
+    int32_t  nb_inv_ = 0.0;
+
+    double  dupl_rate_ = 0.0;
+    double  del_rate_ = 0.0;
+    double  trans_rate_ = 0.0;
+    double  inv_rate_ = 0.0;
+    double  mean_align_score_ = 0.0;
+
+    int32_t  nb_bases_in_0_CDS_ = 0.0;
+    int32_t  nb_bases_in_0_functional_CDS_ = 0.0;
+    int32_t  nb_bases_in_0_non_functional_CDS_ = 0.0;
+    int32_t  nb_bases_in_0_RNA_ = 0.0;
+    int32_t  nb_bases_in_0_coding_RNA_ = 0.0;
+    int32_t  nb_bases_in_0_non_coding_RNA_ = 0.0;
+
+    int32_t  nb_bases_non_essential_ = 0.0;
+    int32_t  nb_bases_non_essential_including_nf_genes_ = 0.0;
+
     #ifdef __REGUL
-      double  _nb_influences;
-      double  _nb_enhancing_influences;
-      double  _nb_operating_influences;
-      double  _av_value_influences;
-      double  _av_value_enhancing_influences;
-      double  _av_value_operating_influences;
-    #endif
+      int32_t  nb_influences_ = 0.0;
+      int32_t  nb_enhancing_influences_ = 0.0;
+      int32_t  nb_operating_influences_ = 0.0;
+      double  av_value_influences_ = 0.0;
+      double  av_value_enhancing_influences_ = 0.0;
+      double  av_value_operating_influences_ = 0.0;
+      double  nb_TF_;
+      double  nb_pure_TF_;
+#endif
 };
 
 
@@ -236,5 +248,6 @@ class ae_stat_record : public ae_object
 //                       Inline functions' definition
 // =====================================================================
 
+} // namespace aevol
 
-#endif // __AE_STAT_RECORD_H__
+#endif // AEVOL_STAT_RECORD_H_
diff --git a/src/libaevol/Stats.cpp b/src/libaevol/Stats.cpp
new file mode 100644
index 0000000..3be286d
--- /dev/null
+++ b/src/libaevol/Stats.cpp
@@ -0,0 +1,860 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "Stats.h"
+
+#include <string>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "StatRecord.h"
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "Individual.h"
+#include "GeneticUnit.h"
+#ifdef __REGUL
+  #include "raevol/Protein_R.h"
+#endif
+
+using std::string;
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                                Class Stats                               #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+/**
+ * This is a temporary patch for experiment propagation, it shall become
+ * obsolete or need to be adapted when in/out dirs are managed properly
+ */
+Stats::Stats(const string prefix, const string postfix /*= ""*/,
+             bool best_indiv_only /*= false*/) {
+  init_data();
+  set_file_names(prefix, postfix, best_indiv_only);
+}
+
+/**
+ * Create a NEW stat manager
+ */
+Stats::Stats(ExpManager * exp_m,
+             bool best_indiv_only /*= false*/,
+             const string prefix /*= "stat"*/,
+             const string postfix /*= ""*/,
+             bool with_plasmids /*= false*/,
+             bool compute_phen_contrib_by_GU /*= false*/) {
+  exp_m_ = exp_m;
+  init_data();
+  set_file_names(prefix, postfix, best_indiv_only, with_plasmids,
+                 compute_phen_contrib_by_GU);
+  open_files();
+  write_headers();
+}
+
+/**
+ * Create a stat manager to append to existing stats
+ */
+Stats::Stats(ExpManager * exp_m,
+             int64_t time,
+             bool best_indiv_only/* = false */,
+             const string prefix /*= "stat"*/,
+             const string postfix /*= ""*/,
+             bool addition_old_stats /* = true */,
+             bool delete_old_stats /* = true */) {
+  exp_m_ = exp_m;
+  init_data();
+  set_file_names(prefix, postfix, best_indiv_only);
+
+  if (addition_old_stats) {
+    CreateTmpFiles(time);
+    PromoteTmpFiles();
+  }
+  else { // ancstat case
+    open_files();
+    write_headers(true);
+  }
+
+  // Flush the new stat files
+  flush();
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Stats::~Stats() {
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        if(stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) {
+          if (stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr) {
+            fclose(stat_files_[chrom_or_GU][best_or_glob][stat_type]);
+            stat_files_[chrom_or_GU][best_or_glob][stat_type] = nullptr;
+          }
+          delete [] stat_files_names_[chrom_or_GU][best_or_glob][stat_type];
+          stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = nullptr;
+        }
+      }
+
+      delete [] stat_files_[chrom_or_GU][best_or_glob];
+      stat_files_[chrom_or_GU][best_or_glob] = nullptr;
+
+      delete [] stat_files_names_[chrom_or_GU][best_or_glob];
+      stat_files_names_[chrom_or_GU][best_or_glob] = nullptr;
+    }
+
+    delete [] stat_files_[chrom_or_GU];
+    stat_files_[chrom_or_GU] = nullptr;
+
+    delete [] stat_files_names_[chrom_or_GU];
+    stat_files_names_[chrom_or_GU] = nullptr;
+  }
+
+  delete [] stat_files_;
+  stat_files_ = nullptr;
+
+  delete [] stat_files_names_;
+  stat_files_names_ = nullptr;
+}
+
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+
+inline double sqr(double x)
+{
+  return x*x;
+}
+
+inline double rsqr(double x)
+{
+  return (x < 0.00000001) ? 0. : sqrt(x);
+}
+
+
+void Stats::write_headers(bool ancstats_stats /* = false */) {
+  // Column key in the stat files
+  int8_t key;
+
+  // --------------------------------------
+  //  Write headers in FITNESS_STATS files
+  // --------------------------------------
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if(ancstats_stats)
+    {
+      write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], " Lineage individuals fitness statistics ");
+      write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "");
+    }
+    else
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][FITNESS_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], " Fittest individual fitness statistics ");
+        write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][FITNESS_STATS], "");
+      }
+      if (stat_files_names_[chrom_or_GU][GLOB][FITNESS_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], " Average fitness statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][FITNESS_STATS], "");
+      }
+
+      if (stat_files_names_[chrom_or_GU][SDEV][FITNESS_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], " Standard deviation, fitness statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][SDEV][FITNESS_STATS], "");
+      }
+
+      if (stat_files_names_[chrom_or_GU][SKEW][FITNESS_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], " Skewness statistics, fitness over the population ");
+        write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][SKEW][FITNESS_STATS], "");
+      }
+    }
+
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      if (stat_files_names_[chrom_or_GU][best_or_glob][FITNESS_STATS] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS] != nullptr);
+        key = 1;
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Generation", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Population size", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Fitness", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Genome size (amount of DNA)", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic error", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's metabolic error", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic fitness", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion error", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's secretion error", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion fitness", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Amount of compound present in the grid-cell", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Int probe", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Double probe", key++);
+
+        #ifdef __REGUL
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of links in the regulation graph", key++);
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of positive links in the regulation graph", key++);
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of negative links in the regulation graph", key++);
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of links in the regulation graph", key++);
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of positive links in the regulation graph", key++);
+          write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of negative links in the regulation graph", key++);
+        #endif
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][FITNESS_STATS], "");
+      }
+    }
+  }
+
+  // ---------------------------------------
+  //  Write headers in MUTATION_STATS files
+  // ---------------------------------------
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if(ancstats_stats)
+    {
+      write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], " Lineage individuals mutation statistics ");
+      write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "");
+    }
+    else
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][MUTATION_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], " Fittest individual mutation statistics ");
+        write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][MUTATION_STATS], "");
+      }
+      if (stat_files_names_[chrom_or_GU][GLOB][MUTATION_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], " Average mutation statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][MUTATION_STATS], "");
+      }
+    }
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      if (stat_files_names_[chrom_or_GU][best_or_glob][MUTATION_STATS] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS] != nullptr);
+        key = 1;
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Generation", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of local mutations undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of chromosomic rearrangements undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of switch undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of indels undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of duplications undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of deletions undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of translocations undergone", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of inversions undergone", key++);
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][MUTATION_STATS], "");
+      }
+    }
+  }
+
+  // ---------------------------------------
+  //  Write headers in GENES_STATS files
+  // ---------------------------------------
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if(ancstats_stats)
+    {
+      write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], " Lineage individuals gene statistics ");
+      write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "");
+    }
+    else
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][GENES_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], " Fittest individual gene statistics ");
+        write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][GENES_STATS], "");
+      }
+      if (stat_files_names_[chrom_or_GU][GLOB][GENES_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], " Average gene statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][GENES_STATS], "");
+      }
+    }
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      if (stat_files_names_[chrom_or_GU][best_or_glob][GENES_STATS] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS] != nullptr);
+        key = 1;
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Generation", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of coding RNAs (at least one gene on RNA)", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of non-coding RNAs", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of coding RNAs (at least one gene on RNA)", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non-coding RNAs", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Number of functional genes", key++);
+        // Non functional genes are those with width_ == 0 or height_ == 0 or those that lack one kind of codons (M, W or H)
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Nb of non functional genes", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of functional genes", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non functional genes (WARNING : bias towards 0)", key++);
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][GENES_STATS], "");
+      }
+    }
+  }
+
+  // ---------------------------------------
+  //  Write headers in BP_STATS files
+  // ---------------------------------------
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if(ancstats_stats)
+    {
+      write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], " Lineage individuals non-coding statistics ");
+      write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "");
+    }
+    else
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][BP_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], " Fittest individual non-coding statistics ");
+        write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][BP_STATS], "");
+      }
+      if (stat_files_names_[chrom_or_GU][GLOB][BP_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " Average non-coding statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " This data is not available");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], " Computing bp stats for all individuals is extremely costly computationaly");
+        write_header(stat_files_[chrom_or_GU][GLOB][BP_STATS], "");
+
+        // Mark file as "not to be written into" and close it
+        delete [] stat_files_names_[chrom_or_GU][GLOB][BP_STATS];
+        stat_files_names_[chrom_or_GU][GLOB][BP_STATS] = nullptr;
+        fclose(stat_files_[chrom_or_GU][GLOB][BP_STATS]);
+        stat_files_[chrom_or_GU][GLOB][BP_STATS] = nullptr;
+      }
+    }
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      if (stat_files_names_[chrom_or_GU][best_or_glob][BP_STATS] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][best_or_glob][BP_STATS] != nullptr);
+        key = 1;
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Generation", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any CDS", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any functional CDS", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non functional CDS", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any RNA", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any coding RNA", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non coding RNA", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp including non fonctional genes", key++);
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "");
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "NOTE: a bp is considered \"essential\" when it is part of any [functional] CDS");
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "  or any promoter or terminator corresponding to an RNA transcribing a [functional] CDS.");
+        write_header(stat_files_[chrom_or_GU][best_or_glob][BP_STATS], "");
+      }
+    }
+  }
+
+  // ---------------------------------------
+  //  Write headers in REAR_STATS files
+  // ---------------------------------------
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if(ancstats_stats)
+    {
+      write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], " Lineage individuals rearrangement statistics ");
+      write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------");
+      write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "");
+    }
+    else
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][REAR_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], " Fittest individual rearrangement statistics ");
+        write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][BEST][REAR_STATS], "");
+      }
+      if (stat_files_names_[chrom_or_GU][GLOB][REAR_STATS] != nullptr)
+      {
+        write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], " Average rearrangement statistics over the population ");
+        write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------");
+        write_header(stat_files_[chrom_or_GU][GLOB][REAR_STATS], "");
+      }
+    }
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      if (stat_files_names_[chrom_or_GU][best_or_glob][REAR_STATS] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS] != nullptr);
+        key = 1;
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Generation", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual duplication rate", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual deletion rate", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual translocation rate", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Actual inversion rate", key++);
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "Average alignment score (needed score)", key++);
+
+        write_header(stat_files_[chrom_or_GU][best_or_glob][REAR_STATS], "");
+      }
+    }
+  }
+
+  flush();
+}
+
+void Stats::write_current_generation_statistics()
+{
+  StatRecord** stat_records;
+  Individual* best_indiv = exp_m_->best_indiv();
+  ReplicationReport* best_replic_report = exp_m_->tree() ?
+      exp_m_->tree()->report_by_index(AeTime::time(), best_indiv->id()) :
+      nullptr;
+  std::list<std::pair<Individual*, ReplicationReport*>> annotated_indivs =
+      exp_m_->indivs_annotated();
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    if ((not exp_m_->output_m()->compute_phen_contrib_by_GU()) &&
+        chrom_or_GU > ALL_GU) continue;
+
+    stat_records = new StatRecord* [NB_BEST_OR_GLOB];
+
+    // WARNING: stat_record initialization order matters: SKEW computation
+    // relies on SDEV being computed
+    stat_records[BEST] = new StatRecord(exp_m_->exp_s(),
+                                        best_indiv,
+                                        best_replic_report,
+                                        (chrom_or_gen_unit) chrom_or_GU);
+    stat_records[GLOB] = new StatRecord(exp_m_->exp_s(),
+                                        annotated_indivs,
+                                        (chrom_or_gen_unit) chrom_or_GU);
+    stat_records[SDEV] = new StatRecord(exp_m_->exp_s(),
+                                        annotated_indivs,
+                                        stat_records[GLOB],
+                                        (chrom_or_gen_unit) chrom_or_GU);
+    stat_records[SKEW] = new StatRecord(exp_m_->exp_s(),
+                                        annotated_indivs,
+                                        stat_records[GLOB],
+                                        stat_records[SDEV],
+                                        (chrom_or_gen_unit) chrom_or_GU);
+
+    for (int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++)
+    {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++)
+      {
+        if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr)
+        {
+          stat_records[best_or_glob]->
+              write_to_file(stat_files_[chrom_or_GU][best_or_glob][stat_type],
+                            (stats_type) stat_type);
+        }
+      }
+
+      delete stat_records[best_or_glob];
+    }
+
+    delete [] stat_records;
+  }
+}
+
+void Stats::write_statistics_of_this_indiv(Individual * indiv,
+                                           ReplicationReport* replic_report)
+{
+  StatRecord * stat_record;
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++)
+  {
+    stat_record = new StatRecord(exp_m_->exp_s(), indiv, replic_report,
+                                 (chrom_or_gen_unit) chrom_or_GU, true);
+
+    for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++)
+    {
+      if (stat_files_names_[chrom_or_GU][BEST][stat_type] != nullptr)
+      {
+        assert(stat_files_[chrom_or_GU][BEST][stat_type] != nullptr);
+
+        stat_record->write_to_file(stat_files_[chrom_or_GU][BEST][stat_type],
+                                   (stats_type) stat_type);
+      }
+    }
+
+    delete stat_record;
+  }
+}
+
+void Stats::flush() {
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) {
+          assert(stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr);
+          fflush(stat_files_[chrom_or_GU][best_or_glob][stat_type]);
+        }
+      }
+    }
+  }
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+/**
+ * Allocate memory and initialize file handlers and file names to nullptr
+ */
+void Stats::init_data() {
+  stat_files_       = new FILE***[NB_CHROM_OR_GU];
+  stat_files_names_ = new char***[NB_CHROM_OR_GU];
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    stat_files_[chrom_or_GU]        = new FILE**[NB_BEST_OR_GLOB];
+    stat_files_names_[chrom_or_GU]  = new char**[NB_BEST_OR_GLOB];
+
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      stat_files_[chrom_or_GU][best_or_glob] = new FILE*[NB_STATS_TYPES];
+      stat_files_names_[chrom_or_GU][best_or_glob] = new char*[NB_STATS_TYPES];
+
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        stat_files_[chrom_or_GU][best_or_glob][stat_type]       = nullptr;
+        stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = nullptr;
+      }
+    }
+  }
+}
+
+/**
+ * Construct file names
+ */
+// NB: Here is where we "choose" which files we will write.
+//     Files that are not wanted must be left with a nullptr name
+//     (don't new char[] them)
+//     There is an exception though: for the non-coding file for the population,
+//     we will give it a name temporarily so that we can write the warning
+//     headers. Once this is done, the name will be deleted to mark the file as
+//     "not to be written into"
+//
+void Stats::set_file_names(const string prefix,
+                           const string postfix,
+                           bool best_indiv_only,
+                           bool with_plasmids /*= false*/,
+                           bool compute_phen_contrib_by_GU /*= false*/) {
+  // 1) Create stats directory
+  int status;
+  status = mkdir(STATS_DIR, 0755);
+  if ((status == -1) && (errno != EEXIST)) {
+    err(EXIT_FAILURE, STATS_DIR);
+  }
+
+  const char* chrom_or_gu_name[NB_CHROM_OR_GU] =
+      {"", "_chromosome", "_plasmids"};
+  const char* best_or_glob_name[NB_BEST_OR_GLOB] =
+      {"_best", "_glob", "_sdev", "_skew"};
+  const char* stat_type_name[NB_STATS_TYPES] =
+      {"_fitness" ,"_mutation", "_genes", "_bp", "_rear"};
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    // If plasmids are not allowed, don't issue "chromosome" and
+    // "plasmids" files
+    if (not with_plasmids && chrom_or_GU > 0)
+      continue;
+
+    // Idem if COMPUTE_PHEN_CONTRIB_BY_GU not set
+    if ((not compute_phen_contrib_by_GU && chrom_or_GU > ALL_GU))
+      continue;
+
+
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      if (best_indiv_only && best_or_glob != BEST) continue;
+
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        // // We don't want REAR_STATS when rearrangements are done without
+        // alignments
+        // if (stat_type == REAR_STATS && ! exp_m_->with_alignments())
+        //   continue;
+
+        // For now, we only want sdev and skew for fitness data
+        if (best_or_glob > GLOB && stat_type > FITNESS_STATS) continue;
+        if ((chrom_or_GU != ALL_GU || best_or_glob != GLOB) &&
+            stat_type > REAR_STATS) continue;
+
+        stat_files_names_[chrom_or_GU][best_or_glob][stat_type] = new char[255];
+
+        // Construct the correct name
+        if (best_indiv_only) {
+          sprintf(stat_files_names_[chrom_or_GU][best_or_glob][stat_type],
+                  STATS_DIR"/%s%s%s%s.out",
+                  prefix.c_str(),
+                  stat_type_name[stat_type],
+                  chrom_or_gu_name[chrom_or_GU],
+                  postfix.c_str());
+        }
+        else
+        {
+          sprintf(stat_files_names_[chrom_or_GU][best_or_glob][stat_type],
+                  STATS_DIR"/%s%s%s%s%s.out",
+                  prefix.c_str(),
+                  stat_type_name[stat_type],
+                  chrom_or_gu_name[chrom_or_GU],
+                  best_or_glob_name[best_or_glob],
+                  postfix.c_str());
+        }
+
+      }
+    }
+
+  }
+}
+
+/**
+ * Open files that have a non nullptr name
+ */
+void Stats::open_files()
+{
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        if (stat_files_names_[chrom_or_GU][best_or_glob][stat_type] != nullptr) {
+          stat_files_[chrom_or_GU][best_or_glob][stat_type] =
+              fopen(stat_files_names_[chrom_or_GU][best_or_glob][stat_type],
+                    "w");
+        }
+      }
+    }
+  }
+}
+
+/**
+ * Create partial copies (up to a given timestep) of all stat files
+ */
+void Stats::CreateTmpFiles(int64_t time) {
+  char* old_file_name;  // Syntaxic sugar for stat_files_names_[][][]
+  FILE* old_file;
+  char* new_file_name = new char[100];
+  FILE* new_file;
+  char  line[500];
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        old_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type];
+        if (old_file_name != nullptr) {
+          sprintf(new_file_name, "%s.tmp", old_file_name);
+
+          old_file = fopen(old_file_name, "r");
+          new_file = fopen(new_file_name, "w");
+
+          // Copy file header
+          if (fgets(line, 500, old_file) == nullptr) {
+            // TODO check for error
+          }
+
+          while (!feof(old_file) && line[0] == '#') {
+            fputs(line, new_file);
+            if (fgets(line, 500, old_file) == nullptr) {
+              // TODO check for error
+            }
+          }
+
+          // Copy stats until time (included)
+          while ((int64_t)atol(line) <= time && !feof(old_file)) {
+            fputs(line, new_file);
+            if (fgets(line, 500, old_file)) {
+              // TODO check for error
+            }
+          }
+
+          fclose(old_file);
+          fclose(new_file);
+        }
+      }
+    }
+  }
+
+  delete [] new_file_name;
+}
+
+/**
+ * This is a temporary patch for experiment propagation, it shall become
+ * obsolete when in/out dirs are managed properly
+ */
+void Stats::Propagate(const std::string& destdir, int64_t propagated_timestep) {
+  char* old_file_name;  // Syntaxic sugar for stat_files_names_[][][]
+  FILE* old_file;
+  char* new_file_name = new char[255];
+  FILE* new_file;
+  char  line[500];
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        old_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type];
+        if (old_file_name != nullptr) {
+          sprintf(new_file_name, "%s/%s", destdir.c_str(), old_file_name);
+
+          old_file = fopen(old_file_name, "r");
+          new_file = fopen(new_file_name, "w");
+
+          // Copy file header
+          if (fgets(line, 500, old_file) == nullptr) {
+            // TODO check for error
+          }
+
+          while (!feof(old_file) && line[0] == '#') {
+            fputs(line, new_file);
+            if (fgets(line, 500, old_file) == nullptr) {
+              // TODO check for error
+            }
+          }
+
+          // Flush stats until timestep
+          while ((int64_t)atol(line) < propagated_timestep && !feof(old_file)) {
+            if (fgets(line, 500, old_file)) {
+              // TODO check for error
+            }
+          }
+
+          // Write the line for propagated_timestep
+          // after replacing the timestep with 0
+          char new_line[strlen(line)+1];
+          sprintf(new_line, "0%s", strchr(line, ' '));
+          fputs(new_line, new_file);
+
+          fclose(old_file);
+          fclose(new_file);
+        }
+      }
+    }
+  }
+
+  delete [] new_file_name;
+}
+
+/**
+ * Replace all the stat files by their tmp counterpart
+ */
+void Stats::PromoteTmpFiles() {
+  char* cur_file_name;  // Syntaxic sugar for stat_files_names_[][][]
+  char* tmp_file_name = new char[100];
+
+  for (int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++) {
+    for (int8_t best_or_glob = 0 ;
+         best_or_glob < NB_BEST_OR_GLOB ;
+         best_or_glob++) {
+      for (int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++) {
+        cur_file_name = stat_files_names_[chrom_or_GU][best_or_glob][stat_type];
+        if (cur_file_name != nullptr) {
+          sprintf(tmp_file_name, "%s.tmp", cur_file_name);
+
+          remove(cur_file_name);
+          int renameOK = rename(tmp_file_name, cur_file_name);
+          if (renameOK != 0)
+            Utils::ExitWithUsrMsg(string("could not rename file ") +
+                                      tmp_file_name + " into " +
+                                      cur_file_name);
+
+          // Reopen file
+          if (stat_files_[chrom_or_GU][best_or_glob][stat_type] != nullptr)
+            fclose(stat_files_[chrom_or_GU][best_or_glob][stat_type]);
+          stat_files_[chrom_or_GU][best_or_glob][stat_type] =
+              fopen(cur_file_name, "a");
+        }
+      }
+    }
+  }
+
+  delete [] tmp_file_name;
+}
+
+} // namespace aevol
diff --git a/src/libaevol/Stats.h b/src/libaevol/Stats.h
new file mode 100644
index 0000000..4e40ef2
--- /dev/null
+++ b/src/libaevol/Stats.h
@@ -0,0 +1,179 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+/*! \class Stats
+    \brief Manage statistics files
+*/
+
+
+#ifndef AEVOL_STATS_H_
+#define AEVOL_STATS_H_
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <inttypes.h>
+#include <stdio.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "Individual.h"
+#include "ReplicationReport.h"
+
+
+namespace aevol {
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+
+
+
+
+
+
+class Stats {
+ public :
+
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  Stats() = delete;
+  Stats(const Stats&) = delete;
+  Stats(const std::string prefix, const std::string postfix = "",
+        bool best_indiv_only = false);
+  Stats(ExpManager* exp_m,
+        bool best_indiv_only = false,
+        const std::string prefix = "stat",
+        const std::string postfix = "",
+        bool with_plasmids = false,
+        bool compute_phen_contrib_by_GU = false);
+  Stats(ExpManager* exp_m,
+        int64_t time,
+        bool best_indiv_only = false,
+        const std::string prefix = "stat",
+        const std::string postfix = "",
+        bool addition_old_stats = true,
+        bool delete_old_stats = true);
+
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~Stats();
+
+  // =================================================================
+  //                        Accessors: getters
+  // =================================================================
+
+  // =================================================================
+  //                        Accessors: setters
+  // =================================================================
+  inline void set_exp_m(ExpManager * exp_m);
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void write_current_generation_statistics();
+  void write_statistics_of_this_indiv(Individual* indiv,
+                                      ReplicationReport* replic_report);
+
+  void flush();
+
+  void write_headers(bool ancstats_stats = false);
+
+  void CreateTmpFiles(int64_t time);
+  void Propagate(const std::string& destdir, int64_t propagated_timestep);
+  void PromoteTmpFiles();
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  void init_data();
+  void set_file_names(const std::string prefix,
+                      const std::string postfix,
+                      bool best_indiv_only,
+                      bool with_plasmids = false,
+                      bool compute_phen_contrib_by_GU = false);
+  void open_files();
+
+  inline void write_header(FILE* file_name, const char* header);
+  inline void write_header(FILE* file_name, const char* header, int8_t key);
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  ExpManager * exp_m_;
+
+  // 3D tables of stat files (FILE*) and their names (char*)
+  // Dimensions are given by:
+  //    * genetic unit (ALL_GU, CHROM or PLASMIDS)
+  //    * BEST or GLOB
+  //    * stat type (FITNESS_STATS, MUTATION_STATS, GENES_STATS, BP_STATS or REAR_STATS)
+  // Files that are not wanted MUST have their name set to NULL.
+  // The files themselves are also NULL because we don't fopen() them.
+  FILE**** stat_files_;
+  char**** stat_files_names_;
+};
+
+
+// =====================================================================
+//                          Accessors' definitions
+// =====================================================================
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+inline void Stats::set_exp_m(ExpManager * exp_m)
+{
+  exp_m_ = exp_m;
+}
+
+inline void Stats::write_header(FILE* file_name, const char* header)
+{
+  if (file_name != NULL) fprintf(file_name, "# %s\n", header);
+}
+
+inline void Stats::write_header(FILE* file_name, const char* header, int8_t key)
+{
+  if (file_name != NULL) fprintf(file_name, "# %2d. %s\n", key, header);
+}
+
+
+} // namespace aevol
+#endif // AEVOL_STATS_H_
diff --git a/src/libaevol/Translocation.cpp b/src/libaevol/Translocation.cpp
new file mode 100644
index 0000000..ddccf20
--- /dev/null
+++ b/src/libaevol/Translocation.cpp
@@ -0,0 +1,91 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Translocation.h"
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+Translocation::Translocation(int32_t pos1, int32_t pos2, int32_t pos3,
+                             int32_t pos4, int32_t length, bool invert,
+                             int16_t align_score_1, int16_t align_score_2) :
+    pos1_(pos1), pos2_(pos2), pos3_(pos3), pos4_(pos4),
+    length_(length), invert_(invert),
+    align_score_1_(align_score_1), align_score_2_(align_score_2) {
+}
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Translocation::save(gzFile backup_file) const {
+  int8_t tmp_mut_type = TRANS;
+  gzwrite(backup_file, &tmp_mut_type, sizeof(tmp_mut_type));
+  gzwrite(backup_file, &pos1_, sizeof(pos1_));
+  gzwrite(backup_file, &pos2_, sizeof(pos2_));
+  gzwrite(backup_file, &pos3_, sizeof(pos3_));
+  gzwrite(backup_file, &pos4_, sizeof(pos4_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, &invert_, sizeof(invert_));
+  gzwrite(backup_file, &align_score_1_, sizeof(align_score_1_));
+  gzwrite(backup_file, &align_score_2_, sizeof(align_score_2_));
+}
+
+void Translocation::load(gzFile backup_file) {
+  gzread(backup_file, &pos1_, sizeof(pos1_));
+  gzread(backup_file, &pos2_, sizeof(pos2_));
+  gzread(backup_file, &pos3_, sizeof(pos3_));
+  gzread(backup_file, &pos4_, sizeof(pos4_));
+  gzread(backup_file, &length_, sizeof(length_));
+  gzread(backup_file, &invert_, sizeof(invert_));
+  gzread(backup_file, &align_score_1_, sizeof(align_score_1_));
+  gzread(backup_file, &align_score_2_, sizeof(align_score_2_));
+}
+
+void Translocation::generic_description_string(char* str) const {
+  sprintf(str, "%" PRId8 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32
+      " %" PRId8 " %" PRId16 " %" PRId16 " %" PRId32 " %" PRId32,
+          mut_type(), pos1(), pos2(), pos3(), pos4(),
+          invert_ ? 1 : 0, align_score_1(), align_score_2(), length_, -1);
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/Translocation.h b/src/libaevol/Translocation.h
new file mode 100644
index 0000000..7a20553
--- /dev/null
+++ b/src/libaevol/Translocation.h
@@ -0,0 +1,139 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#ifndef AEVOL_TRANSLOCATION_H_
+#define AEVOL_TRANSLOCATION_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+
+#include "Rearrangement.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class Translocation : public Rearrangement {
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Translocation() = default; //< Default ctor
+  Translocation(const Translocation&) = default; //< Copy ctor
+  Translocation(Translocation&&) = delete; //< Move ctor
+
+  Translocation(int32_t pos1, int32_t pos2, int32_t pos3, int32_t pos4,
+                int32_t length,
+                bool invert,
+                int16_t align_score_1 = -1, int16_t align_score_2 = -1);
+
+  virtual Mutation* Clone() const override { return new Translocation(*this); };
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Translocation() noexcept = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  Translocation& operator=(const Translocation& other) = default;
+
+  /// Move assignment
+  Translocation& operator=(Translocation&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void save(gzFile backup_file) const override;
+  virtual void load(gzFile backup_file) override;
+  void generic_description_string(char* str) const override;
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual MutationType mut_type() const override {
+    return TRANS;
+  };
+
+  int32_t pos1() const {
+    return pos1_;
+  }
+
+  int32_t pos2() const {
+    return pos2_;
+  }
+
+  int32_t pos3() const {
+    return pos3_;
+  }
+
+  int32_t pos4() const {
+    return pos4_;
+  }
+
+  int32_t length() const {
+    return length_;
+  }
+
+  bool invert() const {
+    return invert_;
+  }
+
+  int16_t align_score_1() const {
+    return align_score_1_;
+  }
+
+  int16_t align_score_2() const {
+    return align_score_2_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  int32_t pos1_, pos2_, pos3_, pos4_;
+  int32_t length_;
+  bool invert_;
+  int16_t align_score_1_ = -1;
+  int16_t align_score_2_ = -1;
+};
+
+} // namespace aevol
+#endif //AEVOL_TRANSLOCATION_H_
diff --git a/src/libaevol/Tree.cpp b/src/libaevol/Tree.cpp
new file mode 100644
index 0000000..d2a4ed8
--- /dev/null
+++ b/src/libaevol/Tree.cpp
@@ -0,0 +1,216 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Tree.h"
+
+#include "macros.h"
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "Individual.h"
+#include "Utils.h"
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                                Class Tree                                #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+const int32_t Tree::NO_PARENT = -1;
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Tree::Tree(ExpManager* exp_m, int64_t tree_step) {
+  exp_m_ = exp_m;
+  tree_step_ = tree_step;
+
+  replics_ = new ReplicationReport** [tree_step_];
+
+  for (int32_t time = 0 ; time < tree_step ; time++) {
+    replics_[time] = new ReplicationReport* [exp_m->nb_indivs()];
+    for (int32_t num_indiv = 0 ;
+         num_indiv < exp_m->nb_indivs() ;
+         num_indiv++) {
+      replics_[time][num_indiv] = new ReplicationReport();
+    }
+  }
+}
+
+
+/**
+ *
+ */
+Tree::Tree(ExpManager* exp_m, char* tree_file_name) {
+  exp_m_ = exp_m;
+  tree_step_ = exp_m_->tree_step();
+
+  gzFile tree_file = gzopen(tree_file_name, "r");
+  if (tree_file == Z_NULL) {
+    printf("ERROR : Could not read tree file %s\n", tree_file_name);
+    exit(EXIT_FAILURE);
+  }
+
+  replics_ = new ReplicationReport** [tree_step_];
+
+  for (int64_t t = 0 ; t < tree_step_ ; t++) {
+    replics_[t] = new ReplicationReport* [exp_m_->nb_indivs()];
+    for (int32_t indiv_i = 0 ;
+         indiv_i < exp_m_->nb_indivs() ;
+         indiv_i++) {
+      // Retrieve a replication report
+      ReplicationReport* replic_report = new ReplicationReport(tree_file,
+                                                               nullptr);
+
+      // Put it at its rightful position
+      replics_[t][replic_report->id()] = replic_report;
+    }
+  }
+  gzclose(tree_file);
+}
+
+
+
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Tree::~Tree() {
+  if (replics_ != NULL)  {
+    for (int32_t i = 0 ; i < tree_step_ ; i++)
+      if (replics_[i] != NULL) {
+        for (int32_t j = 0 ; j < exp_m_->nb_indivs() ; j++)
+          delete replics_[i][j];
+        delete [] replics_[i];
+      }
+    delete [] replics_;
+  }
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+ReplicationReport** Tree::reports(int64_t t) const {
+  return replics_[Utils::mod(t - 1, tree_step_)];
+}
+
+ReplicationReport* Tree::report_by_index(int64_t t, int32_t index) const {
+  return replics_[Utils::mod(t - 1, tree_step_)][index];
+}
+
+
+ReplicationReport* Tree::report_by_rank(int64_t t, int32_t rank) const {
+  int32_t nb_indivs = exp_m_->nb_indivs();
+  assert(rank <= nb_indivs);
+
+  for (int32_t i = 0 ; i < nb_indivs ; i++) {
+    if (replics_[Utils::mod(t - 1, tree_step_)][i]->rank() == rank) {
+      return replics_[Utils::mod(t - 1, tree_step_)][i];
+    }
+  }
+
+  fprintf(stderr,
+          "ERROR: Couldn't find indiv with rank %" PRId32 " in file %s:%d\n",
+          rank, __FILE__, __LINE__);
+  return NULL;
+}
+
+void Tree::signal_end_of_generation() {
+  auto cur_reports = reports(AeTime::time());
+  for (int32_t i = 0; i < exp_m_->nb_indivs(); i++) {
+    cur_reports[i]->signal_end_of_generation();
+  }
+}
+
+void Tree::write_to_tree_file(gzFile tree_file) {
+  // Write the tree in the backup
+  for (int64_t t = 0 ; t < tree_step_ ; t++)
+    for (int32_t indiv_i = 0 ; indiv_i < exp_m_->nb_indivs() ; indiv_i++) {
+      assert(replics_[t][indiv_i] != NULL);
+      replics_[t][indiv_i]->write_to_tree_file(tree_file);
+    }
+
+  // Reinitialize the tree
+  for (int32_t t = 0 ; t < tree_step_ ; t++)
+    for (int32_t indiv_i = 0 ; indiv_i < exp_m_->nb_indivs() ; indiv_i++) {
+      delete replics_[t][indiv_i];
+      replics_[t][indiv_i] = new ReplicationReport();
+    }
+}
+
+/**
+ * This method is called whenever an observed object calls notifyObservers
+ *
+ * \param o the observable that has called notifyObservers
+ * \param e type of event triggered
+ * \param arg array containing a pointer to the new indiv and its parent
+ */
+void Tree::update(Observable& o, ObservableEvent e, void* arg) {
+  switch (e) {
+    case NEW_INDIV : {
+      // Initialize the replication report corresponding to the new individual
+      auto indivs = reinterpret_cast<Individual**>(arg);
+      Individual* new_indiv = indivs[0];
+      Individual* parent = indivs[1];
+      report_by_index(AeTime::time(), new_indiv->id())->init(new_indiv, parent);
+      break;
+    }
+    case END_GENERATION :
+      signal_end_of_generation();
+      break;
+    default :
+      Utils::ExitWithDevMsg("Event not handled", __FILE__, __LINE__);
+  }
+}
+
+
+
+// =================================================================
+//                  Non-inline accessors' definition
+// =================================================================
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_align.h b/src/libaevol/Tree.h
similarity index 63%
rename from src/libaevol/ae_align.h
rename to src/libaevol/Tree.h
index a4a86bc..ad1f8c8 100644
--- a/src/libaevol/ae_align.h
+++ b/src/libaevol/Tree.h
@@ -3,125 +3,115 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
-#ifndef __AE_ALIGN_H__
-#define __AE_ALIGN_H__
+#ifndef AEVOL_TREE_H_
+#define AEVOL_TREE_H_
 
 
 // =================================================================
-//                              Libraries
+//                              Includes
 // =================================================================
 #include <inttypes.h>
 
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
 
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_vis_a_vis.h>
+#include "ReplicationReport.h"
+#include "Observer.h"
+#include "ObservableEvent.h"
+#include "ae_enums.h"
 
 
+namespace aevol {
 
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_dna;
-
+class ExpManager;
 
 
-
-
-
-class ae_align : public ae_object
+class Tree : public Observer
 {
   public :
 
     // =================================================================
     //                             Constructors
     // =================================================================
+    Tree() = delete;
+    Tree(const Tree &model) = delete;
+    // To be used when we want to run a simulation.
+    Tree(ExpManager* exp_m, int64_t tree_step);
+    // To be used when we want to INSPECT a tree,
+    // not when we want to run a simulation.
+    Tree(ExpManager* exp_m, char* tree_file_name);
 
     // =================================================================
     //                             Destructors
     // =================================================================
+    virtual ~Tree() noexcept;
 
     // =================================================================
-    //                              Accessors
+    //                        Accessors: getters
     // =================================================================
+    inline int64_t  tree_step() const {
+      return tree_step_;
+    };
+
+    // Precondition for the following methods:
+    // the tree was emptied every TREE_STEP generations ==> it contains
+    // only the last generations since the last emptying ==> do not ask
+    // something about an older generation
+    ReplicationReport** reports(int64_t t) const;
+    ReplicationReport* report_by_index(int64_t t, int32_t index) const;
+    ReplicationReport* report_by_rank(int64_t t, int32_t rank) const;
+
 
     // =================================================================
-    //                            Public Methods
+    //                        Accessors: setters
     // =================================================================
-    static ae_vis_a_vis* search_alignment_direct( const ae_dna* chrom1, const int32_t seed1,
-                                                  const ae_dna* chrom2, const int32_t seed2, int16_t needed_score );
-    static ae_vis_a_vis* search_alignment_indirect( const ae_dna* chrom1, const int32_t seed1,
-                                                    const ae_dna* chrom2, const int32_t seed2, int16_t needed_score );
 
     // =================================================================
-    //                           Public Attributes
+    //                            Public Methods
     // =================================================================
+    void signal_end_of_generation();
+    void write_to_tree_file(gzFile tree_file);
 
-    static bool with_alignments;
-
-    static ae_align_fun_shape align_fun_shape;
-    
-    static double  align_sigm_lambda;
-    static int16_t align_sigm_mean;
-    static int16_t align_lin_min;
-    static int16_t align_lin_max;
-    
-    // Maximum shift of one seq on the other
-    static int16_t align_max_shift;
-    // Work zone half length
-    static int16_t align_w_zone_h_len;
-    // Corresponding residues match bonus
-    static int16_t align_match_bonus;
-    // Corresponding residues mismatch cost
-    static int16_t align_mismatch_cost;
+  void update(Observable& o, ObservableEvent e, void* arg) override;
 
 
+    // =================================================================
+    //                           Public Attributes
+    // =================================================================
+    static const int32_t NO_PARENT;
 
 
 
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_align( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_align( const ae_align &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
 
 
+  protected :
     // =================================================================
     //                           Protected Methods
     // =================================================================
@@ -129,16 +119,37 @@ class ae_align : public ae_object
     // =================================================================
     //                          Protected Attributes
     // =================================================================
+    ExpManager* exp_m_;
+
+    int64_t tree_step_;
+
+    ReplicationReport*** replics_;
+    // Two-dimensional table of ReplicationReport*
+    //    dimension 1 (lines)   : generation
+    //    dimension 2 (columns) : individual
+    //
+    // !!!!! WARNING !!!!!
+    // The report at line l, column c is for the
+    // replication that created the indiv with index c of generation l+1
+
+    // light tree representation
+    int32_t** parent_;
 };
 
 
 // =====================================================================
-//                          Accessors' definitions
+//                           Getters' definitions
 // =====================================================================
 
 // =====================================================================
+//                           Setters' definitions
+// =====================================================================
+
+
+// =====================================================================
 //                       Inline functions' definition
 // =====================================================================
 
+} // namespace aevol
 
-#endif // __AE_ALIGN_H__
+#endif // AEVOL_TREE_H_
diff --git a/src/libaevol/ae_phenotype.cpp b/src/libaevol/Utils.cpp
similarity index 51%
copy from src/libaevol/ae_phenotype.cpp
copy to src/libaevol/Utils.cpp
index 958b8ff..1431a80 100644
--- a/src/libaevol/ae_phenotype.cpp
+++ b/src/libaevol/Utils.cpp
@@ -3,105 +3,113 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
+//
+// ****************************************************************************
 
 
-// =================================================================
-//                              Libraries
-// =================================================================
 
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Utils.h"
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_phenotype.h>
-#include <ae_individual.h>
+#include "JumpingMT.h"
 
 
+using std::string;
+using std::cout;
+using std::endl;
 
 
+namespace aevol {
 //##############################################################################
-//                                                                             #
-//                              Class ae_phenotype                             #
-//                                                                             #
+//
+//                           Class Utils
+//
 //##############################################################################
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_phenotype::ae_phenotype( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = NULL;
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+
+
+/**
+ * Compute value(t+1) with the provided parameters and prng
+ *
+ * value(t+1) = value(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random()
+ */
+void Utils::ApplyAutoregressiveStochasticProcess(double& value,
+                                                 double sigma,
+                                                 int16_t tau,
+                                                 JumpingMT& prng) {
+  value = value * (1.0 - 1.0/tau) +
+          (sigma/tau) * sqrt(2*tau- 1.0) * prng.gaussian_random();
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv, const ae_phenotype &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set( model )
-#elif defined __X11
-  ae_fuzzy_set_X11( model )
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+/**
+ * Print an error message and exit (with error status)
+ *
+ * \param msg message to be printed
+ * \param file should be __FILE__
+ * \param line should be __LINE__
+ */
+void Utils::ExitWithDevMsg(const std::string& msg,
+                           const std::string& file, int line) {
+  cout << file << ":" << line << ": error: " << msg << endl;
+  exit(EXIT_FAILURE);
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+/**
+ * Print an error message and exit (with error status)
+ *
+ * \param msg message to be printed
+ * \param bin the binary that caused the error
+ */
+void Utils::ExitWithUsrMsg(const string& msg) {
+  cout << "error: " << msg << endl;
+  exit(EXIT_FAILURE);
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_phenotype::~ae_phenotype( void )
+/**
+ * Print aevol version number
+ */
+void Utils::PrintAevolVersion()
 {
+  printf("aevol %s\n", VERSION);
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+} // namespace aevol
diff --git a/src/libaevol/Utils.h b/src/libaevol/Utils.h
new file mode 100644
index 0000000..b856ccb
--- /dev/null
+++ b/src/libaevol/Utils.h
@@ -0,0 +1,106 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_UTILS_H_
+#define AEVOL_UTILS_H_
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include <cinttypes>
+#include <cassert>
+#include <cstdlib>
+
+#include <string>
+#include <iostream>
+
+
+namespace aevol {
+class JumpingMT;
+
+class Utils {
+ public :
+  Utils() = delete;
+  Utils(const Utils&) = delete;
+  Utils(Utils&&) = delete;
+  ~Utils() = delete;
+  static inline int32_t mod(int32_t a, int32_t b);
+  static inline int64_t mod(int64_t a, int64_t b);
+  static inline int32_t min(int32_t a, int32_t b);
+  static inline int32_t max(int32_t a, int32_t b);
+  static inline void exchange(int32_t& a, int32_t& b);
+  static void ApplyAutoregressiveStochasticProcess(double& value,
+                                                   double sigma,
+                                                   int16_t tau,
+                                                   JumpingMT& prng);
+  static int16_t hamming(const char* str1, const char* str2);
+
+  static void ExitWithUsrMsg(const std::string& msg);
+  static void ExitWithDevMsg(const std::string& msg,
+                             const std::string& file, int line);
+  static void PrintAevolVersion();
+};
+
+inline int32_t Utils::mod(int32_t a, int32_t b)
+{
+  assert(b > 0);
+
+  while (a < 0)  a += b;
+  while (a >= b) a -= b;
+
+  return a;
+}
+
+inline int64_t Utils::mod(int64_t a, int64_t b)
+{
+  assert(b > 0);
+
+  while (a < 0)  a += b;
+  while (a >= b) a -= b;
+
+  return a;
+}
+
+inline int32_t Utils::min(int32_t a, int32_t b)
+{
+  return ((a < b)? a : b);
+}
+
+inline int32_t Utils::max(int32_t a, int32_t b)
+{
+  return ((a > b)? a : b);
+}
+
+inline void Utils::exchange(int32_t& a, int32_t& b)
+{
+  int32_t tmp = a;
+  a = b;
+  b = tmp;
+}
+} // namespace aevol
+#endif // AEVOL_UTILS_H_
diff --git a/src/libaevol/ae_grid_cell.cpp b/src/libaevol/VisAVis.cpp
similarity index 67%
rename from src/libaevol/ae_grid_cell.cpp
rename to src/libaevol/VisAVis.cpp
index ca43c39..6cb63da 100644
--- a/src/libaevol/ae_grid_cell.cpp
+++ b/src/libaevol/VisAVis.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -36,17 +36,17 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_grid_cell.h>
-#include <ae_individual.h>
+#include "VisAVis.h"
 
+namespace aevol {
 
 
 
-//##############################################################################
-//                                                                             #
-//                              Class ae_grid_cell                             #
-//                                                                             #
-//##############################################################################
+// ############################################################################
+//
+//                              Class VisAVis
+//
+// ############################################################################
 
 // =================================================================
 //                    Definition of static attributes
@@ -55,44 +55,45 @@
 // =================================================================
 //                             Constructors
 // =================================================================
-ae_grid_cell::ae_grid_cell( int16_t x, int16_t y, ae_individual* indiv )
-{
-  _x = x;
-  _y = y;
-  
-  _compound_amount  = 0.0;
-  
-  _individual       = indiv;
+VisAVis::VisAVis(const Dna* chrom_1, const Dna* chrom_2,
+                 int32_t i_1, int32_t i_2, AlignmentSense sense /*= DIRECT*/) {
+  chrom_1_  = chrom_1;
+  chrom_2_  = chrom_2;
+  i_1_      = i_1;
+  i_2_      = i_2;
+  sense_    = sense;
+  score_    = 0;
 }
 
-ae_grid_cell::ae_grid_cell( gzFile backup_file )
-{
-  gzread( backup_file, &_x, sizeof(_x) );
-  gzread( backup_file, &_y, sizeof(_y) );
-  
-  gzread( backup_file, &_compound_amount, sizeof(_compound_amount) );
-  
-  _individual = NULL;
+VisAVis::VisAVis(const VisAVis & orig) {
+  chrom_1_  = orig.chrom_1_;
+  chrom_2_  = orig.chrom_2_;
+  i_1_      = orig.i_1_;
+  i_2_      = orig.i_2_;
+  sense_    = orig.sense_;
+  score_    = orig.score_;
 }
 
+//~ VisAVis::VisAVis(const VisAVis* orig)
+//~ {
+  //~ chrom_1_  = orig->chrom_1_;
+  //~ chrom_2_  = orig->chrom_2_;
+  //~ i_1_      = orig->i_1_;
+  //~ i_2_      = orig->i_2_;
+  //~ sense_    = orig->sense_;
+//~ }
+
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_grid_cell::~ae_grid_cell( void )
-{
+VisAVis::~VisAVis() {
 }
 
 // =================================================================
 //                            Public Methods
 // =================================================================
-void ae_grid_cell::save( gzFile backup_file ) const
-{
-  gzwrite( backup_file, &_x, sizeof(_x) );
-  gzwrite( backup_file, &_y, sizeof(_y) );
-  
-  gzwrite( backup_file, &_compound_amount, sizeof(_compound_amount) );
-}
 
 // =================================================================
 //                           Protected Methods
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/VisAVis.h b/src/libaevol/VisAVis.h
new file mode 100644
index 0000000..2868677
--- /dev/null
+++ b/src/libaevol/VisAVis.h
@@ -0,0 +1,348 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_VIS_A_VIS_H_
+#define AEVOL_VIS_A_VIS_H_
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <inttypes.h>
+
+
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "Dna.h"
+#include "Utils.h"
+
+
+namespace aevol {
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+
+
+
+
+
+
+
+class VisAVis
+{
+  friend class Alignment;
+
+  public :
+
+    // =================================================================
+    //                             Constructors
+    // =================================================================
+    VisAVis() = default;
+    VisAVis(const Dna * chrom_1, const Dna * chrom_2,
+            int32_t i_1, int32_t i_2, AlignmentSense sense = DIRECT);
+    VisAVis(const VisAVis & orig);
+
+    // =================================================================
+    //                             Destructors
+    // =================================================================
+    virtual ~VisAVis();
+
+    // =================================================================
+    //                              Accessors
+    // =================================================================
+    inline const Dna*  chrom_1() const;
+    inline const Dna*  chrom_2() const;
+    inline int32_t        i_1() const;
+    inline int32_t        i_2() const;
+    inline int16_t        score() const;
+    inline AlignmentSense sense() const;
+
+    // =================================================================
+    //                              Operators
+    // =================================================================
+    inline bool operator <  (VisAVis &cmp);
+    inline bool operator <= (VisAVis &cmp);
+    inline bool operator >  (VisAVis &cmp);
+    inline bool operator >= (VisAVis &cmp);
+
+    // =================================================================
+    //                            Public Methods
+    // =================================================================
+    inline bool match();
+    inline void step_fwd();
+    inline void step_back();
+    inline void add(int common_inc);
+    inline void add(int inc_1, int inc_2);
+    inline void sub(int common_inc);
+    inline void sub(int inc_1, int inc_2);
+    inline void swap();
+
+    inline void copy(VisAVis * source);
+    inline void check_indices();
+
+    // =================================================================
+    //                           Public Attributes
+    // =================================================================
+
+
+
+
+
+  protected :
+    // =================================================================
+    //                           Protected Methods
+    // =================================================================
+
+    // =================================================================
+    //                          Protected Attributes
+    // =================================================================
+    const Dna* chrom_1_ = nullptr;
+    const Dna* chrom_2_ = nullptr;
+    int32_t i_1_ = -1; //< Index on chrom_1
+    int32_t i_2_ = -1; //< Index on chrom_2
+    int16_t score_ = -1;
+    // Sense (DIRECT or INDIRECT) of the vis_a_vis (alignement)
+    AlignmentSense sense_ = DIRECT;
+    // Say we have the following sequences :
+    //    0 1 2 3 4 5 6 7 8 9             0 1 2 3 4 5 6 7 8 9
+    //    |a|b|c|d|e|f|g|h|i|j|           |a|b|c|d|e|f|g|h|i|j|
+    //
+    // The DIRECT vis_a_vis between i_1_ = 3 and i_2_ = 7 is 'd' with 'h' (caracters at indices 3 and 7 resp.).
+    //   The corresponding alignment would be "defgh" with "hijkl"
+    //
+    // WARNING! The INDIRECT vis_a_vis between the same i_1_ = 3 and i_2 = 7 is 'd' with 'g' (and not 'h'!).
+    // This is because we are reading backwards (towards the left). Directly left to index 7 is 'g' which corresponds to index 6.
+    //   The corresponding alignment would hence be "defgh" with "!g!f!e!d!c" ("!x" means "complementary of x")
+};
+
+
+// =====================================================================
+//                          Accessors' definitions
+// =====================================================================
+inline const Dna *VisAVis::chrom_1() const
+{
+  return chrom_1_;
+}
+
+inline const Dna *VisAVis::chrom_2() const
+{
+  return chrom_2_;
+}
+
+inline int32_t VisAVis::i_1() const
+{
+  return i_1_;
+}
+
+inline int32_t VisAVis::i_2() const
+{
+  return i_2_;
+}
+
+inline int16_t VisAVis::score() const
+{
+  return score_;
+}
+
+inline AlignmentSense VisAVis::sense() const
+{
+  return sense_;
+}
+
+
+
+// =====================================================================
+//                          Operators' definitions
+// =====================================================================
+inline bool VisAVis::operator < (VisAVis &cmp)
+{
+  return (i_1_ < cmp.i_1_);
+}
+
+inline bool VisAVis::operator <= (VisAVis &cmp)
+{
+  return (i_1_ <= cmp.i_1_);
+}
+
+inline bool VisAVis::operator > (VisAVis &cmp)
+{
+  return (i_1_ > cmp.i_1_);
+}
+
+inline bool VisAVis::operator >= (VisAVis &cmp)
+{
+  return (i_1_ >= cmp.i_1_);
+}
+
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+inline bool VisAVis::match()
+{
+  if (sense_ == DIRECT)
+  {
+    return (chrom_1_->data()[Utils::mod(i_1_, chrom_1_->length())] ==
+        chrom_2_->data()[Utils::mod(i_2_, chrom_2_->length())]);
+  }
+  else // (sense_ == INDIRECT)
+  {
+    // Note that we are reading the sequence backwards, The nucleotide corresponding to a breakpoint at point <i>
+    // is hence stored at index <i-1>
+    //    a b c d e f g h i j
+    //    |_|_|_|_|_|_|_|_|_|_|
+    //    | | | | | | | | | | |
+    //      9 8 7 6 5 4 3 2 1 0
+    //
+    // The breakpoint F-5 puts into a vis_a_vis the nucleotide at index F on seq1 and that at index 4 (not 5!!!) on seq2
+    return (chrom_1_->data()[Utils::mod(i_1_, chrom_1_->length())] !=
+        chrom_2_->data()[Utils::mod(i_2_-1, chrom_2_->length())]);
+  }
+}
+
+inline void VisAVis::step_fwd()
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_++;
+    i_2_++;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_++;
+    i_2_--;
+  }
+}
+
+inline void VisAVis::step_back()
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_--;
+    i_2_--;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_--;
+    i_2_++;
+  }
+}
+
+inline void VisAVis::add(int common_inc)
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_ += common_inc;
+    i_2_ += common_inc;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_ += common_inc;
+    i_2_ -= common_inc;
+  }
+}
+
+inline void VisAVis::add(int inc_1, int inc_2)
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_ += inc_1;
+    i_2_ += inc_2;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_ += inc_1;
+    i_2_ -= inc_2;
+  }
+}
+
+inline void VisAVis::sub(int common_inc)
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_ -= common_inc;
+    i_2_ -= common_inc;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_ -= common_inc;
+    i_2_ += common_inc;
+  }
+}
+
+inline void VisAVis::sub(int inc_1, int inc_2)
+{
+  if (sense_ == DIRECT)
+  {
+    i_1_ -= inc_1;
+    i_2_ -= inc_2;
+  }
+  else // (sense_ == INDIRECT)
+  {
+    i_1_ -= inc_1;
+    i_2_ += inc_2;
+  }
+}
+
+inline void VisAVis::swap()
+{
+  const Dna *  tmp_chrom = chrom_1_;
+  int32_t         tmp_i     = i_1_;
+
+  chrom_1_  = chrom_2_;
+  i_1_      = i_2_;
+
+  chrom_2_  = tmp_chrom;
+  i_2_      = tmp_i;
+}
+
+inline void VisAVis::copy(VisAVis * source)
+{
+  i_1_ = source->i_1_;
+  i_2_ = source->i_2_;
+  chrom_1_ = source->chrom_1_;
+  chrom_2_ = source->chrom_2_;
+  sense_ = source->sense_;
+  score_ = source->score_;
+}
+
+inline void VisAVis::check_indices()
+{
+  i_1_ = Utils::mod(i_1_, chrom_1_->length());
+  i_2_ = Utils::mod(i_2_, chrom_2_->length());
+}
+} // namespace aevol
+
+#endif // AEVOL_VIS_A_VIS_H_
diff --git a/src/libaevol/World.cpp b/src/libaevol/World.cpp
new file mode 100644
index 0000000..ac8fe25
--- /dev/null
+++ b/src/libaevol/World.cpp
@@ -0,0 +1,502 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Includes
+// =================================================================
+#include "World.h"
+#include "HabitatFactory.h"
+
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include <list>
+#include <iostream>
+
+#ifdef __REGUL
+#include "raevol/Individual_R.h"
+#endif
+
+using std::cout;
+using std::endl;
+using std::list;
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                                Class World                                  #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+
+// =================================================================
+//                             Destructor
+// =================================================================
+World::~World()
+{
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      delete grid_[x][y];
+
+  // grid_ is 2D accessible but 1D allocated, there were only 2 new
+  // statements and these are the corresponding deletes
+  delete [] grid_1d_;
+  delete [] grid_;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void World::InitGrid(int16_t width, int16_t height,
+                     Habitat& habitat,
+                     bool share_phenotypic_target) {
+  assert(share_phenotypic_target);
+
+  if (share_phenotypic_target) {
+    #ifndef __REGUL
+    phenotypic_target_handler_ = new PhenotypicTargetHandler(habitat.phenotypic_target_handler());
+    #else
+    phenotypic_target_handler_ = new PhenotypicTargetHandler_R((dynamic_cast<Habitat_R&>(habitat)).phenotypic_target_handler());
+    #endif
+  }
+  
+  width_  = width;
+  height_ = height;
+
+  MallocGrid();
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+    {
+      if (share_phenotypic_target)
+        grid_[x][y] =
+            new GridCell(x, y,
+                HabitatFactory::create_unique_habitat(habitat,share_phenotypic_target),
+                             NULL,std::make_shared<JumpingMT>(mut_prng_->random(1000000)),
+                             std::make_shared<JumpingMT>(stoch_prng_->random(1000000)));
+    }
+}
+
+void World::MallocGrid()
+{
+  // Although grid_ is a 2D array, we want all its cells to be contiguous
+  // in memory. However, we also want it to be 2D-accessible i.e. we want to
+  // be able to access a cell with grid_[x][y].
+  // The following code does just this
+  grid_1d_ = new GridCell * [width_ * height_];
+  grid_ = new GridCell ** [width_];
+  for (int16_t x = 0 ; x < width_ ; x++)
+    grid_[x] = &(grid_1d_[x * height_]);
+}
+
+void World::PlaceIndiv(Individual * indiv, int16_t x, int16_t y) {
+  grid_[x][y]->set_individual(indiv);
+  indiv->set_mut_prng(grid_[x][y]->mut_prng());
+  indiv->set_stoch_prng(grid_[x][y]->stoch_prng());
+}
+
+void World::FillGridWithClones(Individual & dolly)
+{
+  int32_t id_new_indiv = 0;
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      #ifndef __REGUL
+      PlaceIndiv(Individual::CreateClone(&dolly, id_new_indiv++), x, y);
+      #else
+      PlaceIndiv(Individual_R::CreateClone(dynamic_cast<Individual_R*>(&dolly), id_new_indiv++), x, y);
+      #endif
+}
+
+void World::evaluate_individuals()
+{
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++) {
+      #ifndef __REGUL
+      Individual* indiv       = indiv_at(x, y);
+      #else
+      Individual_R* indiv       = dynamic_cast <Individual_R*> (indiv_at(x, y));
+      #endif
+
+      indiv->Evaluate();
+      indiv->compute_statistical_data();
+    }
+}
+
+void World::update_secretion_grid()
+{
+  int16_t cur_x, cur_y;
+
+  double ** new_secretion = new double*[width_];
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    new_secretion[x] = new double[height_];
+    for (int16_t y = 0 ; y < height_ ; y++)
+    {
+      new_secretion[x][y] = grid_[x][y]->compound_amount();
+    }
+  }
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    for (int16_t y = 0 ; y < height_ ; y++)
+    {
+      // look at the entire neighborhood
+      for (int8_t i = -1 ; i < 2 ; i++)
+      {
+        for (int8_t j = -1 ; j < 2 ; j ++)
+        {
+          cur_x = (x + i + width_)  % width_;
+          cur_y = (y + j + height_) % height_;
+
+          // add the diffusion from the neighboring cells
+          new_secretion[x][y] +=
+              grid_[cur_x][cur_y]->compound_amount() *
+                  secretion_diffusion_prop_;
+        }
+      }
+    }
+  }
+
+  // Substract what has diffused from each cell, and calculate the
+  // compound degradation
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    for (int16_t y = 0 ; y < height_ ; y++)
+    {
+      grid_[x][y]->set_compound_amount(new_secretion[x][y] -
+          9 * grid_[x][y]->compound_amount() * secretion_diffusion_prop_);
+      grid_[x][y]->set_compound_amount(grid_[x][y]->compound_amount() *
+          (1 - secretion_degradation_prop_));
+    }
+  }
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    delete [] new_secretion[x];
+  }
+  delete [] new_secretion;
+}
+
+/*
+ * Perform mixing of individuals
+ *
+ * Depending on parameters this can either well-mix or partially-mix
+ * the population
+ */
+void World::MixIndivs()
+{
+  if (is_well_mixed_)
+    WellMixIndivs();
+  else if (partial_mix_nb_permutations_ > 0)
+    PartiallyMixIndivs();
+}
+
+/*
+ * Suffle individuals randomly using Fisher-Yates shuffle
+ */
+void World::WellMixIndivs()
+{
+  for (int16_t i = width_ * height_ - 1 ; i > 0 ; i--) {
+    int16_t j = prng_->random(i + 1); // random in [0, 1]
+
+    // Swap individuals btw cells i and j
+    Individual * tmp = grid_1d_[i]->individual();
+    grid_1d_[i]->set_individual(grid_1d_[j]->individual());
+    grid_1d_[j]->set_individual(tmp);
+    tmp->set_mut_prng(grid_1d_[j]->mut_prng());
+    tmp->set_stoch_prng(grid_1d_[j]->stoch_prng());
+  }
+}
+
+/*
+ * Perform permutations between individuals randomly
+ *
+ * The number of permutations is given by partial_mix_nb_permutations_
+ */
+void World::PartiallyMixIndivs()
+{
+  for (int32_t i = 0 ; i < partial_mix_nb_permutations_ ; i++)
+  {
+    int16_t old_x = prng_->random(width_);
+    int16_t old_y = prng_->random(height_);
+    int16_t new_x = prng_->random(width_);
+    int16_t new_y = prng_->random(height_);
+
+    // Swap the individuals in these grid cells...
+    Individual * tmp_swap = grid_[old_x][old_y]->individual();
+    grid_[old_x][old_y]->set_individual(grid_[new_x][new_y]->individual());
+    grid_[new_x][new_y]->set_individual(tmp_swap);
+
+    grid_[old_x][old_y]->individual()->set_mut_prng(grid_[old_x][old_y]->mut_prng());
+    grid_[old_x][old_y]->individual()->set_stoch_prng(grid_[old_x][old_y]->stoch_prng());
+
+    grid_[new_x][new_y]->individual()->set_mut_prng(grid_[new_x][new_y]->mut_prng());
+    grid_[new_x][new_y]->individual()->set_stoch_prng(grid_[new_x][new_y]->stoch_prng());
+  }
+}
+
+void World::update_best()
+{
+  x_best = y_best = 0;
+  double fit_best = indiv_at(0, 0)->fitness();
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      if (indiv_at(x, y)->fitness() > fit_best) {
+        x_best = x;
+        y_best = y;
+        fit_best = indiv_at(x, y)->fitness();
+      }
+}
+
+void World::ApplyHabitatVariation() {
+  if (phenotypic_target_shared_)
+    phenotypic_target_handler_->ApplyVariation();
+  else
+    for (int16_t x = 0 ; x < width_ ; x++)
+      for (int16_t y = 0 ; y < height_ ; y++)
+        grid_[x][y]->ApplyHabitatVariation();
+}
+
+void World::save(gzFile backup_file) const
+{
+  if (prng_ == nullptr)
+  {
+    printf("%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+
+  prng_->save(backup_file);
+
+  mut_prng_->save(backup_file);
+
+  int8_t tmp_with_stoch = static_cast<int8_t>(stoch_prng_ == nullptr ? 0 : 1);
+  gzwrite(backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch));
+  if (tmp_with_stoch)
+  {
+    stoch_prng_->save(backup_file);
+  }
+  if (grid_ == nullptr)
+  {
+    printf("%s:%d: error: grid not initialized.\n", __FILE__, __LINE__);
+    exit(EXIT_FAILURE);
+  }
+
+  // Manage shared or private phenotypic targets
+  int8_t tmp_phenotypic_target_shared =
+      static_cast<int8_t>(phenotypic_target_shared_ ? 1 : 0);
+  gzwrite(backup_file,
+          &tmp_phenotypic_target_shared,
+          sizeof(tmp_phenotypic_target_shared));
+  if (phenotypic_target_shared_) {
+    phenotypic_target_handler_->save(backup_file);
+  }
+    
+
+  gzwrite(backup_file, &width_,   sizeof(width_));
+  gzwrite(backup_file, &height_,  sizeof(height_));
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      grid_[x][y]->save(backup_file, phenotypic_target_shared_);
+
+  gzwrite(backup_file, &x_best, sizeof(x_best));
+  gzwrite(backup_file, &y_best, sizeof(y_best));
+
+  gzwrite(backup_file, &is_well_mixed_,
+          sizeof(is_well_mixed_));
+  gzwrite(backup_file, &partial_mix_nb_permutations_,
+          sizeof(partial_mix_nb_permutations_));
+  gzwrite(backup_file, &secretion_diffusion_prop_,
+          sizeof(secretion_diffusion_prop_));
+  gzwrite(backup_file, &secretion_degradation_prop_,
+          sizeof(secretion_degradation_prop_));
+}
+
+void World::load(gzFile backup_file, ExpManager * exp_man)
+{
+  // Retrieve PRNGs
+  prng_ = std::make_shared<JumpingMT>(backup_file);
+  mut_prng_ = std::make_shared<JumpingMT>(backup_file);
+
+  int8_t tmp_with_stoch;
+  gzread(backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch));
+  if (tmp_with_stoch)
+  {
+    stoch_prng_ = std::make_shared<JumpingMT>(backup_file);
+  }
+
+  // Manage shared or private phenotypic targets
+  int8_t tmp_phenotypic_target_shared;
+  gzread(backup_file,
+          &tmp_phenotypic_target_shared,
+          sizeof(tmp_phenotypic_target_shared));
+  phenotypic_target_shared_ = tmp_phenotypic_target_shared;
+  if (phenotypic_target_shared_) {
+    phenotypic_target_handler_ =
+    #ifndef __REGUL
+        new PhenotypicTargetHandler(backup_file);
+    #else 
+        new PhenotypicTargetHandler_R(backup_file);
+    #endif
+  }
+  
+  // A priori useless car déjà fait dans le constructeur de reprise sur backup
+  //phenotypic_target_handler_->BuildPhenotypicTarget();
+
+  gzread(backup_file, &width_,  sizeof(width_));
+  gzread(backup_file, &height_, sizeof(height_));
+
+  MallocGrid();
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      grid_[x][y] = new GridCell(backup_file,
+                                 exp_man,
+                                 phenotypic_target_handler_);
+
+  gzread(backup_file, &x_best, sizeof(x_best));
+  gzread(backup_file, &y_best, sizeof(y_best));
+
+  gzread(backup_file, &is_well_mixed_,
+         sizeof(is_well_mixed_));
+  gzread(backup_file, &partial_mix_nb_permutations_,
+         sizeof(partial_mix_nb_permutations_));
+  gzread(backup_file, &secretion_diffusion_prop_,
+         sizeof(secretion_diffusion_prop_));
+  gzread(backup_file, &secretion_degradation_prop_,
+         sizeof(secretion_degradation_prop_));
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void World::backup_stoch_prng()
+{
+  // Store a copy of stoch_prng_ in stoch_prng_bak_
+#if __cplusplus == 201103L
+  stoch_prng_bak_ = make_unique<JumpingMT>(*stoch_prng_);
+#else
+  stoch_prng_bak_ = std::make_unique<JumpingMT>(*stoch_prng_);
+#endif
+}
+
+// =================================================================
+//                          Non inline accessors
+// =================================================================
+std::shared_ptr<JumpingMT> World::prng() const
+{
+  return prng_;
+}
+
+std::shared_ptr<JumpingMT> World::mut_prng() const
+{
+  return mut_prng_;
+}
+
+std::shared_ptr<JumpingMT> World::stoch_prng() const
+{
+  return stoch_prng_;
+}
+
+list<Individual *> World::indivs() const
+{
+  list<Individual *> r;
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++)
+      r.push_back(indiv_at(x, y));
+
+  return r;
+}
+
+void World::set_mut_prng(std::shared_ptr<JumpingMT> prng)
+{
+  mut_prng_ = prng;
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++) {
+      Individual * indiv;
+      if ((indiv = indiv_at(x, y)))
+        indiv->set_mut_prng(mut_prng_);
+    }
+}
+
+void World::set_stoch_prng(std::shared_ptr<JumpingMT> prng)
+{
+  stoch_prng_ = prng;
+
+  for (int16_t x = 0 ; x < width_ ; x++)
+    for (int16_t y = 0 ; y < height_ ; y++) {
+      Individual * indiv;
+      if ((indiv = indiv_at(x, y)))
+        indiv->set_stoch_prng(stoch_prng_);
+    }
+}
+
+void World::set_phen_target_prngs(std::shared_ptr<JumpingMT> var_prng,
+                                  std::shared_ptr<JumpingMT> noise_prng) {
+  assert(phenotypic_target_shared_);
+  phenotypic_target_handler_->set_var_prng(var_prng);
+  phenotypic_target_handler_->set_noise_prng(noise_prng);
+}
+
+Individual* World::indiv_by_id(int32_t id) const {
+  Individual* indiv = grid_1d_[id]->individual();
+  // When the population isn't mixed at all, the individual with id n is in
+  // grid_1d_[n]. Try this first...
+  if (indiv->id() == id)
+    return indiv;
+  // ... If it isn't, do a basic search
+  int32_t nb_indivs = width_ * height_;
+  for (int32_t i = 0 ; i < nb_indivs ; i++) {
+    if (grid_1d_[i]->individual()->id() == id)
+      return grid_1d_[i]->individual();
+  }
+  return nullptr;
+}
+
+Individual* World::indiv_by_rank(int32_t rank) const {
+  int32_t nb_indivs = width_ * height_;
+  for (int32_t i = 0 ; i < nb_indivs ; i++) {
+    if (grid_1d_[i]->individual()->rank() == rank)
+      return grid_1d_[i]->individual();
+  }
+  return nullptr;
+}
+} // namespace aevol
diff --git a/src/libaevol/World.h b/src/libaevol/World.h
new file mode 100644
index 0000000..433cd72
--- /dev/null
+++ b/src/libaevol/World.h
@@ -0,0 +1,312 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_WORLD_H_
+#define AEVOL_WORLD_H_
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
+
+#include <zlib.h>
+
+#include "GridCell.h"
+
+
+namespace aevol {
+
+
+
+// =================================================================
+//                          Class declarations
+// =================================================================
+class ExpManager;
+
+
+
+
+
+
+class World
+{
+ public :
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  World() = default;
+  World(const World &) = delete;
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~World();
+
+  // =================================================================
+  //                        Accessors: getters
+  // =================================================================
+  // PRNGs
+  std::shared_ptr<JumpingMT> prng() const;
+  std::shared_ptr<JumpingMT> mut_prng() const;
+  std::shared_ptr<JumpingMT> stoch_prng() const;
+
+  std::list<Individual*> indivs() const;
+  inline int32_t          nb_indivs() const;
+  inline Individual* best_indiv() const;
+  int16_t          width()  const {return width_;};
+  int16_t          height() const {return height_;};
+  inline int32_t          partial_mix_nb_permutations() const;
+  GridCell ***  grid() const {return grid_;};
+  inline GridCell*    grid(int16_t x, int16_t y) const;
+  inline Individual*   indiv_at(int16_t x, int16_t y) const;
+  Individual* indiv_by_id(int32_t id) const;
+  Individual* indiv_by_rank(int32_t rank) const;
+
+  inline double** secretion_present_grid() const;
+  inline double** secreted_amount_grid() const;
+  inline double** metabolic_fitness_grid() const;
+  inline double** total_fitness_grid() const;
+
+  bool phenotypic_target_shared() const {
+    return phenotypic_target_shared_;
+  }
+  PhenotypicTargetHandler*
+  phenotypic_target_handler() const {
+    return phenotypic_target_handler_;
+  }
+
+  // =================================================================
+  //                        Accessors: setters
+  // =================================================================
+  // PRNGs
+  inline void set_prng(std::shared_ptr<JumpingMT> prng);
+  void set_mut_prng(std::shared_ptr<JumpingMT> prng);
+  void set_stoch_prng(std::shared_ptr<JumpingMT> prng);
+
+  inline void set_is_well_mixed(bool is_well_mixed);
+  inline void set_partial_mix_nb_permutations(int32_t nb_permutations);
+  inline void set_secretion_degradation_prop(double degradation_prop);
+  inline void set_secretion_diffusion_prop(double diffusion_prop);
+  inline void set_best(int16_t x, int16_t y);
+
+  // =================================================================
+  //                              Operators
+  // =================================================================
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void InitGrid(int16_t width, int16_t height,
+                Habitat& habitat,
+                bool share_phenotypic_target);
+  void PlaceIndiv(Individual * indiv, int16_t x, int16_t y);
+  void FillGridWithClones(Individual & dolly);
+  void evaluate_individuals();
+  void update_secretion_grid();
+  void MixIndivs();
+  void update_best();
+  void ApplyHabitatVariation();
+
+  void save(gzFile backup_file) const;
+  void load(gzFile backup_file, ExpManager * exp_man);
+
+  void set_phen_target_prngs(std::shared_ptr<JumpingMT> var_prng,
+                             std::shared_ptr<JumpingMT> noise_prng);
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  void MallocGrid();
+  void WellMixIndivs();
+  void PartiallyMixIndivs();
+  void backup_stoch_prng();
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+  std::shared_ptr<JumpingMT> prng_ = nullptr;
+
+  std::shared_ptr<JumpingMT> mut_prng_ = nullptr;
+  std::shared_ptr<JumpingMT> stoch_prng_ = nullptr;
+  std::unique_ptr<JumpingMT> stoch_prng_bak_ = nullptr;
+
+  int16_t width_  = -1;
+  int16_t height_ = -1;
+
+  int16_t x_best = -1;
+  int16_t y_best = -1;
+
+  GridCell*** grid_ = nullptr;
+  GridCell** grid_1d_ = nullptr;
+
+  bool is_well_mixed_ = false;
+  int32_t partial_mix_nb_permutations_ = 0;
+
+  bool phenotypic_target_shared_ = true;
+  PhenotypicTargetHandler* phenotypic_target_handler_ = NULL;
+
+
+  double  secretion_diffusion_prop_ = -1;
+  double  secretion_degradation_prop_ = -1;
+};
+
+
+// =====================================================================
+//                           Getters' definitions
+// =====================================================================
+inline int32_t World::nb_indivs() const
+{
+  return width_ * height_;
+}
+
+inline Individual *World::best_indiv() const
+{
+  return grid_[x_best][y_best]->individual();
+}
+
+inline int32_t World::partial_mix_nb_permutations() const
+{
+  return partial_mix_nb_permutations_;
+}
+
+inline GridCell *World::grid(int16_t x, int16_t y) const
+{
+  return grid_[x][y];
+}
+
+inline Individual *World::indiv_at(int16_t x, int16_t y) const
+{
+  return grid_[x][y]->individual();
+}
+
+inline double**World::secretion_present_grid() const
+{
+  double** ret = new double*[width_];
+
+  for (int16_t x = 0; x < width_ ; x++)
+  {
+    ret[x] = new double[height_];
+    for (int16_t y = 0; y < height_ ; y++)
+    {
+      ret[x][y] = grid_[x][y]->compound_amount();
+    }
+  }
+
+  return ret;
+}
+
+inline double**World::secreted_amount_grid() const
+{
+  double** ret = new double*[width_];
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    ret[x] = new double[height_];
+    for (int16_t y = 0; y < height_ ; y++)
+    {
+      ret[x][y] = grid_[x][y]->secreted_amount();
+    }
+  }
+
+  return ret;
+}
+
+inline double**World::metabolic_fitness_grid() const
+{
+  double** ret = new double*[width_];
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    ret[x] = new double[height_];
+    for (int16_t y = 0; y < height_ ; y++)
+    {
+      ret[x][y] = grid_[x][y]->metabolic_fitness();
+    }
+  }
+
+  return ret;
+}
+
+inline double**World::total_fitness_grid() const
+{
+  double** ret = new double*[width_];
+  for (int16_t x = 0 ; x < width_ ; x++)
+  {
+    ret[x] = new double[height_];
+    for (int16_t y = 0; y < height_ ; y++)
+    {
+      ret[x][y] = grid_[x][y]->total_fitness();
+    }
+  }
+
+  return ret;
+}
+
+// =====================================================================
+//                           Setters' definitions
+// =====================================================================
+inline void World::set_prng(std::shared_ptr<JumpingMT> prng) {
+  prng_ = prng;
+}
+
+inline void World::set_is_well_mixed(bool is_well_mixed) {
+  is_well_mixed_ = is_well_mixed;
+}
+
+inline void World::set_partial_mix_nb_permutations(int32_t nb_permutations) {
+  partial_mix_nb_permutations_ = nb_permutations;
+}
+
+inline void World::set_secretion_degradation_prop(double degradation_prop) {
+  secretion_degradation_prop_=degradation_prop;
+}
+
+inline void World::set_secretion_diffusion_prop(double diffusion_prop) {
+  secretion_diffusion_prop_=diffusion_prop;
+}
+
+inline void World::set_best(int16_t x, int16_t y) {
+  x_best = x;
+  y_best = y;
+}
+
+
+// =====================================================================
+//                          Operators' definitions
+// =====================================================================
+
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+
+} // namespace aevol
+#endif // AEVOL_WORLD_H_
diff --git a/src/libaevol/X11Window.cpp b/src/libaevol/X11Window.cpp
new file mode 100644
index 0000000..5bd264f
--- /dev/null
+++ b/src/libaevol/X11Window.cpp
@@ -0,0 +1,555 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <stdio.h>
+#include <assert.h>
+#include <string>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+#include <unordered_map>
+#include <string>
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "X11Window.h"
+
+#include "ExpSetup.h"
+namespace aevol {
+
+// =================================================================
+//                       Basic X11/Xlib notions
+// =================================================================
+//
+// THE DISPLAY
+//
+// The major notion of using Xlib is the X display. This is a structure
+// representing the connection we have open with a given X server. It
+// hides a queue of messages coming from the server, and a queue of
+// pending requests that our client intends to send to the server.
+// In Xlib, this structure is named 'Display'. When we open a connection
+// to an X server, the library returns a pointer to such a structure.
+// Later, we supply this pointer to any Xlib function that should send
+// messages to the X server or receive messages from this server.
+//
+//
+// THE WINDOWS
+//
+// X11 relies on a hierarchical model of rectangular areas called "Windows".
+//
+// 1. Each Window can be included in another Window (its parent) and may include
+//    other Windows (its children). Windows sharing the same owner are called
+//    siblings.
+// 2. The screen itself is a Window (the Root Window) that contains all Windows.
+// 3. A window can be above or behind a sibling Window. The Window which is above
+//    hides partly or completely the other one.
+// 4. Any drawing made in a Window is automatically "cut", meaning that only the
+//    part of the drawing which is inside the Window is drawn.
+// 5. A Window can be hidden or displayed ("mapped"). The drawing instructions
+//    made on an unmapped Window are ignored. By default, newly created windows
+//    are not mapped on the screen - they are invisible. In order to make a
+//    window visible, we must use the XMapWindow() function.
+// 6. Each event (keyboard, mouse) is aimed at a specific Window.
+// 7. A Window does not memorize its content. Each time it must be re-displayed,
+//    it gets an Expose event, and the content must be redrawn as a response to
+//    this event.
+//
+//
+// THE GC (GRAPHICS CONTEXT)
+//
+// When we perform various drawing operations (graphics, text, etc), we may
+// specify various options for controlling how the data will be drawn - what
+// foreground and background colors to use, how line edges will be connected,
+// what font to use when drawing some text, etc). In order to avoid the need
+// to supply zillions of parameters to each drawing function, a graphical context
+// structure, of type 'GC' is used. We set the various drawing options in this
+// structure, and then pass a pointer to this structure to any drawing routines.
+// This is rather handy, as we often needs to perform several drawing requests
+// with the same options. Thus, we would initialize a graphical context, set the
+// desired options, and pass this GC structure to all drawing functions.
+// Allocating a new GC is done using the XCreateGC() function.
+//    GC XCreateGC(Display *display, Drawable d, uint32_t valuemask,
+//                  XGCValues *values)
+// Since a graphics context has zillions of attributes, and since often we want
+// to define only few of them, we need to be able to tell the XCreateGC() which
+// attributes we want to set. This is what the "valuemask" variable is for.
+// We then use the "values" variable to specify actual values for the attributes
+// we defined in the "valuesmask". The rest of the attributes of this GC will
+// be set to their default values. Once we created a graphics context, we can
+// use it in drawing functions. We can also modify its parameters using various
+// functions (e.g. XSetForeground to change the foreground color of the GC).
+//
+//
+// THE EVENTS
+//
+// A structure of type 'XEvent' is used to pass events received from the X server.
+// Xlib supports a large amount of event types. The XEvent structure contains the
+// type of event received, as well as the data associated with the event (e.g.
+// position on the screen where the event was generated, mouse button associated
+// with the event, region of screen associated with a 'redraw' event, etc). The way
+// to read the event's data depends on the event type. Thus, an XEvent structure
+// contains a C language union of all possible event types (if you're not sure what
+// C unions are, it is time to check your favourite C language manual...). Thus,
+// we could have an XExpose event, an XButton event, an XMotion event, etc.
+// After a program creates a window (or several windows), it should tell the X
+// server what types of events it wishes to receive for this window. By default,
+// no events are sent to the program. This is done for optimizing the server-to-client
+// connection (i.e. why send a program (that might even be running at the other
+// side of the globe) an event it is not interested in?). It may register for
+// various mouse (also called "pointer") events, keyboard events, expose events, etc.
+// In Xlib, we use the XSelectInput() function to register for events. This function
+// accepts 3 parameters - the display structure, an ID of a window, and a mask of
+// the event types it wishes to get.
+
+
+
+
+//##############################################################################
+//                                                                             #
+//                             Class X11Window                             #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+X11Window::X11Window()
+{
+}
+
+
+X11Window::X11Window(Display* display, int8_t screen, Atom* atoms,
+                              uint16_t x, uint16_t y, uint16_t width, uint16_t height,
+                              const char* caption)
+{
+  width_    = width;
+  height_   = height;
+  display_  = display;
+  screen_   = screen;
+
+  XSetWindowAttributes win_attributes;
+  win_attributes.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+  win_attributes.background_pixel = XBlackPixel(display_, screen_);
+
+  window_ = XCreateWindow(display_, DefaultRootWindow(display_), x, y, width_, height_, 0,
+                            CopyFromParent, CopyFromParent, CopyFromParent,
+                            CWBackPixel|CWEventMask, &win_attributes);
+  // NB: the 7th parameter is the width of the window's border, it has nothing to do with
+  // the border appended by the window manager, so this is most often set to zero.
+
+  // Define the title & iconname of the window
+  XSetStandardProperties(display_, window_, caption, caption, None, NULL, 0, NULL);
+
+
+  // We want to get MapNotify events, KeyPress events...
+  XSelectInput(display_, window_, StructureNotifyMask | ExposureMask | KeyPressMask);
+
+
+  // Create graphical contexts
+  uint32_t whiteColor = WhitePixel(display_, screen_);
+  XGCValues values;
+  values.line_width = 1;
+
+  values.foreground = pixel(display_, screen_, (char*)"white", whiteColor);
+  values.background = pixel(display_, screen_, (char*)"black", whiteColor);
+  gcWhite_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+
+  values.foreground = pixel(display_, screen_, (char*)"black",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"white",whiteColor);
+  gcBlack_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"red",  whiteColor);
+  values.background = pixel(display_, screen_, (char*)"black",whiteColor);
+  gcRed_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"green",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"green",whiteColor);
+  gcGreen_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"blue", whiteColor);
+  values.background = pixel(display_, screen_, (char*)"black",whiteColor);
+  gcBlue_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"orange",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"orange",whiteColor);
+  gcOrange_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"yellow",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"yellow",whiteColor);
+  gcYellow_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"lightgrey",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"lightgrey",whiteColor);
+  gcLightGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"darkgrey", whiteColor);
+  values.background = pixel(display_, screen_, (char*)"darkgrey", whiteColor);
+  gcDarkGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"grey15", whiteColor);
+  values.background = pixel(display_, screen_, (char*)"grey15", whiteColor);
+  gcDarkerGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  values.foreground = pixel(display_, screen_, (char*)"grey",whiteColor);
+  values.background = pixel(display_, screen_, (char*)"grey",whiteColor);
+  gcGrey_ = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+
+  XMapWindow(display_, window_);
+  XMoveWindow(display_, window_, x, y);
+  XFlush(display_);
+
+
+  // Necessary to handle window closing
+  XSetWMProtocols(display_, window_, atoms, 2);
+}
+
+
+// =================================================================
+//                             Destructors
+// =================================================================
+
+X11Window::~X11Window()
+{
+  XFreeGC(display_, gcWhite_);
+  XFreeGC(display_, gcBlack_);
+  XFreeGC(display_, gcRed_);
+  XFreeGC(display_, gcGreen_);
+  XFreeGC(display_, gcBlue_);
+  XFreeGC(display_, gcOrange_);
+  XFreeGC(display_, gcYellow_);
+  XFreeGC(display_, gcGrey_);
+  XFreeGC(display_, gcLightGrey_);
+  XFreeGC(display_, gcDarkGrey_);
+  XFreeGC(display_, gcDarkerGrey_);
+
+  XDestroyWindow(display_, window_);
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+
+
+
+void X11Window::resize(unsigned int width, unsigned int height)
+{
+  width_  = width;
+  height_ = height;
+}
+
+
+void X11Window::draw_string(int16_t x, int16_t y, char * str)
+{
+  XDrawImageString(display_, window_, gcWhite_, x, y, str, strlen(str));
+}
+
+void X11Window::draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold /*= false*/)
+{
+  GC* gc = NULL;
+
+  // Determine which GC to use
+  switch (color)
+  {
+    case WHITE :
+      gc = &gcWhite_;
+      break;
+    case BLACK :
+      gc = & gcBlack_;
+      break;
+    case RED :
+      gc = & gcRed_;
+      break;
+    case GREEN :
+      gc = & gcGreen_;
+      break;
+    case BLUE :
+      gc = & gcBlue_;
+      break;
+    case ORANGE :
+      gc = & gcOrange_;
+      break;
+    case YELLOW :
+      gc = & gcYellow_;
+      break;
+    case GREY :
+      gc = & gcGrey_;
+      break;
+    case LIGHT_GREY :
+      gc = & gcLightGrey_;
+      break;
+    case DARK_GREY :
+      gc = & gcDarkGrey_;
+      break;
+    case DARKER_GREY :
+      gc = & gcDarkerGrey_;
+      break;
+  }
+
+
+  // Draw line (lines if bold)
+  XDrawLine(display_, window_, *gc, x1, y1, x2, y2);
+  if (bold)
+  {
+    XDrawLine(display_, window_, *gc, x1-1, y1, x2-1, y2);
+    XDrawLine(display_, window_, *gc, x1+1, y1, x2+1, y2);
+  }
+}
+
+void X11Window::draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold /*= false*/)
+{
+  // Create custom GC
+  XGCValues values;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground, &values);
+
+  // Draw line (lines if bold)
+  XDrawLine(display_, window_, tmp_gc, x1, y1, x2, y2);
+  if (bold)
+  {
+    XDrawLine(display_, window_, tmp_gc, x1-1, y1, x2-1, y2);
+    XDrawLine(display_, window_, tmp_gc, x1+1, y1, x2+1, y2);
+  }
+
+  XFreeGC(display_, tmp_gc);
+}
+
+void X11Window::draw_circle(int16_t x, int16_t y, int16_t diam)
+{
+  XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, 0, 64*360);
+}
+
+void X11Window::draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2)
+{
+  XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, 64*angle1, 64*angle2);
+}
+
+void X11Window::draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color)
+{
+  XGCValues values;
+  values.line_width = 2;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  XDrawArc(display_, window_, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2);
+
+  XFreeGC(display_, tmp_gc);
+}
+
+void X11Window::draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2)
+{
+  XDrawArc(display_, window_, gcWhite_, x, y, diam, diam, angle1, angle2);
+}
+
+void X11Window::draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color)
+{
+  XGCValues values;
+  values.line_width = 2;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  XDrawArc(display_, window_, tmp_gc, x, y, diam, diam, angle1, angle2);
+
+  XFreeGC(display_, tmp_gc);
+}
+
+void X11Window::fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2)
+{
+  XFillArc(display_, window_, gcWhite_, x, y, diam, diam, 64*angle1, 64*angle2);
+}
+
+void X11Window::fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color)
+{
+  XGCValues values;
+  values.line_width = 2;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  XFillArc(display_, window_, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2);
+
+  XFreeGC(display_, tmp_gc);
+}
+
+void X11Window::fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2)
+{
+  XFillArc(display_, window_, gcWhite_, x, y, diam, diam, angle1, angle2);
+}
+
+void X11Window::fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color)
+{
+  XGCValues values;
+  values.line_width = 2;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground|GCLineWidth, &values);
+
+  XFillArc(display_, window_, tmp_gc, x, y, diam, diam, angle1, angle2);
+
+  XFreeGC(display_, tmp_gc);
+}
+
+void X11Window::fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, color_map color)
+{
+  switch (color)
+  {
+    case WHITE :
+      XFillRectangle(display_, window_, gcWhite_, x, y, width, height);
+      break;
+    case BLACK :
+      XFillRectangle(display_, window_, gcBlack_, x, y, width, height);
+      break;
+    case RED :
+      XFillRectangle(display_, window_, gcRed_, x, y, width, height);
+      break;
+    case GREEN :
+      XFillRectangle(display_, window_, gcGreen_, x, y, width, height);
+      break;
+    case BLUE :
+      XFillRectangle(display_, window_, gcBlue_, x, y, width, height);
+      break;
+    case ORANGE :
+      XFillRectangle(display_, window_, gcOrange_, x, y, width, height);
+      break;
+    case YELLOW :
+      XFillRectangle(display_, window_, gcYellow_, x, y, width, height);
+      break;
+    case GREY :
+      XFillRectangle(display_, window_, gcGrey_, x, y, width, height);
+      break;
+    case LIGHT_GREY :
+      XFillRectangle(display_, window_, gcLightGrey_, x, y, width, height);
+      break;
+    case DARK_GREY :
+      XFillRectangle(display_, window_, gcDarkGrey_, x, y, width, height);
+      break;
+    case DARKER_GREY :
+      XFillRectangle(display_, window_, gcDarkerGrey_, x, y, width, height);
+      break;
+  }
+}
+
+void X11Window::fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, char* color)
+{
+  XGCValues values;
+  values.foreground = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  values.background = pixel(display_, screen_, color, WhitePixel(display_,screen_));
+  GC tmp_gc = XCreateGC(display_, window_, GCForeground|GCBackground, &values);
+
+  XFillRectangle(display_, window_, tmp_gc, x, y, width, height);
+
+  XFreeGC(display_, tmp_gc);
+}
+
+char*X11Window::color(double mean)
+{
+  int16_t red, green, blue;
+
+  double  mean_range     = X_MAX - X_MIN;
+  double  mean_range_5   = X_MIN + mean_range / 5;
+  double  mean_range_2_5 = X_MIN + 2 * mean_range / 5;
+  double  mean_range_3_5 = X_MIN + 3 * mean_range / 5;
+  double  mean_range_4_5 = X_MIN + 4 * mean_range / 5;
+
+  if (mean < mean_range_5)
+  {
+    red   = 0;
+    green = 255 * (1.0 - ((mean_range_5 - mean) / mean_range_5));
+    blue  = 255;
+  }
+  else if (mean < mean_range_2_5)
+  {
+    red   = 0;
+    green = 255;
+    blue  = 255 * ((mean_range_2_5 - mean) / mean_range_5);
+  }
+  else if (mean < mean_range_3_5)
+  {
+    red   = 255 * (1.0 - ((mean_range_3_5 - mean) / mean_range_5));
+    green = 255;
+    blue  = 0;
+  }
+  else if (mean < mean_range_4_5)
+  {
+    red   = 255;
+    green = 255 * ((mean_range_4_5 - mean) / mean_range_5);
+    blue  = 0;
+  }
+  else
+  {
+    red   = 255;
+    green = 0;
+    blue  = 255 * (1.0 - ((mean_range - mean) / mean_range_5));
+  }
+
+  char* color = new char[8];
+  sprintf(color, "#%02x%02x%02x", red, green, blue);
+  return color;
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+
+uint32_t X11Window::pixel(Display *display, int8_t screen, char *color_name, uint32_t default_color)
+{
+  // hacked on 2014-12-05 because XQuarz and Yosemite make XAllocColor veeery slow
+  // dirty memoization workaround: display and screen are assumed to be constant
+  // costs 21Kb of RAM on basic example (according to the measure given before the return)
+  static std::unordered_map <std::string, unsigned long> color_memo;
+
+  // if color_name is already recorded, compute and record it
+  if (color_memo.find(color_name) == color_memo.end()) {
+    XColor color;
+    if (XParseColor(display, DefaultColormap(display,screen), color_name, &color) == 0) {
+      fprintf(stderr, "Invalid color: %s\n", color_name);
+      return default_color;
+    }
+    if (XAllocColor(display, DefaultColormap(display,screen), &color) == 0) {
+      fprintf(stderr, "Could not allocate color %s\n", color_name);
+      return default_color;
+    }
+    color_memo[color_name] = color.pixel;
+  }
+  // printf("ram used: %lu bytes\n", sizeof(color_memo) + color_memo.size() * (sizeof(std::string) + sizeof(unsigned long)));
+  return color_memo[color_name];
+}
+} // namespace aevol
diff --git a/src/libaevol/ae_X11_window.h b/src/libaevol/X11Window.h
similarity index 51%
rename from src/libaevol/ae_X11_window.h
rename to src/libaevol/X11Window.h
index a78e245..feb0999 100644
--- a/src/libaevol/ae_X11_window.h
+++ b/src/libaevol/X11Window.h
@@ -3,32 +3,32 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
- 
- 
-#ifndef  __AE_X11_WINDOW_H__
-#define  __AE_X11_WINDOW_H__
- 
- 
+//
+// ****************************************************************************
+
+
+#ifndef  AEVOL_X11_WINDOW_H_
+#define  AEVOL_X11_WINDOW_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
@@ -40,9 +40,13 @@
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
 
 
+namespace aevol {
 
 
 // =================================================================
@@ -68,122 +72,122 @@ enum color_map
 
 
 
- 
-class ae_X11_window : public ae_object
-{  
+
+class X11Window
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_X11_window( void );
-    ae_X11_window(  Display* display, int8_t screen, Atom * atoms,
-                    uint16_t pos_x, uint16_t pos_y, 
+    X11Window();
+    X11Window(Display* display, int8_t screen, Atom * atoms,
+                    uint16_t pos_x, uint16_t pos_y,
                     uint16_t width, uint16_t height,
-                    const char* caption );
-  
+                    const char* caption);
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_X11_window( void );
-  
+    virtual ~X11Window();
+
     // =================================================================
     //                              Accessors
     // =================================================================
-    GC get_gc_white( void )     { return _gcWhite;      };
-    GC get_gc_black( void )     { return _gcBlack;      };
-    GC getGCBlue( void )        { return _gcBlue;       };
-    GC getGCRed( void )         { return _gcRed;        };
-    GC getGCLightGrey( void )   { return _gcLightGrey;  };
-    GC getGCDarkGrey( void )    { return _gcDarkGrey;   };
-    GC getGCDarkerGrey( void )  { return _gcDarkerGrey; };
-    GC getGCGrey( void )        { return _gcGrey;       };
-    GC getGCGreen( void )       { return _gcGreen;      };
-    GC getGCOrange( void )      { return _gcOrange;     };
-    GC getGCYellow( void )      { return _gcYellow;     };
-
-    uint16_t  get_width( void )         { return _width;   };
-    uint16_t  get_height( void )        { return _height;  };
-    Window        get_window( void )    { return _window;  };
-    Display *     get_display( void )   { return _display; };
-  
+    GC gc_white()     { return gcWhite_;      };
+    GC gc_black()     { return gcBlack_;      };
+    GC getGCBlue()        { return gcBlue_;       };
+    GC getGCRed()         { return gcRed_;        };
+    GC getGCLightGrey()   { return gcLightGrey_;  };
+    GC getGCDarkGrey()    { return gcDarkGrey_;   };
+    GC getGCDarkerGrey()  { return gcDarkerGrey_; };
+    GC getGCGrey()        { return gcGrey_;       };
+    GC getGCGreen()       { return gcGreen_;      };
+    GC getGCOrange()      { return gcOrange_;     };
+    GC getGCYellow()      { return gcYellow_;     };
+
+    uint16_t  width()         { return width_;   };
+    uint16_t  height()        { return height_;  };
+    Window        window()    { return window_;  };
+    Display *     display()   { return display_; };
+
     // =================================================================
     //                            Public Methods
     // =================================================================
 
-    void resize( unsigned int width, unsigned int height );
-    inline void blacken( void );
-    void draw_string( int16_t x, int16_t y, char* str );
-    void draw_line( int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold = false );
-    void draw_line( int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold = false );
-    void draw_circle( int16_t x, int16_t y, int16_t diam );
-    void draw_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 );
-    void draw_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color );
-    void draw_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 );
-    void draw_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color );
-    void fill_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 );
-    void fill_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color );
-    void fill_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 );
-    void fill_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color );
-    void fill_rectangle( int16_t x, int16_t y, int16_t width, int16_t height, color_map color );
-    void fill_rectangle( int16_t x, int16_t y, int16_t width, int16_t height, char* color );
-    
-    static char* get_color( double mean );
-  
+    void resize(unsigned int width, unsigned int height);
+    inline void blacken();
+    void draw_string(int16_t x, int16_t y, char* str);
+    void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold = false);
+    void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold = false);
+    void draw_circle(int16_t x, int16_t y, int16_t diam);
+    void draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2);
+    void draw_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color);
+    void draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2);
+    void draw_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color);
+    void fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2);
+    void fill_arc(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color);
+    void fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2);
+    void fill_arc_64(int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color);
+    void fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, color_map color);
+    void fill_rectangle(int16_t x, int16_t y, int16_t width, int16_t height, char* color);
+
+    static char* color(double mean);
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-  
-  
-  
-  
-  
+
+
+
+
+
   protected :
-  
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    //~ ae_X11_window( void )
+    //~ X11Window()
     //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
+      //~ printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      //~ exit(EXIT_FAILURE);
     //~ };
-    ae_X11_window( const ae_X11_window &model )
+    X11Window(const X11Window &model)
     {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
     };
 
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    uint32_t get_pixel( Display *display, int8_t screen, char *color_name, uint32_t default_color );
-    void set_codes( void );
-  
+    uint32_t pixel(Display *display, int8_t screen, char *color_name, uint32_t default_color);
+    void set_codes();
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    Display * _display;
-    int8_t    _screen;
-    Window    _window;
-    Cursor    _cursor;
-    
-    uint16_t _width;
-    uint16_t _height;
+    Display * display_;
+    int8_t    screen_;
+    Window    window_;
+    Cursor    cursor_;
+
+    uint16_t width_;
+    uint16_t height_;
+
 
-  
     // Graphic Contexts
-    GC _gcWhite;
-    GC _gcBlack;
-    GC _gcRed;
-    GC _gcGreen;
-    GC _gcBlue;
-    GC _gcOrange;
-    GC _gcYellow;
-    GC _gcGrey;
-    GC _gcLightGrey;
-    GC _gcDarkGrey;
-    GC _gcDarkerGrey;
+    GC gcWhite_;
+    GC gcBlack_;
+    GC gcRed_;
+    GC gcGreen_;
+    GC gcBlue_;
+    GC gcOrange_;
+    GC gcYellow_;
+    GC gcGrey_;
+    GC gcLightGrey_;
+    GC gcDarkGrey_;
+    GC gcDarkerGrey_;
 };
 
 
@@ -194,10 +198,10 @@ class ae_X11_window : public ae_object
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-void ae_X11_window::blacken( void )
+void X11Window::blacken()
 {
-  fill_rectangle( 0, 0, _width, _height, BLACK );
+  fill_rectangle(0, 0, width_, height_, BLACK);
 }
 
-
-#endif // __AE_X11_WINDOW_H__
+} // namespace aevol
+#endif // AEVOL_X11_WINDOW_H_
diff --git a/src/libaevol/ae_X11_window.cpp b/src/libaevol/ae_X11_window.cpp
deleted file mode 100644
index 7595e30..0000000
--- a/src/libaevol/ae_X11_window.cpp
+++ /dev/null
@@ -1,558 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <assert.h>
-#include <string>
-#include <X11/Xutil.h>
-#include <X11/cursorfont.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_X11_window.h>
-
-#include <ae_exp_setup.h>
-
-
-
-
-// =================================================================
-//                       Basic X11/Xlib notions
-// =================================================================
-//
-// THE DISPLAY
-//
-// The major notion of using Xlib is the X display. This is a structure 
-// representing the connection we have open with a given X server. It 
-// hides a queue of messages coming from the server, and a queue of 
-// pending requests that our client intends to send to the server. 
-// In Xlib, this structure is named 'Display'. When we open a connection 
-// to an X server, the library returns a pointer to such a structure. 
-// Later, we supply this pointer to any Xlib function that should send 
-// messages to the X server or receive messages from this server.
-// 
-//
-// THE WINDOWS
-//
-// X11 relies on a hierarchical model of rectangular areas called "Windows".
-//
-// 1. Each Window can be included in another Window (its parent) and may include
-//    other Windows (its children). Windows sharing the same owner are called 
-//    siblings.
-// 2. The screen itself is a Window (the Root Window) that contains all Windows.
-// 3. A window can be above or behind a sibling Window. The Window which is above
-//    hides partly or completely the other one.
-// 4. Any drawing made in a Window is automatically "cut", meaning that only the 
-//    part of the drawing which is inside the Window is drawn.
-// 5. A Window can be hidden or displayed ("mapped"). The drawing instructions
-//    made on an unmapped Window are ignored. By default, newly created windows 
-//    are not mapped on the screen - they are invisible. In order to make a 
-//    window visible, we must use the XMapWindow() function.
-// 6. Each event (keyboard, mouse) is aimed at a specific Window.
-// 7. A Window does not memorize its content. Each time it must be re-displayed, 
-//    it gets an Expose event, and the content must be redrawn as a response to
-//    this event. 
-//
-//
-// THE GC (GRAPHICS CONTEXT)
-//
-// When we perform various drawing operations (graphics, text, etc), we may 
-// specify various options for controlling how the data will be drawn - what 
-// foreground and background colors to use, how line edges will be connected, 
-// what font to use when drawing some text, etc). In order to avoid the need 
-// to supply zillions of parameters to each drawing function, a graphical context 
-// structure, of type 'GC' is used. We set the various drawing options in this 
-// structure, and then pass a pointer to this structure to any drawing routines. 
-// This is rather handy, as we often needs to perform several drawing requests 
-// with the same options. Thus, we would initialize a graphical context, set the 
-// desired options, and pass this GC structure to all drawing functions. 
-// Allocating a new GC is done using the XCreateGC() function. 
-//    GC XCreateGC( Display *display, Drawable d, uint32_t valuemask, 
-//                  XGCValues *values )
-// Since a graphics context has zillions of attributes, and since often we want 
-// to define only few of them, we need to be able to tell the XCreateGC() which 
-// attributes we want to set. This is what the "valuemask" variable is for. 
-// We then use the "values" variable to specify actual values for the attributes 
-// we defined in the "valuesmask". The rest of the attributes of this GC will 
-// be set to their default values. Once we created a graphics context, we can 
-// use it in drawing functions. We can also modify its parameters using various 
-// functions (e.g. XSetForeground to change the foreground color of the GC).
-//
-//
-// THE EVENTS
-//
-// A structure of type 'XEvent' is used to pass events received from the X server. 
-// Xlib supports a large amount of event types. The XEvent structure contains the 
-// type of event received, as well as the data associated with the event (e.g. 
-// position on the screen where the event was generated, mouse button associated 
-// with the event, region of screen associated with a 'redraw' event, etc). The way 
-// to read the event's data depends on the event type. Thus, an XEvent structure 
-// contains a C language union of all possible event types (if you're not sure what 
-// C unions are, it is time to check your favourite C language manual...). Thus, 
-// we could have an XExpose event, an XButton event, an XMotion event, etc.
-// After a program creates a window (or several windows), it should tell the X 
-// server what types of events it wishes to receive for this window. By default, 
-// no events are sent to the program. This is done for optimizing the server-to-client
-// connection (i.e. why send a program (that might even be running at the other 
-// side of the globe) an event it is not interested in?). It may register for 
-// various mouse (also called "pointer") events, keyboard events, expose events, etc.
-// In Xlib, we use the XSelectInput() function to register for events. This function 
-// accepts 3 parameters - the display structure, an ID of a window, and a mask of 
-// the event types it wishes to get. 
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_X11_window                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_X11_window::ae_X11_window( void )
-{
-}
-
-
-ae_X11_window::ae_X11_window( Display* display, int8_t screen, Atom* atoms,
-                              uint16_t x, uint16_t y, uint16_t width, uint16_t height,
-                              const char* caption )
-{
-  _width    = width;
-  _height   = height;
-  _display  = display;
-  _screen   = screen;
-
-
-  XSetWindowAttributes win_attributes;
-  win_attributes.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
-  win_attributes.background_pixel = XBlackPixel( _display, _screen );
-  
-  _window = XCreateWindow(  _display, DefaultRootWindow(_display), x, y, _width, _height, 0,
-                            CopyFromParent, CopyFromParent, CopyFromParent,
-                            CWBackPixel|CWEventMask, &win_attributes );
-  // NB: the 7th parameter is the width of the window's border, it has nothing to do with 
-  // the border appended by the window manager, so this is most often set to zero. 
-
-  // Define the title & iconname of the window 
-  XSetStandardProperties( _display, _window, caption, caption, None, NULL, 0, NULL );
-
-
-  // We want to get MapNotify events, KeyPress events...
-  XSelectInput( _display, _window, StructureNotifyMask | ExposureMask | KeyPressMask );
-
-
-  // Create graphical contexts
-  uint32_t whiteColor = WhitePixel( _display, _screen );
-  XGCValues values;
-  values.line_width = 1;
-
-  values.foreground = get_pixel( _display, _screen, (char*)"white", whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"black", whiteColor );
-  _gcWhite = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-
-  values.foreground = get_pixel( _display, _screen, (char*)"black",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"white",whiteColor );
-  _gcBlack = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"red",  whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"black",whiteColor );
-  _gcRed = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"green",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"green",whiteColor );
-  _gcGreen = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"blue", whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"black",whiteColor );
-  _gcBlue = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"orange",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"orange",whiteColor );
-  _gcOrange = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"yellow",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"yellow",whiteColor );
-  _gcYellow = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"lightgrey",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"lightgrey",whiteColor );
-  _gcLightGrey = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"darkgrey", whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"darkgrey", whiteColor );
-  _gcDarkGrey = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"grey15", whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"grey15", whiteColor );
-  _gcDarkerGrey = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  values.foreground = get_pixel( _display, _screen, (char*)"grey",whiteColor );
-  values.background = get_pixel( _display, _screen, (char*)"grey",whiteColor );
-  _gcGrey = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-
-  XMapWindow( _display, _window );
-  XMoveWindow( _display, _window, x, y );
-  XFlush( _display );
-
-
-  // Necessary to handle window closing
-  XSetWMProtocols( _display, _window, atoms, 2 );
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-ae_X11_window::~ae_X11_window( void )
-{
-  XFreeGC( _display, _gcWhite );
-  XFreeGC( _display, _gcBlack );
-  XFreeGC( _display, _gcRed );
-  XFreeGC( _display, _gcGreen );
-  XFreeGC( _display, _gcBlue );
-  XFreeGC( _display, _gcOrange );
-  XFreeGC( _display, _gcYellow );
-  XFreeGC( _display, _gcGrey );
-  XFreeGC( _display, _gcLightGrey );
-  XFreeGC( _display, _gcDarkGrey );
-  XFreeGC( _display, _gcDarkerGrey );
-
-  XDestroyWindow( _display, _window );
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-
-
-void ae_X11_window::resize( unsigned int width, unsigned int height )
-{
-  _width  = width;
-  _height = height;
-}
-
-
-void ae_X11_window::draw_string( int16_t x, int16_t y, char * str )
-{
-  XDrawImageString( _display, _window, _gcWhite, x, y, str, strlen(str) );
-}
-
-void ae_X11_window::draw_line( int16_t x1, int16_t y1, int16_t x2, int16_t y2, color_map color, bool bold /*= false*/ )
-{
-  GC* gc = NULL;
-  
-  // Determine which GC to use
-  switch ( color )
-  {
-    case WHITE :
-      gc = &_gcWhite;
-      break;
-    case BLACK :
-      gc = & _gcBlack;
-      break;
-    case RED :
-      gc = & _gcRed;
-      break;
-    case GREEN :
-      gc = & _gcGreen;
-      break;
-    case BLUE :
-      gc = & _gcBlue;
-      break;
-    case ORANGE :
-      gc = & _gcOrange;
-      break;
-    case YELLOW :
-      gc = & _gcYellow;
-      break;
-    case GREY :
-      gc = & _gcGrey;
-      break;
-    case LIGHT_GREY :
-      gc = & _gcLightGrey;
-      break;
-    case DARK_GREY :
-      gc = & _gcDarkGrey;
-      break;
-    case DARKER_GREY :
-      gc = & _gcDarkerGrey;
-      break;
-  }
-  
-  
-  // Draw line (lines if bold)
-  XDrawLine( _display, _window, *gc, x1, y1, x2, y2 );
-  if ( bold )
-  {
-    XDrawLine( _display, _window, *gc, x1-1, y1, x2-1, y2 );
-    XDrawLine( _display, _window, *gc, x1+1, y1, x2+1, y2 );
-  }
-}
-
-void ae_X11_window::draw_line( int16_t x1, int16_t y1, int16_t x2, int16_t y2, char* color, bool bold /*= false*/ )
-{
-  // Create custom GC
-  XGCValues values;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground, &values );
-
-  // Draw line (lines if bold)
-  XDrawLine( _display, _window, tmp_gc, x1, y1, x2, y2 );
-  if ( bold )
-  {
-    XDrawLine( _display, _window, tmp_gc, x1-1, y1, x2-1, y2 );
-    XDrawLine( _display, _window, tmp_gc, x1+1, y1, x2+1, y2 );
-  }
-
-  XFreeGC( _display, tmp_gc );
-}
-
-void ae_X11_window::draw_circle( int16_t x, int16_t y, int16_t diam )
-{
-  XDrawArc( _display, _window, _gcWhite, x, y, diam, diam, 0, 64*360 );
-}
-
-void ae_X11_window::draw_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 )
-{
-  XDrawArc( _display, _window, _gcWhite, x, y, diam, diam, 64*angle1, 64*angle2 );
-}
-
-void ae_X11_window::draw_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color )
-{
-  XGCValues values;
-  values.line_width = 2;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  XDrawArc( _display, _window, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2 );
-
-  XFreeGC( _display, tmp_gc );
-}
-
-void ae_X11_window::draw_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 )
-{
-  XDrawArc( _display, _window, _gcWhite, x, y, diam, diam, angle1, angle2 );
-}
-
-void ae_X11_window::draw_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color )
-{
-  XGCValues values;
-  values.line_width = 2;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  XDrawArc( _display, _window, tmp_gc, x, y, diam, diam, angle1, angle2 );
-
-  XFreeGC( _display, tmp_gc );
-}
-
-void ae_X11_window::fill_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 )
-{
-  XFillArc( _display, _window, _gcWhite, x, y, diam, diam, 64*angle1, 64*angle2 );
-}
-
-void ae_X11_window::fill_arc( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color )
-{
-  XGCValues values;
-  values.line_width = 2;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  XFillArc( _display, _window, tmp_gc, x, y, diam, diam, 64*angle1, 64*angle2 );
-
-  XFreeGC( _display, tmp_gc );
-}
-
-void ae_X11_window::fill_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2 )
-{
-  XFillArc( _display, _window, _gcWhite, x, y, diam, diam, angle1, angle2 );
-}
-
-void ae_X11_window::fill_arc_64( int16_t x, int16_t y, int16_t diam, int16_t angle1, int16_t angle2, char* color )
-{
-  XGCValues values;
-  values.line_width = 2;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground|GCLineWidth, &values );
-
-  XFillArc( _display, _window, tmp_gc, x, y, diam, diam, angle1, angle2 );
-
-  XFreeGC( _display, tmp_gc );
-}
-
-void ae_X11_window::fill_rectangle( int16_t x, int16_t y, int16_t width, int16_t height, color_map color )
-{
-  switch ( color )
-  {
-    case WHITE :
-      XFillRectangle( _display, _window, _gcWhite, x, y, width, height );
-      break;
-    case BLACK :
-      XFillRectangle( _display, _window, _gcBlack, x, y, width, height );
-      break;
-    case RED :
-      XFillRectangle( _display, _window, _gcRed, x, y, width, height );
-      break;
-    case GREEN :
-      XFillRectangle( _display, _window, _gcGreen, x, y, width, height );
-      break;
-    case BLUE :
-      XFillRectangle( _display, _window, _gcBlue, x, y, width, height );
-      break;
-    case ORANGE :
-      XFillRectangle( _display, _window, _gcOrange, x, y, width, height );
-      break;
-    case YELLOW :
-      XFillRectangle( _display, _window, _gcYellow, x, y, width, height );
-      break;
-    case GREY :
-      XFillRectangle( _display, _window, _gcGrey, x, y, width, height );
-      break;
-    case LIGHT_GREY :
-      XFillRectangle( _display, _window, _gcLightGrey, x, y, width, height );
-      break;
-    case DARK_GREY :
-      XFillRectangle( _display, _window, _gcDarkGrey, x, y, width, height );
-      break;
-    case DARKER_GREY :
-      XFillRectangle( _display, _window, _gcDarkerGrey, x, y, width, height );
-      break;
-  }
-}
-
-void ae_X11_window::fill_rectangle( int16_t x, int16_t y, int16_t width, int16_t height, char* color )
-{
-  XGCValues values;
-  values.foreground = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  values.background = get_pixel( _display, _screen, color, WhitePixel(_display,_screen) );
-  GC tmp_gc = XCreateGC( _display, _window, GCForeground|GCBackground, &values );
-
-  XFillRectangle( _display, _window, tmp_gc, x, y, width, height );
-
-  XFreeGC( _display, tmp_gc );
-}
-
-char* ae_X11_window::get_color( double mean )
-{
-  int16_t red, green, blue;
-
-  double  mean_range     = X_MAX - X_MIN;
-  double  mean_range_5   = X_MIN + mean_range / 5;
-  double  mean_range_2_5 = X_MIN + 2 * mean_range / 5;
-  double  mean_range_3_5 = X_MIN + 3 * mean_range / 5;
-  double  mean_range_4_5 = X_MIN + 4 * mean_range / 5;
-
-  if ( mean < mean_range_5 )
-  {
-    red   = 0;
-    green = 255 * ( 1.0 - ( (mean_range_5 - mean) / mean_range_5 ) );
-    blue  = 255;
-  }
-  else if ( mean < mean_range_2_5 )
-  {
-    red   = 0;
-    green = 255;
-    blue  = 255 * ( (mean_range_2_5 - mean) / mean_range_5 );
-  }
-  else if ( mean < mean_range_3_5 )
-  {
-    red   = 255 * ( 1.0 - ( (mean_range_3_5 - mean) / mean_range_5 ) );
-    green = 255;
-    blue  = 0;
-  }
-  else if ( mean < mean_range_4_5 )
-  {
-    red   = 255;
-    green = 255 * ( (mean_range_4_5 - mean) / mean_range_5 );
-    blue  = 0;
-  }
-  else
-  {
-    red   = 255;
-    green = 0;
-    blue  = 255 * ( 1.0 - ( (mean_range - mean) / mean_range_5 ) );
-  }
-
-  char* color = new char[8];
-  sprintf( color, "#%02x%02x%02x", red, green, blue );
-  return color;
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-uint32_t ae_X11_window::get_pixel( Display *display, int8_t screen, char *color_name, uint32_t default_color )
-{
-  XColor color;
-
-  if ( XParseColor( display, DefaultColormap(display,screen), color_name, &color ) == 0 )
-  {
-    fprintf( stderr, "Invalid colour : %s\n", color_name );
-    return default_color;
-  }
-
-  if ( XAllocColor( display, DefaultColormap(display,screen), &color ) == 0 )
-  {
-    fprintf( stderr, "Could not allocate colour %s\n", color_name );
-    return default_color;
-  }
-
-
-  return color.pixel;
-}
-
-
-
-
diff --git a/src/libaevol/ae_align.cpp b/src/libaevol/ae_align.cpp
deleted file mode 100644
index 62ab49d..0000000
--- a/src/libaevol/ae_align.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_align.h>
-#include <ae_utils.h>
-#include <ae_individual.h>
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_align                               #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-//bool ae_align::with_alignments;
-
-//ae_align_fun_shape ae_align::align_fun_shape;
-
-//double  ae_align::align_sigm_lambda;
-//int16_t ae_align::align_sigm_mean;
-//int16_t ae_align::align_lin_min;
-//int16_t ae_align::align_lin_max;
-
-//int16_t ae_align::align_max_shift;
-//int16_t ae_align::align_w_zone_h_len;
-//int16_t ae_align::align_match_bonus;
-//int16_t ae_align::align_mismatch_cost;
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-ae_vis_a_vis* ae_align::search_alignment_direct( const ae_dna* chrom_1, const int32_t seed_1,
-                                                 const ae_dna* chrom_2, const int32_t seed_2, const int16_t needed_score )
-{
-  ae_vis_a_vis * best_alignment = NULL;
-  
-  int16_t nb_diags = 2 * chrom_1->get_indiv()->get_align_max_shift() + 1;
-  ae_vis_a_vis * cur_vav = NULL;
-  
-  // TODO : As ae_vis_a_vis now contains its score, we should adapt the code to make it more integrated
-  int16_t cur_score;
-  
-  
-  // Zone 1 (Indice on the chromosome)
-  int32_t w_zone_1_first  = seed_1 - chrom_1->get_indiv()->get_align_w_zone_h_len();       // First base in working zone 1
-  int32_t w_zone_1_last   = seed_1 + chrom_1->get_indiv()->get_align_w_zone_h_len();       // Last  base in working zone 1
-  int32_t x_zone_1_first  = w_zone_1_first - chrom_1->get_indiv()->get_align_max_shift();  // First base in extended zone 1
-  //~ int32_t x_zone_1_last   = w_zone_1_last  + align_max_shift;  // Last  base in extended zone 1
-  
-  // Zone 2 (Indice on the chromosome)
-  int32_t w_zone_2_first  = seed_2 - chrom_2->get_indiv()->get_align_w_zone_h_len();       // First base in working zone 2
-  int32_t w_zone_2_last   = seed_2 + chrom_2->get_indiv()->get_align_w_zone_h_len();       // Last  base in working zone 2
-  //~ int32_t x_zone_2_first  = w_zone_2_first - align_max_shift;  // First base in extended zone 2
-  //~ int32_t x_zone_2_last   = w_zone_2_last  + align_max_shift;  // Last base in extended zone 2
-  
-  int32_t w_zone_2_shifted_first = w_zone_2_first + chrom_2->get_indiv()->get_align_max_shift(); // This doesn't represent any point of interest
-                                                                                              // in the sequence but will spare some calculation
-  
-  
-  // Parse diagonals
-  for ( int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++ )
-  {
-    // Initialize cur_vav according to the diagonal we are on
-    if ( cur_diag < chrom_1->get_indiv()->get_align_max_shift() )
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, x_zone_1_first + cur_diag, w_zone_2_first, DIRECT );
-    }
-    else if ( cur_diag > chrom_1->get_indiv()->get_align_max_shift() )
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, w_zone_1_first, w_zone_2_shifted_first - cur_diag, DIRECT );
-    }
-    else // Central diagonal
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, w_zone_1_first, w_zone_2_first, DIRECT );
-    }
-    
-    // A sequence against itself is not an alignment
-    if ( chrom_1 == chrom_2 && ae_utils::mod(cur_vav->_i_1, chrom_1->get_length()) == ae_utils::mod(cur_vav->_i_2, chrom_2->get_length()) )
-    {
-      delete cur_vav;
-      continue;
-    }
-    
-    cur_score = 0;
-    
-    // Parse current diagonal
-    while ( cur_vav->_i_1 <= w_zone_1_last || cur_vav->_i_2 <= w_zone_2_last )
-    {
-      // Re-initialize score and potential alignment starting point if score <= 0
-      if ( cur_score <= 0 )
-      {
-        cur_score = 0;
-        if ( best_alignment != NULL )
-        {
-          best_alignment->copy( cur_vav );
-        }
-        else
-        {
-          best_alignment = new ae_vis_a_vis( *cur_vav );
-        }
-      }
-      
-      // Update Score
-      if ( cur_vav->match() )
-      {
-        cur_score += chrom_1->get_indiv()->get_align_match_bonus();
-        
-        // Check whether score is high enough to rearrange
-        if ( cur_score >= needed_score )
-        {
-          delete cur_vav;
-          best_alignment->check_indices();
-          
-          best_alignment->_score = cur_score;
-          return best_alignment;
-        }
-      }
-      else
-      {
-        cur_score -= chrom_1->get_indiv()->get_align_mismatch_cost();
-      }
-      
-      // Step forward
-      cur_vav->step_fwd();
-    }
-    
-    delete cur_vav;
-  }
-  
-  
-  if ( best_alignment != NULL )
-  {
-    delete best_alignment;
-  }
-  
-  return NULL; // Didn't find any alignment with sufficient score.
-}
-
-
-ae_vis_a_vis* ae_align::search_alignment_indirect( const ae_dna* chrom_1, const int32_t seed_1,
-                                                   const ae_dna* chrom_2, const int32_t seed_2, const int16_t needed_score )
-{
-  ae_vis_a_vis * best_alignment = NULL;
-  
-  int16_t nb_diags = 2 * chrom_1->get_indiv()->get_align_max_shift() + 1;
-  int16_t cur_score;
-  ae_vis_a_vis * cur_vav = NULL;
-  
-  // Zone 1 (Indice on the chromosome)
-  int32_t w_zone_1_first  = seed_1 - chrom_1->get_indiv()->get_align_w_zone_h_len();       // First base in working zone 1
-  int32_t w_zone_1_last   = seed_1 + chrom_1->get_indiv()->get_align_w_zone_h_len();       // Last  base in working zone 1
-  int32_t x_zone_1_first  = w_zone_1_first - chrom_1->get_indiv()->get_align_max_shift();  // First base in extended zone 1
-  //~ int32_t x_zone_1_last   = w_zone_1_last  + align_max_shift;  // Last  base in extended zone 1
-  
-  // Zone 2 (Indice on the chromosome)
-  // ********** WARNING **********
-  // Because we are reading backwards, every read is shifted by -1.
-  //
-  //    0 1 2 3 4 5 6 7 8 9
-  //    |_|_|_|_|_|_|_|_|_|_|   On this sequence, if you consider index 5, the nucleotide you need to consider 
-  //                            for a backards read is seq[4], NOT seq[5].
-  //
-  // This is managed by class ae_vis_a_vis.
-  //
-  //    a b c d e f g h i j       Creating a new ae_vis_a_vis( F, 5, LAGGING );
-  //    |_|_|_|_|_|_|_|_|_|_|     and then asking: my_vis_a_vis->match() will compare seq1[F] and seq2[4]
-  //    | | | | | | | | | | |     (i.e. its "real" vis_a_vis).
-  //      9 8 7 6 5 4 3 2 1 0     my_vis_a_vis->match() returns true if (seq1[F] == complementary( seq2[4] ))
-  //
-  // In this example and with a align_w_zone_h_len of 2 and a max_shift of 1, the working_zone and extended_zone will be defined by
-  // w_zone_1_first = d   // (f-2)
-  // w_zone_1_last  = h   // (f+2)
-  // x_zone_1_first = c   // (f-2-1)
-  // w_zone_2_first = 7   // The "real" vis_a_vis for d (5+2)
-  // w_zone_2_last  = 3   // The "real" vis_a_vis for h (5-2)
-  // w_zone_2_shifted_first = 4 // (5-1).
-  //
-  // It is worth noting that the working zone is defined as follows:
-  //
-  //    d e f g h       Hence, while 'd' and 'h' do correspond to the zone's first and last nucleotides' indices, 
-  //    |_|_|_|_|_|     '7' and '3' are indeed shifted and it seems they don't correspond to anything.
-  //    | | | | | |     I should have coded the limits (i.e. 'd' and 'i' + '7' and '2') in the first place...
-  //      6 5 4 3 2
-  //
-  int32_t w_zone_2_first  = seed_2 + chrom_2->get_indiv()->get_align_w_zone_h_len();       // First base in working zone 2
-  int32_t w_zone_2_last   = seed_2 - chrom_2->get_indiv()->get_align_w_zone_h_len();       // Last  base in working zone 2
-  //~ int32_t x_zone_2_first  = w_zone_2_first + align_max_shift;  // First base in extended zone 2
-  //~ int32_t x_zone_2_last   = w_zone_2_last  - align_max_shift;  // Last  base in extended zone 2
-  
-  int32_t w_zone_2_shifted_first = w_zone_2_first - chrom_2->get_indiv()->get_align_max_shift(); // This doesn't represent any interesting point
-                                                                                              // in the sequence but will spare some calculation
-  
-  
-  // Parse diagonals
-  for ( int16_t cur_diag = 0 ; cur_diag < nb_diags ; cur_diag++ )
-  {
-    // Initialize cur_vav according to the diagonal we are on
-    if ( cur_diag < chrom_1->get_indiv()->get_align_max_shift() )
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, x_zone_1_first + cur_diag, w_zone_2_first, INDIRECT );
-    }
-    else if ( cur_diag > chrom_1->get_indiv()->get_align_max_shift() )
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, w_zone_1_first, w_zone_2_shifted_first + cur_diag, INDIRECT );
-    }
-    else // Central diagonal
-    {
-      cur_vav = new ae_vis_a_vis( chrom_1, chrom_2, w_zone_1_first, w_zone_2_first, INDIRECT );
-    }
-    
-    cur_score = 0;
-    
-    
-    // Parse diagonal
-    while ( cur_vav->_i_1 <= w_zone_1_last || cur_vav->_i_2 >= w_zone_2_last )
-    {
-      // Re-initialize score and potential alignment starting point if score <= 0
-      if ( cur_score <= 0 )
-      {
-        cur_score = 0;
-        if ( best_alignment != NULL )
-        {
-          best_alignment->copy( cur_vav );
-        }
-        else
-        {
-          best_alignment = new ae_vis_a_vis( *cur_vav );
-        }
-      }
-      
-      // Update Score
-      if ( cur_vav->match() )
-      {
-        cur_score += chrom_1->get_indiv()->get_align_match_bonus();
-        
-        // Check whether score is high enough to rearrange
-        if ( cur_score >= needed_score )
-        {
-          delete cur_vav;
-          best_alignment->check_indices();
-          
-          best_alignment->_score = cur_score;
-          return best_alignment;
-        }
-      }
-      else
-      {
-        cur_score -= chrom_1->get_indiv()->get_align_mismatch_cost();
-      }
-      
-      // Step forward
-      cur_vav->step_fwd();
-    }
-    
-    delete cur_vav;
-  }
-  
-  
-  if ( best_alignment != NULL )
-  {
-    delete best_alignment;
-  }
-  
-  return NULL; // Didn't find any alignment with sufficient score.
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_dna.cpp b/src/libaevol/ae_dna.cpp
deleted file mode 100644
index 8918e65..0000000
--- a/src/libaevol/ae_dna.cpp
+++ /dev/null
@@ -1,3388 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_dna.h>
-#include <ae_genetic_unit.h>
-#include <ae_individual.h>
-#include <ae_rna.h>
-#include <ae_utils.h>
-#include <ae_vis_a_vis.h>
-#include <ae_align.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_dna                                 #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-/**
- * Creates a random dna sequence of length <length> belonging to <gen_unit>.
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, int32_t length ) : ae_string( length )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-  
-  _replic_report  = NULL;
-}
-
-/**
- * Creates a new piece of dna identical to the model but belonging to <gen_unit>
- * The replication report is copied if it exists
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, const ae_dna &model ) : ae_string( model )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-  
-  if ( ( _exp_m->get_num_gener() > 0 && _exp_m->get_output_m()->get_record_tree() ) && ( model._replic_report != NULL ) )
-  {
-    _replic_report = new ae_dna_replic_report( *(model._replic_report) );
-  }
-  else
-  {
-    _replic_report = NULL;
-  }
-}
-
-/**
- * Creates a new piece of dna identical to the parent's but belonging to <gen_unit>
- * The replication report is set to NULL
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, ae_dna* const parent_dna ) :
-    ae_string( parent_dna->_data, parent_dna->_length )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-  
-  _replic_report = NULL;
-}
-
-/**
- * Creates a new piece of dna with sequence <seq> (of length <length>).
- * WARNING : <seq> will be used directly as the new dna sequence (it will not be copied),
- *           which means the caller must not delete it.
- * The replication report is set to NULL
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, char* seq, int32_t length ) :
-    ae_string( seq, length, true )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-  
-  _replic_report = NULL;
-}
-
-/**
- * Loads a piece of dna from <backup_file>
- * The replication report is set to NULL
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, gzFile backup_file ) : ae_string( backup_file )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-  
-  _replic_report = NULL;
-}
-
-/**
- * Creates a dna sequence from a text file
- * The replication report is set to NULL
- */
-ae_dna::ae_dna( ae_genetic_unit* gen_unit, char* organism_file_name ) : ae_string( organism_file_name )
-{
-  _gen_unit = gen_unit;
-  _exp_m    = gen_unit->get_exp_m();
-  _indiv    = gen_unit->get_indiv();
-
-  _replic_report  = NULL;
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_dna::~ae_dna( void )
-{
-}
-
-// =================================================================
-//                         Non inline Accessors
-// =================================================================
-char* ae_dna::get_subsequence( int32_t from, int32_t to, ae_strand strand ) const
-{
-  char* subseq = NULL;
-  
-  from  = ae_utils::mod( from, _length );
-  to    = ae_utils::mod( to, _length );
-  
-  if ( strand == LEADING )
-  {
-    if ( from < to )
-    {
-      subseq = new char[to-from+1];
-      subseq[to-from] = '\0';
-      strncpy( subseq, &(_data[from]), to-from );
-    }
-    else
-    {
-      subseq = new char[_length-from+to+1];
-      subseq[_length-from+to] = '\0';
-      strncpy( subseq, &(_data[from]), _length-from );
-      strncpy( &subseq[_length-from], _data, to );
-    }
-  }
-  else // if ( strand == LAGGING )
-  {
-    if ( from > to )
-    {
-      subseq = new char[from-to+1];
-      subseq[from-to] = '\0';
-      
-      for ( int32_t i = 0 ; i < from - to ; i++ )
-      {
-        subseq[i] = (_data[from-1-i] == '1') ? '0' : '1';
-      }
-    }
-    else
-    {
-      subseq = new char[from+_length-to+1];
-      subseq[from+_length-to] = '\0';
-      
-      for ( int32_t i = 0 ; i < from ; i++ )
-      {
-        subseq[i] = (_data[from-1-i] == '1') ? '0' : '1';
-      }
-      for ( int32_t i = 0 ; i < _length-to ; i++ )
-      {
-        subseq[from+i] = (_data[_length-1-i] == '1') ? '0' : '1';
-      }
-    }
-  }
-  
-  return subseq;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_dna::perform_mutations( int32_t parent_id )
-{
-  if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-  {
-    _replic_report = new ae_dna_replic_report();
-  }
-  
-  if(_indiv->get_with_HT())
-  {
-  	do_transfer(parent_id);
-  }
-  
-  if ( _indiv->get_with_alignments() )
-  {
-    do_rearrangements_with_align();
-  }
-  else
-  {
-    do_rearrangements();
-  }
-  
-  do_small_mutations();
-  
-  // Store mutation events in replication report (temporary lists are emptied)
-  // TODO : next 2 lines
-  //~ new_indiv->_replic_report->set_parent_genome_size( (this->_genome)->get_length() );  
-  // if crossover => please set also donor_index, donor_misadaptation_value and donor_genome_size
-  
-  // TODO!!!
-  //~ new_indiv->_replic_report->compute_statistical_data();
-}
-
-void ae_dna::do_small_mutations( void )
-{
-  // ==============================================================
-  //  1. Compute how many rearrangements this genome will undertake
-  // ==============================================================
-  //
-  // Given the rate p (by nucl.) of insertion - for instance -, the number of 
-  // insertions we perform on the genome follows a binomial law B(n, p), with 
-  // n = genome length.
-  
-  int32_t nb_swi = _indiv->_mut_prng->binomial_random( _length, _indiv->get_point_mutation_rate()  );
-  int32_t nb_ins = _indiv->_mut_prng->binomial_random( _length, _indiv->get_small_insertion_rate() );
-  int32_t nb_del = _indiv->_mut_prng->binomial_random( _length, _indiv->get_small_deletion_rate()  );
-  int32_t nb_mut = nb_swi + nb_ins + nb_del;
-
-
-
-  // ====================================================
-  //  2. Perform those small mutations in a random order
-  // ====================================================
-  // 
-  // We put the '_nb_small_mutations' mutation events in an "urn". Then we repeat a random drawing
-  // of one mutation event in this urn, without replacement, until no mutation 
-  // event is left in the urn. Here is the "urn" we use at the beginning:
-  //
-  //     -----------------------------------------------------------
-  //    | swi | swi | swi | ins | ins | ins | del | del | del | del |
-  //     -----------------------------------------------------------
-  //                      ^                 ^                       ^
-  //                  nb_swi             nb_swi                   nb_swi
-  //                                    +nb_ins                  +nb_ins 
-  //                                                             +nb_del 
-  //
-  // Random draw of one mutation = random draw of one position in this "urn". 
-  // Given this position, we know what kind of mutation we have drawn.
-
-
-  int32_t random_value;
-  ae_mutation* mut = NULL;
-
-  for ( int32_t i = nb_mut ; i >= 1 ; i-- ) 
-  {
-    random_value = _indiv->_mut_prng->random( i );
-    
-    if ( random_value < nb_swi )
-    {
-      mut = do_switch();
-      assert( mut != NULL || !(_exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL) );
-      
-      nb_swi--;  // updating the urn (no replacement!)...
-    }
-    else if ( random_value < nb_swi + nb_ins )
-    {
-      mut = do_small_insertion();
-      
-      nb_ins--;
-    }
-    else // ( random_value >= nb_swi + nb_ins ) => del
-    {
-      mut = do_small_deletion();
-      
-      nb_del--;
-    }
-    
-    // Record mutation in tree
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      if ( mut != NULL )
-      {
-        _replic_report->add_mut( mut );
-      }
-    }
-    else
-    {
-      if ( mut != NULL )
-      {
-        delete mut;
-        mut = NULL;
-      }
-    }
-  }
-}
-
-void ae_dna::do_rearrangements( void )
-{
-  // ==============================================================
-  //  1. Compute how many rearrangements this genome will undertake
-  // ==============================================================
-  // 
-  // Given the rate p (by nucl.) of duplication - for instance -, the number of 
-  // duplications we perform on the genome follows a binomial law B(n, p), with 
-  // n = genome length.
-  
-  int32_t nb_dupl  = _indiv->_mut_prng->binomial_random( _length, _indiv->get_duplication_rate() );
-  int32_t nb_del   = _indiv->_mut_prng->binomial_random( _length, _indiv->get_deletion_rate() );
-  int32_t nb_trans = _indiv->_mut_prng->binomial_random( _length, _indiv->get_translocation_rate() );
-  int32_t nb_inv   = _indiv->_mut_prng->binomial_random( _length, _indiv->get_inversion_rate() );
-  int32_t nb_rear  = nb_dupl + nb_del + nb_trans + nb_inv;
-  
-
-  // ===================================================
-  //  2. Perform those rearrangements in a random order
-  // ===================================================
-  //  
-  // We put the nb_rea rearrangements in an "urn". Then we repeat a random draw 
-  // of one rearrangement in this urn, without replacement, until no rearrange-
-  // -ment is left in the urn. Here is the "urn" we use at the beginning:
-  //
-  //     ------------------------------------------------------------------------------
-  //    | Dupl | Dupl | Dupl | Del | Del | Del | Del | Trans | Trans | Inv | Inv | Inv |
-  //     ------------------------------------------------------------------------------
-  //                         ^                       ^               ^                 ^
-  //                      nb_dupl                 nb_dupl         nb_dupl           nb_dupl
-  //                                             +nb_del         +nb_del           +nb_del
-  //                                                             +nb_trans         +nb_trans
-  //                                                                               +nb_inv
-  //
-  // Random draw of one rearrangement = random draw of one position in this urn. 
-  // Given this position, we know what kind of rearrangement we have drawn.
-  
-  int32_t random_value;
-  ae_mutation* mut = NULL;
-
-  for ( int32_t i = nb_rear ; i >= 1 ; i-- )
-  {
-    random_value = _indiv->_mut_prng->random( i );
-    
-    if ( random_value < nb_dupl ) 
-    {
-      mut = do_duplication();
-      
-      nb_dupl--;  // Updating the urn (no replacement!)...
-    }
-    else if ( random_value < nb_dupl + nb_del ) 
-    {
-      mut = do_deletion();
-      
-      nb_del--;
-    }
-    else if ( random_value < nb_dupl + nb_del + nb_trans ) 
-    {
-      mut = do_translocation();
-      
-      nb_trans--;
-    }
-    else 
-    {
-      mut = do_inversion();
-      
-      nb_inv--;
-    }
-    
-    // Record rearrangement in tree
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      if ( mut != NULL )
-      {
-        _replic_report->add_rear( mut );
-      }
-    }
-    else
-    {
-      if ( mut != NULL )
-      {
-        delete mut;
-        mut = NULL;
-      }
-    }
-  }
-}
-
-void ae_dna::do_rearrangements_with_align( void )
-{
-	bool    direct_sense; // Whether we look for a direct or indirect alignment
-	double  rand1 = 0.0;  // Determines the type of rearrangement that will be done if an alignment is found
-	int16_t needed_score; // Minimum alignment score needed to recombine (stochastic)
-  int32_t seed1, seed2; // Points defining the sequences between which we will look for an alignment
-  
-	double ttl = 1.0; // Indiv's Time To Live
-	int32_t nb_pairs; // Number of pairs of sequences we will try to align
-  int32_t genome_size = _length; // Keep trace of the original length of the genome
-	
-  ae_mutation* mut = NULL;
-  ae_vis_a_vis* alignment = NULL;
-  
-  //////////////////////////////////////////////////////////////////////////////////////////////////
-  // For each pair of points to be tested (i.e. while the organism is still "alive"),
-  // 1) Draw a random sense (direct or indirect).
-  // 2) Determine the minimum alignment score needed for a rearrangement to occur.
-  // 3) Test the existence of an alignment with a high enough score.
-  // 4) If such an alignment was found, determine the type of rearrangement to be performed
-  //    and proceed (WARNING : translocations require another alignment to be found between
-  //    the sequence to be translocated and the rest of the chromosome).
-  // 5) If there was a change in the chromosome's length, update the individual's TTL and nb_pairs
-  //    according to new genome size.
-  // 6) If there was a rearrangement, we either save its record in the tree or delete it.
-  //////////////////////////////////////////////////////////////////////////////////////////////////
-	for ( nb_pairs = (int32_t)( ceil( ttl * _length * _indiv->get_neighbourhood_rate() ) )
-      ; nb_pairs > 0
-      ; nb_pairs-- )
-	{
-    /////////////////////////////////////////////////
-    // 1) Draw a random sense (direct or indirect) //
-    /////////////////////////////////////////////////
-    direct_sense  = (_indiv->_mut_prng->random() < 0.5); // Determine whether we look for a direct or indirect alignment
-    rand1         = _indiv->_mut_prng->random();         // Determine the type of rearrangement to be done. This is an 
-                                                            // anticipation on 4) for optimization purpose (save computation
-                                                            // time if the type of rear is "none"
-    
-    
-    //////////////////////////////////////////////////////////////////////////////////
-    // 2) Determine the minimum alignment score needed for a rearrangement to occur //
-    //////////////////////////////////////////////////////////////////////////////////
-    if ( _indiv->get_align_fun_shape() == LINEAR )
-    {
-      needed_score = (int16_t) ceil( _indiv->get_align_lin_min() + _indiv->_mut_prng->random() * ( _indiv->get_align_lin_max() - _indiv->get_align_lin_min() ) );
-    }
-    else
-    {
-      // I want the probability of rearrangement for an alignment of score <score> to be
-      // prob = 1 / ( 1 + exp( -(score-mean)/lambda ) )
-      // The score needed for a rearrangement to take place with a given random drawing is hence
-      // needed_score = ceil( -lambda * log( 1/rand - 1 ) + mean )
-      needed_score = (int16_t) ceil( - _indiv->get_align_sigm_lambda() * log( 1/_indiv->_mut_prng->random() - 1 ) + _indiv->get_align_sigm_mean() );
-      if ( needed_score < 0 ) needed_score = 0;
-      
-      //~ <DEBUG>
-      //~ FILE* tmp_file = fopen( "scores.out", "a" );
-      //~ fprintf( tmp_file, "%"PRId16"\n", needed_score );
-      //~ fclose( tmp_file );
-      //~ </DEBUG>
-    }
-    
-    // Determine where to look for an alignment (draw seeds)
-    seed1 = _indiv->_mut_prng->random( _length );
-    seed2 = _indiv->_mut_prng->random( _length );
-    
-    
-    if ( direct_sense )
-    {
-      if ( rand1 >= _indiv->get_duplication_proportion() + _indiv->get_deletion_proportion() + _indiv->get_translocation_proportion() )
-      {
-        // rand1 corresponds to "no rearrangement" => Nothing to do
-        continue;
-      }
-      
-      ////////////////////////////////////////////////////////////////////
-      // 3) Test the existence of an alignment with a high enough score //
-      ////////////////////////////////////////////////////////////////////
-      alignment = ae_align::search_alignment_direct( this, seed1, this, seed2, needed_score );
-      
-      if ( alignment == NULL )
-      {
-        // No alignment found
-        continue;
-      }
-      
-      //~ printf( "direct   needed_score : %"PRId32"\n", needed_score );
-      
-      ////////////////////////////////////////////////////////////////////////
-      // 4) Determine the type of rearrangement to be performed and proceed //
-      ////////////////////////////////////////////////////////////////////////
-      if ( rand1 < _indiv->get_duplication_proportion() )
-      {
-        // Remember the length of the segment to be duplicated and of the genome before the duplication
-        int32_t segment_length      = ae_utils::mod( alignment->get_i_2() - alignment->get_i_1(), _length );
-        int32_t gu_size_before  = _length;
-        int32_t gu_size_after   = gu_size_before + segment_length;
-        int32_t genome_size_before = _indiv->get_amount_of_dna();
-        int32_t genome_size_after = genome_size_before + segment_length;
-        
-        if ( ( genome_size_after > _indiv->get_max_genome_length() ) || ( gu_size_after > _gen_unit->get_max_gu_length() ) )
-        {
-          if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-          {
-            // Write an entry in the barrier log file
-            fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" DUPLICATION %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                      _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, gu_size_before, genome_size_before );
-          }
-        }
-        else
-        {
-          // Perform in situ (tandem) DUPLICATION
-          do_duplication( alignment->get_i_1(), alignment->get_i_2(), alignment->get_i_2() );
-          
-          // Report the duplication
-          if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-          {
-            // Report the insertion
-            mut = new ae_mutation();
-            mut->report_duplication( alignment->get_i_1(), alignment->get_i_2(), alignment->get_i_2(), segment_length, needed_score );
-          }
-          
-          // Write a line in rearrangement logfile
-          if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-          {
-            fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32" %"PRId16"\n", 
-                      _exp_m->get_num_gener(), _indiv->get_id(), int8_t(DUPL), segment_length, genome_size_before, needed_score );
-          }
-        }
-      }
-      else if ( rand1 < _indiv->get_duplication_proportion() + _indiv->get_deletion_proportion() )
-      {
-        // Remember the length of the segment to be duplicated and of the genome before the deletion
-        int32_t segment_length      = ae_utils::mod( alignment->get_i_2() - alignment->get_i_1() - 1, _length ) + 1;
-        int32_t gu_size_before  = _length;
-        int32_t gu_size_after   = gu_size_before - segment_length;
-        int32_t genome_size_before = _indiv->get_amount_of_dna();
-        int32_t genome_size_after = genome_size_before - _length;
-        
-        if ( ( genome_size_after < _indiv->get_min_genome_length() ) || ( gu_size_after < _gen_unit->get_min_gu_length() ) )
-        {
-          if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-          {
-            // Write an entry in the barrier log file
-            fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" DELETION %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                      _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, gu_size_before, genome_size_before );
-          }
-        }
-        else
-        {
-          // Perform DELETION
-          do_deletion( alignment->get_i_1(), alignment->get_i_2() );
-          
-          // Report the deletion
-          if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-          {
-            // Report the insertion
-            mut = new ae_mutation();
-            mut->report_deletion( alignment->get_i_1(), alignment->get_i_2(), segment_length, needed_score );
-          }
-          
-          // Write a line in rearrangement logfile
-          if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-          {
-            fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32" %"PRId16"\n", 
-                      _exp_m->get_num_gener(), _indiv->get_id(), int8_t(DEL), segment_length, genome_size_before, needed_score );
-          }
-        }
-      }
-      else
-      {
-        assert( rand1 < _indiv->get_duplication_proportion() +
-                        _indiv->get_deletion_proportion() + 
-                        _indiv->get_translocation_proportion() );
-        
-        // Perform TRANSLOCATION
-        // Make sure the segment to be translocated doesn't contain OriC TODO : is that still necessary?
-        if ( alignment->get_i_1() > alignment->get_i_2() )
-        {
-          alignment->swap();
-        }
-        
-        // Remember the length of the segment to be translocated
-        int32_t segment_length = ae_utils::mod( alignment->get_i_2() - alignment->get_i_1(), _length );
-        
-        // Extract the segment to be translocated
-        ae_genetic_unit* translocated_segment = extract_into_new_GU( alignment->get_i_1(), alignment->get_i_2() );
-        
-        // Look for an alignment between the segment to be translocated and the rest of the genome
-        bool direct_sense;
-        int16_t needed_score_2;
-        ae_vis_a_vis* alignment_2 = NULL;
-        int32_t seed1, seed2;
-        for ( nb_pairs = (int32_t)( ceil( ttl * _length * _indiv->get_neighbourhood_rate() ) )
-            ; nb_pairs > 0
-            ; nb_pairs-- )
-        {
-          direct_sense = (_indiv->_mut_prng->random() < 0.5);
-          
-          if ( _indiv->get_align_fun_shape() == LINEAR )
-          {
-            needed_score_2  = (int16_t) ceil(  _indiv->get_align_lin_min() + _indiv->_mut_prng->random() * ( _indiv->get_align_lin_max() - _indiv->get_align_lin_min() ) );
-          }
-          else
-          {
-            needed_score_2 = (int16_t) ceil( - _indiv->get_align_sigm_lambda() * log( 1/_indiv->_mut_prng->random() - 1 ) + _indiv->get_align_sigm_mean() );
-            if ( needed_score_2 < 0 ) needed_score_2 = 0;
-          }
-
-          seed1 = _indiv->_mut_prng->random( _length );
-          seed2 = _indiv->_mut_prng->random( segment_length );
-          
-          if ( direct_sense )
-          {
-            alignment_2 = ae_align::search_alignment_direct( this, seed1, translocated_segment->get_dna(), seed2, needed_score_2 );
-          }
-          else // if indirect
-          {
-            alignment_2 = ae_align::search_alignment_indirect( this, seed1, translocated_segment->get_dna(), seed2, needed_score_2 );
-          }
-          
-          if ( alignment_2 != NULL )
-          {
-            //~ printf( "transloc needed_score : %"PRId32"\n", needed_score_2 );
-            break;
-          }
-        }
-        
-        
-        // If an alignment was found between the segment to be translocated and the rest of the genome, proceed to the 
-        // translocation, otherwise, replace the extracted segment at its former position (cancel the translocation event).
-        if ( alignment_2 != NULL )
-        {
-          // Proceed to the translocation
-          insert_GU( translocated_segment, alignment_2->get_i_1(), alignment_2->get_i_2(), (alignment_2->get_sense() == INDIRECT) );
-
-          // Report the translocation
-          if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-          {
-            mut = new ae_mutation();
-            mut->report_translocation( alignment->get_i_1(), alignment->get_i_2(),
-                                       alignment_2->get_i_1(), alignment_2->get_i_2(), segment_length,
-                                       (alignment_2->get_sense() == INDIRECT), needed_score, needed_score_2 );
-          }
-        
-          // Write a line in rearrangement logfile
-          if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-          {
-            fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32" %"PRId16"\n", 
-                      _exp_m->get_num_gener(), _indiv->get_id(), int8_t(TRANS), segment_length, _length, needed_score_2 );
-          }      
-          delete alignment_2;
-        } 
-        else
-        {
-          // Cancel the translocation (replace the extracted segment at its former position)
-          insert_GU( translocated_segment, alignment->get_i_1(), 0, false );
-        }
-        
-        delete translocated_segment;
-      }
-      
-      delete alignment;
-    }
-    else // if indirect
-    {
-      if ( rand1 >= _indiv->get_inversion_proportion() )
-      {
-        // rand1 corresponds to no rearrangement => Nothing to do
-        continue;
-      }
-      
-      //~ printf( "indirect needed_score : %"PRId32"\n", needed_score );
-      
-      ////////////////////////////////////////////////////////////////////
-      // 3) Test the existence of an alignment with a high enough score //
-      ////////////////////////////////////////////////////////////////////
-      alignment = ae_align::search_alignment_indirect( this, seed1, this, seed2, needed_score );
-      
-      if ( alignment == NULL )
-      {
-        // No alignment found
-        continue;
-      }
-      
-      /////////////////////////////
-      // 4) Proceed to inversion //
-      /////////////////////////////
-      // Make sure the segment to be inverted doesn't contain OriC
-      if ( alignment->get_i_1() > alignment->get_i_2() )
-      {
-        alignment->swap();
-      }
-      
-      // Remember the length of the segment to be duplicated
-      int32_t segment_length = ae_utils::mod( alignment->get_i_2() - alignment->get_i_1(), _length );
-      
-      // Proceed
-      do_inversion( alignment->get_i_1(), alignment->get_i_2() );
-      
-      // Report the inversion
-      if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-      {
-        mut = new ae_mutation();
-        mut->report_inversion( alignment->get_i_1(), alignment->get_i_2(), segment_length, needed_score );
-      }
-        
-      // Write a line in rearrangement logfile
-      if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-      {
-        fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32" %"PRId16"\n", 
-                  _exp_m->get_num_gener(), _indiv->get_id(), int8_t(INV), segment_length, _length, needed_score );
-      }
-      
-      delete alignment;
-    }
-        
-    
-    //////////////////////////////////////////////////////////////////////////////
-    // 5) If there was a change in the chromosome's length,                     //
-    //    update the individual's TTL and nb_pairs according to new genome size //
-    //////////////////////////////////////////////////////////////////////////////
-    if ( genome_size != _length )
-    {
-      ttl = ((double)(nb_pairs-1)) / ((double)genome_size) / _indiv->get_neighbourhood_rate();
-      genome_size = _length;
-      nb_pairs = (int32_t)( ceil( ttl * _length * _indiv->get_neighbourhood_rate() ) ) + 1; 
-    }
-		
-    //////////////////////////////////////////////////////////////////////////////////////////
-    // 6) If there was a rearrangement, we either save its record in the tree or delete it. //
-    //////////////////////////////////////////////////////////////////////////////////////////
-    if ( mut != NULL )
-    {
-      if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-      {
-        _replic_report->add_rear( mut );
-        mut = NULL;
-      }
-      else
-      {
-        delete mut;
-        mut = NULL;
-      }
-    }
-  }
-}
-
-void ae_dna::do_transfer( int32_t parent_id )
-{
-  ae_mutation* mut = NULL;
-  if ( _indiv->get_mut_prng()->random() < _indiv->get_HT_ins_rate() )
-  {
-    mut = do_ins_HT(parent_id);
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      if ( mut != NULL )
-      {
-        _replic_report->add_HT( mut );
-      }
-    }
-    else
-    {
-      if ( mut != NULL )
-      {
-        delete mut;
-        mut = NULL;
-      }
-    }
-  }
-  
-  if ( _indiv->get_mut_prng()->random() < _indiv->get_HT_repl_rate() )
-  {
-    mut = do_repl_HT(parent_id);
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      if ( mut != NULL )
-      {
-        _replic_report->add_HT( mut );
-      }
-    }
-    else
-    {
-      if ( mut != NULL )
-      {
-        delete mut;
-        mut = NULL;
-      }
-    }
-  }
-}
-
-ae_mutation* ae_dna::do_switch( void )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t pos = _indiv->_mut_prng->random( _length );
-
-  if ( do_switch( pos ) )
-  {
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      // Report the mutation
-      mut = new ae_mutation();
-      mut->report_point_mutation( pos );
-    }
-  }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_small_insertion( void )
-{
-  ae_mutation* mut = NULL;
-  
-  // Determine the position and size of the small insertion
-  int32_t pos = _indiv->_mut_prng->random( _length );
-  int16_t nb_insert;
-  if ( _indiv->get_max_indel_size() == 1 )
-  {
-    nb_insert = 1;
-  }
-  else
-  {
-    nb_insert = 1 + _indiv->_mut_prng->random( _indiv->get_max_indel_size() ); 
-    // <nb_insert> must be in [1 ; max_indel_size]
-  }
-  
-  // Check that the insertion won't throw the genome size over the limit
-  if ( ( _indiv->get_amount_of_dna() + nb_insert > _indiv->get_max_genome_length() ) || (_length + nb_insert > _gen_unit->get_max_gu_length()) )
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" S_INS %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                _exp_m->get_num_gener(), _indiv->get_id(), nb_insert, 0, _length, _indiv->get_amount_of_dna() );
-    }
-    
-    return NULL;
-  }
-  
-  // Prepare the sequence to be inserted
-  char* inserted_seq = new char[nb_insert + 1];
-  char  inserted_char;
-  for ( int16_t j = 0 ; j < nb_insert ; j++ )
-  {
-    inserted_char = (char) '0' + _indiv->_mut_prng->random( NB_BASE );
-    inserted_seq[j] = inserted_char;
-  }
-  inserted_seq[nb_insert] = '\0';
-
-  // Proceed to the insertion and report it
-  if ( do_small_insertion( pos, nb_insert, inserted_seq ) )
-  {
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      // Report the insertion
-      mut = new ae_mutation();
-      mut->report_small_insertion( pos, nb_insert, inserted_seq );
-    }
-  }
-  
-  // Delete the sequence
-  delete [] inserted_seq;
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_small_deletion( void )
-{
-  ae_mutation* mut = NULL;
-  
-  // Determine the position and size of the small deletion
-  int32_t pos = _indiv->_mut_prng->random( _length );
-  int16_t nb_del;
-  if ( _indiv->get_max_indel_size() == 1 )
-  {
-    nb_del = 1;
-  }
-  else
-  {
-    nb_del = 1 + _indiv->_mut_prng->random( _indiv->get_max_indel_size() );
-    // <nb_del> must be in [1 ; max_indel_size]
-  }
-  
-  // Check that the insertion won't shrink the genome size under the limit nor to nothing
-  if ( ( _indiv->get_amount_of_dna() - nb_del < _indiv->get_min_genome_length() ) || (_length - nb_del < _gen_unit->get_min_gu_length()) )
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" S_DEL %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                _exp_m->get_num_gener(), _indiv->get_id(), nb_del, 0, _length, _indiv->get_amount_of_dna() );
-    }
-    
-    return NULL;
-  }
-  
-  if ( do_small_deletion( pos, nb_del ) )
-  {
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      mut = new ae_mutation();
-      mut->report_small_deletion( pos, nb_del );
-    }
-  }
-
-  return mut;
-}
-
-bool ae_dna::do_switch( int32_t pos ) 
-{
-  // Perform the mutation
-  if ( _data[pos] == '0' )  _data[pos] = '1';
-  else                      _data[pos] = '0';
-  
-  // Remove promoters containing the switched base
-  _gen_unit->remove_promoters_around( pos, ae_utils::mod(pos + 1, _length) );
-  
-  // Look for potential new promoters containing the switched base  
-  if ( _length >= PROM_SIZE )
-  {
-    _gen_unit->look_for_new_promoters_around( pos, ae_utils::mod(pos + 1, _length) );
-  }
-  
-  
-  return true;
-}
-
-bool ae_dna::do_small_insertion( int32_t pos, int16_t nb_insert, char * seq )
-{
-  // Check genome size limit
-  assert(_length + nb_insert <= _gen_unit->get_max_gu_length());
-  assert(_indiv->get_amount_of_dna() + nb_insert <= _indiv->get_max_genome_length());
-
-  // Remove the promoters that will be broken
-  _gen_unit->remove_promoters_around( pos );
-  
-  // Insert the sequence
-  insert( pos, seq, nb_insert );
-  
-  // Look for new promoters
-  if ( _length >= PROM_SIZE )
-  {
-    if ( _length - nb_insert < PROM_SIZE )
-    {
-      // Special case where the genome was smaller than a promoter before the insertion and greater than (or as big as) a promoter after the insertion.
-      // In that case, we must look for new promoters thoroughly on the whole genome using locate_promoters
-      _gen_unit->locate_promoters();
-    }
-    else
-    {
-      _gen_unit->move_all_promoters_after( pos, nb_insert );
-      _gen_unit->look_for_new_promoters_around( pos, ae_utils::mod(pos + nb_insert, _length) );
-    }
-  }
-
-  return true;
-}
-
-bool ae_dna::do_small_deletion( int32_t pos, int16_t nb_del )
-{
-  // Check genome size limit
-  assert( _length - nb_del >= _gen_unit->get_min_gu_length());
-  assert( _indiv->get_amount_of_dna() - nb_del >= _indiv->get_min_genome_length() );
-  
-  // Remove promoters containing at least one nucleotide from the sequence to delete
-  _gen_unit->remove_promoters_around( pos, ae_utils::mod(pos + nb_del, _length) );
-
-  // Do the deletion and update promoter list
-  if ( pos + nb_del <= _length ) // the deletion does not contain the replication origin 
-  {
-    // Do the deletion
-    remove( pos, pos + nb_del );
-    
-    // Update promoter list
-    if ( _length >= PROM_SIZE )
-    {
-      _gen_unit->move_all_promoters_after( pos, -nb_del );
-      _gen_unit->look_for_new_promoters_around( ae_utils::mod(pos, _length) );
-    }
-  }
-  else // the deletion contains the replication origin
-  {
-    // Do the deletion
-    int32_t nb_del_at_pos_0 = nb_del - _length + pos;
-    remove( pos, _length );
-    remove( 0, nb_del_at_pos_0 );
-    pos -= nb_del_at_pos_0;
-    
-    // Update promoter list
-    if ( _length >= PROM_SIZE )
-    {
-      _gen_unit->move_all_promoters_after( 0, -nb_del_at_pos_0 );
-      _gen_unit->look_for_new_promoters_around( 0 );
-    }
-  }
-  
-  return true;
-}
-
-ae_mutation* ae_dna::do_duplication( void )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t pos_1, pos_2, pos_3;
-  pos_1 = _indiv->_mut_prng->random( _length );
-  pos_2 = _indiv->_mut_prng->random( _length );
-  pos_3 = _indiv->_mut_prng->random( _length );
-  
-  // Remember the length of the segment to be duplicated and of the former genome
-  int32_t segment_length      = ae_utils::mod( pos_2 - pos_1 - 1, _length ) + 1;
-  int32_t gu_size_before  = _length;
-  int32_t gu_size_after   = gu_size_before + segment_length;
-  int32_t genome_size_before = _indiv->get_amount_of_dna();
-  int32_t genome_size_after = genome_size_before + segment_length;
-  if ( (gu_size_after > _gen_unit->get_max_gu_length()) || (genome_size_after > _indiv->get_max_genome_length()) )
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" DUPLICATION %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, gu_size_before, genome_size_before );
-    }
-  }
-  else
-  {
-    // Perform the duplication
-    do_duplication( pos_1, pos_2, pos_3 );
-    
-    // Report the duplication
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      mut = new ae_mutation();
-      mut->report_duplication( pos_1, pos_2, pos_3, segment_length );
-    }
-
-    // Write a line in rearrangement logfile
-    if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-    {
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                _exp_m->get_num_gener(), _indiv->get_id(), int8_t(DUPL), segment_length, genome_size_before );
-    }
-  }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_deletion( void )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t pos_1, pos_2;
-  pos_1 = _indiv->_mut_prng->random( _length );
-  pos_2 = _indiv->_mut_prng->random( _length );
-  
-  // Remember the length of the segment to be deleted and of the genome before the deletion
-  int32_t segment_length      = ae_utils::mod( pos_2 - pos_1 - 1, _length ) + 1;
-  int32_t gu_size_before  = _length;
-  int32_t gu_size_after   = gu_size_before - segment_length;
-  int32_t genome_size_before = _indiv->get_amount_of_dna();
-  int32_t genome_size_after = genome_size_before - segment_length;
-  if ( ( gu_size_after < _gen_unit->get_min_gu_length() ) || ( genome_size_after < _indiv->get_min_genome_length() ) )
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" DELETION %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, gu_size_before, genome_size_before );
-     }
-  }
-  else
-  {
-    // Perform the deletion
-    do_deletion( pos_1, pos_2 );
-    
-    // Report the deletion
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      mut = new ae_mutation();
-      mut->report_deletion( pos_1, pos_2, segment_length );
-    }
-        
-    // Write a line in rearrangement logfile
-    if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-    {
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                _exp_m->get_num_gener(), _indiv->get_id(), int8_t(DEL), segment_length, genome_size_before );
-    }
-  }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_translocation( void )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t pos_1, pos_2, pos_3, pos_4;
-  int32_t segment_length;
-  bool invert;
-  
-  if ( _indiv->get_allow_plasmids() )
-  {
-    // -----------------------------------------------------------------
-    // WARNING : This is only valid when there is only 1 plasmid allowed
-    // -----------------------------------------------------------------
-    int32_t pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel;
-    
-    ae_individual* indiv = _indiv;
-    ae_genetic_unit* chromosome = indiv->get_genetic_unit_list()->get_first()->get_obj();
-    ae_genetic_unit* plasmid    = indiv->get_genetic_unit_list()->get_first()->get_next()->get_obj();
-    int32_t chrom_length        = chromosome->get_dna()->get_length();
-    int32_t total_amount_of_dna = indiv->get_amount_of_dna();
-    
-    // 1) What sequence are we translocating?
-    pos_1_rel = _indiv->_mut_prng->random( _length );
-    pos_2_rel = _indiv->_mut_prng->random( _length );
-    
-    int32_t segment_length = ae_utils::mod( pos_2_rel - pos_1_rel, _length );
-    
-    pos_3_rel = ae_utils::mod( pos_1_rel + _indiv->_mut_prng->random( segment_length ), _length );
-    
-    if ( _gen_unit == chromosome )
-    {
-      pos_1 = pos_1_rel;
-      pos_2 = pos_2_rel;
-      pos_3 = pos_3_rel;
-    }
-    else // ( _gen_unit == plasmid )
-    {
-      pos_1 = pos_1_rel + chrom_length;
-      pos_2 = pos_2_rel + chrom_length;
-      pos_3 = pos_3_rel + chrom_length;
-    }
-    
-    
-    // 2) Where are we translocating it?
-    pos_4 = _indiv->_mut_prng->random( total_amount_of_dna - segment_length );
-    
-    if ( _gen_unit == chromosome )
-    {
-      if ( pos_1 <= pos_2 )
-      {
-        if ( pos_4 >= pos_1 )
-        {
-          pos_4 += segment_length;
-        }
-      }
-      else
-      {
-        if ( pos_4 >= chrom_length - segment_length )
-        {
-          pos_4 += segment_length;
-        }
-        else
-        {
-          pos_4 += pos_2;
-        }
-      }
-      if ( pos_4 >= chrom_length )
-      {
-        pos_4_rel = pos_4 - chrom_length;
-      }
-      else 
-      {
-        pos_4_rel = pos_4;
-      }  
-    }
-    else // ( _gen_unit == plasmid )
-    {
-      if ( pos_1 <= pos_2 )
-      {
-        if ( pos_4 >= pos_1 )
-        {
-          pos_4 += segment_length;
-        }
-      }
-      else
-      {
-        if ( pos_4 >= chrom_length )
-        {
-          pos_4 += pos_2_rel;
-        }
-      }
-      
-      if ( pos_4 >= chrom_length )
-      {
-        pos_4_rel = pos_4 - chrom_length;
-      }
-      else 
-      {
-        pos_4_rel = pos_4;
-      }      
-    }
-    
-    invert = ( _indiv->_mut_prng->random( 2 ) == 0 );
-    
-    if ( ( _gen_unit == chromosome && pos_4 >= chrom_length ) || // If inter GU translocation
-         ( _gen_unit == plasmid && pos_4 < chrom_length ) )
-    {
-      //~ printf( "Translocation from the %s to the %s\n", _gen_unit==chromosome?"chromosome":"plasmid", _gen_unit==chromosome?"plasmid":"chromosome" );
-      
-      //~ printf( "  Chromosome length : %"PRId32"     Plasmid length : %"PRId32"     Total length : %"PRId32"\n",
-              //~ chrom_length, plasmid->get_dna()->get_length(), chrom_length + plasmid->get_dna()->get_length() );
-      //~ printf( "  %"PRId32" %"PRId32" %"PRId32" %"PRId32" (length : %"PRId32")\n", pos_1, pos_2, pos_3, pos_4, segment_length );
-      //~ printf( "  former pos : %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n", former_pos_1, former_pos_2, former_pos_3, former_pos_4 );
-      
-      if ( do_inter_GU_translocation( pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, invert ) )
-      {
-        // Report the translocation
-        if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-        {
-          mut = new ae_mutation();
-          mut->report_translocation( pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, segment_length, invert );
-        }
-        
-        // Write a line in rearrangement logfile
-        if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-        {
-          fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                    _exp_m->get_num_gener(), _indiv->get_id(), int8_t(TRANS), segment_length, _length );
-        }
-      }
-    }
-    else
-    {
-      if ( pos_1_rel > pos_2_rel )
-      {
-        
-      }
-      //~ printf( "Translocation intra %s\n", _gen_unit==chromosome?"chromosome":"plasmid" );
-      //~ printf( "  Chromosome length : %"PRId32"     Plasmid length : %"PRId32"     Total length : %"PRId32"\n",
-              //~ chrom_length, plasmid->get_dna()->get_length(), chrom_length + plasmid->get_dna()->get_length() );
-      //~ printf( "  %"PRId32" %"PRId32" %"PRId32" %"PRId32" (length : %"PRId32")\n", pos_1, pos_2, pos_3, pos_4, segment_length );
-      //~ printf( "  former pos : %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n", former_pos_1, former_pos_2, former_pos_3, former_pos_4 );
-      if ( do_translocation( pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, invert ) )
-      {
-        // Report the translocation
-        if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-        {
-          mut = new ae_mutation();
-          mut->report_translocation( pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel, segment_length, invert );
-        }
-        
-        // Write a line in rearrangement logfile
-        if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-        {
-          fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                    _exp_m->get_num_gener(), _indiv->get_id(), int8_t(TRANS), segment_length, _length );
-        }
-      }
-    }
-  }
-  else // ( ! ae_common::params->get_allow_plasmids() )
-  {
-    pos_1 = _indiv->_mut_prng->random( _length );
-    pos_2 = _indiv->_mut_prng->random( _length );
-    if ( pos_1 == pos_2 ) return NULL;
-    
-    // As it will be seen in do_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert ),
-    // translocating segment [pos_1, pos_2] is the same as translocating segment  [pos_2, pos_1]
-    // Since OriC must be at position 0, we will always translocate segment [pos_1, pos_2] with pos_1 < pos_2
-    if ( pos_1 > pos_2 ) ae_utils::exchange( pos_1, pos_2 );
-    
-    segment_length = pos_2 - pos_1;
-    
-    // Generate a position between pos_1 and pos_2
-    pos_3 = pos_1 + _indiv->_mut_prng->random( segment_length );
-    
-    // Generate a position that is NOT between pos_1 and pos_2
-    pos_4 = _indiv->_mut_prng->random( _length - segment_length );
-    if ( pos_4 >= pos_1 ) pos_4 += segment_length;
-    
-    invert = ( _indiv->_mut_prng->random( 2 ) == 0 );
-    
-    if ( do_translocation( pos_1, pos_2, pos_3, pos_4, invert ) )
-    {
-      // Report the translocation
-      if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-      {
-        mut = new ae_mutation();
-        mut->report_translocation( pos_1, pos_2, pos_3, pos_4, segment_length, invert );
-      }
-        
-      // Write a line in rearrangement logfile
-      if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-      {
-        fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                  _exp_m->get_num_gener(), _indiv->get_id(), int8_t(TRANS), segment_length, _length );
-      }
-    }
-  }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_inversion( void )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t pos_1, pos_2;
-  int32_t segment_length;
-  pos_1 = _indiv->_mut_prng->random( _length );
-  pos_2 = _indiv->_mut_prng->random( _length );
-  
-  if ( pos_1 == pos_2 ) return NULL; // Invert everything <=> Invert nothing!
-  if ( pos_1 >  pos_2 ) ae_utils::exchange( pos_1, pos_2 ); // Invert the segment that don't contain OriC
-  
-  segment_length = pos_2 - pos_1;
-  
-  if( do_inversion( pos_1, pos_2 ) == true )
-  {
-    // Report the inversion
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      mut = new ae_mutation();
-      mut->report_inversion( pos_1, pos_2, segment_length );
-    }
-        
-    // Write a line in rearrangement logfile
-    if ( _exp_m->get_output_m()->is_logged( LOG_REAR ) == true )
-    {
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_REAR ), "%"PRId32" %"PRId32" %"PRId8" %"PRId32" %"PRId32"\n", 
-                _exp_m->get_num_gener(), _indiv->get_id(), int8_t(INV), segment_length, _length );
-    }
-  }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_insertion( const char* seq_to_insert, int32_t seq_length /*= -1*/ )
-{
-  ae_mutation* mut = NULL;
-  
-  // Compute seq_length if not known
-  if ( seq_length == -1 )
-  {
-    seq_length = strlen( seq_to_insert );
-  }
-  
-  // Where to insert the sequence
-  int32_t pos = _indiv->_mut_prng->random( _length );
-  
-  if ( do_insertion( pos, seq_to_insert, seq_length ) )
-  {
-    if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-    {
-      // Report the insertion
-      mut = new ae_mutation();
-      mut->report_insertion( pos, seq_length, seq_to_insert );
-    }
-  }
-  
-  return mut;
-}
-
-
-bool ae_dna::do_duplication( int32_t pos_1, int32_t pos_2, int32_t pos_3 )
-// Duplicate segment [pos_1; pos_2[ and insert the duplicate before pos_3
-{
-  char* duplicate_segment = NULL;
-  int32_t seg_length;
-  
-  if ( pos_1 < pos_2 ) 
-  {
-    //                                                     
-    //       pos_1         pos_2                   -> 0-         
-    //         |             |                   -       -
-    // 0--------------------------------->      -         -
-    //         ===============                  -         - pos_1
-    //           tmp (copy)                      -       -   
-    //                                             -----      |
-    //                                             pos_2    <-'
-    //
-    
-    seg_length = pos_2 - pos_1;
-    duplicate_segment = new char[seg_length+1];
-    memcpy( duplicate_segment, &_data[pos_1], seg_length );
-    duplicate_segment[seg_length] = '\0';
-  }
-  else // if ( pos_1 >= pos_2 ) 
-  {
-    // The segment to duplicate includes the replication origin.
-    // The copying process will be done in two steps.
-    //
-    //                                            ,->   
-    //    pos_2                 pos_1            |      -> 0-          
-    //      |                     |                   -       - pos_2
-    // 0--------------------------------->     pos_1 -         -
-    // ======                     =======            -         -
-    //  tmp2                        tmp1              -       -
-    //                                                  -----
-    //
-    //
-    
-    int32_t tmp1_len = _length - pos_1;
-    int32_t tmp2_len = pos_2;
-    seg_length = tmp1_len + tmp2_len;
-    duplicate_segment = new char[seg_length+1];
-    memcpy( duplicate_segment, &_data[pos_1], tmp1_len );     // Copy tmp1
-    memcpy( &duplicate_segment[tmp1_len], _data, tmp2_len );  // Copy tmp2
-    duplicate_segment[seg_length] = '\0';
-  }
-  
-  // Create a copy of the promoters beared by the segment to be duplicated
-  // (they will be inserted in the individual's RNA list later)
-  ae_list<ae_rna*>** duplicated_promoters = new ae_list<ae_rna*>*[2];
-  duplicated_promoters[LEADING] = new ae_list<ae_rna*>();
-  duplicated_promoters[LAGGING] = new ae_list<ae_rna*>();
-  _gen_unit->duplicate_promoters_included_in( pos_1, pos_2, duplicated_promoters );
-  
-  _gen_unit->remove_promoters_around( pos_3 );
-  
-  insert( pos_3, duplicate_segment, seg_length );
-  
-  if ( _length >= PROM_SIZE )
-  {
-    if ( _length - seg_length < PROM_SIZE )
-    {
-      // Special case where the genome was smaller than a promoter before the insertion and greater than (or as big as) a promoter after the insertion.
-      // In that case, we must look for new promoters thoroughly on the whole genome using locate_promoters
-      _gen_unit->locate_promoters();
-    }
-    else
-    {
-      _gen_unit->move_all_promoters_after( pos_3, seg_length );
-      
-      _gen_unit->insert_promoters_at( duplicated_promoters, pos_3 );
-      
-      _gen_unit->look_for_new_promoters_around( pos_3 );
-      _gen_unit->look_for_new_promoters_around( pos_3 + seg_length );
-    }
-  }
-  
-  
-  delete [] duplicate_segment;
-  
-  delete duplicated_promoters[LEADING];
-  delete duplicated_promoters[LAGGING];
-  delete [] duplicated_promoters;
-  
-  return true;
-}
-
-bool ae_dna::do_deletion( int32_t pos_1, int32_t pos_2 )
-// Delete segment going from pos_1 (included) to pos_2 (excluded)
-{
-  if ( pos_1 < pos_2 ) 
-  {
-    //                                                     
-    //       pos_1         pos_2                   -> 0-         
-    //         |             |                   -       -
-    // 0--------------------------------->      -         -
-    //         ===============                  -         - pos_1
-    //           tmp (copy)                      -       -   
-    //                                             -----      |
-    //                                             pos_2    <-'
-    //
-    
-    int32_t segment_length = pos_2 - pos_1;
-    
-    // Remove promoters containing at least one nucleotide from the sequence to delete
-    _gen_unit->remove_promoters_around( pos_1, pos_2 );
-    
-    // Delete the sequence between pos_1 and pos_2
-    remove( pos_1, pos_2 );
-    
-    // Update promoter list
-    if ( _length >= PROM_SIZE )
-    {
-      _gen_unit->move_all_promoters_after( pos_1, -segment_length );
-      
-      _gen_unit->look_for_new_promoters_around( pos_1 );
-    }
-  }
-  else // if ( pos_1 >= pos_2 ) 
-  {
-    // The segment to delete includes the replication origin.
-    // The deletion process will be done in two steps.
-    //
-    //                                            ,->   
-    //    pos_2                 pos_1            |      -> 0-          
-    //      |                     |                   -       - pos_2
-    // 0--------------------------------->     pos_1 -         -
-    // =====                      =======            -         -
-    //  tmp2                        tmp1              -       -
-    //                                                  -----
-    //
-    //
-    
-    //int32_t segment_length = _length + pos_2 - pos_1; //useless variable
-    
-    // Remove promoters containing at least one nucleotide from the sequence to delete
-    _gen_unit->remove_promoters_around( pos_1, pos_2 );
-    
-    // Delete the sequence between pos_1 and pos_2
-    remove( pos_1, _length ); // delete tmp1 from genome
-    remove( 0, pos_2 );       // delete tmp2 from genome
-    
-    // Update promoter list
-    if ( _length >= PROM_SIZE )
-    {
-      _gen_unit->move_all_promoters_after( 0, -pos_2 );
-      
-      _gen_unit->look_for_new_promoters_around( 0 );
-    }
-  }
-  
-  return true;
-}
-
-bool ae_dna::do_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert )
-{
-  // Provided that OriC must be at position 0
-  //
-  //    1) Note that in Case 1 (without inversion), whichever position comes first, translocating segment [pos_1->pos_2]
-  //        to pos_4 through pos_3 is always equivalent to rearrange the sequences from an ABCDE order to ADCBE
-  //    2) In Case 2, depending on which position comes first, we may have the following rearrangements :
-  //        (ABCDE => ADB'C'E) or (ABCDE => AC'D'BE) where X' stands for "inverted X"
-  //
-  //  Case 1 : Without inversion
-  //
-  //         A      B        C       D       E                        A      D        C       B        E
-  //      |----->=======[>=======>-------[>-------|        =>      |----->-------[>=======>=======[>-------|
-  //          pos_1   pos_3    pos_2   pos_4
-  //
-  //         A      B        C       D       E                        A      D        C       B        E
-  //      |=====>-------[>------->=======[>=======|        =>      |=====>=======[>------->-------[>=======|
-  //          pos_2   pos_4    pos_1   pos_3
-  //
-  //         A      B        C       D       E                        A       D       C        B        E
-  //      |====[>========>-------[>------->=======|        =>      |=====[>------->-------[>=======[>=======|
-  //          pos_3    pos_2    pos_4   pos_1
-  //
-  //         A      B        C       D       E                        A       D       C        B        E
-  //      |----[>-------->=======[>=======>-------|        =>      |-----[>=======>=======[>-------[>-------|
-  //          pos_4    pos_1    pos_3   pos_2
-  //
-  //
-  //  Case 2 : With inversion
-  //
-  //    Case 2.A
-  //
-  //         A      B        C       D        E                       A      D        B'      C'       E
-  //      |----->=======[>=======>-------<]-------|        =>      |----->-------<]=======<=======<]-------|
-  //          pos_1   pos_3    pos_2   pos_4
-  //
-  //         A      B        C       D       E                        A      D        B'      C'       E
-  //      |=====>-------[>------->=======<]=======|        =>      |=====>=======<]-------<-------<]=======|
-  //          pos_2   pos_4    pos_1   pos_3
-  //
-  //
-  //    Case 2.B
-  //
-  //         A      B        C       D       E                        A       C'      D'       B       E
-  //      |====[>========>-------<]------->=======|        =>      |=====[>-------<-------[>=======>=======|
-  //          pos_3    pos_2    pos_4   pos_1
-  //
-  //         A      B        C       D       E                        A       C'      D'       B       E
-  //      |----<]-------->=======[>=======>-------|        =>      |-----<]=======>=======<]------->-------|
-  //          pos_4    pos_1    pos_3   pos_2
-  //
-  
-  // Determine which position comes first and do the corresponding rearrangement
-  int32_t pos_min = ae_utils::min( pos_1, ae_utils::min( pos_2, ae_utils::min( pos_3, pos_4 ) ) );
-  
-  if ( ! invert )
-  {
-    if ( pos_min == pos_1 )
-    {
-      ABCDE_to_ADCBE( pos_1, pos_3, pos_2, pos_4 );
-    }
-    else if ( pos_min == pos_2 )
-    {
-      ABCDE_to_ADCBE( pos_2, pos_4, pos_1, pos_3 );
-    }
-    else if ( pos_min == pos_3 )
-    {
-      ABCDE_to_ADCBE( pos_3, pos_2, pos_4, pos_1 );
-    }
-    else // if ( pos_min == pos_4 )
-    {
-      ABCDE_to_ADCBE( pos_4, pos_1, pos_3, pos_2 );
-    }
-  }
-  else // invert
-  {
-    if ( pos_min == pos_1 )
-    {
-      ABCDE_to_ADBpCpE( pos_1, pos_3, pos_2, pos_4 );
-    }
-    else if ( pos_min == pos_2 )
-    {
-      ABCDE_to_ADBpCpE( pos_2, pos_4, pos_1, pos_3 );
-    }
-    else if ( pos_min == pos_3 )
-    {
-      ABCDE_to_ACpDpBE( pos_3, pos_2, pos_4, pos_1 );
-    }
-    else // if ( pos_min == pos_4 )
-    {
-      ABCDE_to_ACpDpBE( pos_4, pos_1, pos_3, pos_2 );
-    }
-  }
-  
-  return true;
-}
-
-bool ae_dna::do_inter_GU_translocation( int32_t pos_1_rel, int32_t pos_2_rel, int32_t pos_3_rel, int32_t pos_4_rel, bool invert )
-{
-  // TODO check GU lengths according to positions and size limit
-  int32_t segment_length = ae_utils::mod( pos_2_rel - pos_1_rel, _length );
-
-  if (  pos_1_rel == pos_2_rel ) // TODO : should'nt that raise an error?
-  {
-    return false; 
-  }
-  
-  // Do not allow translocation if it would decrease the size of the origin GU below a threshold
-  if ( (_length - segment_length ) < _gen_unit->get_min_gu_length() )
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" TRANS %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-              _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, _length, _indiv->get_amount_of_dna() );
-    }
-    return false;
-  }
-  
-  //
-  ae_genetic_unit* chromosome     = _indiv->get_genetic_unit( 0 );
-  ae_genetic_unit* plasmid        = _indiv->get_genetic_unit( 1 );
-  ae_genetic_unit* destination_GU = ( _gen_unit == chromosome )? plasmid : chromosome;
-
-  int32_t dest_gu_size_before = destination_GU->get_seq_length();
-  
-  // Do not allow translocation if it would increase the size of the receiving GU below a threshold
-  if (dest_gu_size_before + segment_length > destination_GU->get_max_gu_length())
-  {
-    if ( _exp_m->get_output_m()->is_logged( LOG_BARRIER ) == true )
-    {
-      // Write an entry in the barrier log file
-      fprintf(  _exp_m->get_output_m()->get_log( LOG_BARRIER ), "%"PRId32" %"PRId32" TRANS %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-              _exp_m->get_num_gener(), _indiv->get_id(), segment_length, 0, dest_gu_size_before, _indiv->get_amount_of_dna() );
-    }
-    return false;
-  }
-  
-  //~ // Provided that OriC must be at position 0
-  //~ //
-  //~ //      Gen unit 1           Gen unit 2              Gen unit 1       Gen unit 2
-  //~ //
-  //~ //   Case 1: inter_GU_ABCDE_to_ACDBE
-  //~ //
-  //~ //         A    B     C        D     E                  A    C          D     B     E
-  //~ //      |---->=====>----|    |----[>----|             |---->----|     |----[>====[>----| 
-  //~ //          p1r   p2r            p4r                      p1r             p4r   p4r+(p2r-p1r)
-  //~ //
-  //~ //
-  //~ //   Case 2: inter_GU_ABCDE_to_BDCAE
-  //~ //
-  //~ //         A    B     C        D     E                   B               D     C     A   E
-  //~ //      |====>----->====|    |----[>----|             |-----|         |----[>====[>====>----| 
-  //~ //          p2r   p1r             p4r                                     p4r    
-  //~ //                                                                            p4r+(_length-p1r)
-  //~ //                                                                                  p4r+(_length-(p1r-p2r))
-  
-  // Determine which position comes first and do the corresponding rearrangement
-  // int32_t pos_min = ae_utils::min( pos_1, pos_2 );
-  
-  if ( ! invert )
-  {
-    if ( pos_1_rel < pos_2_rel )
-    {
-      // if ( _gen_unit == _indiv->get_genetic_unit( 0 ) /*chromosome*/ )
-      //      {
-      //           printf( "do_inter_GU_translocation( %"PRId32", %"PRId32", %"PRId32", %"PRId32", %s ) (sizes : %"PRId32" %"PRId32" %"PRId32")\n",
-      //                   pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel + _length, invert?"invert":"plain",
-      //                   _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   _indiv->get_genetic_unit( 1 )->get_dna()->get_length(),
-      //                   _indiv->get_amount_of_dna() );
-      //       }
-      //       else
-      //       {
-      //           printf( "do_inter_GU_translocation( %"PRId32", %"PRId32", %"PRId32", %"PRId32", %s ) (sizes : %"PRId32" %"PRId32" %"PRId32")\n",
-      //                   pos_1_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_2_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_3_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_4_rel, invert?"invert":"plain",
-      //                   _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   _indiv->get_genetic_unit( 1 )->get_dna()->get_length(),
-      //                   _indiv->get_amount_of_dna() );
-      //       }
-      
-      segment_length = ae_utils::mod( pos_2_rel - pos_1_rel, _length );
-      inter_GU_ABCDE_to_ACDBE( pos_1_rel, pos_2_rel, pos_4_rel );
-    }
-    else 
-    {
-      //       if ( _gen_unit == _indiv->get_genetic_unit( 0 ) /*chromosome*/ )
-      //       {
-      //           printf( "do_inter_GU_translocation( %"PRId32", %"PRId32", %"PRId32", %"PRId32", %s ) (sizes : %"PRId32" %"PRId32" %"PRId32")\n",
-      //                   pos_1_rel, pos_2_rel, pos_3_rel, pos_4_rel + _length, invert?"invert":"plain",
-      //                   _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   _indiv->get_genetic_unit( 1 )->get_dna()->get_length(),
-      //                   _indiv->get_amount_of_dna() );
-      //       }
-      //       else
-      //       {
-      //           printf( "do_inter_GU_translocation( %"PRId32", %"PRId32", %"PRId32", %"PRId32", %s ) (sizes : %"PRId32" %"PRId32" %"PRId32")\n",
-      //                   pos_1_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_2_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_3_rel + _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   pos_4_rel, invert?"invert":"plain",
-      //                   _indiv->get_genetic_unit( 0 )->get_dna()->get_length(),
-      //                   _indiv->get_genetic_unit( 1 )->get_dna()->get_length(),
-      //                   _indiv->get_amount_of_dna() );
-      //       }
-      
-      segment_length = ae_utils::mod( pos_1_rel - pos_2_rel, _length );
-      inter_GU_ABCDE_to_BDCAE( pos_2_rel, pos_1_rel, pos_4_rel );
-    }
-  }
-  else // invert
-  {
-    if ( pos_1_rel < pos_2_rel )
-    {
-      segment_length = ae_utils::mod( pos_2_rel - pos_1_rel, _length );
-      do_inversion( pos_1_rel, pos_2_rel );
-      inter_GU_ABCDE_to_ACDBE( pos_1_rel, pos_2_rel, pos_4_rel );
-    }
-    else // pos_1_rel > pos_2_rel
-    {
-      segment_length = ae_utils::mod( pos_1_rel - pos_2_rel, _length );
-      if (pos_2_rel != 0)       { do_inversion( 0, pos_2_rel); }
-      if (pos_1_rel != _length) { do_inversion( pos_1_rel, _length); }
-      inter_GU_ABCDE_to_BDCAE( pos_2_rel, pos_1_rel, pos_4_rel );
-    }
-  }
-  
-  return true;
-}
-
-bool ae_dna::do_inversion( int32_t pos_1, int32_t pos_2 )
-// Invert segment going from pos_1 (included) to pos_2 (excluded)
-// Exemple : sequence 011101001100 => 110011010001
-{
-  if ( pos_1 == pos_2 ) return false; // Invert everything <=> Invert nothing!
-  assert( pos_1 < pos_2 );
-  
-  //                                                     
-  //       pos_1         pos_2                   -> 0-         
-  //         |             |                   -       -
-  // 0--------------------------------->      -         -
-  //         ===============                  -         - pos_1
-  //           tmp (copy)                      -       -   
-  //                                             -----      |
-  //                                             pos_2    <-'
-  //
-  
-  int32_t seg_length = pos_2 - pos_1;
-  
-  // Create the inverted sequence
-  char* inverted_segment = NULL;
-  inverted_segment = new char[seg_length+1];
-  for ( int32_t i = 0, j = pos_2 - 1 ; i < seg_length ; i++, j-- )
-  {
-    if ( _data[j] == '0' ) inverted_segment[i] = '1';
-    else                   inverted_segment[i] = '0';
-  }
-  inverted_segment[seg_length] = '\0';
-  
-  // Remove promoters that included a breakpoint
-  _gen_unit->remove_promoters_around( pos_1 );
-  _gen_unit->remove_promoters_around( pos_2 );
-  
-  // Invert the sequence
-  replace( pos_1, inverted_segment, seg_length );
-  
-  // Update promoter list
-  if ( _length >= PROM_SIZE )
-  {
-    _gen_unit->invert_promoters_included_in( pos_1, pos_2 );
-    
-    _gen_unit->look_for_new_promoters_around( pos_1 );
-    _gen_unit->look_for_new_promoters_around( pos_2 );
-  }
-  
-  delete [] inverted_segment;
-  
-  return true;
-}
-
-bool ae_dna::do_insertion( int32_t pos, const char* seq_to_insert, int32_t seq_length )
-{
-  // Remove the promoters that will be broken
-  _gen_unit->remove_promoters_around( pos );
-  
-  // Insert the sequence
-  insert( pos, seq_to_insert, seq_length );
-  
-  // Look for new promoters
-  if ( _length >= PROM_SIZE )
-  {
-    _gen_unit->move_all_promoters_after( pos, seq_length );
-    _gen_unit->look_for_new_promoters_around( pos, pos + seq_length );
-  }
-  
-  return true;
-}
-
-
-ae_mutation* ae_dna::do_ins_HT( int32_t parent_id )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t nb_indivs = _exp_m->get_pop()->get_nb_indivs();
-  
-  // Insertion transfer
-  // Requirements:
-  //    * A circular exogenote => an alignment on the donor chromosome
-  //    * An alignment between the exogenote and the endogenote
-  
-  // 1) Draw a random donor (uniform drawing).
-  // We use the rank because indivs are sorted by rank (1 for the worst, POP_SIZE for the best).
-  ae_individual * donor = NULL;
-  do donor = _exp_m->get_pop()->get_indiv_by_rank( _exp_m->get_sel()->get_prng()->random( nb_indivs ) + 1 );
-  while ( donor->get_id() == parent_id );
-  
-  // 2) Look for an alignment within the donor genome
-  ae_vis_a_vis* alignment_1   = NULL;
-  ae_dna*       donor_dna     = donor->get_genetic_unit( 0 )->get_dna();
-  int32_t       nb_pairs_1    = (int32_t)( ceil( donor_dna->get_length() * _indiv->get_neighbourhood_rate() ) );
-  
-  alignment_1 = donor_dna->search_alignment( donor_dna, nb_pairs_1, DIRECT );
-    
-    if ( alignment_1 != NULL )
-    {
-      // 3) Make a copy of the sequence to be transferred (the exogenote)
-      ae_genetic_unit* exogenote = donor_dna->copy_into_new_GU( alignment_1->get_i_1(), alignment_1->get_i_2() );
-      
-      // 4) Look for an alignments between the exogenote and the endogenote
-      ae_vis_a_vis* alignment_2 = NULL;
-      int32_t       nb_pairs_2  = (int32_t)( ceil( get_length() * _indiv->get_neighbourhood_rate() ) );
-      
-      alignment_2 = exogenote->get_dna()->search_alignment( this, nb_pairs_2, BOTH_SENSES );
-      
-      if ( alignment_2 != NULL )
-      {      
-        int32_t gu_length_before  = _length;
-        int32_t gu_length_after   = gu_length_before + exogenote->get_dna()->get_length();
-        int32_t genome_length_before = _indiv->get_amount_of_dna();
-        int32_t genome_length_after = genome_length_before + exogenote->get_dna()->get_length();
-        
-        if ( ( genome_length_after > _indiv->get_max_genome_length() ) || ( gu_length_after > _gen_unit->get_max_gu_length() ) )
-        {
-          if ( _exp_m->get_output_m()->is_logged(LOG_BARRIER) == true )
-          {
-            // Write an entry in the barrier log file
-            fprintf(  _exp_m->get_output_m()->get_log(LOG_BARRIER), "%"PRId32" %"PRId32" INS_TRANSFER %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                      _exp_m->get_num_gener(),
-                      _indiv->get_id(),
-                      exogenote->get_dna()->get_length(),
-                      0,
-                      gu_length_before,
-                      genome_length_before );
-          }
-        }
-        else
-        {
-          insert_GU( exogenote, alignment_2->get_i_2(), alignment_2->get_i_1(), (alignment_2->get_sense() == INDIRECT) );
-          //~ fprintf( logfile, "RESULT:\n%s\n\n\n", new_indiv_dna->get_data() );
-          //~ fflush( logfile );
-
-          // Write a line in transfer logfile
-          if ( _exp_m->get_output_m()->is_logged(LOG_TRANSFER) == true )
-          {
-            fprintf(  _exp_m->get_output_m()->get_log(LOG_TRANSFER),
-                      "%"PRId32" %"PRId32" %"PRId32" 0 %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId16" %"PRId32" %"PRId32" %"PRId16"\n",
-                      _exp_m->get_num_gener(),
-                      _indiv->get_id(),
-                      donor->get_id(),
-                      exogenote->get_dna()->get_length(),
-                      0,
-                      genome_length_before,
-                      get_length(),
-                      alignment_1->get_i_1(),
-                      alignment_1->get_i_2(),
-                      alignment_1->get_score(),
-                      alignment_2->get_i_1(),
-                      alignment_2->get_i_2(),
-                      alignment_2->get_score() );
-          }
-    
-          #ifdef BIG_DEBUG
-            ae_common::sim->get_logs()->flush();
-            _indiv->assert_promoters();
-            _indiv->assert_promoters_order();
-          #endif
-          
-          if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-          {
-            char* donor_seq;
-            if(alignment_2->get_sense() == DIRECT)
-            {
-              donor_seq = exogenote->get_dna()->get_subsequence(alignment_2->get_i_1(),alignment_2->get_i_1(), LEADING);
-            }
-            else
-            {
-              donor_seq = exogenote->get_dna()->get_subsequence(alignment_2->get_i_1(),alignment_2->get_i_1(), LAGGING);
-            }
-            // Report the transfer
-            mut = new ae_mutation();
-            mut->report_ins_HT( alignment_1->get_i_1(), alignment_1->get_i_2(), alignment_2->get_i_1(), alignment_2->get_i_2(), exogenote->get_dna()->get_length(), alignment_1->get_score(),alignment_2->get_score(),  donor->get_id(), alignment_2->get_sense(), donor_seq);
-            delete [] donor_seq;
-          }          
-        }
-        
-        delete alignment_2;
-      }
-      
-      delete exogenote;
-      delete alignment_1;
-    }
-  
-  return mut;
-}
-
-ae_mutation* ae_dna::do_repl_HT( int32_t parent_id )
-{
-  ae_mutation* mut = NULL;
-  
-  int32_t nb_indivs = _exp_m->get_pop()->get_nb_indivs();
-  
-  // Replacement transfer
-  // Requirements:
-  //    * 2 distinct alignments between the (linear) exogenote and the endogenote
-  
-  //printf("Indiv: %d\n",new_indiv->get_id());
-  // 1) Draw a random donor (uniform drawing).
-  // We use the rank because indivs are sorted by rank (1 for the worst, POP_SIZE for the best).
-  ae_individual * donor = NULL;
-  do donor = _exp_m->get_pop()->get_indiv_by_rank( _exp_m->get_sel()->get_prng()->random( nb_indivs ) + 1 );
-  while ( donor->get_id() == parent_id );
-  
-  // 2) Look for an alignment between the parent genome and the donor genome
-  ae_vis_a_vis* alignment_1   = NULL;
-  ae_vis_a_vis* alignment_2   = NULL;
-  ae_dna*       donor_dna     = donor->get_genetic_unit( 0 )->get_dna();
-  ae_sense      sense         = (_exp_m->get_sel()->get_prng()->random() < 0.5) ? DIRECT : INDIRECT;
-  int32_t       nb_pairs_1    = (int32_t)( ceil( get_length() * _indiv->get_neighbourhood_rate() ) );
-  int32_t       nb_pairs_2    = (int32_t)( ceil( get_length() * _indiv->get_neighbourhood_rate() ) );
-  int8_t        research_sense = 0;
-  
-  alignment_1 = search_alignment( donor_dna, nb_pairs_1, sense );
-  if ( alignment_1 != NULL )
-  {
-    //printf("\talignement 1: %d %d\n", alignment_1->get_i_1(), alignment_1->get_i_2());
-    if( _exp_m->get_repl_HT_with_close_points())
-    {
-      //printf("Id: %d\n",new_indiv->get_id());
-      
-      alignment_2 = search_alignment_around_positions( donor_dna, alignment_1->get_i_1(), alignment_1->get_i_2(), alignment_1->get_sense(), research_sense);
-      if ( alignment_2 != NULL && alignment_2->get_i_1() == alignment_1->get_i_1() )
-      {
-        delete alignment_2;
-        alignment_2 = NULL;
-      }
-      if ( alignment_2 != NULL )
-      {
-        // If the second alignment is found upstream of the first alignment, they are inverse to facilitate
-        if(research_sense == -1) 
-        {
-          ae_vis_a_vis* tmp_alignment = new ae_vis_a_vis( *alignment_1 );
-          alignment_1->copy( alignment_2 );
-          alignment_2->copy( tmp_alignment );
-          delete tmp_alignment;
-        }
-      }
-    }
-    else
-    {
-      // Look for a second alignement between the parent and the donor (must be different from alignment_1)
-      while ( alignment_2 == NULL && nb_pairs_2 > 0 )
-      {
-        alignment_2 = search_alignment( donor_dna, nb_pairs_2, sense );
-      
-        // Forbid the replacement of the whole genome of the parent
-        if ( alignment_2 != NULL && alignment_2->get_i_1() == alignment_1->get_i_1() )
-        {
-          delete alignment_2;
-          alignment_2 = NULL;
-        }
-      }
-    }
-      
-    // If both alignments were found, proceed to the transfer
-    if ( alignment_2 != NULL )
-    {      
-      int32_t gu_length_before  = _length;
-      int32_t exogenote_length      = ae_utils::mod( alignment_2->get_i_2() - alignment_1->get_i_2() - 1, donor_dna->get_length() ) + 1;
-      int32_t replaced_seq_length   = ae_utils::mod( alignment_2->get_i_1() - alignment_1->get_i_1() - 1, gu_length_before ) + 1;
-      int32_t gu_length_after   = gu_length_before - replaced_seq_length + exogenote_length;
-      
-      int32_t genome_length_before = _indiv->get_amount_of_dna();
-      int32_t genome_length_after = genome_length_before - replaced_seq_length + exogenote_length;
-      
-      if ( genome_length_after < _indiv->get_min_genome_length() || genome_length_after > _indiv->get_max_genome_length() || gu_length_after < _gen_unit->get_min_gu_length() || gu_length_after > _gen_unit->get_max_gu_length() )
-      {
-        if ( _exp_m->get_output_m()->is_logged(LOG_BARRIER) == true )
-        {
-          // Write an entry in the barrier log file
-          fprintf(  _exp_m->get_output_m()->get_log(LOG_BARRIER), "%"PRId32" %"PRId32" REPL_TRANSFER %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-                    _exp_m->get_num_gener(),
-                    _indiv->get_id(),
-                    exogenote_length,
-                    replaced_seq_length,
-                    gu_length_before,
-                    genome_length_before );
-        }
-      }
-      else
-      {
-        // 3) Make a copy of the sequence to be transferred (the exogenote)
-        ae_genetic_unit* exogenote = NULL;
-        if ( sense == DIRECT )
-        {
-          exogenote = donor_dna->copy_into_new_GU( alignment_1->get_i_2(), alignment_2->get_i_2() );
-        }
-        else
-        {
-          exogenote = donor_dna->copy_into_new_GU( alignment_2->get_i_2(), alignment_1->get_i_2() );
-        }
-        
-        char* alignment1_parent_dna,* alignment2_parent_dna,* alignment1_donor_dna,* alignment2_donor_dna;
-        if ( _exp_m->get_output_m()->is_logged(LOG_TRANSFER) == true )
-        {
-          if( sense  == DIRECT)
-          {
-            alignment1_parent_dna = get_subsequence( alignment_1->get_i_1(), alignment_1->get_i_1() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-            alignment2_parent_dna = get_subsequence( alignment_2->get_i_1(), alignment_2->get_i_1() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-            alignment1_donor_dna = donor_dna->get_subsequence( alignment_1->get_i_2(), alignment_1->get_i_2() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-            alignment2_donor_dna = donor_dna->get_subsequence( alignment_2->get_i_2(), alignment_2->get_i_2() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-          }
-          else
-          {
-            alignment1_parent_dna = get_subsequence( alignment_1->get_i_1(), alignment_1->get_i_1() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-            alignment2_parent_dna = get_subsequence( alignment_2->get_i_1(), alignment_2->get_i_1() + 2*_indiv->get_align_w_zone_h_len() + _indiv->get_align_max_shift(), LEADING);
-            alignment1_donor_dna = donor_dna->get_subsequence( alignment_1->get_i_2(), alignment_1->get_i_2() - 2*_indiv->get_align_w_zone_h_len() - _indiv->get_align_max_shift(), LAGGING);
-            alignment2_donor_dna = donor_dna->get_subsequence( alignment_2->get_i_2(), alignment_2->get_i_2() - 2*_indiv->get_align_w_zone_h_len() - _indiv->get_align_max_shift(), LAGGING);
-          }
-        }            
-        
-        // Delete the sequence to be replaced
-        do_deletion( alignment_1->get_i_1(), alignment_2->get_i_1() );
-        if ( alignment_1->get_i_1() < alignment_2->get_i_1() )
-        {
-          insert_GU( exogenote, alignment_1->get_i_1(), 0, sense == INDIRECT );
-        }
-        else
-        {
-          insert_GU( exogenote, 0, 0, sense == INDIRECT );
-        }       
-        
-        // Write a line in transfer logfile
-        if ( _exp_m->get_output_m()->is_logged(LOG_TRANSFER) == true )
-        {
-          fprintf(  _exp_m->get_output_m()->get_log(LOG_TRANSFER),
-                  "%"PRId32" %"PRId32" %"PRId32" 1 %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId16" %"PRId32" %"PRId32" %"PRId16" %"PRId32" %"PRId32" %"PRId16" %"PRId16"\n",
-                  _exp_m->get_num_gener(),
-                  _indiv->get_id(),
-                  donor->get_id(),
-                  exogenote->get_dna()->get_length(),
-                  replaced_seq_length,
-                  genome_length_before,
-                  get_length(),
-                  (int16_t) alignment_1->get_sense(),
-                  alignment_1->get_i_1(),
-                  alignment_1->get_i_2(),
-                  alignment_1->get_score(),
-                  alignment_2->get_i_1(),
-                  alignment_2->get_i_2(),
-                  alignment_2->get_score() ,
-                  (int16_t) research_sense);
-            fprintf(_exp_m->get_output_m()->get_log(LOG_TRANSFER),
-                  "\tAlignment 1:\n\t\t%s\n\t\t%s\n\tAlignment 2:\n\t\t%s\n\t\t%s\n",alignment1_parent_dna, alignment1_donor_dna, alignment2_parent_dna, alignment2_donor_dna);
-          
-            delete [] alignment1_parent_dna;
-            delete [] alignment2_parent_dna;
-            delete [] alignment1_donor_dna;
-            delete [] alignment2_donor_dna;
-        }
-        
-        if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-        {
-          // Report the transfer
-          char* donor_seq;
-          if(alignment_2->get_sense() == DIRECT)
-          {
-            donor_seq = exogenote->get_dna()->get_subsequence(0,exogenote->get_dna()->get_length(), LEADING);
-          }
-          else
-          {
-            donor_seq = exogenote->get_dna()->get_subsequence(0,exogenote->get_dna()->get_length(), LAGGING);
-          }
-          mut = new ae_mutation();
-          mut->report_repl_HT( alignment_1->get_i_1(), alignment_1->get_i_2(), alignment_2->get_i_1(), alignment_2->get_i_2(), replaced_seq_length, exogenote->get_dna()->get_length(), alignment_1->get_score(),alignment_2->get_score(),  donor->get_id(), alignment_2->get_sense(),donor_seq  );
-          delete [] donor_seq;
-        }
-         
-        delete exogenote;
-      }
-      delete alignment_2;
-    }
-    delete alignment_1;
-  }
-  return mut;
-}
-
-bool ae_dna::do_ins_HT( int32_t pos, const char* seq_to_insert, int32_t seq_length )
-{
-  // Remove the promoters that will be broken
-  _gen_unit->remove_promoters_around( pos );
-  
-  // Insert the sequence
-  insert( pos, seq_to_insert, seq_length );
-  
-  // Look for new promoters
-  if ( _length >= PROM_SIZE )
-  {
-    _gen_unit->move_all_promoters_after( pos, seq_length );
-    _gen_unit->look_for_new_promoters_around( pos, pos + seq_length );
-  }
-  
-  return true;
-}
-
-bool ae_dna::do_repl_HT( int32_t pos1, int32_t pos2, const char* seq_to_insert, int32_t seq_length )
-{
-  // Remove the promoters that will be broken
-  _gen_unit->remove_promoters_around( pos1 );
-  
-  // Delete the replaced segment
-  do_deletion( pos1, pos2 );
-  
-  // Insert the sequence
-  int32_t insertion_position;
-  if(pos1 < pos2)
-  {
-  	insertion_position = pos1;
-  }
-  else
-  {
-  	insertion_position = 0;
-  }
-  insert(insertion_position, seq_to_insert, seq_length );
-  
-  // Look for new promoters
-  if ( _length >= PROM_SIZE )
-  {
-    _gen_unit->move_all_promoters_after( insertion_position, seq_length );
-    _gen_unit->look_for_new_promoters_around( insertion_position, insertion_position + seq_length );
-  }
-  
-  return true;
-}
-
-void ae_dna::undergo_this_mutation( ae_mutation * mut )
-{
-  if( mut == NULL ) return;
-
-  int32_t pos1, pos2, pos3, pos4;
-  int32_t length;
-  bool invert;
-  char *seq = NULL;
-  ae_sense sense;
-    
-  switch( mut->get_mut_type() )
-    {
-    case SWITCH:
-      mut->get_infos_point_mutation( &pos1 );
-      do_switch( pos1 );
-      break;
-    case S_INS:
-      mut->get_infos_small_insertion( &pos1, &length );
-      seq = new char[length + 1];
-      mut->get_sequence_small_insertion( seq );
-      do_small_insertion( pos1, length, seq );
-      delete [] seq; 
-      break;
-    case S_DEL:
-      mut->get_infos_small_deletion( &pos1, &length );
-      do_small_deletion( pos1, length );
-      break;
-    case DUPL:
-      mut->get_infos_duplication( &pos1, &pos2, &pos3 );
-      do_duplication( pos1, pos2, pos3 );
-      break;
-    case DEL:
-      mut->get_infos_deletion( &pos1, &pos2 );
-      do_deletion( pos1, pos2 );
-      break;
-    case TRANS:
-      mut->get_infos_translocation( &pos1, &pos2, &pos3, &pos4, &invert );
-      if ( _indiv->get_with_alignments() )
-      {
-        // Extract the segment to be translocated
-        ae_genetic_unit* translocated_segment = extract_into_new_GU( pos1, pos2 );
-        
-        // Reinsert the segment
-        insert_GU( translocated_segment, pos3, pos4, invert );
-      }
-      else
-      {
-        do_translocation( pos1, pos2, pos3, pos4, invert );
-      }
-      break;
-    case INV:
-      mut->get_infos_inversion( &pos1, &pos2 );
-      do_inversion( pos1, pos2 );
-      break;
-    case INS_HT:
-      mut->get_infos_ins_HT( &pos1, &pos2, &pos3, &pos4, &sense, &length );
-      seq = new char[length + 1];
-      mut->get_sequence_ins_HT( seq );
-      do_ins_HT( pos4, seq, length );
-      delete [] seq; 
-      break;
-    case REPL_HT:
-      mut->get_infos_repl_HT( &pos1, &pos2, &pos3, &pos4, &sense, &length );
-      seq = new char[length + 1];
-      mut->get_sequence_repl_HT( seq );
-      do_repl_HT( pos1, pos3, seq, length );
-      delete [] seq; 
-      break;
-    default :
-      fprintf( stderr, "ERROR, invalid mutation type in file %s:%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-}
-
-void ae_dna::compute_statistical_data( void )
-// *************************************************************************************************
-//                                      WARNING     Deprecated
-// *************************************************************************************************
-// Values that are computed : 
-//    Number of each type of mutations and rearrangements undergone by the individual
-//    Number of small mutations
-//    Number of rearrangements
-{
-  assert( false );
-  //~ ae_list_node<ae_mutation*>* mut_node  = _replic_report->_mutations->get_first();
-  //~ ae_mutation*  mut;
-  
-  //~ while ( mut_node != NULL )
-  //~ {
-    //~ mut = mut_node->get_obj();
-    
-    //~ switch( mut->get_mut_type() )
-    //~ {
-      //~ case SWITCH :
-        //~ _replic_report->_nb_switch++;
-        //~ break;
-      //~ case S_INS :
-        //~ _replic_report->_nb_small_insertions++;
-        //~ break;
-      //~ case S_DEL :
-        //~ _replic_report->_nb_small_deletions++;
-        //~ break;
-      //~ case DUPL :
-        //~ _replic_report->_nb_duplications++;
-        //~ break;
-      //~ case DEL :
-        //~ _replic_report->_nb_deletions++;
-        //~ break;
-      //~ case TRANS :
-        //~ _replic_report->_nb_translocations++;
-        //~ // TODO : if inter GU ...
-        //~ break;
-      //~ case INV :
-        //~ _replic_report->_nb_inversions++;
-        //~ break;
-    //~ }
-    
-    //~ mut_node = mut_node->get_next();
-  //~ }
-}
-
-/* static */ void ae_dna::set_GU( ae_list<ae_rna*>** rna_list, ae_genetic_unit* GU )
-{
-  ae_list_node<ae_rna*>* rna_node  = NULL;
-  ae_rna* rna = NULL;
-  
-  for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    rna_node = rna_list[strand]->get_first();
-    
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-      
-      rna->set_genetic_unit( GU );
-
-      rna_node = rna_node->get_next();
-    }
-  }
-}
-
-
-ae_genetic_unit* ae_dna::extract_into_new_GU( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 < pos_2 );
-  int32_t seq_length = pos_2 - pos_1;
-  
-  // ==================== Remove/Extract promoters from old sequence ====================
-  // Remove promoters around breakpoints
-  _gen_unit->remove_promoters_around( pos_1 );
-  _gen_unit->remove_promoters_around( pos_2 );
-
-  // Remove promoters belonging to the sequence (to be extracted) from the "old" GU
-  // and put them in a stand-alone promoter list (with indices ranging from 0 to seq_length-1)
-  ae_list<ae_rna*>** proms_GU_1  = new ae_list<ae_rna*>*[2];
-  proms_GU_1[LEADING]   = new ae_list<ae_rna*>();
-  proms_GU_1[LAGGING]   = new ae_list<ae_rna*>();
-  _gen_unit->extract_promoters_included_in( pos_1, pos_2, proms_GU_1 );  
-  ae_genetic_unit::shift_promoters( proms_GU_1, -pos_1, _length );
-  
-  
-  // ==================== Manage sequences ====================
-  // Copy the sequence in a stand-alone char* (size must be multiple of BLOCK_SIZE)
-  int32_t length_GU_1     = seq_length;
-  char*   sequence_GU_1   = new char[nb_blocks( length_GU_1 ) * BLOCK_SIZE];
-  memcpy( sequence_GU_1, &_data[pos_1], length_GU_1 * sizeof(char) );
-  sequence_GU_1[length_GU_1] = '\0';
-  
-  // Remove the sequence from the "old" GU
-  int32_t  length_GU_0     = _length - seq_length;
-  char*    sequence_GU_0   = new char[nb_blocks( length_GU_0 ) * BLOCK_SIZE];
-  memcpy( sequence_GU_0,          _data,          pos_1 * sizeof(char) );
-  memcpy( &sequence_GU_0[pos_1],  &_data[pos_2],  (_length - pos_2) * sizeof(char) );
-  sequence_GU_0[length_GU_0] = '\0';
-  
-  set_data( sequence_GU_0, length_GU_0 );
-  
-  
-  // ==================== Create the new genetic unit ====================
-  ae_genetic_unit* GU_1 = new ae_genetic_unit( _indiv, sequence_GU_1, length_GU_1, proms_GU_1 );
-  
-  
-  // ==================== Update promoter lists ====================
-  // Shift the position of the promoters of the "old" GU
-  _gen_unit->move_all_promoters_after( pos_1, -seq_length );
-  
-  // Look for new promoters around breakpoints
-  _gen_unit->look_for_new_promoters_around( pos_1 );
-  GU_1->look_for_new_promoters_around( 0 );
-  
-  return GU_1;
-}
-
-
-/*!
-  \brief Copy the sequence going from pos_1 (included) to pos_2 (excluded) into a new standalone genetic unit.
-
-  The new genetic unit's list of promoter is up-to-date.
-  if ( pos_1 == pos_2 ), the whole genome is copied
-*/
-ae_genetic_unit* ae_dna::copy_into_new_GU( int32_t pos_1, int32_t pos_2 ) const
-{
-  int32_t seq_length = ae_utils::mod( pos_2 - pos_1, _length );
-  if ( seq_length == 0 ) seq_length = _length;
-  
-  // ==================== Copy promoters from old sequence ====================
-  // Copy the promoters belonging to the sequence to be copied from the "old" GU
-  // into a stand-alone promoter list (with indices ranging from 0 to seq_length-1)
-  ae_list<ae_rna*>** proms_new_GU  = new ae_list<ae_rna*>*[2];
-  proms_new_GU[LEADING]   = new ae_list<ae_rna*>();
-  proms_new_GU[LAGGING]   = new ae_list<ae_rna*>();
-  _gen_unit->copy_promoters_included_in( pos_1, pos_2, proms_new_GU );
-  ae_genetic_unit::shift_promoters( proms_new_GU, -pos_1, _length );
-  
-  
-  // ==================== Manage sequences ====================
-  // Copy the sequence in a stand-alone char* (size must be multiple of BLOCK_SIZE)
-  int32_t length_new_GU     = seq_length;
-  char*   sequence_new_GU   = new char[nb_blocks( length_new_GU ) * BLOCK_SIZE];
-  if ( pos_1 < pos_2 )
-  {
-    memcpy( sequence_new_GU, &_data[pos_1], length_new_GU * sizeof(char) );
-  }
-  else
-  {
-    memcpy( sequence_new_GU, &_data[pos_1], (_length - pos_1) * sizeof(char) );
-    memcpy( &sequence_new_GU[_length - pos_1], &_data[0], pos_2 * sizeof(char) );
-  }
-  sequence_new_GU[length_new_GU] = '\0';
-  
-  
-  // ==================== Create the new genetic unit ====================
-  ae_genetic_unit* new_GU = new ae_genetic_unit( _indiv, sequence_new_GU, length_new_GU, proms_new_GU );
-  
-  
-  // ==================== Update new GU promoter list ====================
-  // Look for new promoters around breakpoints
-  new_GU->look_for_new_promoters_around( 0 );
-  
-  return new_GU;
-}
-
-/*!
-  \brief Insert the genetic unit GU_to_insert at pos_B, through pos_D. (sequence is inverted if invert == true)
-
-  GU to insert: segments C and D, breakpoint pos_D.
-  Current GU:   segments A and B, breakpoint pos_B.
- 
-  \verbatim
-  If invert is false, the insertion will render ADCB
-           A        B                  C        D                          A       D       C        B
-       |-------[>-------|     +     |=====[>========|        =>        |-------[>=====|========[>-------|
-             pos_B                      pos_D
- 
- 
-  If invert is true, the insertion will render ACpDpB, with Cp (resp. Dp) = inverted C (resp. D).
-           A        B                  C        D                          A       Cp     Dp        B
-       |-------[>-------|     +     |=====<]========|        =>        |-------[>=====|========[>-------|
-             pos_B                      pos_D
-  \endverbatim
-
-  Sequence from GU_to_insert is untouched but its list of promoters is emptied
-*/
-void ae_dna::insert_GU( ae_genetic_unit* GU_to_insert, int32_t pos_B, int32_t pos_D, bool invert )
-{
-  // Compute segment lengths
-  const char* GUti_data = GU_to_insert->get_dna()->get_data();
-  int32_t len_A     = pos_B;
-  int32_t len_B     = _length - pos_B;
-  int32_t len_C     = pos_D;
-  int32_t len_D     = GU_to_insert->get_dna()->get_length() - pos_D;
-  int32_t len_AB    = _length;
-  int32_t len_CD    = GU_to_insert->get_dna()->get_length();
-  int32_t len_ABCD  = len_AB + len_CD;
-  
-  //~ printf( "len_A : %"PRId32", len_B : %"PRId32", len_C : %"PRId32", len_D : %"PRId32",\nlen_AB : %"PRId32", len_CD : %"PRId32", len_ABCD : %"PRId32"\n", 
-          //~ len_A, len_B, len_C, len_D, len_AB, len_CD, len_ABCD );
-  
-  
-  // ==================== Insert the sequence ====================
-  // Create new genome
-  char* new_seq = new char[ BLOCK_SIZE * nb_blocks(len_ABCD) ];
-  
-  // Insert A
-  memcpy( new_seq, _data, len_A * sizeof(char) );
-  
-  // Insert C and D (inverted?)
-  if ( invert )
-  {
-    // Build Cp and Dp
-    char* seq_Cp = new char[pos_D+1];
-    for ( int32_t i = 0, j = pos_D - 1 ; i < len_C ; i++, j-- )
-    {
-      if ( GUti_data[j] == '0' ) seq_Cp[i] = '1';
-      else                       seq_Cp[i] = '0';
-    }
-    seq_Cp[len_C] = '\0';
-    
-    char* seq_Dp = new char[len_D+1];
-    for ( int32_t i = 0, j = len_CD - 1 ; i < len_D ; i++, j-- )
-    {
-      if ( GUti_data[j] == '0' ) seq_Dp[i] = '1';
-      else                       seq_Dp[i] = '0';
-    }
-    seq_Dp[len_D] = '\0';
-    
-    // Insert Cp and DP
-    // TODO : Maybe we should construct Cp and Dp directly at their rightful place...
-    memcpy( &new_seq[len_A],        seq_Cp, len_C * sizeof(char) );
-    memcpy( &new_seq[len_A+len_C],  seq_Dp, len_D * sizeof(char) );
-    
-    delete [] seq_Cp;
-    delete [] seq_Dp;
-  }
-  else // if ( invert == false )
-  {
-    // Insert D and C
-    memcpy( &new_seq[len_A],        &GUti_data[pos_D],  len_D * sizeof(char) );
-    memcpy( &new_seq[len_A+len_D],  GUti_data,          len_C * sizeof(char) );
-  }
-  
-  // Insert B
-  memcpy( &new_seq[len_A+len_C+len_D], &_data[pos_B], len_B * sizeof(char) );
-  new_seq[len_ABCD] = '\0';
-  
-  
-  // Remove promoters that are astride segments A and B : breakpoint pos_B
-  _gen_unit->remove_promoters_around( pos_B );
-  
-  
-  set_data( new_seq, len_ABCD );
-  
-  
-  
-  
-  // ==================== Manage promoters ====================
-  // Remove promoters that are astride segments C and D : breakpoint pos_D
-  GU_to_insert->remove_promoters_around( pos_D );
-  
-  // Shift the position of the promoters of segment B
-  _gen_unit->move_all_promoters_after( pos_B, len_CD );
-  
-  // Extract promoters of segments C and D.
-  // NOTE : We want ALL THE PROMOTERS to be transfered, not only those that are completely included
-  //        in segment C or D. Hence, we will use extract_promoters_starting_between() instead of 
-  //        extract_promoters_included_in().
-  // NOTE : Once removed the promoters starting on sequence D, the remaining is precisely the promoters
-  //        starting on sequence C (and they are at their rightful position). We can hence directly use 
-  //        the list of promoters from GU_to_insert.
-  ae_list<ae_rna*>** proms_C = new ae_list<ae_rna*>*[2];
-  proms_C[LEADING]  = new ae_list<ae_rna*>();
-  proms_C[LAGGING]  = new ae_list<ae_rna*>();
-  ae_list<ae_rna*>** proms_D  = new ae_list<ae_rna*>*[2];
-  proms_D[LEADING]  = new ae_list<ae_rna*>();
-  proms_D[LAGGING]  = new ae_list<ae_rna*>();
-  
-  if ( pos_D != 0 ) // TODO : Manage this in the different functions? with a parameter WholeGenomeEventHandling ?
-  {
-    GU_to_insert->extract_promoters_starting_between( 0, pos_D, proms_C );
-  }
-  GU_to_insert->extract_promoters_starting_between( pos_D, len_CD, proms_D );
-  assert( GU_to_insert->get_rna_list()[LEADING]->is_empty() );
-  assert( GU_to_insert->get_rna_list()[LAGGING]->is_empty() );
-  ae_genetic_unit::shift_promoters( proms_D, -len_C, len_D );
-  
-  if ( invert )
-  {
-    //~ printf( "+++++++++++++++++++++++++++++++++++++\n" );
-    //~ ae_genetic_unit::print_rnas( proms_C );
-    //~ ae_genetic_unit::print_rnas( proms_D );
-    //~ printf( "//////////////////////////////////////\n" );
-    
-    ae_genetic_unit::invert_promoters( proms_C, len_C );
-    ae_genetic_unit::invert_promoters( proms_D, len_D );
-    
-    //~ ae_genetic_unit::print_rnas( proms_C );
-    //~ ae_genetic_unit::print_rnas( proms_D );
-    //~ printf( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" );
-    
-    _gen_unit->insert_promoters_at( proms_C, len_A );
-    _gen_unit->insert_promoters_at( proms_D, len_A + len_C );
-  }
-  else // if ( invert == false )
-  {
-    _gen_unit->insert_promoters_at( proms_D, len_A );
-    _gen_unit->insert_promoters_at( proms_C, len_A + len_D );
-  }
-  
-  // Delete the temporary lists (objects are untouched)
-  delete proms_C[LEADING];
-  delete proms_C[LAGGING];
-  delete [] proms_C;
-  delete proms_D[LEADING];
-  delete proms_D[LAGGING];
-  delete [] proms_D;
-  
-  // Look for new promoters around breakpoints
-  _gen_unit->look_for_new_promoters_around( pos_B );
-  _gen_unit->look_for_new_promoters_around( pos_B + len_CD );
-  
-  set_GU( _gen_unit->get_rna_list(), _gen_unit );
-}
-
-
-/*!
-  \brief Looks for an alignment between this and chrom2 in the given sense with max nb_pairs trials. nb_pairs is updated accordingly
- 
-  Performs local alignment searches between this and chrom2 around randomly drawn pairs of points.
-  The minimum score will be generated according to align_fun_shape and associated parameters for each pair of points.
-  The parameter nb_pairs will be updated according to how many trials were necessary for an alignment to be found.
-
-  The sense of the searched alignment can be either DIRECT, INDIRECT or BOTH_SENSE. \
-  In the latter case, the sense will be randomly drawn (uniformly between DIRECT and INDIRECT) for each pair of points.
-*/
-ae_vis_a_vis* ae_dna::search_alignment( ae_dna* chrom2, int32_t& nb_pairs, ae_sense sense )
-{  
-  ae_vis_a_vis* alignment = NULL;
-  ae_sense cur_sense = sense; // Which sense (direct or indirect)
-  int16_t needed_score;       // Minimum alignement score needed to recombine (stochastic)
-  
-  for ( ; nb_pairs > 0 ; nb_pairs-- )
-  {
-    ///////////////////////////////////////
-    //  1) Draw random sense (if needed) //
-    ///////////////////////////////////////
-    if ( sense == BOTH_SENSES )
-    {
-      cur_sense = (_indiv->_mut_prng->random() < 0.5) ? DIRECT : INDIRECT;
-    }
-    
-    /////////////////////////////////////////////////////
-    // 2) Determine the minimum alignment score needed //
-    /////////////////////////////////////////////////////
-    if ( _indiv->get_align_fun_shape() == LINEAR )
-    {
-      needed_score = (int16_t) ceil( _indiv->get_align_lin_min() + _indiv->_mut_prng->random() * ( _indiv->get_align_lin_max() - _indiv->get_align_lin_min() ) );
-    }
-    else
-    {
-      // I want the probability of rearrangement for an alignment of score <score> to be
-      // prob = 1 / ( 1 + exp( -(score-mean_score)/lambda ) )
-      // The score needed for a rearrangement to take place with a given random drawing is hence
-      // needed_score = ceil( -lambda * log( 1/rand - 1 ) + mean )
-      needed_score = (int16_t) ceil( - _indiv->get_align_sigm_lambda() * log( 1/_indiv->_mut_prng->random() - 1 ) + _indiv->get_align_sigm_mean() );
-      if ( needed_score < 0 ) needed_score = 0;
-    }
-    
-    ///////////////////////////////////////////////////////////////
-    // 3) Determine where to look for an alignement (draw seeds) //
-    ///////////////////////////////////////////////////////////////
-    int32_t seed1 = _indiv->_mut_prng->random( _length );
-    int32_t seed2 = _indiv->_mut_prng->random( chrom2->get_length() );
-    
-    ////////////////////////////////////////////////////////////////////
-    // 3) Test the existence of an alignment with a high enough score //
-    ////////////////////////////////////////////////////////////////////
-    if ( cur_sense == DIRECT )
-    {
-      alignment = ae_align::search_alignment_direct( this, seed1, chrom2, seed2, needed_score );
-      if ( alignment != NULL )
-      {
-        return alignment;
-      }
-    }
-    else // if ( cur_sense = INDIRECT )
-    {
-      alignment = ae_align::search_alignment_indirect( this, seed1, chrom2, seed2, needed_score );
-      if ( alignment != NULL )
-      {
-        return alignment;
-      }
-    }
-  }
-  
-  return NULL;
-}
-
-/*!
-  \brief Looks for an alignment between this and chrom2 in the given sense around the given positions
- 
-  Performs local alignment searches between this and chrom2 around the given positions
-  The minimum score will be generated according to align_fun_shape and associated parameters for each pair of points.
-  The parameter nb_pairs will be updated according to how many trials were necessary for an alignment to be found.
-
-  The sense of the searched alignment can be either DIRECT, INDIRECT or BOTH_SENSE. \
-  In the latter case, the sense will be randomly drawn (uniformly between DIRECT and INDIRECT) for each pair of points.
-*/
-ae_vis_a_vis* ae_dna::search_alignment_around_positions( ae_dna* chrom2, int32_t chrom1_pos_1, int32_t chrom2_pos_1, ae_sense sense, int8_t& research_sense)
-{
-  ae_vis_a_vis* alignment = NULL;
-  ae_vis_a_vis* tmp_alignment = NULL;
-  ae_sense cur_sense = sense; // Which sense (direct or indirect)
-  int16_t needed_score;       // Minimum alignement score needed to recombine (stochastic)
-  int32_t chrom1_pos_for_research; 
-  int32_t chrom2_pos_for_research;
-  int32_t size_between_two_alignments = 3 * _indiv->get_align_w_zone_h_len();
-  
-  ///////////////////////////////////////
-  //  1) Draw random sense (if needed) //
-  ///////////////////////////////////////
-  if ( sense == BOTH_SENSES )
-  {
-    printf( "WARNING : Alignment could not be searched in both senses in %s:%d\n", __FILE__, __LINE__ );
-    return(NULL);
-  }
-  
-  /////////////////////////////////////////////////////
-  // 2) Determine the minimum alignment score needed //
-  /////////////////////////////////////////////////////
-  if ( _indiv->get_align_fun_shape() == LINEAR )
-  {
-    needed_score = (int16_t) ceil( _indiv->get_align_lin_min() + _indiv->_mut_prng->random() * ( _indiv->get_align_lin_max() - _indiv->get_align_lin_min() ) );
-  }
-  else
-  {
-    // I want the probability of rearrangement for an alignment of score <score> to be
-    // prob = 1 / ( 1 + exp( -(score-mean_score)/lambda ) )
-    // The score needed for a rearrangement to take place with a given random drawing is hence
-    // needed_score = ceil( -lambda * log( 1/rand - 1 ) + mean )
-    needed_score = (int16_t) ceil( - _indiv->get_align_sigm_lambda() * log( 1/_indiv->_mut_prng->random() - 1 ) + _indiv->get_align_sigm_mean() );
-    if ( needed_score < 0 ) needed_score = 0;
-  }
-  
-  /////////////////////////////////////////////////////////
-  // 3) Determine the sense by which the research begins //
-  /////////////////////////////////////////////////////////
-  int16_t first_research_sense = (_indiv->_mut_prng->random() < 0.5) ? 1 : -1;
-  int16_t second_research_sense = -1*first_research_sense;
-  
-  ////////////////////////////////////////////////////////////////////////////////////////
-  // 4) Test the first sense for the existence of an alignment with a high enough score //
-  ////////////////////////////////////////////////////////////////////////////////////////
-  chrom1_pos_for_research = chrom1_pos_1;
-  chrom2_pos_for_research = chrom2_pos_1;
-  int16_t i = 0;
-  
-  while( _indiv->_mut_prng->random() < 1-_exp_m->get_repl_HT_detach_rate() )
-  {
-    //printf("%d longueur genome %d\n",i, this->get_length());
-    //printf("chrom1_pos_for_research : %d, chrom2_pos_for_research : %d\n", chrom1_pos_for_research, chrom1_pos_for_research);
-    chrom1_pos_for_research = ae_utils::mod(chrom1_pos_for_research + first_research_sense * size_between_two_alignments, this->get_length()) ;
-    if ( cur_sense == DIRECT )
-    {
-      chrom2_pos_for_research = ae_utils::mod(chrom2_pos_for_research + first_research_sense * size_between_two_alignments, chrom2->get_length());
-      tmp_alignment = ae_align::search_alignment_direct( this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score );
-    }
-    else // if ( cur_sense = INDIRECT )
-    {
-      chrom2_pos_for_research = ae_utils::mod(chrom2_pos_for_research - first_research_sense * size_between_two_alignments, chrom2->get_length());
-      tmp_alignment = ae_align::search_alignment_indirect( this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score );
-    }
-    //printf("chrom1_pos_for_research : %d, chrom2_pos_for_research : %d\n", chrom1_pos_for_research, chrom1_pos_for_research);
-    
-    if(tmp_alignment == NULL)
-    {
-      if(alignment != NULL)
-      {
-        //printf("tmp_alignment == NULL alignment != NULL\n",i);
-        research_sense = first_research_sense;
-        return alignment;
-      }
-      else
-      {
-        //printf("tmp_alignment == NULL alignment == NULL\n",i);
-        break;
-      }
-    }
-    else
-    {
-      if(alignment != NULL)
-      {
-        //printf("tmp_alignment != NULL alignment != NULL\n",i);
-        alignment->copy( tmp_alignment );
-      }
-      else
-      {
-        //printf("tmp_alignment != NULL alignment == NULL\n",i);
-        alignment = new ae_vis_a_vis( *tmp_alignment );
-      }
-      delete tmp_alignment;
-      chrom1_pos_for_research = alignment->get_i_1();
-      chrom2_pos_for_research = alignment->get_i_2();
-    }
-    i++;
-  }
-  
-  if(alignment != NULL)
-  {
-    
-    research_sense = first_research_sense;
-    return alignment;
-  }
-  
-  /////////////////////////////////////////////////////////////////////////////////////////
-  // 5) Test the second sense for the existence of an alignment with a high enough score //
-  /////////////////////////////////////////////////////////////////////////////////////////
-  alignment = NULL;
-  chrom1_pos_for_research = chrom1_pos_1;
-  chrom2_pos_for_research = chrom2_pos_1;
-  i = 0 ;
-  while( _indiv->_mut_prng->random() < 1-_exp_m->get_repl_HT_detach_rate() )
-  {
-    chrom1_pos_for_research = ae_utils::mod(chrom1_pos_for_research + second_research_sense * size_between_two_alignments, this->get_length() );
-    if ( cur_sense == DIRECT )
-    {
-      chrom2_pos_for_research = ae_utils::mod(chrom2_pos_for_research + second_research_sense * size_between_two_alignments, chrom2->get_length() );
-      tmp_alignment = ae_align::search_alignment_direct( this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score );
-    }
-    else // if ( cur_sense = INDIRECT )
-    {
-      chrom2_pos_for_research = ae_utils::mod(chrom2_pos_for_research - second_research_sense * size_between_two_alignments, chrom2->get_length() );
-      tmp_alignment = ae_align::search_alignment_indirect( this, chrom1_pos_for_research, chrom2, chrom2_pos_for_research, needed_score );
-    }
-    
-    if(tmp_alignment == NULL)
-    {
-      if(alignment != NULL)
-      {
-        research_sense = second_research_sense;
-        return alignment;
-      }
-      else
-      {
-        break;
-      }
-    }
-    else
-    {
-      if(alignment != NULL)
-      {
-        alignment->copy( tmp_alignment );
-      }
-      else
-      {
-        alignment = new ae_vis_a_vis( *tmp_alignment );
-      }
-      delete tmp_alignment;
-      chrom1_pos_for_research = alignment->get_i_1();
-      chrom2_pos_for_research = alignment->get_i_2();
-    }
-    i++;
-  }
-  if(alignment != NULL)
-  {
-    research_sense = second_research_sense;
-    return alignment;
-  }
-  
-  return NULL;
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-/**
- * Extract the sequence going from pos_1 (included) to pos_2 (excluded) into a new standalone genetic unit.
- * Promoter lists are created / updated accordingly
- */
-void ae_dna::ABCDE_to_ADCBE( int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E )
-{
-  // Rearrange the sequence from ABCDE to ADCBE (complex translocation of segment defined
-  // between positions pos_B and pos_D)
-  //
-  // Segments are identified by pos_x values as shown below.
-  //
-  // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF???
-  //
-  //         A      B        C       D       E                        A      D        C       B        E
-  //      |----->=======[>=======>-------[>-------|        =>      |----->-------[>=======>=======[>-------|
-  //          pos_B   pos_C    pos_D   pos_E
-  //
-  
-  // Check points' order and range
-  assert( pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= _length );
-  
-  // Compute segment lengths
-  int32_t len_A = pos_B;
-  int32_t len_B = pos_C - pos_B;
-  int32_t len_C = pos_D - pos_C;
-  int32_t len_D = pos_E - pos_D;
-  int32_t len_E = _length - pos_E;
-  int32_t len_AD   = len_A + len_D;
-  int32_t len_ADC  = len_AD + len_C;
-  int32_t len_ADCB = len_ADC + len_B;
-  
-  // Create new sequence
-  char* new_genome = new char[_nb_blocks * BLOCK_SIZE];
-  
-  memcpy( new_genome,             _data,          len_A * sizeof(char) );
-  memcpy( &new_genome[len_A],     &_data[pos_D],  len_D * sizeof(char) );
-  memcpy( &new_genome[len_AD],    &_data[pos_C],  len_C * sizeof(char) );
-  memcpy( &new_genome[len_ADC],   &_data[pos_B],  len_B * sizeof(char) );
-  memcpy( &new_genome[len_ADCB],  &_data[pos_E],  len_E * sizeof(char) );
-  new_genome[_length] = '\0';
-  
-  // Replace sequence
-  // NB : The size of the genome doesn't change. Therefore, we don't need to update _length and _nb_blocks
-  delete [] _data;
-  _data = new_genome;
-  
-  
-  // ========== Update promoter list ==========
-  // 1) Remove promoters that include a breakpoint
-  // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-  // 3) Shift these promoters positions
-  // 4) Reinsert the shifted promoters
-  // 5) Look for new promoters including a breakpoint
-  if ( _length >= PROM_SIZE )
-  {
-    // 1) Remove promoters that include a breakpoint
-    _gen_unit->remove_promoters_around( pos_B );
-    _gen_unit->remove_promoters_around( pos_C );
-    _gen_unit->remove_promoters_around( pos_D );
-    _gen_unit->remove_promoters_around( pos_E );
-    
-    // Create temporary lists for promoters to move and/or invert
-    ae_list<ae_rna*>** promoters_B = new ae_list<ae_rna*>*[2];
-    promoters_B[LEADING] = new ae_list<ae_rna*>();
-    promoters_B[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_C = new ae_list<ae_rna*>*[2];
-    promoters_C[LEADING] = new ae_list<ae_rna*>();
-    promoters_C[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_D = new ae_list<ae_rna*>*[2];
-    promoters_D[LEADING] = new ae_list<ae_rna*>();
-    promoters_D[LAGGING] = new ae_list<ae_rna*>();
-    
-    // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-    if ( len_B >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_B, pos_C, promoters_B );
-    }
-    if ( len_C >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_C, pos_D, promoters_C );
-    }
-    if ( len_D >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_D, pos_E, promoters_D );
-    }
-    
-    // 3) Shift these promoters positions
-    ae_genetic_unit::shift_promoters( promoters_B, len_D + len_C,  _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_C, len_D - len_B,  _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_D, -len_B - len_C, _gen_unit->get_dna()->get_length() );
-    
-    // 4) Reinsert the shifted promoters
-    _gen_unit->insert_promoters( promoters_B );
-    _gen_unit->insert_promoters( promoters_C );
-    _gen_unit->insert_promoters( promoters_D );
-    
-    // Delete the temporary lists (objects are untouched)
-    delete promoters_B[LEADING];
-    delete promoters_B[LAGGING];
-    delete [] promoters_B;
-    delete promoters_C[LEADING];
-    delete promoters_C[LAGGING];
-    delete [] promoters_C;
-    delete promoters_D[LEADING];
-    delete promoters_D[LAGGING];
-    delete [] promoters_D;
-    
-    // 5) Look for new promoters including a breakpoint
-    _gen_unit->look_for_new_promoters_around( len_A );
-    _gen_unit->look_for_new_promoters_around( len_AD );
-    _gen_unit->look_for_new_promoters_around( len_ADC );
-    _gen_unit->look_for_new_promoters_around( len_ADCB );
-  }
-}
-
-void ae_dna::ABCDE_to_ADBpCpE( int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E )
-{
-  // Rearrange the sequence from ABCDE to ADBpCpE (complex translocation with inversion
-  // of segment defined between positions pos_B and pos_D)
-  // Bp (resp Cp) stands for inverted B (resp C)
-  //
-  // Segments are identified by pos_x values as shown below.
-  //
-  // WARNING : Segment C includes nucleotide at pos_D // NOTE : WTF???
-  //
-  //         A      B        C       D        E                       A      D        Bp      Cp       E
-  //      |----->=======[>=======>-------<]-------|        =>      |----->-------<]=======<=======<]-------|
-  //          pos_B   pos_C    pos_D   pos_E
-  //
-  
-  // Check points' order and range
-  assert( pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= _length );
-  
-  // Compute segment lengths
-  int32_t len_A = pos_B;
-  int32_t len_B = pos_C - pos_B;
-  int32_t len_C = pos_D - pos_C;
-  int32_t len_D = pos_E - pos_D;
-  int32_t len_E = _length - pos_E;
-  int32_t len_AD   = len_A + len_D;
-  int32_t len_ADB  = len_AD + len_B;
-  int32_t len_ADBC = len_ADB + len_C;
-  
-  // Create new sequence
-  char* new_genome = new char[_nb_blocks * BLOCK_SIZE];
-  
-  // Copy segments A and D
-  memcpy( new_genome,         _data,            len_A * sizeof(char) );
-  memcpy( &new_genome[len_A], &_data[pos_D],  len_D * sizeof(char) );
-  
-  
-  // Build Bp and put it in the new genome
-  char* inverted_segment = new char[len_B+1];
-  
-  for ( int32_t i = 0, j = pos_C - 1 ; i < len_B ; i++, j-- )
-  {
-    if ( _data[j] == '0' ) inverted_segment[i] = '1';
-    else                   inverted_segment[i] = '0';
-  }
-  inverted_segment[len_B] = '\0';
-  
-  memcpy( &new_genome[len_AD], inverted_segment, len_B * sizeof(char) );
-  
-  delete [] inverted_segment;
-  
-  
-  // Build Cp and put it in the new genome
-  inverted_segment = new char[len_C+1];
-  
-  for ( int32_t i = 0, j = pos_D - 1 ; i < len_C ; i++, j-- )
-  {
-    if ( _data[j] == '0' ) inverted_segment[i] = '1';
-    else                   inverted_segment[i] = '0';
-  }
-  inverted_segment[len_C] = '\0';
-  
-  memcpy( &new_genome[len_ADB], inverted_segment, len_C * sizeof(char) );
-  
-  delete [] inverted_segment;
-  
-  // Copy segment E into the new genome
-  memcpy( &new_genome[len_ADBC], &_data[pos_E], len_E * sizeof(char) );
-  new_genome[_length] = '\0';
-  
-  
-  // Replace sequence
-  delete [] _data;
-  _data = new_genome;
-  
-  
-  // ========== Update promoter list ==========
-  // 1) Remove promoters that include a breakpoint
-  // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-  // 3) Shift (and invert when needed) these promoters positions
-  // 4) Reinsert the shifted promoters
-  // 5) Look for new promoters including a breakpoint
-  if ( _length >= PROM_SIZE )
-  {
-    // 1) Remove promoters that include a breakpoint
-    _gen_unit->remove_promoters_around( pos_B );
-    _gen_unit->remove_promoters_around( pos_C );
-    _gen_unit->remove_promoters_around( pos_D );
-    _gen_unit->remove_promoters_around( pos_E );
-    
-    // Create temporary lists for promoters to move and/or invert
-    ae_list<ae_rna*>** promoters_B = new ae_list<ae_rna*>*[2];
-    promoters_B[LEADING] = new ae_list<ae_rna*>();
-    promoters_B[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_C = new ae_list<ae_rna*>*[2];
-    promoters_C[LEADING] = new ae_list<ae_rna*>();
-    promoters_C[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_D = new ae_list<ae_rna*>*[2];
-    promoters_D[LEADING] = new ae_list<ae_rna*>();
-    promoters_D[LAGGING] = new ae_list<ae_rna*>();
-    
-    // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-    if ( len_B >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_B, pos_C, promoters_B );
-    }
-    if ( len_C >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_C, pos_D, promoters_C );
-    }
-    if ( len_D >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_D, pos_E, promoters_D );
-    }
-    
-    // 3a) Invert promoters of segments B and C
-    ae_genetic_unit::invert_promoters( promoters_B, pos_B, pos_C );
-    ae_genetic_unit::invert_promoters( promoters_C, pos_C, pos_D );
-    
-    // 3b) Shift these promoters positions
-    ae_genetic_unit::shift_promoters( promoters_B, len_D,           _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_C, len_D,           _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_D, -len_B - len_C,  _gen_unit->get_dna()->get_length() );
-    
-    // 4) Reinsert the shifted promoters
-    _gen_unit->insert_promoters( promoters_C );
-    _gen_unit->insert_promoters( promoters_B );
-    _gen_unit->insert_promoters( promoters_D );
-    
-    // Delete the temporary lists (objects are untouched)
-    delete promoters_B[LEADING];
-    delete promoters_B[LAGGING];
-    delete [] promoters_B;
-    delete promoters_C[LEADING];
-    delete promoters_C[LAGGING];
-    delete [] promoters_C;
-    delete promoters_D[LEADING];
-    delete promoters_D[LAGGING];
-    delete [] promoters_D;
-    
-    // 5) Look for new promoters including a breakpoint
-    _gen_unit->look_for_new_promoters_around( len_A );
-    _gen_unit->look_for_new_promoters_around( len_AD );
-    _gen_unit->look_for_new_promoters_around( len_ADB );
-    _gen_unit->look_for_new_promoters_around( len_ADBC );
-  }
-}
-
-void ae_dna::ABCDE_to_ACpDpBE( int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E )
-{
-  // Rearrange the sequence from ABCDE to ACpDpBE (complex translocation with inversion
-  // of segment defined between positions pos_C and pos_E)
-  // Cp (resp Dp) stands for inverted C (resp D)
-  //
-  // Segments are identified by pos_x values as shown below.
-  //
-  // WARNING : Segment D includes nucleotide at pos_E // NOTE : WTF???
-  //
-  //         A      B        C       D       E                        A       C'      D'       B       E
-  //      |----<]-------->=======[>=======>-------|        =>      |-----<]=======>=======<]------->-------|
-  //          pos_B    pos_C    pos_D   pos_E
-  //
-  
-  // Check points' order and range
-  assert( pos_B >= 0 && pos_C >= pos_B && pos_D >= pos_C && pos_E >= pos_D && pos_E <= _length );
-  
-  // Compute segment lengths
-  int32_t len_A = pos_B;
-  int32_t len_B = pos_C - pos_B;
-  int32_t len_C = pos_D - pos_C;
-  int32_t len_D = pos_E - pos_D;
-  int32_t len_E = _length - pos_E;
-  int32_t len_AC   = len_A + len_C;
-  int32_t len_ACD  = len_AC + len_D;
-  int32_t len_ACDB = len_ACD + len_B;
-  
-  // Create new sequence
-  char* new_genome = new char[_nb_blocks * BLOCK_SIZE];
-  
-  // Copy segment A
-  memcpy( new_genome, _data, len_A * sizeof(char) );
-  
-  
-  // Build Cp and put it in the new genome
-  char* inverted_segment = new char[len_C+1];
-  
-  for ( int32_t i = 0, j = pos_D - 1 ; i < len_C ; i++, j-- )
-  {
-    if ( _data[j] == '0' ) inverted_segment[i] = '1';
-    else                   inverted_segment[i] = '0';
-  }
-  inverted_segment[len_C] = '\0';
-  
-  memcpy( &new_genome[len_A], inverted_segment, len_C * sizeof(char) );
-  
-  delete [] inverted_segment;
-  
-  
-  // Build Dp and put it in the new genome
-  inverted_segment = new char[len_D+1];
-  
-  for ( int32_t i = 0, j = pos_E - 1 ; i < len_D ; i++, j-- )
-  {
-    if ( _data[j] == '0' ) inverted_segment[i] = '1';
-    else                   inverted_segment[i] = '0';
-  }
-  inverted_segment[len_D] = '\0';
-  
-  memcpy( &new_genome[len_AC], inverted_segment, len_D * sizeof(char) );
-  
-  delete [] inverted_segment;
-  
-  // Copy segments B and E
-  memcpy( &new_genome[len_ACD],   &_data[pos_B], len_B * sizeof(char) );
-  memcpy( &new_genome[len_ACDB],  &_data[pos_E], len_E * sizeof(char) );
-  new_genome[_length] = '\0';
-  
-  
-  // Replace sequence
-  delete [] _data;
-  _data = new_genome;
-  
-  
-  // ========== Update promoter list ==========
-  // 1) Remove promoters that include a breakpoint
-  // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-  // 3) Shift (and invert when needed) these promoters positions
-  // 4) Reinsert the shifted promoters
-  // 5) Look for new promoters including a breakpoint
-  if ( _length >= PROM_SIZE )
-  {
-    // 1) Remove promoters that include a breakpoint
-    _gen_unit->remove_promoters_around( pos_B );
-    _gen_unit->remove_promoters_around( pos_C );
-    _gen_unit->remove_promoters_around( pos_D );
-    _gen_unit->remove_promoters_around( pos_E );
-    
-    // Create temporary lists for promoters to move and/or invert
-    ae_list<ae_rna*>** promoters_B = new ae_list<ae_rna*>*[2];
-    promoters_B[LEADING] = new ae_list<ae_rna*>();
-    promoters_B[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_C = new ae_list<ae_rna*>*[2];
-    promoters_C[LEADING] = new ae_list<ae_rna*>();
-    promoters_C[LAGGING] = new ae_list<ae_rna*>();
-    ae_list<ae_rna*>** promoters_D = new ae_list<ae_rna*>*[2];
-    promoters_D[LEADING] = new ae_list<ae_rna*>();
-    promoters_D[LAGGING] = new ae_list<ae_rna*>();
-    
-    // 2) Extract promoters that are totally included in each segment to be moved (B, C and D)
-    if ( len_B >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_B, pos_C, promoters_B );
-    }
-    if ( len_C >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_C, pos_D, promoters_C );
-    }
-    if ( len_D >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_D, pos_E, promoters_D );
-    }
-    
-    // 3a) Invert promoters of segments C and D
-    ae_genetic_unit::invert_promoters( promoters_C, pos_C, pos_D );
-    ae_genetic_unit::invert_promoters( promoters_D, pos_D, pos_E );
-    
-    // 3b) Shift these promoters positions
-    ae_genetic_unit::shift_promoters( promoters_B, len_C + len_D, _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_C, -len_B,        _gen_unit->get_dna()->get_length() );
-    ae_genetic_unit::shift_promoters( promoters_D, -len_B,        _gen_unit->get_dna()->get_length() );
-    
-    // 4) Reinsert the shifted promoters
-    _gen_unit->insert_promoters( promoters_B );
-    _gen_unit->insert_promoters( promoters_D );
-    _gen_unit->insert_promoters( promoters_C );
-    
-    // Delete the temporary lists (objects are untouched)
-    delete promoters_B[LEADING];
-    delete promoters_B[LAGGING];
-    delete [] promoters_B;
-    delete promoters_C[LEADING];
-    delete promoters_C[LAGGING];
-    delete [] promoters_C;
-    delete promoters_D[LEADING];
-    delete promoters_D[LAGGING];
-    delete [] promoters_D;
-    
-    // 5) Look for new promoters including a breakpoint
-    _gen_unit->look_for_new_promoters_around( len_A );
-    _gen_unit->look_for_new_promoters_around( len_AC );
-    _gen_unit->look_for_new_promoters_around( len_ACD );
-    _gen_unit->look_for_new_promoters_around( len_ACDB );
-  }
-}
-
-void ae_dna::inter_GU_ABCDE_to_ACDBE( int32_t pos_B, int32_t pos_C, int32_t pos_E )
-{
-  // Check points' order and range
-  assert( ( pos_B >= 0 && pos_C >= pos_B ) && ( pos_E >= 0 ) );
-  
-  if ( pos_B != pos_C )
-  {
-    // Usefull values
-    ae_individual* indiv            = _indiv;
-    ae_genetic_unit* chromosome     = indiv->get_genetic_unit( 0 );
-    ae_genetic_unit* plasmid        = indiv->get_genetic_unit( 1 );
-    ae_genetic_unit* destination_GU = ( _gen_unit == chromosome )? plasmid : chromosome;
-    
-    // Compute segment lengths
-    int32_t len_A = pos_B;
-    int32_t len_B = pos_C - pos_B;
-    int32_t len_C = _length - pos_C;
-    int32_t len_D = pos_E;
-    int32_t len_E = destination_GU->get_dna()->get_length() - pos_E;
-    int32_t len_AC = len_A + len_C;
-    int32_t len_DB = len_D + len_B;
-    int32_t len_DBE = len_DB + len_E;
-    
-    
-    // Create the new sequence of this genetic unit
-    int32_t tmp = ae_string::nb_blocks( len_AC );
-    char* new_sequence_this = new char[tmp * BLOCK_SIZE];
-    
-    memcpy( new_sequence_this,           _data,          len_A * sizeof(char) );
-    memcpy( &new_sequence_this[len_A],   &_data[pos_C],  len_C * sizeof(char) );
-    new_sequence_this[len_AC]='\0';
-    
-    // Create the new sequence of the destination genetic unit
-    tmp = ae_string::nb_blocks(len_DBE) * BLOCK_SIZE;
-    char* new_sequence_dest = new char[tmp];
-    char* dest_GU_former_seq = (char*) destination_GU->get_dna()->get_data();
-    
-    memcpy( new_sequence_dest,           dest_GU_former_seq,          len_D * sizeof(char) );
-    memcpy( &new_sequence_dest[len_D],   &_data[pos_B],               len_B * sizeof(char) );
-    memcpy( &new_sequence_dest[len_DB],  &dest_GU_former_seq[pos_E],  len_E * sizeof(char) );
-    new_sequence_dest[len_DBE]='\0';
-
-    
-    
-    // ========== Update promoter list ==========
-    // 1) Remove promoters that include a breakpoint
-    // 2) Extract promoters that are totally included in each segment to be moved (B, C and E)
-    // NB : Sequences have to be updated at this stage in order to have the correct lengths when managing new promoter positions
-    // ........
-    // 3) Shift these promoters positions
-    // 4) Reinsert the shifted promoters
-    // 5) Look for new promoters including a breakpoint
-    
-    
-    // 1) Remove promoters that include a breakpoint
-    _gen_unit->remove_promoters_around( pos_B );
-    _gen_unit->remove_promoters_around( pos_C );
-    destination_GU->remove_promoters_around( pos_E );
-    
-    // Create temporary lists for promoters to move and/or invert
-    ae_list<ae_rna*>** promoters_B = new ae_list<ae_rna*>*[2];
-    promoters_B[LEADING] = new ae_list<ae_rna*>();
-    promoters_B[LAGGING] = new ae_list<ae_rna*>();
-    
-    // 2) Extract promoters that are totally included in each segment to be moved (B, C and E)
-    if ( len_B >= PROM_SIZE )
-    {
-      _gen_unit->extract_promoters_included_in( pos_B, pos_C, promoters_B );
-    }
-    
-    
-    
-    // ========== Replace sequences ==========
-    set_data( new_sequence_this, len_AC );
-    destination_GU->get_dna()->set_data( new_sequence_dest, len_DBE );
-  
-    
-    // 3) Shift these promoters positions
-    ae_genetic_unit::shift_promoters( promoters_B, len_D - len_A, destination_GU->get_dna()->get_length() );
-    
-    // Reassign promoters to their new genetic unit
-    ae_list_node<ae_rna*>* rna_node; 
-    ae_rna* rna;
-    for (int32_t tmp_strand = 0;  tmp_strand < 2; tmp_strand++)
-    {
-      rna_node = promoters_B[tmp_strand]->get_first();
-      while ( rna_node )
-      {
-        rna = rna_node->get_obj();
-        rna->set_genetic_unit(destination_GU); 
-        rna_node = rna_node->get_next();
-      }
-    }
-
-    // Shift the promoters of sequences C and E
-    _gen_unit->move_all_promoters_after( pos_C, -len_B );
-    destination_GU->move_all_promoters_after( pos_E, len_B );
-    
-    // 4) Reinsert the shifted promoters
-    destination_GU->insert_promoters( promoters_B );
-    
-    // Delete the temporary lists (objects are untouched)
-    delete promoters_B[LEADING];
-    delete promoters_B[LAGGING];
-    delete [] promoters_B;
-    
-    // 5) Look for new promoters including a breakpoint
-    _gen_unit->look_for_new_promoters_around( 0 );
-    _gen_unit->look_for_new_promoters_around( len_A );
-    destination_GU->look_for_new_promoters_around( 0 );
-    destination_GU->look_for_new_promoters_around( len_D );
-    destination_GU->look_for_new_promoters_around( len_DB );
-  }
-}
-
-void ae_dna::inter_GU_ABCDE_to_BDCAE( int32_t pos_B, int32_t pos_C, int32_t pos_E )
-{
-  // Check points' order and range
-  assert( ( pos_B >= 0 && pos_C >= pos_B ) && ( pos_E >= 0 ) );
-  
-  // Compute segment lengths
-  int32_t len_A = pos_B;
-  int32_t len_B = pos_C - pos_B;
-  int32_t len_C = _length - pos_C;
-  //~ int32_t len_ABC = _length;   
-  int32_t len_DA = len_A + pos_E; 
-    
-  inter_GU_ABCDE_to_ACDBE( 0, pos_B, pos_E ); 
-  inter_GU_ABCDE_to_ACDBE( len_B, (len_B+len_C), len_DA); 
-}
diff --git a/src/libaevol/ae_dna.h b/src/libaevol/ae_dna.h
deleted file mode 100644
index 11c9e5e..0000000
--- a/src/libaevol/ae_dna.h
+++ /dev/null
@@ -1,246 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
- 
- 
- #ifndef __AE_DNA_H__
-#define  __AE_DNA_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdlib.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_dna_replic_report.h>
-#include <ae_enums.h>
-#include <ae_list.h>
-#include <ae_mutation.h>
-#include <ae_string.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-class ae_individual;
-class ae_genetic_unit;
-class ae_vis_a_vis;
-class ae_rna;
-
-
-
-
-
-
-class ae_dna : public ae_string
-{  
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_dna( ae_genetic_unit* gen_unit, int32_t length );
-    ae_dna( ae_genetic_unit* gen_unit, const ae_dna &model );
-    ae_dna( ae_genetic_unit* gen_unit, ae_dna* const parent_dna );
-    ae_dna( ae_genetic_unit* gen_unit, char* seq, int32_t length );
-    ae_dna( ae_genetic_unit* gen_unit, gzFile backup_file );
-    ae_dna( ae_genetic_unit* gen_unit, char* organism_file_name );
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_dna( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    // From ae_string
-    //   inline const char*   get_data( void ) const;
-    //   inline       void    set_data( char* data, int32_t length = -1 );
-    //   inline       int32_t get_length( void ) const;
-    inline ae_dna_replic_report*  get_replic_report( void ) const;
-    inline void                   set_replic_report( ae_dna_replic_report * rep ); // for post-treatment only
-    
-    inline ae_genetic_unit *      get_genetic_unit( void ) const;
-    inline ae_individual*         get_indiv(void) const;
-    
-    char* get_subsequence( int32_t from, int32_t to, ae_strand strand ) const; // WARNING : creates a new char[...] (up to you to delete it!)
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================    
-    // Perform all the mutations (local mutations, rearrangements and transfer)
-    void perform_mutations( int32_t parent_id );
-    
-    // Perform all the local mutations (point mutations and indels) of the replication
-    void do_small_mutations( void );
-    
-    // Perform all the chromosomic rearrangements (duplications, deletions, translocations and inversions)
-    // of the replication
-    void do_rearrangements( void );
-    void do_rearrangements_with_align( void );
-    
-    // Perform all transfer (with insertion and with replacement)
-    void do_transfer( int32_t parent_id );
-    
-    // Perform a single local mutation at a random position
-    ae_mutation* do_switch( void );
-    ae_mutation* do_small_insertion( void );
-    ae_mutation* do_small_deletion( void );
-
-    // Perform a single local mutation at a specified position (useful to replay the evolution)
-    bool do_switch( int32_t pos );
-    bool do_small_insertion( int32_t pos, int16_t nb_insert, char * seq );
-    bool do_small_deletion( int32_t pos, int16_t nb_del );
-    
-    // Perform a single rearrangement at random positions
-    ae_mutation* do_duplication( void );
-    ae_mutation* do_deletion( void );
-    ae_mutation* do_translocation( void );
-    ae_mutation* do_inter_GU_translocation( void );
-    ae_mutation* do_inversion( void );
-    ae_mutation* do_insertion( const char* seq_to_insert, int32_t seq_length = -1 );
-  
-    // Perform a single rearrangement at specified positions
-    bool do_duplication( int32_t pos_1, int32_t pos_2, int32_t pos_3 );
-    bool do_deletion( int32_t pos_1, int32_t pos_2 );
-    bool do_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert );
-    bool do_inter_GU_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, bool invert );
-    bool do_inversion( int32_t pos_1, int32_t pos_2 );
-    bool do_insertion( int32_t pos, const char* seq_to_insert, int32_t seq_length );
-    
-    // Perform transfer with the search of alignments
-    ae_mutation* do_ins_HT( int32_t parent_id );
-    ae_mutation* do_repl_HT( int32_t parent_id );
-    
-    // Perform a single transfer at specified positions
-    bool do_ins_HT( int32_t pos, const char* seq_to_insert, int32_t seq_length );
-    bool do_repl_HT( int32_t pos1, int32_t pos2, const char* seq_to_insert, int32_t seq_length );
-    
-    ae_genetic_unit*  extract_into_new_GU( int32_t pos_1, int32_t pos_2 );
-    ae_genetic_unit*  copy_into_new_GU   ( int32_t pos_1, int32_t pos_2 ) const;
-    void insert_GU( ae_genetic_unit* GU_to_insert, int32_t pos_B, int32_t pos_D, bool invert );
-    
-    ae_vis_a_vis* search_alignment( ae_dna* chrom2, int32_t& nb_pairs, ae_sense sense );
-    ae_vis_a_vis* search_alignment_around_positions( ae_dna* chrom2, int32_t chrom1_pos_1, int32_t chrom1_pos_2, ae_sense sense, int8_t& research_sense);
-    
-    void undergo_this_mutation( ae_mutation * mut ); // useful when we replay the evolution
-
-    void compute_statistical_data( void );
-    
-    
-    static void set_GU( ae_list<ae_rna*>** rna_list, ae_genetic_unit* GU );
-  
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_dna( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_dna( const ae_dna &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void ABCDE_to_ADCBE(   int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E );
-    void ABCDE_to_ADBpCpE( int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E );
-    void ABCDE_to_ACpDpBE( int32_t pos_B, int32_t pos_C, int32_t pos_D, int32_t pos_E );
-    void inter_GU_ABCDE_to_ACDBE( int32_t pos_B, int32_t pos_C, int32_t pos_E );
-    void inter_GU_ABCDE_to_BDCAE( int32_t pos_B, int32_t pos_C, int32_t pos_E );
-    
-    
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-    
-    // From ae_string
-    //   char*   _data;
-    //   int32_t _length;
-    //   int32_t _nb_blocks;
-    ae_individual*        _indiv;
-    ae_genetic_unit*      _gen_unit; // Genetic unit which the genetic unit belongs to
-    ae_dna_replic_report* _replic_report;
-};
-
-
-// =====================================================================
-//                          Accessors definitions
-// =====================================================================
-inline ae_dna_replic_report* ae_dna::get_replic_report( void ) const
-{
-  return _replic_report;
-}
-
-inline ae_individual* ae_dna::get_indiv(void) const
-{
-  return _indiv;
-}
-
- // for post-treatment only
-inline void ae_dna::set_replic_report( ae_dna_replic_report * rep )
-{
-  _replic_report = rep;
-}
-
-inline ae_genetic_unit * ae_dna::get_genetic_unit( void ) const
-{
-  return _gen_unit;
-}
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_DNA_H__
diff --git a/src/libaevol/ae_dna_replic_report.cpp b/src/libaevol/ae_dna_replic_report.cpp
deleted file mode 100644
index 97ba95a..0000000
--- a/src/libaevol/ae_dna_replic_report.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                          Class ae_dna_replic_report                         #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_dna_replic_report::ae_dna_replic_report( void )
-{
-  _mutations        = new ae_list<ae_mutation*>();
-  _rearrangements   = new ae_list<ae_mutation*>();
-  _HT               = new ae_list<ae_mutation*>();
-
-  _nb_mut[SWITCH] = 0;
-  _nb_mut[S_INS]  = 0;
-  _nb_mut[S_DEL]  = 0;
-  _nb_mut[DUPL]   = 0;
-  _nb_mut[DEL]    = 0;
-  _nb_mut[TRANS]  = 0;
-  _nb_mut[INV]    = 0;
-  _nb_mut[INS_HT] = 0;
-  _nb_mut[REPL_HT]= 0;
-}
-
-ae_dna_replic_report::ae_dna_replic_report( const ae_dna_replic_report &model )
-{
-  // Initialize trivial attributes
-  _nb_mut[SWITCH] = model._nb_mut[SWITCH];
-  _nb_mut[S_INS]  = model._nb_mut[S_INS];
-  _nb_mut[S_DEL]  = model._nb_mut[S_DEL];
-  _nb_mut[DUPL]   = model._nb_mut[DUPL];
-  _nb_mut[DEL]    = model._nb_mut[DEL];
-  _nb_mut[TRANS]  = model._nb_mut[TRANS];
-  _nb_mut[INV]    = model._nb_mut[INV];
-  _nb_mut[INS_HT] = model._nb_mut[INS_HT];
-  _nb_mut[REPL_HT]= model._nb_mut[REPL_HT];
-  
-  // Copy _mutations and _rearrangements
-  _mutations = new ae_list<ae_mutation*>();
-  ae_list_node<ae_mutation*>* mut_node = (model._mutations)->get_first();
-  ae_mutation* mut = NULL;
-  while ( mut_node != NULL )
-  {
-    mut = mut_node->get_obj();
-    _mutations->add( new ae_mutation( *mut ) );
-    mut_node = mut_node->get_next();
-  }
-  
-  _rearrangements = new ae_list<ae_mutation*>();
-  ae_list_node<ae_mutation*>* rear_node = (model._rearrangements)->get_first();
-  ae_mutation* rear = NULL;
-  while ( rear_node != NULL )
-  {
-    rear = rear_node->get_obj();
-    _rearrangements->add( new ae_mutation( *rear ) );
-    rear_node = rear_node->get_next();
-  }
-  
-  _HT = new ae_list<ae_mutation*>();
-  ae_list_node<ae_mutation*>* HT_node = (model._HT)->get_first();
-  ae_mutation* HT = NULL;
-  while ( HT_node != NULL )
-  {
-    HT = HT_node->get_obj();
-    _HT->add( new ae_mutation( *HT ) );
-    HT_node = HT_node->get_next();
-  }
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_dna_replic_report::~ae_dna_replic_report( void )
-{
-  _mutations->erase( true );
-  _rearrangements->erase( true );
-  _HT->erase( true );
-  
-  delete _mutations;
-  delete _rearrangements;
-  delete _HT;
-}
-
-
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-void ae_dna_replic_report::compute_stats( void )
-{
-  // useful when we inspect a tree file
-  // because stats are not saved in the file 
-  _nb_mut[SWITCH] = 0;
-  _nb_mut[S_INS]  = 0;
-  _nb_mut[S_DEL]  = 0;
-  _nb_mut[DUPL]   = 0;
-  _nb_mut[DEL]    = 0;
-  _nb_mut[TRANS]  = 0;
-  _nb_mut[INV]    = 0;
-  _nb_mut[INS_HT] = 0;
-  _nb_mut[REPL_HT]= 0;
-  
-  ae_list_node<ae_mutation*>* event_node  = _HT->get_first();
-  ae_mutation* event       = NULL;
-  while ( event_node != NULL )
-  {
-    event = event_node->get_obj();
-    assert( event->get_mut_type() == INS_HT || event->get_mut_type() == REPL_HT );
-    
-    _nb_mut[ event->get_mut_type() ]++;
-    
-    event_node = event_node->get_next();
-  }
-  
-  event_node = _rearrangements->get_first();
-  event = NULL;
-  while ( event_node != NULL )
-  {
-    event = event_node->get_obj();
-    assert( event->get_mut_type() == DUPL || event->get_mut_type() == DEL || 
-            event->get_mut_type() == TRANS || event->get_mut_type() == INV );
-    
-    _nb_mut[ event->get_mut_type() ]++;
-    
-    event_node = event_node->get_next();
-  }
-  
-  event_node  = _mutations->get_first();
-  event       = NULL;
-  while ( event_node != NULL )
-  {
-    event = event_node->get_obj();
-    assert( event->get_mut_type() == SWITCH || 
-            event->get_mut_type() == S_INS || event->get_mut_type() == S_DEL );
-    
-    _nb_mut[ event->get_mut_type() ]++;
-    
-    event_node = event_node->get_next();
-  }
-  
-  
-  
-}
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_dna_replic_report.h b/src/libaevol/ae_dna_replic_report.h
deleted file mode 100644
index e9acee8..0000000
--- a/src/libaevol/ae_dna_replic_report.h
+++ /dev/null
@@ -1,257 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef __AE_DNA_REPLIC_REPORT_H__
-#define __AE_DNA_REPLIC_REPORT_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_list.h>
-#include <ae_mutation.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_dna;
-
-
-
-
-
-class ae_dna_replic_report : public ae_object
-{
-  friend class ae_dna;
-  
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_dna_replic_report( void );
-    ae_dna_replic_report( const ae_dna_replic_report &model );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_dna_replic_report( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline ae_list<ae_mutation*>* get_mutations( void )      const;
-    inline ae_list<ae_mutation*>* get_rearrangements( void ) const;
-    inline ae_list<ae_mutation*>* get_HT( void ) const;
-
-    inline int32_t get_nb_small_mutations( void )  const;
-    inline int32_t get_nb_rearrangements( void )   const;
-    inline int32_t get_nb_HT( void )   const;
-    inline int32_t get_nb_switch( void )           const;
-    inline int32_t get_nb_small_insertions( void ) const;
-    inline int32_t get_nb_small_deletions( void )  const;
-    inline int32_t get_nb_indels( void )           const;
-    inline int32_t get_nb_duplications( void )     const;
-    inline int32_t get_nb_deletions( void )        const;
-    inline int32_t get_nb_translocations( void )   const;
-    inline int32_t get_nb_inversions( void )       const;
-    inline int32_t get_nb_ins_HT( void )           const;
-    inline int32_t get_nb_repl_HT( void )          const;
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void compute_stats( void );  // useful when we inspect a tree file
-    inline void add_rear( ae_mutation* rear );
-    inline void add_mut( ae_mutation* mut );
-    inline void add_HT( ae_mutation* HT);
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    /*    ae_dna_replic_report( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_dna_replic_report( const ae_dna_replic_report &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_list<ae_mutation*>* _mutations;       // Lists of mutations, rearrangements and undergone
-    ae_list<ae_mutation*>* _rearrangements;  // by the genetic unit at last replication
-    ae_list<ae_mutation*>* _HT;              
-
-    int32_t _nb_mut[10]; // Number of mutations/rearrangements/HT of each type undergone
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline ae_list<ae_mutation*>* ae_dna_replic_report::get_mutations( void ) const
-{
-  return _mutations;
-}
-
-inline ae_list<ae_mutation*>* ae_dna_replic_report::get_rearrangements( void ) const
-{
-  return _rearrangements;
-}
-
-inline ae_list<ae_mutation*>* ae_dna_replic_report::get_HT( void ) const
-{
-  return _HT;
-}
-
-inline int32_t ae_dna_replic_report::get_nb_small_mutations( void ) const
-{
-  assert( _mutations->get_nb_elts() == _nb_mut[SWITCH] + _nb_mut[S_INS] + _nb_mut[S_DEL] );
-  return _mutations->get_nb_elts();
-}
-
-inline int32_t ae_dna_replic_report::get_nb_rearrangements( void ) const
-{
-  assert( _rearrangements->get_nb_elts() == _nb_mut[DUPL] + _nb_mut[DEL] + _nb_mut[TRANS] + _nb_mut[INV] );
-  return _rearrangements->get_nb_elts();
-}
-
-inline int32_t ae_dna_replic_report::get_nb_HT( void ) const
-{
-  assert( _HT->get_nb_elts() == _nb_mut[INS_HT] + _nb_mut[REPL_HT] );
-  return _HT->get_nb_elts();
-}
-
-inline int32_t ae_dna_replic_report::get_nb_switch( void ) const
-{
-  return _nb_mut[SWITCH];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_small_insertions( void ) const
-{
-  return _nb_mut[S_INS];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_small_deletions( void ) const
-{
-  return _nb_mut[S_DEL];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_indels( void ) const
-{
-  return _nb_mut[S_INS] + _nb_mut[S_DEL];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_duplications( void ) const
-{
-  return _nb_mut[DUPL];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_deletions( void ) const
-{
-  return _nb_mut[DEL];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_translocations( void ) const
-{
-  return _nb_mut[TRANS];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_inversions( void ) const
-{
-  return _nb_mut[INV];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_ins_HT( void ) const
-{
-  return _nb_mut[INS_HT];
-}
-
-inline int32_t ae_dna_replic_report::get_nb_repl_HT( void ) const
-{
-  return _nb_mut[REPL_HT];
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_dna_replic_report::add_mut( ae_mutation* mut )
-{
-  assert( mut != NULL );
-  
-  _mutations->add( mut );
-  _nb_mut[ mut->get_mut_type() ]++;
-}
-
-inline void ae_dna_replic_report::add_rear( ae_mutation* rear )
-{
-  assert( rear != NULL );
-  
-  _rearrangements->add( rear );
-  _nb_mut[ rear->get_mut_type() ]++;
-}
-
-inline void ae_dna_replic_report::add_HT( ae_mutation* HT )
-{
-  assert( HT != NULL );
-  _HT->add( HT );
-  _nb_mut[ HT->get_mut_type() ]++;
-}
-
-
-#endif // __AE_DNA_REPLIC_REPORT_H__
diff --git a/src/libaevol/ae_dump.cpp b/src/libaevol/ae_dump.cpp
deleted file mode 100644
index 89bcd2d..0000000
--- a/src/libaevol/ae_dump.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <sys/stat.h>
-#include <err.h>
-#include <errno.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_dump.h>
-#include <ae_exp_manager.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#ifdef __REGUL
-  #include <ae_influence_R.h>
-  #include <ae_protein_R.h>
-#endif
-
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_dump                                #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_dump::ae_dump( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-  int status;
-  status = mkdir( "stats/dump/", 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, "stats/dump/" );
-  }
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-const char* DUMP_FORMAT = "\t%d\t%d\t%f\n";
-
-void ae_dump::write_current_generation_dump( void )
-{
-  //  printf("Begin dump\n");
-  write_fitness_total();
-  write_secretion_present();
-  write_fitness_metabolic();
-  write_secreted_amount();
-  write_individual_probes();
-  //  printf("End dump\n");
-}
-
-void ae_dump::write_fitness_total( void )
-{
-  
-  if ( _exp_m->is_spatially_structured() )
-  {
-    sprintf( filename_buffer, "stats/dump/fitness_total_%06"PRId32".out", _exp_m->get_num_gener() ) ;
-    current_file = fopen( filename_buffer, "w+" );
-    double** map = _exp_m->get_spatial_structure()->get_total_fitness_grid();
-    fprintf( current_file, "#\tX\tY\tfitness_total(X, Y)\n" );
-    
-    for( int16_t x = 0 ; x < _exp_m->get_grid_width() ; x++ )
-    {
-      for( int16_t y = 0 ; y < _exp_m->get_grid_height() ; y++ )
-      {
-        fprintf( current_file, DUMP_FORMAT, x, y, map [x][y] );
-      }
-      fprintf( current_file, "\n" );
-    }
-    fflush( current_file );
-    fclose( current_file );
-        
-    // Has been allocated in ae_spatial_structure::get_total_fitness_grid()
-    for ( int16_t x = 0 ; x < _exp_m->get_grid_width() ; x++ )
-    {
-      delete [] map[x];
-    }
-    delete [] map; 
-  } 
-}
-
-void ae_dump::write_secreted_amount ( void )
-{
-  if ( _exp_m->is_spatially_structured() )
-  {
-    sprintf( filename_buffer, "stats/dump/secreted_amount_%06"PRId32".out", _exp_m->get_num_gener() ) ;
-    current_file = fopen( filename_buffer, "w+" );
-    
-    double** map = _exp_m->get_spatial_structure()->get_secreted_amount_grid();
-    fprintf( current_file, "#\tX\tY\tsecreted_amount(X, Y)\n" );
-    for( int16_t x = 0 ; x < _exp_m->get_grid_width() ; x++ )
-    {
-      for( int16_t y = 0 ; y < _exp_m->get_grid_height() ; y++ )
-      {
-        fprintf( current_file, DUMP_FORMAT, x, y, map [x][y] );
-      }
-      fprintf( current_file, "\n" );
-    }
-    fflush( current_file );
-    fclose( current_file );
-    for ( int16_t x = 0; x < _exp_m->get_grid_width() ; x++ )
-    {
-      delete [] map[x];
-    }
-    delete [] map;
-  }
-}
-
-void ae_dump::write_fitness_metabolic ( void )
-{
-  if ( _exp_m->is_spatially_structured() )
-  {
-    sprintf( filename_buffer, "stats/dump/fitness_metabolic_%06"PRId32".out", _exp_m->get_num_gener() ) ;
-    current_file = fopen( filename_buffer, "w+" );
-    
-    double** map = _exp_m->get_spatial_structure()->get_metabolic_fitness_grid();
-    fprintf( current_file, "#\tX\tY\tfitness_metabolic(X, Y)\n" );
-    for( int16_t x = 0 ; x < _exp_m->get_grid_width() ; x++ )
-    {
-      for( int16_t y = 0 ; y < _exp_m->get_grid_height() ; y++ )
-      {
-        fprintf( current_file, DUMP_FORMAT, x, y, map [x][y] );
-      }
-      fprintf( current_file, "\n" );
-    }
-    fflush( current_file );
-    fclose( current_file );
-    for ( int16_t x = 0; x < _exp_m->get_grid_width() ; x++ )
-    {
-      delete [] map[x];
-    }
-    delete [] map;
-  }
-}
-
-void ae_dump::write_secretion_present ( void )
-{
-  if ( _exp_m->is_spatially_structured() )
-  {
-    sprintf( filename_buffer, "stats/dump/secretion_present_%06"PRId32".out", _exp_m->get_num_gener() ) ;
-    current_file = fopen( filename_buffer, "w+" );
-    
-    double** map = _exp_m->get_spatial_structure()->get_secretion_present_grid();
-    fprintf( current_file, "#\tX\tY\tsecretion_present(X, Y)\n" );
-    for( int16_t x = 0 ; x < _exp_m->get_grid_width() ; x++ )
-    {
-      for( int16_t y = 0 ; y < _exp_m->get_grid_height() ; y++ )
-        fprintf( current_file, DUMP_FORMAT, x, y, map [x][y] );
-      fprintf( current_file, "\n" );
-    }
-    fflush( current_file );
-    fclose( current_file );
-    for ( int16_t x = 0; x < _exp_m->get_grid_width() ; x++ )
-    {
-      delete [] map[x];
-    }
-    delete [] map;
-  }
-}
-
-/*!
-  \brief Write the probes (5 int and 5 double) of each individual at a given generation
-*/
-void ae_dump::write_individual_probes( void )
-{
-  sprintf( filename_buffer, "stats/dump/individual_probes_%06"PRId32".out", _exp_m->get_num_gener() ) ;
-  current_file = fopen( filename_buffer, "w" );
-  
-  fprintf(current_file, "Id\tInt_Probe_1\tInt_Probe_2\tInt_Probe_3\tInt_Probe_4\tInt_Probe_5\tDouble_Probe_1\tDouble_Probe_2\tDouble_Probe_3\tDouble_Probe_4\tDouble_Probe_5\n");
-  
-  ae_list_node<ae_individual*>* indiv_node  = _exp_m->get_indivs()->get_first();
-  ae_individual*  indiv       = NULL;
-  
-  int32_t* int_probes;
-  double* double_probes;
-  int32_t index;
-
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-    index = indiv->get_id();
-    int_probes    = indiv->get_int_probes();
-    double_probes = indiv->get_double_probes();
-    
-    fprintf(current_file,"%"PRId32, index);
-    for(int16_t i = 0; i < 5; i++)
-    {
-      fprintf(current_file,"\t%"PRId32,int_probes[i]);
-    }
-    for(int16_t i = 0; i < 5; i++)
-    {
-      fprintf(current_file,"\t%f",double_probes[i]);
-    }
-    fprintf(current_file,"\n");
-    
-    indiv_node = indiv_node->get_next();
-  }
-  
-  fflush( current_file );
-  fclose( current_file );
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_enums.h b/src/libaevol/ae_enums.h
index 1759552..251fa74 100644
--- a/src/libaevol/ae_enums.h
+++ b/src/libaevol/ae_enums.h
@@ -3,39 +3,39 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
 
-#ifndef __AE_ENUMS_H__
-#define __AE_ENUMS_H__
+#ifndef AEVOL_ENUMS_H_
+#define AEVOL_ENUMS_H_
 
-enum ae_align_fun_shape
-{
+namespace aevol {
+
+enum AlignmentFunctionShape {
   LINEAR  = 0,
   SIGMOID = 1
 };
 
-enum ae_env_axis_feature
-{
+enum PhenotypicFeature {
   NEUTRAL     = 0,
   METABOLISM  = 1,
   SECRETION   = 2,
@@ -43,65 +43,66 @@ enum ae_env_axis_feature
   RECIPIENT   = 4
 };
 
-#define NB_FEATURES 5 // This is used to know how many possible features exist to make them easy to parse.
+// This is used to know how many possible features exist to make them easy to
+// parse
+// TODO <david.parsons at inria.fr> This is bad !!!
+#define NB_FEATURES 5
 
-enum ae_env_var
-{
+enum PhenotypicTargetVariationMethod {
   NO_VAR                    = 0,
   AUTOREGRESSIVE_MEAN_VAR   = 1,
   AUTOREGRESSIVE_HEIGHT_VAR = 2,
-  LOCAL_GAUSSIANS_VAR       = 3
+  LOCAL_GAUSSIANS_VAR       = 3,
+  SWITCH_IN_A_LIST          = 4
 };
 
-enum ae_env_noise
-{
+enum PhenotypicTargetNoiseMethod {
   NO_NOISE  = 0,
   FRACTAL   = 1
 };
 
-enum ae_init_method
-{
+enum GenomeInitializationMethod {
   ONE_GOOD_GENE   = 0x01,
   CLONE           = 0x02,
   WITH_INS_SEQ    = 0x04
 };
 
-enum ae_sense
-{
+enum AlignmentSense {
   DIRECT      = 0,
   INDIRECT    = 1,
   BOTH_SENSES = 2
 };
-  
-enum ae_selection_scheme
-{
+
+enum SelectionScheme {
   RANK_LINEAR           = 0,
   RANK_EXPONENTIAL      = 1,
   FITNESS_PROPORTIONATE = 2,
   FITTEST               = 3
 };
 
-enum ae_strand
-{
-  LEADING = 0,
-  LAGGING = 1
-};
-  
-enum ae_tree_mode
-{
-  LIGHT   = 0,
-  NORMAL  = 1
-};
-
-enum ae_log_type
-{
+enum LogType {
   LOG_TRANSFER  = 0x01,
   LOG_REAR      = 0x02,
   LOG_BARRIER   = 0x04,
-  //LOG_LOADS     = 0x08
+  LOG_LOADS     = 0x08
 };
 
+enum Strand {
+  LEADING = 0,
+  LAGGING = 1
+};
+
+constexpr const char* StrandName[] = {
+  "LEADING",
+  "LAGGING"
+};
 
+enum Position {
+  BEFORE,
+  BETWEEN,
+  AFTER
+};
 
+} // namespace aevol
 
-#endif // __AE_ENUMS_H__
+#endif // AEVOL_ENUMS_H_
diff --git a/src/libaevol/ae_environment.cpp b/src/libaevol/ae_environment.cpp
deleted file mode 100644
index 0ae1dae..0000000
--- a/src/libaevol/ae_environment.cpp
+++ /dev/null
@@ -1,835 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_environment.h>
-#include <ae_point_2d.h>
-#include <ae_gaussian.h>
-#include <ae_list.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                            Class ae_environment                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_environment::ae_environment( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  // Environment "shape"
-  _initial_gaussians  = NULL;
-  _gaussians          = NULL;
-  _sampling           = 0;
-  _custom_points      = NULL;
-  
-  _total_area = 0.0;
-  
-  // Environment segmentation
-  _nb_segments      = 1;
-  _segments         = new ae_env_segment* [1];
-  _segments[0]      = new ae_env_segment( X_MIN, X_MAX, METABOLISM );
-  _area_by_feature  = new double [NB_FEATURES];
-  
-  // Variation management
-  _var_prng   = NULL;
-  _var_method = NO_VAR;  
-  _var_sigma  = 0.0;
-  _var_tau    = 0;
-  
-  // Noise management
-  _cur_noise          = NULL;
-  _noise_method       = NO_NOISE;
-  _noise_prng         = NULL;
-  _noise_prob         = 0.0;
-  _noise_alpha        = 0.0;
-  _noise_sigma        = 0.0;
-  _noise_sampling_log = 8;
-}
-
-
-
-ae_environment::ae_environment( const ae_environment &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set(model)
-#elif defined __X11
-  ae_fuzzy_set_X11(model)
-#else
-#error You must specify a graphic option
-#endif
-{
-   // Environment "shape"
-  _sampling           = model._sampling;
-
-  if (model._initial_gaussians == NULL) { _initial_gaussians  = NULL; }
-  else
-    {
-      _initial_gaussians = new ae_list<ae_gaussian *>;
-      ae_list_node<ae_gaussian *> * node = model._initial_gaussians->get_first();
-      ae_gaussian * gaussian = NULL;
-      while (node != NULL)
-        {
-          gaussian = node->get_obj();
-          _initial_gaussians->add( new ae_gaussian(*gaussian));
-          node = node->get_next();
-        }
-    }
-
-  if (model._gaussians == NULL) { _gaussians  = NULL; }
-  else
-    {
-      _gaussians = new ae_list<ae_gaussian *>;
-      ae_list_node<ae_gaussian *> * node = model._gaussians->get_first();
-      ae_gaussian * gaussian = NULL;
-      while (node != NULL)
-        {
-          gaussian = node->get_obj();
-          _gaussians->add( new ae_gaussian(*gaussian));
-          node = node->get_next();
-        }
-    }
-
-
-  if (model._custom_points == NULL) { _custom_points  = NULL; }
-  else
-    {
-      _custom_points = new ae_list<ae_point_2d *>;
-      ae_list_node<ae_point_2d *> * node = model._custom_points->get_first();
-      ae_point_2d * point = NULL;
-      while (node != NULL)
-        {
-          point = node->get_obj();
-          _custom_points->add( new ae_point_2d(*point));
-          node = node->get_next();
-        }
-    }
-  
-  _total_area = model._total_area;
-  
-  // Environment segmentation
-  _nb_segments      = model._nb_segments;
-
-  if (_nb_segments == 0) { _segments = NULL; }
-  else 
-    {
-      _segments = new ae_env_segment* [_nb_segments];
-      for(int32_t i = 0; i < _nb_segments; i++)
-        {
-          _segments[i] = new ae_env_segment( *(model._segments[i]) );
-        }
-    }
-
-  _area_by_feature  = new double [NB_FEATURES];
-  for (int32_t i = 0; i < NB_FEATURES; i++)
-    {
-      _area_by_feature[i] = model._area_by_feature[i];
-    }
-
-
-  // Variation management
-  _var_method = model._var_method; 
-  if (model._var_prng == NULL) { _var_prng = NULL; }
-  else  { _var_prng   = new ae_jumping_mt( *(model._var_prng) ); }
-  _var_sigma  = model._var_sigma;
-  _var_tau    = model._var_tau;
-  
-  // Noise management
-  _noise_method       = model._noise_method;
-  if (model._cur_noise == NULL) { _cur_noise = NULL; }
-  else { _cur_noise = new ae_fuzzy_set( *(model._cur_noise) ); }
-  if (model._noise_prng == NULL) { _noise_prng = NULL; }
-  else  { _noise_prng   = new ae_jumping_mt( *(model._noise_prng) ); }
-  _noise_prob         = model._noise_prob;
-  _noise_alpha        = model._noise_alpha;
-  _noise_sigma        = model._noise_sigma;
-  _noise_sampling_log = model._noise_sampling_log;
-
-
-};
-
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_environment::~ae_environment( void )
-{
-  if ( _gaussians != NULL )
-  {
-    _gaussians->erase( true );
-    delete _gaussians;
-  }
-  
-  if ( _initial_gaussians != NULL )
-  {
-    _initial_gaussians->erase( true );
-    delete _initial_gaussians;
-  }
-  
-  if ( _custom_points != NULL )
-  {
-    _custom_points->erase( true );
-    delete _custom_points;
-  }
-  
-  if (_var_prng != NULL)   delete _var_prng;
-  if (_noise_prng != NULL) delete _noise_prng;
-  
-  if ( _segments != NULL )
-  {
-    for ( int16_t i = 0 ; i < _nb_segments; i++ )
-    {
-      delete _segments[i];
-    }
-    
-    delete [] _segments;
-  }
-  
-  delete [] _area_by_feature;
-  
-  delete _cur_noise;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_environment::save( gzFile backup_file ) const
-{
-  // ---------------------
-  //  Write gaussians
-  // ---------------------
-  int16_t nb_gaussians = ( _gaussians == NULL ) ? 0 : _gaussians->get_nb_elts();
-  gzwrite( backup_file, &nb_gaussians, sizeof(nb_gaussians) );
-  
-  if ( _gaussians != NULL )
-  {
-    ae_list_node<ae_gaussian*>* gaussian_node = _gaussians->get_first();
-    ae_gaussian*  gaussian;
-    for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-    {
-      gaussian = gaussian_node->get_obj();
-      
-      gaussian->save( backup_file );
-      
-      gaussian_node = gaussian_node->get_next();
-    }
-  }
-  
-  // ---------------------
-  //  Write sampling
-  // ---------------------
-  gzwrite( backup_file, &_sampling, sizeof(_sampling) );
-  
-  // ---------------------
-  //  Write custom points
-  // ---------------------
-  int16_t nb_custom_points = (_custom_points == NULL) ? 0 : _custom_points->get_nb_elts();
-  gzwrite( backup_file, &nb_custom_points, sizeof(nb_custom_points) );
-  
-  if ( _custom_points != NULL )
-  {
-    ae_list_node<ae_point_2d*>* custom_point_node = _custom_points->get_first();
-    ae_point_2d*  custom_point;
-    for ( int16_t i = 0 ; i < nb_custom_points ; i++ )
-    {
-      custom_point = custom_point_node->get_obj();
-      
-      custom_point->save( backup_file );
-      
-      custom_point_node = custom_point_node->get_next();
-    }
-  }
-  
-  // -------------------------------
-  //  Write x-axis segmentation
-  // -------------------------------
-  gzwrite( backup_file, &_nb_segments, sizeof(_nb_segments) );
-  
-  for ( int16_t i = 0 ; i < _nb_segments; i++ )
-  {
-    _segments[i]->save( backup_file );
-  }
-
-  
-  // -----------------------------------
-  //  Write environmental variation data
-  // -----------------------------------
-  int8_t tmp_var_method = _var_method;
-  gzwrite( backup_file, &tmp_var_method,  sizeof(tmp_var_method) );
-  
-  if ( _var_method != NO_VAR )
-  {
-    _var_prng->save( backup_file );
-    gzwrite( backup_file, &_var_sigma, sizeof(_var_sigma) );
-    gzwrite( backup_file, &_var_tau,   sizeof(_var_tau)   );
-  }
-  
-  // ---------------------
-  //  Write noise data
-  // ---------------------
-  int8_t tmp_noise_method = _noise_method;
-  gzwrite( backup_file, &tmp_noise_method, sizeof(tmp_noise_method) );
-  
-  if ( _noise_method != NO_NOISE )
-  {
-    int8_t tmp_save_cur_noise = ( _cur_noise != NULL );
-    gzwrite( backup_file, &tmp_save_cur_noise,  sizeof(tmp_save_cur_noise) );
-    if ( tmp_save_cur_noise ) _cur_noise->save( backup_file );
-    
-    _noise_prng->save( backup_file );
-    gzwrite( backup_file, &_noise_alpha,  sizeof(_noise_alpha) );
-    gzwrite( backup_file, &_noise_sigma,  sizeof(_noise_sigma) );
-    gzwrite( backup_file, &_noise_prob,   sizeof(_noise_prob) );
-    gzwrite( backup_file, &_noise_sampling_log, sizeof(_noise_sampling_log) );
-  }
-  
-  // ---------------------------------------------------------------
-  //  If needed, keep a copy of the initial state of the gaussians
-  // ---------------------------------------------------------------
-  if ( _var_method != NO_VAR || is_noise_allowed() )
-  {
-    int16_t nb_gaussians = ( _initial_gaussians == NULL ) ? 0 : _initial_gaussians->get_nb_elts();
-    gzwrite( backup_file, &nb_gaussians, sizeof(nb_gaussians) );
-    
-    if ( _initial_gaussians != NULL )
-    {
-      ae_list_node<ae_gaussian*>* gaussian_node = _initial_gaussians->get_first();
-      ae_gaussian*  gaussian;
-      for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-      {
-        gaussian = gaussian_node->get_obj();
-        
-        gaussian->save( backup_file );
-        
-        gaussian_node = gaussian_node->get_next();
-      }
-    }
-  }
-}
-
-void ae_environment::load( gzFile backup_file )
-{
-  // ---------------------
-  //  Retreive gaussians
-  // ---------------------
-  int16_t nb_gaussians;
-  gzread( backup_file, &nb_gaussians, sizeof(nb_gaussians) );
-  if ( nb_gaussians > 0 ) _gaussians = new ae_list<ae_gaussian*>();
-  for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-  {
-    _gaussians->add( new ae_gaussian( backup_file ) );
-  }
-  
-
-  // ------------------------------
-  //  Retrieve sampling
-  // ------------------------------
-  gzread( backup_file, &_sampling, sizeof(_sampling) );
-  
-  
-  // -------------------------
-  //  Retreive custom points
-  // -------------------------
-  int16_t nb_custom_points;
-  gzread( backup_file, &nb_custom_points, sizeof(nb_custom_points) );
-  if ( nb_custom_points > 0 ) _custom_points = new ae_list<ae_point_2d*>();
-  for ( int16_t i = 0 ; i < nb_custom_points ; i++ )
-  {
-    _custom_points->add( new ae_point_2d( backup_file ) );
-  }
-  
-  
-  // -------------------------------
-  //  Retrieve x-axis segmentation
-  // -------------------------------
-  // Delete old data
-  for ( int16_t i = 0 ; i < _nb_segments ; i++ )
-  {
-    delete _segments[i];
-  }
-  delete [] _segments;
-  
-  
-  // Replace by data from the backup
-  gzread( backup_file, &_nb_segments, sizeof(_nb_segments) );
-  
-  _segments = new ae_env_segment* [_nb_segments];
-  
-  for ( int16_t i = 0 ; i < _nb_segments; i++ )
-  {
-    _segments[i] = new ae_env_segment( backup_file );
-    //~ _segments[i] = new ae_env_segment(  ae_common::init_params->get_env_axis_segment_boundaries()[i], 
-                                        //~ ae_common::init_params->get_env_axis_segment_boundaries()[i+1], 
-                                        //~ ae_common::init_params->get_env_axis_features()[i] );
-  }
-  
-  
-  // ----------------------------------------
-  //  Retrieve environmental variation data
-  // ----------------------------------------
-  int8_t tmp_var_method;
-  gzread( backup_file, &tmp_var_method, sizeof(tmp_var_method) );
-  _var_method = (ae_env_var) tmp_var_method;
-  
-  if ( _var_method != NO_VAR )
-  {
-    _var_prng = new ae_jumping_mt( backup_file );
-    gzread( backup_file, &_var_sigma, sizeof(_var_sigma) );  
-    gzread( backup_file, &_var_tau,   sizeof(_var_tau) );
-  }
-  
-  
-  // ------------------------------------
-  //  Retrieve environmental noise data
-  // ------------------------------------);
-  int8_t tmp_noise_method;
-  gzread( backup_file, &tmp_noise_method, sizeof(tmp_noise_method) );
-  _noise_method = (ae_env_noise) tmp_noise_method;
-  
-  if ( _noise_method != NO_NOISE )
-  {
-    int8_t tmp_cur_noise_saved;
-    gzread( backup_file, &tmp_cur_noise_saved,  sizeof(tmp_cur_noise_saved) );
-    if ( tmp_cur_noise_saved )
-    {
-      _cur_noise  = new ae_fuzzy_set( backup_file );
-    }
-    
-    _noise_prng = new ae_jumping_mt( backup_file );
-    gzread( backup_file, &_noise_alpha, sizeof(_noise_alpha) );
-    gzread( backup_file, &_noise_sigma, sizeof(_noise_sigma) );
-    gzread( backup_file, &_noise_prob,  sizeof(_noise_prob)  );
-    gzread( backup_file, &_noise_sampling_log, sizeof(_noise_sampling_log) );
-  }
-  
-  
-  // --------------------------------------------------------------------
-  //  If needed, retreive the copy of the initial state of the gaussians
-  // --------------------------------------------------------------------
-  if ( _var_method != NO_VAR || is_noise_allowed() )
-  {
-    int16_t nb_gaussians;
-    gzread( backup_file, &nb_gaussians, sizeof(nb_gaussians) );
-    if ( nb_gaussians > 0 ) _initial_gaussians = new ae_list<ae_gaussian*>();
-    for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-    {
-      _initial_gaussians->add( new ae_gaussian( backup_file ) );
-    }
-  }
-  
-  // ------------------------------
-  //  Build
-  // ------------------------------
-  build();
-}
-
-void ae_environment::add_gaussian( double a, double b, double c )
-{
-  _gaussians->add( new ae_gaussian( a, b, c ) );
-}
-
-void ae_environment::add_initial_gaussian( double a, double b, double c )
-{
-  _initial_gaussians->add( new ae_gaussian( a, b, c ) );
-}
-
-
-void ae_environment::add_custom_point( double x, double y )
-{
-  _custom_points->add(new ae_point_2d(x, y));
-}
-
-void ae_environment::build( void )
-{
-
-  // NB : Extreme points (at abscissa MIN_X and MAX_X) will be generated, we need to erase the list first
-  _points->erase( true );
-      
-
-  // ----------------------------------------
-  // 1) Generate sample points from gaussians
-  // ----------------------------------------
-
-  if ( _gaussians != NULL)
-    {
-   
-  
-      ae_list_node<ae_gaussian*>* node = NULL;
-  
-      for ( int16_t i = 0 ; i <= _sampling ; i++ )
-        {
-          ae_point_2d* new_point = new ae_point_2d( X_MIN + (double)i * (X_MAX - X_MIN) / (double)_sampling, 0.0 );
-          node = _gaussians->get_first();
-    
-          while ( node )
-            {
-              new_point->y += node->get_obj()->compute_y( new_point->x );
-      
-              node = node->get_next();
-            }
-    
-          _points->add( new_point );
-        }
-    }
-  
-
-  // --------------------
-  // 2) Add custom points
-  // --------------------
- 
-  if ( _custom_points != NULL)
-    {
-      ae_list_node<ae_point_2d*>* pt_node = _custom_points->get_first();
-      ae_point_2d *custom_point = pt_node->get_obj();
-      ae_point_2d *new_point;
-      
-      if ( custom_point->x > X_MIN)
-        {
-          // Add the point (X_MIN, Y_MIN) in front of the list of points
-          new_point = new ae_point_2d( X_MIN, Y_MIN );
-          _points->add_front( new_point );
-        }
-              
-      while ( pt_node != NULL )
-        {
-          custom_point = pt_node->get_obj();
-          new_point = new ae_point_2d( *custom_point );
-          _points->add( new_point );
-          pt_node = pt_node->get_next();
-        }
-      
-      if ( custom_point->x < X_MAX )
-        {
-          // Add the point (X_MAX, Y_MIN) at the end of the list of points
-          new_point = new ae_point_2d( X_MAX, Y_MIN );
-          _points->add( new_point );  
-        }
-    }
-  
-
-  // ---------------------------------------
-  // 3) Simplify (get rid of useless points)
-  // ---------------------------------------
-  add_lower_bound( Y_MIN );
-  add_upper_bound( Y_MAX );
-  simplify();
-  
-  
-  // ---------------------------------------
-  // 4) Compute areas (total and by feature)
-  // ---------------------------------------
-  _compute_area();
-  
-  
-  // -------------------------------------------------------------------
-  //  5) If needed, create a copy of the initial state of the gaussians
-  // -------------------------------------------------------------------
-  if ( _initial_gaussians == NULL && (_var_method != NO_VAR || is_noise_allowed()) )
-  {
-    _initial_gaussians = new ae_list<ae_gaussian*>();
-    
-    int32_t nb_gaussians = _gaussians->get_nb_elts();
-    ae_list_node<ae_gaussian*>* gaussian_node = _gaussians->get_first();
-    ae_gaussian*  gaussian      = NULL;
-    for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-    {
-      gaussian = gaussian_node->get_obj();
-      
-      _initial_gaussians->add( new ae_gaussian( *gaussian ) );
-      
-      gaussian_node = gaussian_node->get_next();
-    }
-  }
-}
-
-/*!
-  Apply a gaussian noise to the set of points with a variance sigma and a coefficient alpha :
- 
-    alpha = [ -1.0 ------------------ 0.0 -------------------- 1.0 ]
-           white noise          uniform fractal             unique draw
-                                     noise
- */
-void ae_environment::apply_noise( void )
-{
-  if ( _noise_method != NO_NOISE && _noise_prng->random() < _noise_prob && _noise_sampling_log > 0 )
-  {
-    // =====================================================================================
-    // Compute a fractal noise in a new fuzzy set and apply it to the (unnoised) environment
-    // =====================================================================================
-    
-    
-    // Clear previous noise (get an unnoised state of th ecurrent environment)
-    build();
-    
-    // Initialize the cur_noise (current noise) fuzzy set to a set of points with y=0
-    // The number of points is determined by _noise_sampling_log (2^_noise_sampling_log)
-    if ( _cur_noise == NULL )
-    {
-      _cur_noise = new ae_fuzzy_set();
-      
-      // Add points to reflect the sampling
-      int32_t nb_points = 1 << (_noise_sampling_log - 1);
-      double interval = (X_MAX - X_MIN) / (nb_points - 1);
-      double half_interval = interval / 2;
-      double cur_x = interval;
-      while ( cur_x - X_MAX < -half_interval ) // while (cur_x < X_MAX) but precision-problems-proof
-      {
-				printf("infinite loop\n");
-        _cur_noise->create_interpolated_point( cur_x );
-        cur_x += interval;
-      }
-    }
-    else // _cur_noise has already been created -> reinitialize all its points to 0
-    {
-      ae_list_node<ae_point_2d*>* point_node  = _cur_noise->get_points()->get_first();
-      while ( point_node != NULL )
-      {
-        point_node->get_obj()->y = 0;
-        
-        point_node = point_node->get_next();
-      }
-    }
-    
-    
-    // Compute a fractal noise:
-    // Add a random noise to the whole fuzzy set, then cut it in 2 and add 
-    // another noise to each half and so on (apply noise to the 4 quarters...)
-    // until each zone contains only one single point.
-    int8_t fractal_step = 0;
-    while ( fractal_step < _noise_sampling_log )
-    {
-      int32_t num_zone;
-      int32_t nb_zones = 1 << fractal_step;
-      int32_t nb_points_in_each_zone = _cur_noise->get_points()->get_nb_elts() / nb_zones;
-      
-      // Compute current noise intensity
-      // We first test the trivial (most common) cases, then the general (positive or negative) cases
-      double noise_intensity;
-      if (_noise_alpha == 0.0)
-      {
-        noise_intensity = _noise_sigma;
-      }
-      //~ else if (_noise_alpha == 1.0)
-      //~ {
-        //~ noise_intensity = _noise_sigma * ( 1 << (fractal_step - 1) );
-      //~ }
-      //~ else if (_noise_alpha == -1.0)
-      //~ {
-        //~ noise_intensity = _noise_sigma * ( 1 << (_noise_sampling_log - fractal_step - 1) );
-      //~ }
-      else if ( _noise_alpha > 0.0 )
-      {
-        noise_intensity = _noise_sigma * pow( 1.0 - _noise_alpha, fractal_step );
-      }
-      else // ( _noise_alpha < 0.0 )
-      {
-        noise_intensity = _noise_sigma * pow( 1.0 + _noise_alpha, _noise_sampling_log - fractal_step );
-      }
-      //~ printf( "_noise_sigma %e\tfractal_step : %"PRId8"\tnoise_intensity : %e\n", _noise_sigma, fractal_step, noise_intensity );
-      
-      // For each zone in the current fractal step, compute a random noise to
-      // be applied to all the points in the zone
-      double* noise_component = new double[nb_zones];
-      for ( num_zone = 0 ; num_zone < nb_zones ; num_zone++ )
-      {
-        // Compute noise component for the current region
-        noise_component[num_zone] = _noise_prng->gaussian_random() * noise_intensity;
-      }
-      
-      // For each point in the noise fuzzy set, apply the noise computed for the corresponding zone
-      ae_list_node<ae_point_2d*>* point_node  = _cur_noise->get_points()->get_first();
-      ae_point_2d*  point       = NULL;
-      int32_t       point_index = 0;
-      while ( point_node != NULL )
-      {
-        point = point_node->get_obj();
-        
-        num_zone = floor( point_index++ / nb_points_in_each_zone );
-        point->y += noise_component[num_zone];
-        
-        point_node = point_node->get_next();
-      }
-      delete noise_component;
-      
-      fractal_step++;
-    }
-    
-    
-    // <DEBUG>
-    //~ ae_list_node* point_node  = _cur_noise->get_points()->get_first();
-    //~ ae_point_2d*  point       = NULL;
-    //~ while ( point_node != NULL )
-    //~ {
-      //~ point = point_node->get_obj();
-      
-      //~ printf( "  x: %f\ty: %e\n", point->x, point->y );
-      
-      //~ point_node = point_node->get_next();
-    //~ }
-    // </DEBUG>
-    
-    
-    // Apply the fractal noise to the environment
-    this->add( _cur_noise );
-    
-    // Bind Y values in [Y_MIN, Y_MAX]
-    add_lower_bound( Y_MIN );
-    add_upper_bound( Y_MAX );
-  
-    // Environment has changed, recompute its area
-    _compute_area();
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_environment::_apply_autoregressive_mean_variation( void )
-{
-  // For each gaussian : 
-  // current_mean = ref_mean + delta_m, where
-  // delta_m follows an autoregressive stochastic process
-  // with the parameters _var_sigma and _var_tau
-  
-  int16_t nb_gaussians = _gaussians->get_nb_elts();
-  
-  ae_list_node<ae_gaussian*>* gaussian_node = _gaussians->get_first();
-  ae_gaussian* gaussian;
-  ae_list_node<ae_gaussian*>* ref_gaussian_node = _initial_gaussians->get_first();
-  ae_gaussian* ref_gaussian;
-  for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-  {
-    gaussian      = gaussian_node->get_obj();
-    ref_gaussian  = ref_gaussian_node->get_obj();
-    
-    // Find the current delta_mean = current_mean - ref_mean
-    double delta_mean = gaussian->get_mean() - ref_gaussian->get_mean();
-    //double delta_height = gaussian->get_height() - ref_gaussian->get_height();
-
-    // Compute the next value :
-    // Dm(t+1) = Dm(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random()
-    delta_mean =  delta_mean * (1.0 - 1.0/_var_tau) + (_var_sigma/_var_tau) * sqrt(2*_var_tau- 1.0) * _var_prng->gaussian_random();
-    //delta_height =  delta_height * (1.0 - 1.0/_var_tau) + (_var_sigma/_var_tau) * sqrt(2*_var_tau- 1.0) * _var_prng->gaussian_random();
-
-    // Deduce the new value of the mean : ref_mean + delta_m
-    gaussian->set_mean( ref_gaussian->get_mean() + delta_mean );
-    //gaussian->set_height( ref_gaussian->get_height() + delta_height );
-    
-    gaussian_node = gaussian_node->get_next();
-    ref_gaussian_node = ref_gaussian_node->get_next();
-  }
-
-  build();
-}
-
-
-void ae_environment::_apply_autoregressive_height_variation( void )
-{
-  // For each gaussian : 
-  // current_height = ref_height + delta_h, where
-  // delta_m follows an autoregressive stochastic process
-  // with the parameters _var_sigma and _var_tau
-  
-  int16_t nb_gaussians = _gaussians->get_nb_elts();
-  
-  ae_list_node<ae_gaussian*>* gaussian_node = _gaussians->get_first();
-  ae_gaussian* gaussian;
-  ae_list_node<ae_gaussian*>* ref_gaussian_node = _initial_gaussians->get_first();
-  ae_gaussian* ref_gaussian;
-  for ( int16_t i = 0 ; i < nb_gaussians ; i++ )
-  {
-    gaussian      = gaussian_node->get_obj();
-    ref_gaussian  = ref_gaussian_node->get_obj();
-    
-    // Find the current delta_height = current_height - ref_height
-    double delta_height = gaussian->get_height() - ref_gaussian->get_height();
-
-    // Compute the next value :
-    // Dh(t+1) = Dh(t)*(1-1/tau) + ssd/tau*sqrt(2*tau-1)*normal_random()
-    delta_height =  delta_height * (1.0 - 1.0/_var_tau) + (_var_sigma/_var_tau) * sqrt(2*_var_tau- 1.0) * _var_prng->gaussian_random();
-
-    // Deduce the new value of the height : ref_height + delta_h
-    gaussian->set_height( ref_gaussian->get_height() + delta_height );
-    
-    gaussian_node = gaussian_node->get_next();
-    ref_gaussian_node = ref_gaussian_node->get_next();
-  }
-
-  build();
-}
-
-void ae_environment::_apply_local_gaussian_variation( void )
-{
-  printf( "ERROR, _apply_local_gaussian_variation has not yet been implemented. in file %s:%d\n", __FILE__, __LINE__ );
-  exit( EXIT_FAILURE );
-}
-
-void ae_environment::_compute_area( void )
-{
-  _total_area = 0.0;
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _area_by_feature[i] = 0.0;
-  }
-
-  // TODO : We should take into account that we compute the areas in a specific order (from the leftmost segment, rightwards)
-  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have 
-  //      already been through them!)
-  for ( int16_t i = 0 ; i < _nb_segments ; i++ )
-  {
-    _area_by_feature[_segments[i]->feature] += get_geometric_area( _segments[i]->start, _segments[i]->stop );
-    _total_area += _area_by_feature[_segments[i]->feature];
-  }
-}
-
diff --git a/src/libaevol/ae_environment.h b/src/libaevol/ae_environment.h
deleted file mode 100644
index 9af5c47..0000000
--- a/src/libaevol/ae_environment.h
+++ /dev/null
@@ -1,439 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef  __AE_ENVIRONMENT_H__
-#define  __AE_ENVIRONMENT_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_env_segment.h>
-#include <ae_jumping_mt.h>
-#include <ae_fuzzy_set.h>
-#include <ae_gaussian.h>
-#ifdef __X11
-  #include <ae_fuzzy_set_X11.h>
-#endif
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-
-#ifdef __NO_X
-class ae_environment : public ae_fuzzy_set
-#elif defined __X11
-class ae_environment : public ae_fuzzy_set_X11
-#else
-#error You must specify a graphic option
-#endif
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_environment( void );
-    ae_environment( const ae_environment &model );
-    ae_environment( gzFile backup_file );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_environment( void );
-
-    // =================================================================
-    //                         Accessors: getters
-    // =================================================================
-    inline ae_list<ae_gaussian*>* get_gaussians( void ) const;
-    inline ae_list<ae_point_2d*>* get_custom_points( void ) const;
-    inline double               get_total_area( void ) const;
-    inline int16_t              get_nb_segments( void ) const;
-    inline ae_env_segment**     get_segments( void ) const;
-    inline double               get_segment_boundaries( int16_t i ) const;
-    inline ae_env_axis_feature  get_axis_feature( int16_t i ) const;
-    inline double               get_area_by_feature( int8_t feature ) const;
-    inline ae_env_var           get_var_method( void ) const;
-    inline double               get_var_sigma( void )  const;
-    inline int32_t              get_var_tau( void )    const;
-    inline ae_env_noise         get_noise_method( void ) const;
-    inline bool                 is_noise_allowed( void ) const;
-    
-    // =================================================================
-    //                         Accessors: setters
-    // =================================================================
-    inline void   set_gaussians( ae_list<ae_gaussian*>* gaussians );
-    inline void   set_custom_points( ae_list<ae_point_2d*>* custom_points );
-    inline void   set_sampling( int16_t val );
-    inline void   set_segmentation( int16_t nb_segments, double* boundaries, ae_env_axis_feature* features, bool separate_segments = false );
-    inline void   set_var_method( ae_env_var var_method );
-    inline void   set_var_prng( ae_jumping_mt* prng );
-    inline void   set_var_sigma( double sigma );
-    inline void   set_var_tau( int32_t tau );
-    inline void   set_var_sigma_tau( double sigma, int32_t tau );
-    inline void   set_noise_method( ae_env_noise noise_method );
-    inline void   set_noise_prng( ae_jumping_mt* prng );
-    inline void   set_noise_sigma( double sigma );
-    inline void   set_noise_alpha( double alpha );
-    inline void   set_noise_prob( double prob );
-    inline void   set_noise_sampling_log( int32_t sampling_log );
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void save( gzFile backup_file ) const;
-    void load( gzFile backup_file );
-
-    void add_custom_point( double x, double y );
-    void add_gaussian( double a, double b, double c );
-    void add_initial_gaussian( double a, double b, double c );
-    void build( void );
-    inline void clear_initial_gaussians( void );
-    inline void clear_gaussians( void );
-    inline void clear_custom_points( void );
-    
-    inline void apply_variation( void );
-    void apply_noise( void );
-
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    //~ ae_environment( void )
-    //~ {
-      //~ printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-  
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void _apply_autoregressive_mean_variation( void );
-    void _apply_autoregressive_height_variation( void );
-    void _apply_local_gaussian_variation( void );
-    void _compute_area( void );
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_list<ae_gaussian*>*  _initial_gaussians; // List containing all the gaussians of the environment in their initial state
-    ae_list<ae_gaussian*>*  _gaussians;         // List containing all the gaussians of the environment
-    int16_t   _sampling;                        // Number of points to be generated from the gaussians.
-    ae_list<ae_point_2d*>*  _custom_points;     // List containing all the custom points of the environment.
-                                                // This can not be used in conjunction with gaussians.
-    
-    int16_t           _nb_segments;
-    ae_env_segment**  _segments; // Ordered table of segments.
-                                 // Each ae_env_segment knows its boundaries and corresponding feature.
-                                 // When the environment is not segmented, this table contains a single
-                                 // segment with feature METABOLIC and boundaries MIN_X and MAX_X
-
-    double  _total_area;      // Geometric area of the whole function
-    double* _area_by_feature; // Geometric area of each feature
-    
-    // Variation management (compatible only with gaussians, not with custom points)
-    ae_env_var      _var_method;  // Variation method
-    ae_jumping_mt*  _var_prng;    // PRNG used for variation
-    double          _var_sigma;   // Autoregressive mean variation sigma parameter
-    int32_t         _var_tau;     // Autoregressive mean variation tau parameter
-    
-    // Noise management
-    ae_fuzzy_set*   _cur_noise;           // Current noise (pure noise that is added to the environment fuzzy set)
-    ae_jumping_mt*  _noise_prng;          // PRNG used for noise
-    ae_env_noise    _noise_method;        // Probability of variation.
-    double          _noise_alpha;         // Alpha value (variance coefficient)
-    double          _noise_sigma;         // Variance of the noise
-    double          _noise_prob;          // Probability of variation.
-    int32_t         _noise_sampling_log;  // Log2 of the number of points in the noise fuzzy_set
-};
-
-
-// =====================================================================
-//                          Getters' definitions
-// =====================================================================
-inline int16_t ae_environment::get_nb_segments( void ) const
-{
-  return _nb_segments;
-}
-
-inline ae_list<ae_gaussian*>* ae_environment::get_gaussians( void ) const
-{
-  return _gaussians;
-}
-
-inline ae_list<ae_point_2d*>* ae_environment::get_custom_points( void ) const
-{
-  return _custom_points;
-}
-
-
-inline ae_env_segment** ae_environment::get_segments( void ) const
-{
-  return _segments;
-}
-
-inline double ae_environment::get_segment_boundaries( int16_t i ) const
-{
-  assert( i <= _nb_segments );
-  
-  if ( i == _nb_segments ) return _segments[i-1]->stop;
-  else return _segments[i]->start;
-}
-
-inline ae_env_axis_feature ae_environment::get_axis_feature( int16_t i ) const
-{
-  assert( i < _nb_segments );
-  
-  return _segments[i]->feature;
-}
-
-inline double ae_environment::get_area_by_feature( int8_t feature ) const
-{
-  return _area_by_feature[ feature ];
-}
-
-inline double ae_environment::get_total_area( void ) const
-{
-  return _total_area;
-}
-
-inline ae_env_var ae_environment::get_var_method( void ) const
-{
-  return _var_method;
-}
-
-inline double ae_environment::get_var_sigma( void ) const
-{
-  return _var_sigma;
-}
-
-inline int32_t ae_environment::get_var_tau( void ) const
-{
-  return _var_tau;
-}
-
-inline ae_env_noise ae_environment::get_noise_method( void ) const
-{
-  return _noise_method;
-}
-
-inline bool ae_environment::is_noise_allowed( void ) const
-{
-  return ( _noise_method != NO_NOISE );
-}
-
-
-// =====================================================================
-//                          Setters' definitions
-// =====================================================================
-inline void ae_environment::set_gaussians( ae_list<ae_gaussian*>* gaussians )
-{
-  _gaussians = gaussians;
-}
-
-inline void ae_environment::set_custom_points( ae_list<ae_point_2d*>* custom_points )
-{
-  _custom_points = custom_points;
-}
-
-inline void ae_environment::set_sampling( int16_t val )
-{
-  _sampling = val;
-}
-
-
-inline void ae_environment::set_segmentation( int16_t nb_segments, double* boundaries, ae_env_axis_feature* features, bool separate_segments /*= false*/ )
-{
-  // Delete the data to be replaced
-  for ( int16_t i = 0 ; i < _nb_segments ; i++ )
-  {
-    delete _segments[i];
-  }
-  delete _segments;
-  
-  
-  // Now replace with the new data
-  _nb_segments  = nb_segments;
-  _segments     = new ae_env_segment* [_nb_segments];
-  
-  for ( int16_t i = 0 ; i < _nb_segments; i++ )
-  {
-    _segments[i] = new ae_env_segment( boundaries[i], boundaries[i+1], features[i] );
-  }
-  
-  
-  // TODO : Manage separate_segments
-}
-
-inline void ae_environment::set_var_method( ae_env_var var_method )
-{
-  _var_method = var_method;
-}
-
-inline void ae_environment::set_var_prng( ae_jumping_mt* prng )
-{
-  if (_var_prng != NULL) delete _var_prng;
-  _var_prng = prng;
-}
-
-inline void ae_environment::set_var_sigma( double sigma )
-{
-  _var_sigma = sigma;
-}
-
-inline void ae_environment::set_var_tau( int32_t tau )
-{
-  _var_tau = tau;
-}
-
-inline void ae_environment::set_var_sigma_tau( double sigma, int32_t tau )
-{
-  _var_sigma  = sigma;
-  _var_tau    = tau;
-}
-
-inline void ae_environment::set_noise_method( ae_env_noise noise_method )
-{
-  _noise_method = noise_method;
-}
-
-inline void ae_environment::set_noise_prng( ae_jumping_mt* prng )
-{
-  if( _noise_prng != NULL) delete _noise_prng;
-  _noise_prng = prng;
-}
-
-inline void ae_environment::set_noise_prob( double prob )
-{
-  _noise_prob = prob;
-}
-
-inline void ae_environment::set_noise_alpha( double alpha )
-{
-  _noise_alpha = alpha;
-}
-
-inline void ae_environment::set_noise_sigma( double sigma )
-{
-  _noise_sigma = sigma;
-}
-
-inline void ae_environment::set_noise_sampling_log( int32_t sampling_log )
-{
-  _noise_sampling_log = sampling_log;
-}
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_environment::clear_initial_gaussians( void )
-{
-  if (_initial_gaussians != NULL)
-  {
-    _initial_gaussians->erase(true);
-    delete _initial_gaussians;
-  }
-  _initial_gaussians=NULL;
-}
-
-inline void ae_environment::clear_gaussians( void )
-{
-  if (_gaussians != NULL)
-    {
-    _gaussians->erase(true);
-    delete _gaussians;
-    }
-  _gaussians = NULL;
-}
-
-inline void ae_environment::clear_custom_points( void )
-{
-  if (_custom_points != NULL)
-    {
-    _custom_points->erase(true);
-    delete _custom_points;
-    }
-  _custom_points = NULL;
-}
-
-
-inline void ae_environment::apply_variation( void )
-{
-  switch ( _var_method )
-  {
-    case NO_VAR :
-      return;
-    case AUTOREGRESSIVE_MEAN_VAR :
-      _apply_autoregressive_mean_variation();
-      break;
-    case AUTOREGRESSIVE_HEIGHT_VAR :
-      _apply_autoregressive_height_variation();
-      break;
-    case LOCAL_GAUSSIANS_VAR :
-      _apply_local_gaussian_variation();
-      break;
-    default :
-      printf( "ERROR : in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-  }
-  
-  // Environment has changed, recompute its area
-  _compute_area();
-}
-
-#endif // __AE_ENVIRONMENT_H__
diff --git a/src/libaevol/ae_exp_manager.cpp b/src/libaevol/ae_exp_manager.cpp
deleted file mode 100644
index 5a78e1e..0000000
--- a/src/libaevol/ae_exp_manager.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <err.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_manager.h>
-#include <ae_population.h>
-
-#ifdef __X11
-  #include <ae_population_X11.h>
-#endif
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_exp_manager                            #
-//                                                                             #
-//##############################################################################
-
-// ===========================================================================
-//                        Definition of static attributes
-// ===========================================================================
-
-// ===========================================================================
-//                                 Constructors
-// ===========================================================================
-ae_exp_manager::ae_exp_manager( void )
-{
-  // ------------------------------------------------------ Experimental setup
-  _exp_s = new ae_exp_setup( this );
-
-  // -------------------------------------------------------------- Population
-  #ifdef __X11
-    _pop = new ae_population_X11( this );
-  #else
-    _pop = new ae_population( this );
-  #endif
-
-  // ------------------------------------------------------------- Environment
-  _env = new ae_environment();
-
-  // ------------------------------------------------------- Spatial structure
-  _spatial_structure = NULL;
-
-  // ---------------------------------------------------------- Output manager
-  _output_m = new ae_output_manager( this );
-
-
-  // ---------------------------- Generation numbers (first, last and current)
-  _num_gener    = 0;
-  _first_gener  = 0;
-  _last_gener   = 0;
-
-
-  // ------------------------------------------------------------- Quit signal
-  _quit_signal_received = false;
-}
-
-// ===========================================================================
-//                                  Destructor
-// ===========================================================================
-ae_exp_manager::~ae_exp_manager( void )
-{
-  delete _pop;
-  delete _exp_s;
-  delete _output_m;
-  delete _env;
-  if ( _spatial_structure != NULL ){delete _spatial_structure;}
-}
-
-// ===========================================================================
-//                                 Public Methods
-// ===========================================================================
-/*!
-  \brief Save all the static data (the data that is constant throughout
-  a simulation)
-
-  Save
-    * The experimental setup
-    * The output profile
-
-  These are written in the current directory in gzipped binary files
-  as well as plain text files
-  This data should be saved once and for all when the experiment is created.
-  There is no need to save this data in the middle of a simulation since it
-  is constant throughout the experiment.
-
-  \see load( int32_t first_gener,
-             char* exp_setup_file_name,
-             char* out_prof_file_name,
-             char* env_file_name,
-             char* pop_file_name,
-             char* sel_file_name,
-             char* sp_struct_file_name,
-             bool verbose )
-  \see save( void )
-  \see save_copy( char* dir, int32_t num_gener )
-*/
-void ae_exp_manager::write_setup_files(void)
-{
-  // 1) Create missing directories
-  create_missing_directories();
-
-  // 2) Open setup files (experimental setup and output profile)
-  gzFile exp_s_gzfile, out_p_gzfile;
-  FILE*  exp_s_txtfile, * out_p_txtfile;
-  open_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile, _num_gener, "w" );
-
-  // 4) Write setup data
-  _exp_s->write_setup_file( exp_s_gzfile );
-  _output_m->write_setup_file( out_p_gzfile );
-  _exp_s->write_setup_file( exp_s_txtfile );
-  _output_m->write_setup_file( out_p_txtfile );
-
-  // 5) Close setup files
-  close_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile );
-}
-
-/*!
-  \brief Save all the dynamic data (the data that changes over the simulation)
-
-  Save the state of
-    * The population
-    * The environment iff it is changing (i.e. it has variation and/or noise)
-    * The spatial structure (if any)
-    * The PRNG (random generator) used for the selection
-
-  These are written in the current directory in gzipped binary files
-  whose names are appended with the current generation number.
-
-  WARNING: The experimental setup and output profile are *not* saved. These
-  should be saved once and for all when the experiment is created.
-
-  \see load( int32_t first_gener,
-             char* exp_setup_file_name,
-             char* out_prof_file_name,
-             char* env_file_name,
-             char* pop_file_name,
-             char* sel_file_name,
-             char* sp_struct_file_name,
-             bool verbose )
-  \see write_setup_files( void )
-  \see save_copy( char* dir, int32_t num_gener )
-*/
-void ae_exp_manager::save(void) const
-{
-  // 1) Create missing directories
-  create_missing_directories();
-
-  // 2) Open backup files (environment, population, selection and spatial structure)
-  gzFile env_file, pop_file, sel_file, sp_struct_file;
-  open_backup_files( env_file, pop_file, sel_file, sp_struct_file, _num_gener, "w" );
-
-  // 3) Write the state of the environment, population and spatial structure into the backups
-  get_env()->save( env_file );
-  get_pop()->save( pop_file );
-  get_sel()->save( sel_file );
-  if ( is_spatially_structured() )
-  {
-    get_spatial_structure()->save( sp_struct_file );
-  }
-
-  // 4) Close backup files
-  close_backup_files( env_file, pop_file, sel_file, sp_struct_file );
-}
-
-/*!
-  \brief Saves a complete copy of the experiment to the provided location.
-
-  Save both the setup (constant) and the backup (dynamic) files to the <dir>
-  directory. Dynamic file names will be appended with the <num_gener>
-
-  Static files (saved both as gzipped binary and plain text)
-    * The experimental setup
-    * The output profile
-
-  Dynamic files (saved as gzipped binary)
-    * The population
-    * The environment iff it is changing (i.e. it has variation and/or noise)
-    * The spatial structure (if any)
-    * The PRNG (random generator) used for the selection
-
-  \see load( int32_t first_gener,
-             char* exp_setup_file_name,
-             char* out_prof_file_name,
-             char* env_file_name,
-             char* pop_file_name,
-             char* sel_file_name,
-             char* sp_struct_file_name,
-             bool verbose )
-  \see write_setup_files( void )
-  \see save( void )
-*/
-void ae_exp_manager::save_copy( char* dir, int32_t num_gener /*= 0*/ ) const
-{
-  // 1) Create missing directories
-  create_missing_directories(dir);
-
-  // 2) Open setup files (experimental setup and output profile)
-  //    and backup files (environment, population, selection and spacial structure)
-  gzFile exp_s_gzfile, out_p_gzfile;
-  FILE*  exp_s_txtfile, * out_p_txtfile;
-  open_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile, num_gener, "w", dir );
-  gzFile env_file, pop_file, sel_file, sp_struct_file;
-  open_backup_files( env_file, pop_file, sel_file, sp_struct_file, num_gener, "w", dir );
-
-  // 3) Write setup data
-  _exp_s->write_setup_file( exp_s_gzfile );
-  _output_m->write_setup_file( out_p_gzfile );
-
-  // 4) Write the state of the environment, population, selection and spatial structure into the backups
-  get_env()->save( env_file );
-  get_pop()->save( pop_file );
-  get_sel()->save( sel_file );
-  if ( is_spatially_structured() )
-  {
-    get_spatial_structure()->save( sp_struct_file );
-  }
-
-  // 4) Close setup and backup files
-  close_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile );
-  close_backup_files( env_file, pop_file, sel_file, sp_struct_file );
-}
-
-
-/*!
-  \brief Load an experiment with the provided files
- */
-void ae_exp_manager::load( gzFile& pop_file,
-                           gzFile& env_file,
-                           gzFile& exp_s_gzfile,
-                           FILE*&  exp_s_txtfile,
-                           gzFile& exp_backup_file,
-                           gzFile& sp_struct_file,
-                           gzFile& out_p_gzfile,
-                           FILE*& out_p_txtfile,
-                           bool verbose,
-                           bool to_be_run /*  = true */ )
-{
-  // ---------------------------------------- Retrieve experimental setup data
-  printf( "  Loading experimental setup..." );
-  fflush( stdout );
-  if ( exp_s_gzfile != NULL )
-  {
-    _exp_s->load( exp_s_gzfile, exp_backup_file, verbose );
-  }
-  else
-  {
-    _exp_s->load( exp_s_txtfile, exp_backup_file, verbose );
-  }
-  printf( " OK\n" );
-
-  // ----------------------------------------- Retrieve spatial structure data
-  if ( sp_struct_file != NULL )
-  {
-    printf( "  Loading spatial structure..." );
-    fflush( stdout );
-    _spatial_structure = new ae_spatial_structure( sp_struct_file );
-    printf( " OK\n" );
-  }
-
-  // ------------------------------------------------ Retrieve population data
-  printf( "  Loading population..." );
-  fflush( stdout );
-  _pop->load( pop_file, verbose );
-  printf( " OK\n" );
-
-  // --------------------------------------------- Retrieve environmental data
-  printf( "  Loading environment..." );
-  fflush( stdout );
-  //~ delete _env;
-  //~ _env = new ae_environment();
-  _env->load( env_file );
-  printf( " OK\n" );
-
-  // --------------------------------------------- Retrieve output profile data
-  printf( "  Loading output profile..." );
-  fflush( stdout );
-  if ( out_p_gzfile != NULL )
-  {
-    _output_m->load( out_p_gzfile, verbose, to_be_run );
-  }
-  else
-  {
-    _output_m->load( out_p_txtfile, verbose, to_be_run );
-  }
-  printf( " OK\n" );
-}
-
-
-/*!
-  \brief Load an experiment with default files from a given directory
- */
-void ae_exp_manager::load( const char* dir,
-    int32_t first_gener, bool use_text_files,
-    bool verbose, bool to_be_run /*  = true */ )
-{
-  _first_gener = first_gener;
-  _num_gener = first_gener;
-
-  // -------------------------------------------------------------------------
-  // 1) Open setup files (experimental setup and output profile)
-  //    and backup files (environment, population, selection and sp structure)
-  // -------------------------------------------------------------------------
-  gzFile exp_s_gzfile, out_p_gzfile;
-  FILE*  exp_s_txtfile, * out_p_txtfile;
-  open_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile, first_gener, "r", dir );
-  gzFile env_file, pop_file, exp_backup_file, sp_struct_file;
-  open_backup_files( env_file, pop_file, exp_backup_file, sp_struct_file, first_gener, "r", dir );
-
-
-  // -------------------------------------------------------------------------
-  // 2) Load data from backup and parameter files
-  // -------------------------------------------------------------------------
-  load( pop_file, env_file, exp_s_gzfile, exp_s_txtfile, exp_backup_file,
-        sp_struct_file, out_p_gzfile, out_p_txtfile, verbose, to_be_run );
-
-
-  // -------------------------------------------------------------------------
-  // 3) Close setup and backup files
-  // -------------------------------------------------------------------------
-  close_setup_files( exp_s_gzfile, exp_s_txtfile, out_p_gzfile, out_p_txtfile );
-  close_backup_files( env_file, pop_file, exp_backup_file, sp_struct_file );
-
-
-  // ---------------------------------------------------------------------------
-  // 4) Recompute unsaved data
-  // ---------------------------------------------------------------------------
-  // Evaluate individuals
-  _pop->evaluate_individuals( get_env() );
-
-  // If the population is spatially structured, then the individuals are saved
-  // and loaded in the order of the grid and not in increasing order of fitness
-  // so we have to sort the individuals
-  if ( is_spatially_structured() )
-  {
-    _pop->sort_individuals();
-  }
-}
-
-
-/*!
-  \brief Load an experiment with the provided constitutive files
- */
-void ae_exp_manager::load( int32_t first_gener,
-                           char* pop_file_name,
-                           char* env_file_name,
-                           char* exp_setup_file_name,
-                           char* exp_backup_file_name,
-                           char* sp_struct_file_name,
-                           char* out_prof_file_name,
-                           bool verbose ,
-                           bool to_be_run /* = true */)
-{
-  _first_gener = first_gener;
-  _num_gener = first_gener;
-
-  // ---------------------------------------------------------------------------
-  // 1) Determine whether the parameter files are in binary or plain text format
-  //    and open in the corresponding "mode"
-  // ---------------------------------------------------------------------------
-  gzFile exp_setup_gzfile = NULL;
-  gzFile out_prof_gzfile = NULL;
-  FILE* exp_setup_txtfile = NULL;
-  FILE* out_prof_txtfile = NULL;
-
-  exp_setup_gzfile = gzopen( exp_setup_file_name, "r" );
-  out_prof_gzfile = gzopen( out_prof_file_name, "r" );
-
-  if ( exp_setup_gzfile == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_setup_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( out_prof_gzfile == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, out_prof_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-  if ( gzdirect( exp_setup_gzfile ) )
-  {
-    // The provided output profile file is not zipped, it is a plain text setup file
-    // => Close gzfile and open as plain file instead
-    gzclose( exp_setup_gzfile );
-    exp_setup_gzfile = NULL;
-    exp_setup_txtfile = fopen( exp_setup_file_name, "r" );
-  }
-
-  if ( gzdirect( out_prof_gzfile ) )
-  {
-    // The provided output profile file is not zipped, it is a plain text setup file
-    // => Close gzfile and open as plain file instead
-    gzclose( out_prof_gzfile );
-    out_prof_gzfile = NULL;
-    out_prof_txtfile = fopen( out_prof_file_name, "r" );
-  }
-
-
-  // ---------------------------------------------------------------------------
-  // 2) Open backup and parameter files
-  // ---------------------------------------------------------------------------
-  gzFile env_file = gzopen( env_file_name, "r" );
-  gzFile pop_file = gzopen( pop_file_name, "r" );
-  gzFile exp_backup_file = gzopen( exp_backup_file_name, "r" );
-  gzFile sp_struct_file  = NULL;
-
-  if ( env_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, env_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( pop_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, pop_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( exp_backup_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, exp_backup_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( sp_struct_file_name != NULL )
-  {
-    sp_struct_file = gzopen( sp_struct_file_name, "r" );
-    if ( sp_struct_file == Z_NULL )
-    {
-      printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, sp_struct_file_name );
-      exit( EXIT_FAILURE );
-    }
-  }
-
-
-  // ---------------------------------------------------------------------------
-  // 3) Load data from backup and parameter files
-  // ---------------------------------------------------------------------------
-
-  // ----------------------------------------- Retrieve spatial structure data
-  if ( sp_struct_file != NULL )
-  {
-    printf( "  Loading spatial structure..." );
-    fflush( stdout );
-    _spatial_structure = new ae_spatial_structure( sp_struct_file );
-    printf( "OK\n" );
-  }
-
-  // ------------------------------------------------ Retrieve population data
-  printf( "  Loading population..." );
-  fflush( stdout );
-  _pop->load( pop_file, verbose );
-  printf( "OK\n" );
-
-  // --------------------------------------------- Retrieve environmental data
-  printf( "  Loading environment..." );
-  fflush( stdout );
-  //~ delete _env;
-  //~ _env = new ae_environment();
-  _env->load( env_file );
-  printf( "OK\n" );
-
-  // ---------------------------------------- Retrieve experimental setup data
-  printf( "  Loading experimental setup..." );
-  fflush( stdout );
-  if ( exp_setup_gzfile != NULL )
-  {
-    _exp_s->load( exp_setup_gzfile, exp_backup_file, verbose );
-  }
-  else
-  {
-    _exp_s->load( exp_setup_txtfile, exp_backup_file, verbose );
-  }
-  printf( "OK\n" );
-
-  // --------------------------------------------- Retrieve output profile data
-  if ( out_prof_gzfile != NULL )
-  {
-    _output_m->load( out_prof_gzfile, verbose, to_be_run );
-  }
-  else
-  {
-    _output_m->load( out_prof_txtfile, verbose, to_be_run );
-  }
-
-
-  // ---------------------------------------------------------------------------
-  // 4) Close setup and backup files
-  // ---------------------------------------------------------------------------
-  gzclose( pop_file );
-  gzclose( env_file );
-  gzclose( exp_setup_gzfile );
-  gzclose( exp_backup_file );
-  gzclose( sp_struct_file );
-  gzclose( out_prof_gzfile );
-
-
-  // ---------------------------------------------------------------------------
-  // 5) Recompute unsaved data
-  // ---------------------------------------------------------------------------
-  // Evaluate individuals
-  _pop->evaluate_individuals( get_env() );
-
-  // If the population is spatially structured, then the individuals are saved
-  // and loaded in the order of the grid and not in increasing order of fitness
-  // so we have to sort the individuals
-  if ( is_spatially_structured() )
-  {
-    _pop->sort_individuals();
-  }
-}
-
-/*!
-  Run the simulation
- */
-void ae_exp_manager::run_evolution( void )
-{
-  // We are running a simulation.
-  // Save the setup files to keep track of the setup history
-  write_setup_files();
-
-  // Dump the initial state of the population; useful for restarts
-  _output_m->write_current_generation_outputs();
-
-  while ( _num_gener < _last_gener )
-  {
-    if ( quit_signal_received() ) break;
-
-    printf( "============================== %"PRId32" ==============================\n", _num_gener );
-    printf( "  Best individual's distance to target (metabolic) : %f\n",
-            _pop->get_best()->get_dist_to_target_by_feature( METABOLISM ) );
-
-    #ifdef __X11
-      display();
-    #endif
-
-    // Take one step in the evolutionary loop
-    step_to_next_generation();
-
-    // Write statistical data and store phylogenetic data (tree)
-    _output_m->write_current_generation_outputs();
-  }
-
-  _output_m->flush();
-
-  printf( "============================== %"PRId32" ==============================\n", _num_gener );
-  printf( "  Best individual's distance to target (metabolic) : %f\n",
-          _pop->get_best()->get_dist_to_target_by_feature( METABOLISM ) );
-  printf( "===================================================================\n");
-  printf ("  The run is finished. \n");
-  printf ("  Printing the final best individual into "BEST_LAST_ORG_FNAME"\n");
-  FILE* org_file = fopen( BEST_LAST_ORG_FNAME, "w" );
-  fputs( _pop->get_best()->get_genetic_unit(0)->get_dna()->get_data(), org_file );
-  fclose ( org_file );
-}
-
-// ===========================================================================
-//                                Protected Methods
-// ===========================================================================
-void ae_exp_manager::create_missing_directories( const char* dir /*= "."*/ ) const
-{
-  char cur_dir_name[255];
-  int status;
-
-  // Base directory
-  status = mkdir( dir, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, cur_dir_name, errno );
-  }
-
-  // Experimental setup
-  sprintf( cur_dir_name, "%s/"EXP_S_DIR, dir );
-  status = mkdir( cur_dir_name, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, cur_dir_name, errno );
-  }
-  // Output profile
-  sprintf( cur_dir_name, "%s/"OUT_P_DIR, dir );
-  status = mkdir( cur_dir_name, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, cur_dir_name, errno );
-  }
-  // Environment
-  sprintf( cur_dir_name, "%s/"ENV_DIR, dir );
-  status = mkdir( cur_dir_name, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, cur_dir_name, errno );
-  }
-  // Population
-  sprintf( cur_dir_name, "%s/"POP_DIR, dir );
-  status = mkdir( cur_dir_name, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, cur_dir_name, errno );
-  }
-  // Spatial structure
-  if ( is_spatially_structured() )
-  {
-    sprintf( cur_dir_name, "%s/"SP_STRUCT_DIR, dir );
-    status = mkdir( cur_dir_name, 0755 );
-    if ( status == -1 && errno != EEXIST )
-    {
-      err( EXIT_FAILURE, cur_dir_name, errno );
-    }
-  }
-}
-
-void ae_exp_manager::open_backup_files( gzFile& env_file,
-                                        gzFile& pop_file,
-                                        gzFile& exp_backup_file,
-                                        gzFile& sp_struct_file,
-                                        int32_t num_gener,
-                                        const char mode[3],
-                                        const char* dir /*= "."*/ ) const
-{
-  assert( strcmp( mode, "w" ) == 0 or strcmp( mode, "r" ) == 0 );
-
-  // -------------------------------------------------------------------------
-  // 1) Generate backup file names for mandatory files.
-  //    Optional files (e.g. spatial structure) will be handled separately
-  // -------------------------------------------------------------------------
-  char env_file_name[255];
-  char pop_file_name[255];
-  char exp_backup_file_name[255];
-
-  sprintf( env_file_name, "%s/"ENV_FNAME_FORMAT, dir, num_gener );
-  sprintf( pop_file_name, "%s/"POP_FNAME_FORMAT, dir, num_gener );
-  sprintf( exp_backup_file_name, "%s/"EXP_S_FNAME_FORMAT, dir, num_gener );
-
-
-  // -------------------------------------------------------------------------
-  // 2) Open backup files (environment, population and selection)
-  // -------------------------------------------------------------------------
-  env_file = gzopen( env_file_name, mode );
-  pop_file = gzopen( pop_file_name, mode );
-  exp_backup_file = gzopen( exp_backup_file_name, mode );
-
-
-  // -------------------------------------------------------------------------
-  // 3) Check that files were correctly opened
-  // -------------------------------------------------------------------------
-  if ( env_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, env_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( pop_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, pop_file_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( exp_backup_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, exp_backup_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-
-  // -------------------------------------------------------------------------
-  // 4) Handle optional files
-  // -------------------------------------------------------------------------
-  char sp_struct_file_name[255];
-  sprintf( sp_struct_file_name, "%s/"SP_STRUCT_FNAME_FORMAT, dir, num_gener );
-
-  // Check whether there should be spatial structure
-  bool spatially_structured = false;
-  if ( strcmp( mode, "w" ) == 0 )
-  {
-    if ( is_spatially_structured() )
-      spatially_structured = true;
-  }
-  else if ( strcmp( mode, "r" ) == 0 )
-  {
-    // Check for the existence of the corresponding file in the file system.
-    struct stat stat_buf;
-    if ( stat( sp_struct_file_name, &stat_buf ) == -1 )
-    {
-      if ( errno != ENOENT )
-      {
-        printf( "%s:%d: error: unknown error.\n", __FILE__, __LINE__ );
-        exit( EXIT_FAILURE );
-      }
-      // Else file does not exist, leave spatially_structured to false
-    }
-    else
-    {
-      spatially_structured = true;
-    }
-  }
-
-  // If there should be spatial structure, open file and check
-  if ( spatially_structured )
-  {
-    sp_struct_file = gzopen( sp_struct_file_name, mode );
-
-    if ( sp_struct_file == Z_NULL )
-    {
-      printf( "%s:%d: error: could not open backup file %s\n",
-              __FILE__, __LINE__, sp_struct_file_name );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else
-  {
-    sp_struct_file = NULL;
-  }
-}
-
-void ae_exp_manager::close_backup_files(  gzFile& env_file,
-                                          gzFile& pop_file,
-                                          gzFile& exp_backup_file,
-                                          gzFile& sp_struct_file ) const
-{
-  gzclose( env_file );
-  gzclose( pop_file );
-  gzclose( exp_backup_file );
-  if ( is_spatially_structured() )
-  {
-    gzclose( sp_struct_file );
-  }
-}
-
-void ae_exp_manager::open_setup_files(
-        gzFile& exp_s_gzfile, FILE*& exp_s_txtfile,
-        gzFile& out_p_gzfile, FILE*& out_p_txtfile,
-        int32_t num_gener,
-        const char mode[3],
-        const char* dir /*= "."*/ ) const
-{
-  // 1) Generate setup file names
-  char exp_s_gzfile_name[255];
-  char exp_s_txtfile_name[255];
-  char out_p_gzfile_name[255];
-  char out_p_txtfile_name[255];
-
-  sprintf( exp_s_gzfile_name,  "%s/"EXP_S_CONST_FNAME_FORMAT,     dir );
-  sprintf( exp_s_txtfile_name, "%s/"EXP_S_TXT_CONST_FNAME_FORMAT, dir );
-  sprintf( out_p_gzfile_name,  "%s/"OUT_P_FNAME_FORMAT,     dir );
-  sprintf( out_p_txtfile_name, "%s/"OUT_P_TXT_FNAME_FORMAT, dir );
-
-  // 2) Open backup files (environment, population and spacial structure)
-  exp_s_gzfile  = gzopen( exp_s_gzfile_name, mode );
-  exp_s_txtfile = fopen( exp_s_txtfile_name, mode );
-  out_p_gzfile  = gzopen( out_p_gzfile_name, mode );
-  out_p_txtfile = fopen( out_p_txtfile_name, mode );
-
-  // 3) Check that files were correctly opened
-  if ( exp_s_gzfile == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, exp_s_gzfile_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( exp_s_txtfile == NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, exp_s_txtfile_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( out_p_gzfile == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, out_p_gzfile_name );
-    exit( EXIT_FAILURE );
-  }
-  if ( out_p_txtfile == NULL )
-  {
-    printf( "%s:%d: error: could not open backup file %s\n",
-            __FILE__, __LINE__, out_p_txtfile_name );
-    exit( EXIT_FAILURE );
-  }
-}
-
-void ae_exp_manager::close_setup_files(
-        gzFile& exp_s_gzfile, FILE* exp_s_txtfile,
-        gzFile& out_p_gzfile, FILE* out_p_txtfile ) const
-{
-  gzclose( exp_s_gzfile );
-  fclose( exp_s_txtfile );
-  gzclose( out_p_gzfile );
-  fclose( out_p_txtfile );
-}
-// ===========================================================================
-//                               Non inline accessors
-// ===========================================================================
diff --git a/src/libaevol/ae_exp_manager.h b/src/libaevol/ae_exp_manager.h
deleted file mode 100644
index 080ef44..0000000
--- a/src/libaevol/ae_exp_manager.h
+++ /dev/null
@@ -1,605 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-/*!
-  \class ae_exp_manager
-  
-  \brief This is aevol's top-level class. It allows for
-  high-level experiment management
-  
-  An experiment manager allows one to... manage an experiment.
-  It owns a population and an experimental_setup that can be loaded from a
-  pair of aevol binary files (pop and exp_setup)
-*/
-
-
-#ifndef __AE_EXP_MANAGER_H__
-#define __AE_EXP_MANAGER_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_jumping_mt.h>
-#include <ae_exp_setup.h>
-#include <ae_output_manager.h>
-#include <ae_population.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_exp_manager : public ae_object
-{
-  public :
-    // =======================================================================
-    //                                Constructors
-    // =======================================================================
-    ae_exp_manager( void );
-
-    // =======================================================================
-    //                                Destructors
-    // =======================================================================
-    virtual ~ae_exp_manager( void );
-
-    // =======================================================================
-    //                           Accessors: getters
-    // =======================================================================
-    inline ae_exp_setup*        get_exp_s( void ) const;
-    inline ae_population*       get_pop( void ) const;
-    inline ae_environment*      get_env( void ) const;
-    inline ae_selection*        get_sel( void ) const;
-    inline ae_output_manager*   get_output_m( void ) const;
-  
-    inline int32_t  get_first_gener( void ) const;
-    inline int32_t  get_num_gener( void ) const;
-  
-    inline bool quit_signal_received( void ) const;
-    
-    
-    inline int16_t  get_nb_env_segments( void ) const;
-    
-    inline ae_selection_scheme get_selection_scheme( void ) const;
-    inline double get_selection_pressure( void ) const;
-  
-    // ------------------------------------------------------ Spatial structure
-    inline bool                   is_spatially_structured( void ) const;
-    inline ae_spatial_structure*  get_spatial_structure( void ) const;
-    inline ae_grid_cell*          get_grid_cell( int16_t x, int16_t y ) const;
-    inline int16_t                get_grid_width( void ) const;
-    inline int16_t                get_grid_height( void ) const;
-    inline ae_grid_cell***        get_pop_grid( void ) const;
-  
-    // -------------------------------------------------------- Global settings
-    inline bool   get_with_HT( void ) const;
-    inline bool   get_repl_HT_with_close_points ( void ) const;
-    inline double get_HT_ins_rate( void ) const;
-    inline double get_HT_repl_rate( void ) const;
-    inline double get_repl_HT_detach_rate( void ) const;
-    
-    // The ability to own a plasmid is a property of the individuals (_allow_plasmids) because it is used during mutations
-    // However there is also a property of the experimental setup (_with_plasmids) that indicates whether plasmids are used because we need this during replication and during loading/writting
-    // For now when plasmids are used each individual has one and only one plasmid (so these variables should always be equals), however this may change in the future
-    // There is no longer property _with_plasmids_HT because the ability to transfer is evolvable and thus may depend on the plasmid itself
-  
-    inline bool   get_with_plasmids( void ) const;
-    inline double get_prob_plasmid_HT( void ) const;
-    inline double get_tune_donor_ability( void ) const;
-    inline double get_tune_recipient_ability( void ) const;
-    inline double get_donor_cost( void ) const;
-    inline double get_recipient_cost( void ) const;
-    inline bool   get_swap_GUs( void ) const;
-    
-    inline bool   get_with_secretion( void ) const;
-    inline double get_secretion_contrib_to_fitness( void ) const;
-    inline double get_secretion_cost( void ) const;
-    
-    //~ inline bool   get_with_alignments( void ) const;
-    
-    // Accessors to population stuff
-    inline ae_list<ae_individual*>* get_indivs( void ) const;
-    inline int32_t                  get_nb_indivs( void ) const;
-    
-    inline ae_individual* get_best_indiv( void ) const;
-    inline ae_individual*	get_indiv_by_id( int32_t id ) const;
-    inline ae_individual* get_indiv_by_rank( int32_t rank ) const;
-    
-    // Accessors to output manager stuff
-    inline int32_t	get_backup_step(void) const;
-    inline int32_t	get_big_backup_step(void) const;
-    inline bool         get_record_tree( void ) const;
-    inline int32_t      get_tree_step( void ) const;
-    inline ae_tree_mode get_tree_mode( void ) const;
-    inline ae_tree*     get_tree( void ) const;
-    
-    // =======================================================================
-    //                          Accessors: setters
-    // =======================================================================
-    inline void set_first_gener( int32_t first_gener );
-    inline void set_nb_gener( int32_t nb_gener );
-    //~ inline void set_min_genome_length( int32_t min_genome_length );
-    //~ inline void set_max_genome_length( int32_t max_genome_length );
-    inline void set_spatial_structure(  int16_t grid_width,
-                                        int16_t grid_height,
-                                        ae_jumping_mt* prng );
-
-    inline void set_with_HT( bool with_HT ) ;
-    inline void set_repl_HT_with_close_points ( bool repl_HT_with_close_points) ;
-    inline void set_HT_ins_rate( double HT_ins_rate) ;
-    inline void set_HT_repl_rate( double HT_repl_rate) ;
-    inline void set_repl_HT_detach_rate( double repl_HT_detach_rate) ;
-
-    // =======================================================================
-    //                                 Operators
-    // =======================================================================
-
-    // =======================================================================
-    //                               Public Methods
-    // =======================================================================
-    void write_setup_files( void );
-    void save( void ) const;
-    void save_copy( char* dir, int32_t num_gener = 0 ) const;
-    inline void load( int32_t first_gener, bool use_text_files, bool verbose, bool to_be_run = true );
-    void load( const char* dir, int32_t first_gener, bool use_text_files, bool verbose, bool to_be_run = true );
-    void load( int32_t first_gener,
-               char* exp_setup_file_name,
-               char* out_prof_file_name,
-               char* env_file_name,
-               char* pop_file_name,
-               char* sel_file_name,
-               char* sp_struct_file_name,
-               bool verbose, 
-               bool to_be_run = true);
-    void run_evolution( void );
-    virtual void display( void ) {};
-
-    // =======================================================================
-    //                              Public Attributes
-    // =======================================================================
-    
-
-
-
-
-
-  protected :
-
-    // =======================================================================
-    //                            Forbidden Constructors
-    // =======================================================================
-    /*ae_exp_manager( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_exp_manager( const ae_exp_manager &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =======================================================================
-    //                              Protected Methods
-    // =======================================================================
-    inline void step_to_next_generation( void );
-
-    void load( gzFile& pop_file,
-               gzFile& env_file,
-               gzFile& exp_s_gzfile,
-               FILE*&  exp_s_txtfile,
-               gzFile& exp_backup_file,
-               gzFile& sp_struct_file,
-               gzFile& out_p_gzfile,
-               FILE*& out_p_txtfile,
-               bool verbose,
-               bool to_be_run = true );
-  
-    void create_missing_directories( const char* dir = "." ) const;
-    void open_backup_files( gzFile& env_file,
-                            gzFile& pop_file,
-                            gzFile& sel_file,
-                            gzFile& sp_struct_file,
-                            int32_t num_gener,
-                            const char mode[3],
-                            const char* dir = "." ) const;
-    void close_backup_files(  gzFile& env_file,
-                              gzFile& pop_file,
-                              gzFile& sel_file,
-                              gzFile& sp_struct_file ) const;
-    void open_setup_files(  gzFile& exp_s_gzfile, FILE*& exp_s_txtfile,
-                            gzFile& out_p_gzfile, FILE*& out_p_txtfile,
-                            int32_t num_gener,
-                            const char mode[3],
-                            const char* dir = "." ) const;
-    void close_setup_files(
-            gzFile& exp_s_gzfile, FILE* exp_s_txtfile,
-            gzFile& out_p_gzfile, FILE* out_p_txtfile ) const;
-
-    // =======================================================================
-    //                             Protected Attributes
-    // =======================================================================
-    // ---------------------------------------------------- Experimental setup
-    ae_exp_setup* _exp_s;
-    
-    // ------------------------------------------------------------ Population
-    ae_population* _pop;
-      
-    // ----------------------------------------------------------- Environment
-    ae_environment* _env;
-    
-    // ----------------------------------------------------- Spatial structure
-    ae_spatial_structure* _spatial_structure;
-    
-    // -------------------------------------------------------- Output manager
-    ae_output_manager* _output_m;
-    
-    // -------------------------- Generation numbers (first, last and current)
-    int32_t _first_gener;
-    int32_t _last_gener;
-    int32_t _num_gener;
-    
-    // Set to true when ctrl-Q is received. Will cause the simulation
-    // to be ended after current generation is completed
-    bool _quit_signal_received;
-};
-
-
-// ===========================================================================
-//                             Getters' definitions
-// ===========================================================================
-inline ae_population* ae_exp_manager::get_pop( void ) const
-{
-  return _pop;
-}
-
-inline ae_exp_setup* ae_exp_manager::get_exp_s( void ) const
-{
-  return _exp_s;
-}
-
-inline ae_output_manager* ae_exp_manager::get_output_m( void ) const
-{
-  return _output_m;
-}
-
-inline int32_t ae_exp_manager::get_first_gener( void ) const
-{
-  return _first_gener;
-}
-
-inline int32_t ae_exp_manager::get_num_gener( void ) const
-{
-  return _num_gener;
-}
-
-inline bool ae_exp_manager::quit_signal_received( void ) const
-{
-  return _quit_signal_received;
-}
-
-inline ae_environment* ae_exp_manager::get_env( void ) const
-{
-  return _env;
-}
-
-inline ae_selection* ae_exp_manager::get_sel( void ) const
-{
-  return get_exp_s()->get_sel();
-}
-
-inline int16_t ae_exp_manager::get_nb_env_segments( void ) const
-{
-  return get_env()->get_nb_segments();
-}
-
-inline ae_selection_scheme ae_exp_manager::get_selection_scheme( void ) const
-{
-  return get_sel()->get_selection_scheme();
-}
-
-inline double ae_exp_manager::get_selection_pressure( void ) const
-{
-  return get_sel()->get_selection_pressure();
-}
-
-// Global settings
-inline bool ae_exp_manager::is_spatially_structured( void ) const
-{
-  return ( get_spatial_structure() != NULL );
-}
-
-inline ae_spatial_structure* ae_exp_manager::get_spatial_structure( void ) const
-{
-  return _spatial_structure;
-}
-
-inline ae_grid_cell* ae_exp_manager::get_grid_cell( int16_t x, int16_t y ) const
-{
-  return get_spatial_structure()->get_grid_cell( x, y );
-}
-
-inline int16_t ae_exp_manager::get_grid_width( void ) const
-{
-  return get_spatial_structure()->get_grid_width();
-}
-
-inline int16_t ae_exp_manager::get_grid_height( void ) const
-{
-  return get_spatial_structure()->get_grid_height();
-}
-
-inline ae_grid_cell*** ae_exp_manager::get_pop_grid( void ) const
-{
-  return get_spatial_structure()->get_pop_grid();
-}
-
-inline bool ae_exp_manager::get_with_HT( void ) const
-{
-  return get_exp_s()->get_with_HT();
-}
-
-inline bool ae_exp_manager::get_repl_HT_with_close_points ( void ) const
-{
-  return get_exp_s()->get_repl_HT_with_close_points();
-}
-
-inline double ae_exp_manager::get_HT_ins_rate( void ) const
-{
-  return get_exp_s()->get_HT_ins_rate();
-}
-
-inline double ae_exp_manager::get_HT_repl_rate( void ) const
-{
-  return get_exp_s()->get_HT_repl_rate();
-}
-
-inline double ae_exp_manager::get_repl_HT_detach_rate( void ) const
-{
-  return get_exp_s()->get_repl_HT_detach_rate();
-}
-
-inline bool ae_exp_manager::get_with_plasmids( void ) const
-{
-  return get_exp_s()->get_with_plasmids();
-}
-
-inline double ae_exp_manager::get_prob_plasmid_HT( void ) const
-{
-  return get_exp_s()->get_prob_plasmid_HT();
-}
-
-inline double ae_exp_manager::get_tune_donor_ability( void ) const
-{
-  return get_exp_s()->get_tune_donor_ability();
-}
-
-inline double ae_exp_manager::get_tune_recipient_ability( void ) const
-{
-  return get_exp_s()->get_tune_recipient_ability();
-}
-
-inline double ae_exp_manager::get_donor_cost( void ) const
-{
-  return get_exp_s()->get_donor_cost();
-}
-
-inline double ae_exp_manager::get_recipient_cost( void ) const
-{
-  return get_exp_s()->get_recipient_cost();
-}
-
-inline bool ae_exp_manager::get_swap_GUs( void ) const
-{
-  return get_exp_s()->get_swap_GUs();
-}
-
-inline bool ae_exp_manager::get_with_secretion( void ) const
-{
-  return get_exp_s()->get_with_secretion();
-}
-
-inline double ae_exp_manager::get_secretion_contrib_to_fitness( void ) const
-{
-  return get_exp_s()->get_secretion_contrib_to_fitness();
-}
-
-inline double ae_exp_manager::get_secretion_cost( void ) const
-{
-  return get_exp_s()->get_secretion_cost();
-}
-
-//~ inline bool ae_exp_manager::get_with_alignments( void ) const
-//~ {
-  //~ return _exp_s->get_with_alignments();
-//~ }
-
-
-// Accessors to population stuff
-inline int32_t ae_exp_manager::get_nb_indivs( void ) const
-{
-  return get_pop()->get_nb_indivs();
-}
-
-inline ae_individual* ae_exp_manager::get_best_indiv( void ) const
-{
-  return get_pop()->get_best();
-}
-
-inline ae_list<ae_individual*>* ae_exp_manager::get_indivs( void ) const
-{
-  return get_pop()->get_indivs();
-}
-
-inline ae_individual * ae_exp_manager::get_indiv_by_id( int32_t id ) const
-{
-  return get_pop()->get_indiv_by_id( id );
-}
-
-inline ae_individual * ae_exp_manager::get_indiv_by_rank( int32_t rank ) const
-{
-  return get_pop()->get_indiv_by_rank( rank );
-}
-
-
-// Accessors to output manager stuff
-inline int32_t ae_exp_manager::get_backup_step(void) const
-{
-	return get_output_m()->get_backup_step();
-}
-
-inline int32_t ae_exp_manager::get_big_backup_step(void) const
-{
-	return get_output_m()->get_big_backup_step();
-}
-
-inline bool ae_exp_manager::get_record_tree( void ) const
-{
-	return get_output_m()->get_record_tree();
-}
-
-inline int32_t ae_exp_manager::get_tree_step( void ) const
-{
-	return get_output_m()->get_tree_step();
-}
-
-inline ae_tree_mode ae_exp_manager::get_tree_mode( void ) const
-{
-	return get_output_m()->get_tree_mode();
-}
-
-inline ae_tree* ae_exp_manager::get_tree( void ) const
-{
-	return get_output_m()->get_tree();
-}
-
-// ===========================================================================
-//                             Setters' definitions
-// ===========================================================================
-inline void ae_exp_manager::set_first_gener( int32_t first_gener )
-{
-  _num_gener = _first_gener = first_gener;
-}
-
-inline void ae_exp_manager::set_nb_gener( int32_t nb_gener )
-{
-  _last_gener = _first_gener + nb_gener;
-}
-
-// Global constraints
-//~ inline void ae_exp_manager::set_min_genome_length( int32_t min_genome_length )
-//~ {
-  //~ _exp_s->set_min_genome_length( min_genome_length );
-//~ }
-
-//~ inline void ae_exp_manager::set_max_genome_length( int32_t max_genome_length )
-//~ {
-  //~ _exp_s->set_max_genome_length( max_genome_length );
-//~ }
-
-inline void ae_exp_manager::set_spatial_structure( int16_t grid_width,
-                                                   int16_t grid_height,
-                                                   ae_jumping_mt* prng )
-{
-  _spatial_structure = new ae_spatial_structure();
-  _spatial_structure->set_grid_size( grid_width, grid_height );
-  _spatial_structure->set_prng( prng );
-}
-
-
-inline void ae_exp_manager::set_with_HT( bool with_HT )
-{
-  _exp_s->set_with_HT( with_HT );  
-}
-
-inline void ae_exp_manager::set_repl_HT_with_close_points ( bool repl_HT_with_close_points)
-{
-  _exp_s->set_repl_HT_with_close_points( repl_HT_with_close_points );
-}
-
-inline void ae_exp_manager::set_HT_ins_rate( double HT_ins_rate)
-{
-  _exp_s->set_HT_ins_rate( HT_ins_rate );
-}
-
-inline void ae_exp_manager::set_HT_repl_rate( double HT_repl_rate)
-{
-  _exp_s->set_HT_repl_rate( HT_repl_rate );
-}
-
-inline void ae_exp_manager::set_repl_HT_detach_rate( double repl_HT_detach_rate)
-{
-  _exp_s->set_repl_HT_detach_rate( repl_HT_detach_rate );
-}
-
-// ===========================================================================
-//                            Operators' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                         Inline methods' definition
-// ===========================================================================
-inline void ae_exp_manager::step_to_next_generation( void )
-{
-  // Apply environmental variation
-  _env->apply_variation();
-  
-  // Apply environmental noise
-  _env->apply_noise();
-  
-  _exp_s->step_to_next_generation();
-  _num_gener++;
-}
-
-
-/*!
-  \brief Load an experiment with default files from the current directory
- */
-inline void ae_exp_manager::load( int32_t first_gener, bool use_text_files,
-                                  bool verbose, bool to_be_run /*  = true */ )
-{
-  load( ".", first_gener, use_text_files, verbose, to_be_run );
-}
-
-
-#endif // __AE_EXP_MANAGER_H__
diff --git a/src/libaevol/ae_exp_manager_X11.cpp b/src/libaevol/ae_exp_manager_X11.cpp
deleted file mode 100644
index e5d1eab..0000000
--- a/src/libaevol/ae_exp_manager_X11.cpp
+++ /dev/null
@@ -1,809 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <unistd.h>
-#include <X11/Xlib.h>
-#include <X11/keysym.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_manager_X11.h>
-#include <ae_spatial_structure.h>
-#include <ae_point_2d.h>
-#include <ae_population_X11.h>
-#include <ae_individual_X11.h>
-#include <ae_X11_window.h>
-
-
-
-// XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent()
-// with this Predicate function as a work-around ( ClientMessage events
-// are needed in order to catch "WM_DELETE_WINDOW")
-static Bool AlwaysTruePredicate ( Display*, XEvent*, char* ) { return True; }
-
-
-
-//##############################################################################
-//                                                                             #
-//                          Class ae_exp_manager_X11                           #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-#define NB_WIN INT32_C(7) // Number of windows that can be showed => CDS, RNA, phenotype, ...
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_exp_manager_X11::ae_exp_manager_X11( void ) : ae_exp_manager()
-{
-  // Basic initializations
-  _win      = NULL;
-  _win_size = NULL;
-  _win_pos  = NULL;
-  _win_name = NULL;
-  
-  _display_on             = false;
-  _handle_display_on_off  = false;
-  
-  // Initialize XLib stuff
-  _display  = XOpenDisplay( NULL );
-  _screen   = XDefaultScreen( _display );
-  _atoms    = new Atom[2];
-  _atoms[0] = XInternAtom( _display, "WM_DELETE_WINDOW", False );
-  _atoms[1] = XInternAtom( _display, "WM_PROTOCOLS", False );
-  set_codes();
-}
-
-//ae_exp_manager_X11::ae_exp_manager_X11( ae_param_overloader* param_overloader /* = NULL */ ) : ae_exp_manager( param_overloader )
-/*{
-  initialize();
-}*/
-
-//ae_exp_manager_X11::ae_exp_manager_X11( char* backup_file_name, bool to_be_run /* = true */, ae_param_overloader* param_overloader /* = NULL */ ) :
-/*                   ae_exp_manager( backup_file_name, to_be_run, param_overloader  )
-{
-  initialize();
-}*/
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_exp_manager_X11::~ae_exp_manager_X11( void )
-{
-  delete [] _key_codes;
-  delete [] _atoms;
-  
-  for ( int8_t i = 0 ; i < NB_WIN ; i++ )
-  {
-    if ( _win != NULL )
-    {
-      if ( _win[i] != NULL ) delete _win[i];
-    }
-    if ( _win_size != NULL )
-    {
-      if ( _win_size[i] != NULL ) delete [] _win_size[i];
-    }
-    if ( _win_pos != NULL )
-    {
-      if ( _win_pos[i] != NULL ) delete [] _win_pos[i];
-    }
-  }
-  if ( _win != NULL ) delete [] _win;
-  
-  XCloseDisplay( _display );
-  
-  if ( _win_name != NULL ) delete [] _win_name;
-  if ( _win_size != NULL ) delete [] _win_size;
-  if ( _win_pos != NULL ) delete [] _win_pos;
-  
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-
-bool ae_exp_manager_X11::quit_signal_received( void )
-{
-  return _quit_signal_received;
-}
-
-void ae_exp_manager_X11::display( void )
-{
-  // ---------------------
-  // 1) Handle user events
-  // ---------------------
-  if ( _display_on ) handle_events();
-
-
-  // --------------------------------------------------
-  // 2) Handle signal that toggle the display on or off
-  // --------------------------------------------------
-  if ( _handle_display_on_off )
-  {
-    _handle_display_on_off = false;
-    
-    if ( _display_on ) // Display was "on", close all windows (after saving their current size and position)
-    {
-      for ( int8_t num_win = 0 ; num_win < NB_WIN ; num_win++ )
-      {
-        if ( _win[num_win] != NULL )
-        {
-          // 1) Save current window position and size
-          Window aWindow; // Unused
-          int x_return, y_return;
-          int dest_x_return, dest_y_return;
-          unsigned int border_width_return, depth_return; // Unused
-          XGetGeometry( _display, _win[num_win]->get_window(), &aWindow, &x_return, &y_return,
-                        &_win_size[num_win][0], &_win_size[num_win][1], &border_width_return, &depth_return );
-          XTranslateCoordinates( _display, _win[num_win]->get_window(), DefaultRootWindow(_display), 0, 0, &dest_x_return, &dest_y_return, &aWindow );
-          
-          _win_pos[num_win][0] = dest_x_return - x_return;
-          _win_pos[num_win][1] = dest_y_return - y_return;
-          
-          // 2) Delete window
-          delete _win[num_win];
-          _win[num_win] = NULL;
-        }
-      }
-
-      XFlush( _display );
-      delete _win;
-      _win = NULL;
-      
-      _display_on = false;
-    }
-    else // Display was "off", open windows
-    {
-      _show_window |= 1;
-      _new_show_window = _show_window;
-      
-      // If it's the first time the display is switched on, initialize it.
-      if ( _win == NULL ) initialize();
-      
-      for ( int8_t i = 0 ; i < NB_WIN ; i++ )
-      {
-        if ( get_show_window(i) )
-        {
-          _win[i] = new ae_X11_window( _display, _screen, _atoms, _win_pos[i][0], _win_pos[i][1], _win_size[i][0], _win_size[i][1], _win_name[i] );
-        }
-      }
-      
-      _display_on = true;
-    }
-  }
-
-  
-  // ----------
-  // 3) Display
-  // ----------
-  if ( _display_on )
-  {
-    for ( int8_t i = 0 ; i < NB_WIN ; i++ )
-    {
-      if ( get_show_window( i ) )
-      {
-        if ( get_new_show_window( i ) )
-        {
-          draw_window( i );
-        }
-        else
-        {
-          refresh_window( i );
-        }
-      }
-    }
-    
-    // Refresh all windows
-    XFlush( _display );
-  }
-}
-
-void ae_exp_manager_X11::handle_events( void )
-{
-  XEvent event;
-  int8_t win_number;
-  
-
-  // XCheckMaskEvent() doesn't get ClientMessage Events so use XCheckIfEvent()
-  // with the custom AlwaysTruePredicate function as a work-around (ClientMessage 
-  // events are needed in order to catch "WM_DELETE_WINDOW")
-  int iCurrEvent    = 0;
-  int iIgnoreNoise  = 0;
-  while( XCheckIfEvent( _display, &event, AlwaysTruePredicate, 0) )
-  {
-    iCurrEvent ++;
-    win_number = identify_window( event.xany.window );
-    
-    if( win_number == -1) continue;
-    // We discard this event because it occurred on a destroyed window
-    // (e.g. the user pressed F3 and then moved or resized the window,
-    // before the window was destroyed)
-
-    switch( event.type )
-    {
-      case ConfigureNotify :
-      {
-        _win[win_number]->resize( event.xconfigure.width, event.xconfigure.height );
-        //~ _win[win_number]->repos( event.xconfigure.x, event.xconfigure.y );
-        
-        // Mark window as having to be entirely redrawn
-        _new_show_window |= 1 << win_number;
-        break;
-      }
-      case MapNotify :
-      {
-        draw_window( win_number );
-        break;
-      }
-      case Expose:
-      {
-        if( iCurrEvent > iIgnoreNoise )
-        {
-          draw_window( win_number );
-          iIgnoreNoise = iCurrEvent + XQLength( _display );
-        }
-        break;
-      }
-      case ClientMessage :
-      {
-        if ( ((Atom) event.xclient.data.l[0]) == _atoms[0] ) // The user closed the window by clicking on the cross
-        {
-          // 1) Save current window position and size
-          Window aWindow; // Unused
-          int x_return, y_return;
-          int dest_x_return, dest_y_return;
-          unsigned int border_width_return, depth_return; // Unused
-          XGetGeometry( _display, _win[win_number]->get_window(), &aWindow, &x_return, &y_return,
-                        &_win_size[win_number][0], &_win_size[win_number][1], &border_width_return, &depth_return );
-          XTranslateCoordinates( _display, _win[win_number]->get_window(), DefaultRootWindow(_display), 0, 0, &dest_x_return, &dest_y_return, &aWindow );
-          
-          _win_pos[win_number][0] = dest_x_return - x_return;
-          _win_pos[win_number][1] = dest_y_return - y_return;
-          
-          // 2) Delete window and mark as "not to be shown"
-          delete _win[win_number];
-          _win[win_number] = NULL;
-          _show_window &= ~(1 << win_number);
-          
-          // 3) If it was the main that was closed, turn display off.
-          if ( win_number == 0 )
-          {
-            _handle_display_on_off = true;
-          }
-        }
-        break;
-      }
-      case KeyPress :
-      {
-        // Not sure a switch would work on any platform => use ifs instead
-        if ( event.xkey.keycode == _key_codes[KEY_F1] ||
-             event.xkey.keycode == _key_codes[KEY_F2] ||
-             event.xkey.keycode == _key_codes[KEY_F3] ||
-             event.xkey.keycode == _key_codes[KEY_F4] ||
-             event.xkey.keycode == _key_codes[KEY_F5] ||
-             event.xkey.keycode == _key_codes[KEY_F6] )
-        {
-          int8_t num_win;
-          
-          // Not sure a switch would work on any platform => use ifs instead
-          if ( event.xkey.keycode == _key_codes[KEY_F1] ) num_win = 1;
-          else if ( event.xkey.keycode == _key_codes[KEY_F2] ) num_win = 2;
-          else if ( event.xkey.keycode == _key_codes[KEY_F3] ) num_win = 3;
-          else if ( event.xkey.keycode == _key_codes[KEY_F4] ) num_win = 4;
-          else if ( event.xkey.keycode == _key_codes[KEY_F5] ) num_win = 5;
-          else  num_win = 6; // case where ( event.xkey.keycode == _key_codes[KEY_F6] ) 
-          
-          if ( get_show_window( num_win ) )
-          {
-            // 1) Save current window position and size
-            Window aWindow; // Unused
-            int x_return, y_return;
-            int dest_x_return, dest_y_return;
-            unsigned int border_width_return, depth_return; // Unused
-            XGetGeometry( _display, _win[num_win]->get_window(), &aWindow, &x_return, &y_return,
-                          &_win_size[num_win][0], &_win_size[num_win][1], &border_width_return, &depth_return );
-            XTranslateCoordinates( _display, _win[num_win]->get_window(), DefaultRootWindow(_display), 0, 0, &dest_x_return, &dest_y_return, &aWindow );
-            
-            _win_pos[num_win][0] = dest_x_return - x_return;
-            _win_pos[num_win][1] = dest_y_return - y_return;
-            
-            // 2) Delete window and mark as "not to be shown"
-            delete _win[num_win];
-            _win[num_win] = NULL;
-            _show_window &= ~(1 << num_win);
-          }
-          else
-          {
-            _win[num_win] = new ae_X11_window(  _display, _screen, _atoms, _win_pos[num_win][0], _win_pos[num_win][1],
-                                                _win_size[num_win][0], _win_size[num_win][1], _win_name[num_win] );
-            _new_show_window |= 1 << num_win;
-            _show_window |= _new_show_window;
-            draw_window( num_win );
-          }
-        }     
-        else if ( event.xkey.keycode == _key_codes[KEY_P] )
-        {
-          printf(" P A U S E D \n");
-          bool pause_key  = false;
-          while ( ! pause_key )
-          {
-            if ( XCheckIfEvent( _display, &event, AlwaysTruePredicate, 0) )
-            {
-              if ( event.xkey.keycode == _key_codes[KEY_P] )
-              {
-                pause_key = true;               
-              }
-            }
-          }
-        }
-        else if ( (event.xkey.state & ControlMask) && (event.xkey.keycode == _key_codes[KEY_Q]))
-        {
-          printf(" Q U I T   R E Q U E S T E D\n");
-          _quit_signal_received = true;
-          // We do not exit here, because it is cleaner to let the main program
-          // interpret the signal and call the destructor of the simulation.
-          // This ensures that the connection to the X server will be closed 
-          // in a clean way, which is much better if we want to run other
-          // X applications afterwards!
-        }
-        
-        break;
-      }
-      default :
-      {
-        // printf("event not handled \n");
-        break;
-      }
-    }
-  }
-}
-
-void ae_exp_manager_X11::toggle_display_on_off( void )
-{
-  // Mark action to be done
-  _handle_display_on_off = true;
-}
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_exp_manager_X11::initialize( bool with_grid /*= false*/, bool with_plasmids /*= false*/ )
-{
-  // Initialize window structures
-  _win      = new ae_X11_window* [NB_WIN];
-  _win_size = new unsigned int* [NB_WIN];
-  _win_pos  = new int* [NB_WIN];
-  
-  for ( int8_t i = 0 ; i < NB_WIN ; i++ )
-  {
-    _win[i] = NULL;
-    
-    // Default values
-    _win_size[i] = new unsigned int[2];
-    _win_size[i][0] = 300;
-    _win_size[i][1] = 300;
-    _win_pos[i] = new int[2];
-    _win_pos[i][0]  = 0;
-    _win_pos[i][1]  = 0;
-  }
-  
-  // Set phenotype window width
-  _win_size[1][0] = 600;
-  
-  // Set CDS and RNA window width
-  if ( with_plasmids )
-  {
-    _win_size[2][0] = 600;
-    _win_size[3][0] = 600;
-  }
-  
-  // Set initial positions if screen is large enough
-  if ( with_plasmids && with_grid )
-  {
-    //if ( XDisplayWidth( _display, _screen ) >= 900 && XDisplayHeight( _display, _screen ) >= 650 )
-    {
-      _win_pos[0][0]  = 0;
-      _win_pos[0][1]  = 0;
-      _win_pos[1][0]  = 300;
-      _win_pos[1][1]  = 0;
-      _win_pos[2][0]  = 0;
-      _win_pos[2][1]  = 350;
-      _win_pos[3][0]  = 0;
-      _win_pos[3][1]  = 700;
-    }
-  }
-  else if ( with_plasmids )
-  {
-    //if ( XDisplayWidth( _display, _screen ) >= 900 && XDisplayHeight( _display, _screen ) >= 650 )
-    {
-      _win_pos[0][0]  = 0;
-      _win_pos[0][1]  = 0;
-      _win_pos[1][0]  = 300;
-      _win_pos[1][1]  = 0;
-      _win_pos[2][0]  = 0;
-      _win_pos[2][1]  = 350;
-      _win_pos[3][0]  = 0;
-      _win_pos[3][1]  = 700;
-    }
-  }
-  else if ( with_grid )
-  {
-    //if ( XDisplayWidth( _display, _screen ) >= 900 && XDisplayHeight( _display, _screen ) >= 650 )
-    {
-      _win_pos[0][0]  = 0;
-      _win_pos[0][1]  = 0;
-      _win_pos[1][0]  = 300;
-      _win_pos[1][1]  = 0;
-      _win_pos[2][0]  = 0;
-      _win_pos[2][1]  = 350;
-      _win_pos[3][0]  = 300;
-      _win_pos[3][1]  = 350;
-    }
-  }
-  else // ( ! with_plasmids && ! with_grid )
-  {
-    //if ( XDisplayWidth( _display, _screen ) >= 900 && XDisplayHeight( _display, _screen ) >= 650 )
-    {
-      _win_pos[0][0]  = 0;
-      _win_pos[0][1]  = 0;
-      _win_pos[1][0]  = 300;
-      _win_pos[1][1]  = 0;
-      _win_pos[2][0]  = 0;
-      _win_pos[2][1]  = 350;
-      _win_pos[3][0]  = 300;
-      _win_pos[3][1]  = 350;
-    }
-  }
-  
-  
-  // Visible windows at the beginning of the run
-  if ( with_grid )
-  {
-    _show_window  = 0x007F; // hex for bin 1111111  => show first 7 windows
-  }
-  else
-  {
-    _show_window  = 0x000F;   // hex for bin 1111   => show first 4 windows
-  }
-  _new_show_window = _show_window;
-  
-  
-  _win_name = new char*[NB_WIN];
-  if ( with_grid )  _win_name[0] = (char*) "Population grid";
-  else              _win_name[0] = (char*) "Population";
-  
-  _win_name[1] = (char*) "Phenotypic profile";
-  _win_name[2] = (char*) "Genes";
-  _win_name[3] = (char*) "RNAs";
-  _win_name[4] = (char*) "Secreted compound present";
-  _win_name[5] = (char*) "Metabolic fitness";
-  _win_name[6] = (char*) "Current secretion";
-}
-
-int8_t ae_exp_manager_X11::identify_window( Window winID )
-{
-  for ( int8_t i = 0 ; i < NB_WIN ; i++ )
-  {
-    if ( _win[i] != NULL )
-    {
-      if ( _win[i]->get_window() == winID ) return i;
-    }
-  }
-  
-  return -1;
-}
-
-void ae_exp_manager_X11::draw_window( int8_t win_number )
-{
-  if ( _win[win_number] == NULL)
-  {
-    fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n");
-    return;
-  }
-  
-  ae_X11_window* cur_win = _win[win_number];
-
-  switch ( win_number )
-  {
-    case 0:
-    {
-      break;
-    }
-
-    case 1:
-    {
-      cur_win->blacken();
-      
-      // Display colour bar
-      char* color;
-      for ( int16_t i = 0 ; i < cur_win->get_width() ; i++ )
-      {
-        color = ae_X11_window::get_color( ((double)i / cur_win->get_width()) * (X_MAX - X_MIN) );
-        //~ cur_win->draw_line( i, 0, i, cur_win->get_height() / 20, color );
-        cur_win->draw_line( i, cur_win->get_height() * 19 / 20, i, cur_win->get_height(), color );
-        delete [] color;
-      }
-      
-      break;
-    }
-
-    case 2:
-    {
-      break;
-    }
-
-    case 3:
-    {
-      break;
-    }
-
-    // Amount of secreted compound present at each grid location
-    case 4:
-    {
-      break;
-    }
-   
-    // Metabolic fitness  grid
-    case 5:
-    {
-      break;
-    }
-
-    // Current secretion (how much is secreted by each organism)
-    case 6:
-    {
-      break;
-    }
-  }
-  
-  refresh_window( win_number );
-  _new_show_window &= ~(1 << win_number);
-
-  XFlush(_display);
-}
-
-void ae_exp_manager_X11::refresh_window( int8_t win_number )
-{
-  if ( _win[win_number] == NULL)
-  {
-    fprintf(stderr, "Error: cannot draw this window, it doesn't exist.\n");
-    return;
-  }
-  
-  ae_X11_window* cur_win = _win[win_number];
-
-  switch ( win_number )
-  {
-    // Main window (population)
-    case 0 :
-    {
-      cur_win->blacken();
-      
-      if ( is_spatially_structured() )
-      {
-        double** grid = get_spatial_structure()->get_total_fitness_grid();
-        ((ae_population_X11*)_pop)->display_grid( cur_win, grid );
-        
-        // Has been allocated in ae_spatial_structure::get_total_fitness_grid()
-        for ( int16_t x = 0 ; x < get_grid_width() ; x++ )
-        {
-          delete [] grid[x];
-        }
-        delete [] grid;
-      }
-      else
-      {
-        ((ae_population_X11*)_pop)->display( cur_win );
-      }
-      break;
-    }
-    
-    // Display phenotypes and environment
-    case 1 :
-    {
-      // Blacken all the window except the colour bar
-      cur_win->fill_rectangle( 0, 0, cur_win->get_width(), cur_win->get_height() * 19 / 20, BLACK );
-      
-      // Mark all the non-metabolic segments (paint them in grey)
-      if ( get_env()->get_nb_segments() > 1 )
-      {
-        ae_env_segment** segments = get_env()->get_segments();
-     
-        for ( int16_t i = 0 ; i < get_env()->get_nb_segments() ; i++ )
-        {
-          if ( segments[i]->feature != METABOLISM )
-          {
-            if ( segments[i]->feature == NEUTRAL )
-            {
-              cur_win->fill_rectangle(  cur_win->get_width() * segments[i]->start / (X_MAX-X_MIN), 0.0,
-                                        cur_win->get_width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN),
-                                        cur_win->get_height() * 19 / 20, DARKER_GREY );
-            }
-            else
-            {
-              cur_win->fill_rectangle(  cur_win->get_width() * segments[i]->start / (X_MAX-X_MIN), 0.0,
-                                        cur_win->get_width() * (segments[i]->stop - segments[i]->start) / (X_MAX-X_MIN),
-                                        cur_win->get_height() * 19 / 20, GREY );
-            }
-          }
-        }
-      }    
-
-      // Display all the phenotypes (blue)
-      ae_list_node<ae_individual*>* indiv_node = _pop->get_indivs()->get_first();
-      ae_individual*  indiv;
-      
-      while ( indiv_node != NULL )
-      {
-        indiv = indiv_node->get_obj();
-        
-        indiv->get_phenotype()->display( cur_win, BLUE );
-        
-        if ( indiv->get_allow_plasmids() )
-        {
-          ((ae_fuzzy_set_X11*)indiv->get_genetic_unit( 0 )->get_phenotypic_contribution())->display( cur_win, YELLOW );
-          ((ae_fuzzy_set_X11*)indiv->get_genetic_unit( 1 )->get_phenotypic_contribution())->display( cur_win, GREEN );
-        }
-        
-        indiv_node = indiv_node->get_next();
-      }
-        
-      // Display best indiv's phenotype (white)
-      get_best_indiv()->get_phenotype()->display( cur_win, WHITE, true );
-      
-      // Display environment (red)
-      get_env()->display( cur_win, RED, false, true );
-    }
-    break;
-
-    // Display genes
-    case 2 :
-    {
-      cur_win->blacken();
-      
-      ae_individual_X11* indiv = dynamic_cast<ae_individual_X11*>( get_best_indiv() );
-      indiv->display_cdss( cur_win );
-    }
-    break;
-
-    // Display RNAs
-    case 3 :
-    {
-      cur_win->blacken();
-      
-      ae_individual_X11* indiv = dynamic_cast<ae_individual_X11*>( get_best_indiv() );
-      indiv->display_rnas( cur_win );
-    }
-    break;
-
-    // Display the amount of secreted compound present at each location
-    case 4 :
-    {
-      cur_win->blacken();
-      
-      if ( is_spatially_structured() )
-      {
-        ((ae_population_X11*)_pop)->display_grid( cur_win, get_spatial_structure()->get_secretion_present_grid());
-      }
-    }
-    break;
-   
-    // Display the metabolic fitness grid
-    case 5 :
-    {
-      cur_win->blacken();
-      
-      ((ae_population_X11*)_pop)->display_grid( cur_win, get_spatial_structure()->get_metabolic_fitness_grid());
-    }
-    break;
-
-    // display current secretion (how much is secreted by each organism)
-    case 6:
-    {
-      cur_win->blacken();
-      
-      ((ae_population_X11*)_pop)->display_grid( cur_win, get_spatial_structure()->get_secreted_amount_grid());
-    }
-    break;
-  }
-
-  XFlush( _display );
-}
-
-
-
-
-
-void ae_exp_manager_X11::set_codes( void )
-{
-  _key_codes = new KeyCode[50];
-  assert( _key_codes );
-  
-  _key_codes[KEY_ESCAPE]  = XKeysymToKeycode( _display, XK_Escape );
-  _key_codes[KEY_F1]      = XKeysymToKeycode( _display, XK_F1 );
-  _key_codes[KEY_F2]      = XKeysymToKeycode( _display, XK_F2 );
-  _key_codes[KEY_F3]      = XKeysymToKeycode( _display, XK_F3 );
-  _key_codes[KEY_F4]      = XKeysymToKeycode( _display, XK_F4 );
-  _key_codes[KEY_F5]      = XKeysymToKeycode( _display, XK_F5 );
-  _key_codes[KEY_F6]      = XKeysymToKeycode( _display, XK_F6 );
-  _key_codes[KEY_F7]      = XKeysymToKeycode( _display, XK_F7 );
-  _key_codes[KEY_F8]      = XKeysymToKeycode( _display, XK_F8 );
-  _key_codes[KEY_F9]      = XKeysymToKeycode( _display, XK_F9 );
-  _key_codes[KEY_F10]     = XKeysymToKeycode( _display, XK_F10 );
-  _key_codes[KEY_F11]     = XKeysymToKeycode( _display, XK_F11 );
-  _key_codes[KEY_F12]     = XKeysymToKeycode( _display, XK_F12 );
-  _key_codes[KEY_A]       = XKeysymToKeycode( _display, XK_A );
-  _key_codes[KEY_Q]       = XKeysymToKeycode( _display, XK_Q );
-  _key_codes[KEY_W]       = XKeysymToKeycode( _display, XK_W );
-  _key_codes[KEY_Z]       = XKeysymToKeycode( _display, XK_Z );
-  _key_codes[KEY_S]       = XKeysymToKeycode( _display, XK_S );
-  _key_codes[KEY_X]       = XKeysymToKeycode( _display, XK_X );
-  _key_codes[KEY_E]       = XKeysymToKeycode( _display, XK_E );
-  _key_codes[KEY_D]       = XKeysymToKeycode( _display, XK_D );
-  _key_codes[KEY_C]       = XKeysymToKeycode( _display, XK_C );
-  _key_codes[KEY_R]       = XKeysymToKeycode( _display, XK_R );
-  _key_codes[KEY_F]       = XKeysymToKeycode( _display, XK_F );
-  _key_codes[KEY_V]       = XKeysymToKeycode( _display, XK_V );
-  _key_codes[KEY_T]       = XKeysymToKeycode( _display, XK_T );
-  _key_codes[KEY_G]       = XKeysymToKeycode( _display, XK_G );
-  _key_codes[KEY_B]       = XKeysymToKeycode( _display, XK_B );
-  _key_codes[KEY_Y]       = XKeysymToKeycode( _display, XK_Y );
-  _key_codes[KEY_H]       = XKeysymToKeycode( _display, XK_H );
-  _key_codes[KEY_N]       = XKeysymToKeycode( _display, XK_N );
-  _key_codes[KEY_U]       = XKeysymToKeycode( _display, XK_U );
-  _key_codes[KEY_J]       = XKeysymToKeycode( _display, XK_J );
-  _key_codes[KEY_I]       = XKeysymToKeycode( _display, XK_I );
-  _key_codes[KEY_K]       = XKeysymToKeycode( _display, XK_K );
-  _key_codes[KEY_O]       = XKeysymToKeycode( _display, XK_O );
-  _key_codes[KEY_L]       = XKeysymToKeycode( _display, XK_L );
-  _key_codes[KEY_P]       = XKeysymToKeycode( _display, XK_P );
-  _key_codes[KEY_M]       = XKeysymToKeycode( _display, XK_M );
-  _key_codes[KEY_1]       = XKeysymToKeycode( _display, XK_1 );
-  _key_codes[KEY_2]       = XKeysymToKeycode( _display, XK_2 );
-  _key_codes[KEY_3]       = XKeysymToKeycode( _display, XK_3 );
-  _key_codes[KEY_4]       = XKeysymToKeycode( _display, XK_4 );
-  _key_codes[KEY_5]       = XKeysymToKeycode( _display, XK_5 );
-  _key_codes[KEY_6]       = XKeysymToKeycode( _display, XK_6 );
-  _key_codes[KEY_7]       = XKeysymToKeycode( _display, XK_7 );
-  _key_codes[KEY_8]       = XKeysymToKeycode( _display, XK_8 );
-  _key_codes[KEY_9]       = XKeysymToKeycode( _display, XK_9 );
-}
diff --git a/src/libaevol/ae_exp_setup.cpp b/src/libaevol/ae_exp_setup.cpp
deleted file mode 100644
index af3cf72..0000000
--- a/src/libaevol/ae_exp_setup.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <zlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_setup.h>
-#include <ae_population.h>
-
-#ifdef __X11
-  #include <ae_population_X11.h>
-#endif
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_exp_setup                             #
-//                                                                             #
-//##############################################################################
-
-// ===========================================================================
-//                         Definition of static attributes
-// ===========================================================================
-
-// ===========================================================================
-//                                  Constructors
-// ===========================================================================
-ae_exp_setup::ae_exp_setup( ae_exp_manager* exp_m )
-{
-  _exp_m  = exp_m;
-  
-  // -------------------------------------------------------------- Selection
-  _sel = new ae_selection( exp_m );
-  
-  // --------------------------------------------------------------- Transfer
-  _with_HT                    = false;
-  _repl_HT_with_close_points  = false;
-  _HT_ins_rate                = 0.0;
-  _HT_repl_rate               = 0.0;
-  _repl_HT_detach_rate         = 0.0;
-  
-  // --------------------------------------------------------------- Plasmids
-  _with_plasmids    = false;
-  _prob_plasmid_HT  = 0.0;
-  _tune_donor_ability     = 0.0;
-  _tune_recipient_ability = 0.0;
-  _donor_cost       = 0.0;
-  _recipient_cost   = 0.0;
-  _swap_GUs         = false;
-  
-  // -------------------------------------------------------------- Secretion
-  _with_secretion = false;
-  _secretion_contrib_to_fitness = 0.0;
-  _secretion_cost               = 0.0;
-}
-  
-
-// ===========================================================================
-//                                 Destructor
-// ===========================================================================
-ae_exp_setup::~ae_exp_setup( void )
-{
-  delete _sel;
-}
-
-// ===========================================================================
-//                                 Public Methods
-// ===========================================================================
-/*!
-*/
-void ae_exp_setup::write_setup_file( gzFile exp_setup_file ) const
-{
-  // --------------------------------------------------------------- Transfer
-  int8_t tmp_with_HT = _with_HT;
-  gzwrite( exp_setup_file, &tmp_with_HT, sizeof(tmp_with_HT) );
-  int8_t tmp_repl_HT_with_close_points = _repl_HT_with_close_points;
-  gzwrite( exp_setup_file, &tmp_repl_HT_with_close_points, sizeof(tmp_repl_HT_with_close_points) );
-  if ( _with_HT )
-  {
-    gzwrite( exp_setup_file, &_HT_ins_rate,  sizeof(_HT_ins_rate) );
-    gzwrite( exp_setup_file, &_HT_repl_rate, sizeof(_HT_repl_rate) );
-  }
-  if(_repl_HT_with_close_points)
-  {
-    gzwrite( exp_setup_file, &_repl_HT_detach_rate,  sizeof(_repl_HT_detach_rate) );
-  }
-  
-  // --------------------------------------------------------------- Plasmids
-  int8_t tmp_with_plasmids = get_with_plasmids();
-  gzwrite( exp_setup_file, &tmp_with_plasmids, sizeof(tmp_with_plasmids) );
-  if ( tmp_with_plasmids )
-  {
-    gzwrite( exp_setup_file, &_prob_plasmid_HT,  sizeof(_prob_plasmid_HT) );
-    gzwrite( exp_setup_file, &_tune_donor_ability,  sizeof(_tune_donor_ability) );
-    gzwrite( exp_setup_file, &_tune_recipient_ability,  sizeof(_tune_recipient_ability) );
-    gzwrite( exp_setup_file, &_donor_cost,  sizeof(_donor_cost) );
-    gzwrite( exp_setup_file, &_recipient_cost,  sizeof(_recipient_cost) );
-    int8_t tmp_swap_GUs = _swap_GUs;
-    gzwrite( exp_setup_file, &tmp_swap_GUs, sizeof(tmp_swap_GUs) );
-  }
-  
-  // -------------------------------------------------------------- Secretion
-  int8_t tmp_with_secretion = _with_secretion;
-  gzwrite( exp_setup_file, &tmp_with_secretion, sizeof(tmp_with_secretion) );
-  gzwrite( exp_setup_file, &_secretion_contrib_to_fitness, sizeof(_secretion_contrib_to_fitness) );
-  gzwrite( exp_setup_file, &_secretion_cost, sizeof(_secretion_cost) );
-  
-  get_sel()->write_setup_file( exp_setup_file );
-}
-
-void ae_exp_setup::write_setup_file( FILE* exp_setup_file ) const
-{
-  // --------------------------------------------------------------- Transfer
-  //...
-  
-  // -------------------------------------------------------------- Secretion
-  //...
-  
-  get_sel()->write_setup_file( exp_setup_file );
-}
-
-void ae_exp_setup::load( gzFile setup_file, gzFile backup_file, bool verbose )
-{
-  // -------------------------------------------- Retrieve transfer parameters
-  int8_t tmp_with_HT;
-  gzread( setup_file, &tmp_with_HT, sizeof(tmp_with_HT) );
-  _with_HT = tmp_with_HT ? 1 : 0;
-  int8_t tmp_repl_HT_with_close_points;
-  gzread( setup_file, &tmp_repl_HT_with_close_points, sizeof(tmp_repl_HT_with_close_points) );
-  _repl_HT_with_close_points = tmp_repl_HT_with_close_points ? 1 : 0;
-  if ( _with_HT )
-  {
-    gzread( setup_file, &_HT_ins_rate,  sizeof(_HT_ins_rate) );
-    gzread( setup_file, &_HT_repl_rate, sizeof(_HT_repl_rate) );
-  }
-   if(_repl_HT_with_close_points)
-  {
-    gzread( setup_file, &_repl_HT_detach_rate,  sizeof(_repl_HT_detach_rate) );
-  }
-  
-  
-  // -------------------------------------------- Retrieve plasmid parameters
-  int8_t tmp_with_plasmids;
-  gzread( setup_file, &tmp_with_plasmids, sizeof(tmp_with_plasmids) );
-  _with_plasmids = tmp_with_plasmids ? 1 : 0;
-  if ( _with_plasmids )
-  {
-    gzread( setup_file, &_prob_plasmid_HT,  sizeof(_prob_plasmid_HT) );
-    gzread( setup_file, &_tune_donor_ability,  sizeof(_tune_donor_ability) );
-    gzread( setup_file, &_tune_recipient_ability,  sizeof(_tune_recipient_ability) );
-    gzread( setup_file, &_donor_cost,  sizeof(_donor_cost) );
-    gzread( setup_file, &_recipient_cost,  sizeof(_recipient_cost) );
-    int8_t tmp_swap_GUs;
-    gzread( setup_file, &tmp_swap_GUs, sizeof(tmp_swap_GUs) );
-    _swap_GUs = tmp_swap_GUs ? 1 : 0;
-  }
-  
-  // ------------------------------------------ Retrieve secretion parameters
-  int8_t tmp_with_secretion;
-  gzread( setup_file, &tmp_with_secretion, sizeof(tmp_with_secretion) );
-  _with_secretion = tmp_with_secretion ? true : false;
-  gzread( setup_file, &_secretion_contrib_to_fitness, sizeof(_secretion_contrib_to_fitness) );
-  gzread( setup_file, &_secretion_cost, sizeof(_secretion_cost) );
-  
-  // ---------------------------------------------- Retrieve selection context
-  get_sel()->load( setup_file, backup_file, verbose );
-}
-
-void ae_exp_setup::load( FILE* setup_file, gzFile backup_file, bool verbose )
-{
-  printf( "Plain text setup file support not implemented yet (sorry)\n" );
-  exit( EXIT_FAILURE );
-}
-
-
-
-
-// ===========================================================================
-//                                Protected Methods
-// ===========================================================================
diff --git a/src/libaevol/ae_exp_setup.h b/src/libaevol/ae_exp_setup.h
deleted file mode 100644
index 1e44c36..0000000
--- a/src/libaevol/ae_exp_setup.h
+++ /dev/null
@@ -1,382 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef __AE_EXP_SETUP_H__
-#define __AE_EXP_SETUP_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_environment.h>
-#include <ae_selection.h>
-#include <ae_stats.h>
-#include <ae_logs.h>
-#include <ae_tree.h>
-#include <ae_dump.h>
-#include <ae_jumping_mt.h>
-
-
-
-
-// ===========================================================================
-//                          Class declarations
-// ===========================================================================
-class ae_param_loader;
-class ae_param_overloader;
-
-
-
-
- 
-class ae_exp_setup : public ae_object
-{
-  friend class ae_exp_manager;
-  
-  public :
-  
-    // =======================================================================
-    //                             Constructors
-    // =======================================================================
-    ae_exp_setup( ae_exp_manager* exp_m );
-  
-  
-    // =======================================================================
-    //                             Destructors
-    // =======================================================================
-    virtual ~ae_exp_setup( void );
-  
-  
-    // =======================================================================
-    //                         Accessors: getters
-    // =======================================================================
-    // ----------------------------------------------------- Selection context
-    inline ae_selection* get_sel( void ) const;
-  
-    // --------------------------------------------------------------- Transfer
-    inline bool   get_with_HT( void ) const;
-    inline bool   get_repl_HT_with_close_points ( void ) const;
-    inline double get_HT_ins_rate( void ) const;
-    inline double get_HT_repl_rate( void ) const;
-    inline double get_repl_HT_detach_rate( void ) const;
-    
-    // --------------------------------------------------------------- Plasmids
-    // See comments in ae_exp_manager.h on how plasmids are handled
-    inline bool   get_with_plasmids( void ) const;
-    inline double get_prob_plasmid_HT( void ) const;
-    inline double get_tune_donor_ability( void ) const;
-    inline double get_tune_recipient_ability( void ) const;
-    inline double get_donor_cost( void ) const;
-    inline double get_recipient_cost( void ) const;
-    inline bool   get_swap_GUs( void ) const;
-    
-    // -------------------------------------------------------------- Secretion
-    inline bool   get_with_secretion( void ) const;
-    inline double get_secretion_contrib_to_fitness( void ) const;
-    inline double get_secretion_cost( void ) const;
-  
-  
-    // =======================================================================
-    //                         Accessors: setters
-    // =======================================================================
-    // --------------------------------------------------------------- Transfer
-    inline void set_with_HT( bool with_HT );
-    inline void set_repl_HT_with_close_points( bool repl_HT_with_close_points );
-    inline void set_HT_ins_rate( double HT_ins_rate );
-    inline void set_HT_repl_rate( double HT_repl_rate );
-    inline void set_repl_HT_detach_rate( double repl_HT_detach_rate );
-  
-    // --------------------------------------------------------------- Plasmids
-    inline void set_with_plasmids( bool with_p );
-    //~ inline void set_nb_plasmid_HT( int16_t nb_p_HT );
-    inline void set_prob_plasmid_HT( double prob_p_HT );
-    inline void set_tune_donor_ability( double tune_donor_ability );
-    inline void set_tune_recipient_ability( double tune_recipient_ability );
-    inline void set_donor_cost( double donor_cost );
-    inline void set_recipient_cost( double recipient_cost );
-    inline void set_swap_GUs( bool swap_GUs );
-    
-    // -------------------------------------------------------------- Secretion
-    inline void set_with_secretion( bool with_secretion );
-    inline void set_secretion_contrib_to_fitness( double secretion_contrib );
-    inline void set_secretion_cost( double secretion_cost );
-  
-  
-    // =======================================================================
-    //                            Public Methods
-    // =======================================================================
-    void write_setup_file( gzFile exp_setup_file ) const;
-    void write_setup_file( FILE* exp_setup_file ) const;
-    void save( gzFile backup_file ) const;
-    void load( gzFile setup_file, gzFile backup_file, bool verbose );
-    void load( FILE*  setup_file, gzFile backup_file, bool verbose );
-    
-    inline void step_to_next_generation( void );
-    
-    
-    // =======================================================================
-    //                           Public Attributes
-    // =======================================================================
-  
-  
-  
-  
-  protected :
-  
-    // =======================================================================
-    //                         Forbidden Constructors
-    // =======================================================================
-    ae_exp_setup( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_exp_setup( const ae_exp_setup &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    // =======================================================================
-    //                           Protected Methods
-    // =======================================================================
-    virtual void display( void ) {};
-  
-    // =======================================================================
-    //                          Protected Attributes
-    // =======================================================================
-    ae_exp_manager* _exp_m;
-      
-    // ----------------------------------------------------- Selection context
-    ae_selection* _sel;
-    
-    // --------------------------------------------------- Transfer parameters
-    bool    _with_HT;
-    bool    _repl_HT_with_close_points;
-    double  _HT_ins_rate;
-    double  _HT_repl_rate;
-    double  _repl_HT_detach_rate;
-  
-    // --------------------------------------------------- Plasmids parameters
-    bool    _with_plasmids;
-    double  _prob_plasmid_HT; // Base transfer ability independent of evolvable donor and recipient ability
-    double  _tune_donor_ability; // How much the individuals can tune their ability to send plasmids
-    double  _tune_recipient_ability; // How much the individuals can tune their ability to receive plasmids
-    double  _donor_cost;
-    double  _recipient_cost;
-    bool    _swap_GUs; // Whether plasmid HT is uni- or bidirectional
-    
-    // -------------------------------------------------- Secretion parameters
-    bool    _with_secretion;
-    double  _secretion_contrib_to_fitness;
-    double  _secretion_cost;
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-inline ae_selection* ae_exp_setup::get_sel( void ) const
-{
-  return _sel;
-}
-
-inline bool ae_exp_setup::get_with_HT( void ) const
-{
-  return _with_HT;
-}
-
-inline bool ae_exp_setup::get_repl_HT_with_close_points( void ) const
-{
-  return _repl_HT_with_close_points;
-}
-
-inline double ae_exp_setup::get_HT_ins_rate( void ) const
-{
-  return _HT_ins_rate;
-}
-
-inline double ae_exp_setup::get_HT_repl_rate( void ) const
-{
-  return _HT_repl_rate;
-}
-
-inline double ae_exp_setup::get_repl_HT_detach_rate( void ) const
-{
-  return _repl_HT_detach_rate;
-}
-
-inline bool ae_exp_setup::get_with_plasmids( void ) const
-{
-  return _with_plasmids;
-}
-
-inline double ae_exp_setup::get_prob_plasmid_HT( void ) const
-{
-  return _prob_plasmid_HT;
-}
-
-inline double ae_exp_setup::get_tune_donor_ability( void ) const
-{
-  return _tune_donor_ability;
-}
-
-inline double ae_exp_setup::get_tune_recipient_ability( void ) const
-{
-  return _tune_recipient_ability;
-}
-
-inline double ae_exp_setup::get_donor_cost( void ) const
-{
-  return _donor_cost;
-}
-
-inline double ae_exp_setup::get_recipient_cost( void ) const
-{
-  return _recipient_cost;
-}
-
-inline bool   ae_exp_setup::get_swap_GUs( void ) const
-{
-  return _swap_GUs;
-}
-
-inline bool ae_exp_setup::get_with_secretion( void ) const
-{
-  return _with_secretion;
-}
-
-inline double ae_exp_setup::get_secretion_contrib_to_fitness( void ) const
-{
-  return _secretion_contrib_to_fitness;
-}
-
-inline double ae_exp_setup::get_secretion_cost( void ) const
-{
-  return _secretion_cost;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-// --------------------------------------------------------------- Transfer
-inline void ae_exp_setup::set_with_HT( bool with_HT )
-{
-  _with_HT = with_HT;
-}
-
-inline void ae_exp_setup::set_repl_HT_with_close_points( bool repl_HT_with_close_points )
-{
-  _repl_HT_with_close_points = repl_HT_with_close_points;
-}
-
-inline void ae_exp_setup::set_HT_ins_rate( double HT_ins_rate )
-{
-  _HT_ins_rate = HT_ins_rate;
-}
-
-inline void ae_exp_setup::set_HT_repl_rate( double HT_repl_rate )
-{
-  _HT_repl_rate = HT_repl_rate;
-}
-
-inline void ae_exp_setup::set_repl_HT_detach_rate( double repl_HT_detach_rate )
-{
-  _repl_HT_detach_rate = repl_HT_detach_rate;
-}
-
-inline void ae_exp_setup::set_with_plasmids( bool with_p )
-{
-  _with_plasmids = with_p;
-}
-
-inline void ae_exp_setup::set_prob_plasmid_HT( double prob_p_HT )
-{
-  _prob_plasmid_HT = prob_p_HT;
-}
-
-inline void ae_exp_setup::set_tune_donor_ability( double tune_donor_ability )
-{
-  _tune_donor_ability = tune_donor_ability;
-}
-
-inline void ae_exp_setup::set_tune_recipient_ability( double tune_recipient_ability )
-{
-  _tune_recipient_ability = tune_recipient_ability;
-}
-
-inline void ae_exp_setup::set_donor_cost( double donor_cost )
-{
-  _donor_cost = donor_cost;
-}
-
-inline void ae_exp_setup::set_recipient_cost( double recipient_cost )
-{
-  _recipient_cost = recipient_cost;
-}
-
-inline void ae_exp_setup::set_swap_GUs( bool swap_GUs )
-{
-  _swap_GUs = swap_GUs;
-}
-
-// -------------------------------------------------------------- Secretion
-inline void ae_exp_setup::set_with_secretion( bool with_secretion )
-{
-  _with_secretion = with_secretion;
-}
-
-inline void ae_exp_setup::set_secretion_contrib_to_fitness( double secretion_contrib )
-{
-  _secretion_contrib_to_fitness = secretion_contrib;
-}
-
-inline void ae_exp_setup::set_secretion_cost( double secretion_cost )
-{
-  _secretion_cost = secretion_cost;
-}
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_exp_setup::step_to_next_generation( void )
-{ 
-  // Make the individuals reproduce
-  _sel->step_to_next_generation();
-}
-
-
-#endif // __AE_EXP_SETUP_H__
diff --git a/src/libaevol/ae_fuzzy_set.cpp b/src/libaevol/ae_fuzzy_set.cpp
deleted file mode 100644
index a08437f..0000000
--- a/src/libaevol/ae_fuzzy_set.cpp
+++ /dev/null
@@ -1,1026 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_fuzzy_set.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_fuzzy_set                              #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_fuzzy_set::ae_fuzzy_set( void )
-{
-  _points = new ae_list<ae_point_2d*>();
-  
-  initialize();
-}
-
-ae_fuzzy_set::ae_fuzzy_set( const ae_fuzzy_set &model )
-{
-  _points = new ae_list<ae_point_2d*>();
-
-  ae_list_node<ae_point_2d*>* model_point_parser = model._points->get_first();
-  ae_point_2d*  model_point;
-
-  while ( model_point_parser != NULL )
-  {
-    model_point = model_point_parser->get_obj();
-
-    _points->add( new ae_point_2d( *model_point ) );
-
-    model_point_parser = model_point_parser->get_next();
-  }
-}
-
-ae_fuzzy_set::ae_fuzzy_set( gzFile backup_file )
-{
-  _points = new ae_list<ae_point_2d*>();
-  
-  load( backup_file );
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_fuzzy_set::~ae_fuzzy_set( void )
-{
-  if ( _points != NULL )
-  {
-    _points->erase( true );
-    delete _points;
-  }
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_fuzzy_set::simplify( void )
-{
-  // Removes useless points like A or B:
-  //
-  //  ^      B
-  //  |   +--+-----+
-  //  |   |         \     ---
-  //  |  A+          \   /
-  //  |   |           \ /
-  //  |---+------------+-------+----->
-
-  //  printf("initial nb of points %d\n",_points.get_count());
-
-  ae_list_node<ae_point_2d*>* node = _points->get_first();
-  ae_list_node<ae_point_2d*>* next_node = NULL;
-  ae_list_node<ae_point_2d*>* other_node = NULL;
-  ae_point_2d* pt = NULL;
-  ae_point_2d* next_pt = NULL;
-  ae_point_2d* other_pt = NULL;
-  double x, y, next_x, next_y, other_x, other_y;
-
-  while ( node != NULL )
-  {
-    pt = node->get_obj();
-    x = pt->x;
-    y = pt->y;
-    next_node = node->get_next();
-    if ( next_node != NULL )
-    {
-      next_pt = next_node->get_obj();
-      next_x = next_pt->x;
-      next_y = next_pt->y;
-      if ( next_x == x )
-      {
-        // discontinuity on x
-        // is the next point also on the same x ?
-        other_node = next_node->get_next();
-        while ( other_node != NULL )
-        {
-          other_pt = other_node->get_obj();
-          other_x = other_pt->x;
-          other_y = other_pt->y;
-          if ( other_x == x )
-          {
-            _points->remove( next_node, true, true );
-            next_node = other_node;
-          }
-          else
-          {
-            break;
-          }
-          other_node = other_node->get_next();
-        }
-      }
-    }
-    node = next_node;
-  }
-
-
-  node = _points->get_first();
-  next_node = NULL;
-  other_node = NULL;
-  pt = NULL;
-  next_pt = NULL;
-  other_pt = NULL;
-
-  while ( node != NULL )
-  {
-    pt = node->get_obj();
-    x = pt->x;
-    y = pt->y;
-    next_node = node->get_next();
-    if ( next_node != NULL )
-    {
-      next_pt = next_node->get_obj();
-      next_x = next_pt->x;
-      next_y = next_pt->y;
-      if ( next_y == y )
-      {
-        // plateau on y
-        // is the next point also on the same y ?
-        other_node = next_node->get_next();
-        while ( other_node != NULL )
-        {
-          other_pt = other_node->get_obj();
-          other_x = other_pt->x;
-          other_y = other_pt->y;
-          if ( other_y == y )
-          {
-            _points->remove( next_node, true, true );
-            next_node = other_node;
-            next_pt = next_node->get_obj();
-          }
-          else break;
-          other_node = other_node->get_next();
-        }
-      }
-    }
-    node = next_node;
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-void ae_fuzzy_set::print_points( void ) const
-{
-  ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-  ae_point_2d*  point;
-
-  while ( point_node != NULL )
-  {
-    point = point_node->get_obj();
-
-    printf( "  (%f, %f)\n", point->x, point->y );
-
-    point_node = point_node->get_next();
-  }
-}
-
-void ae_fuzzy_set::add_triangle( double mean, double width, double height )
-{
-  assert( X_MIN <= mean   && mean <= X_MAX );
-  assert( W_MIN <= width ); // the maximum width depends on each individual
-  // assert( MIN_H <= height && height <= MAX_H ); Not necessarily because the concentration can be > 1
-  
-  if ( fabs(width) < 1e-15 || fabs(height) < 1e-15 ) return;
-  
-  // Compute triangle points' coordinates
-  double x0 = mean - width;
-  double x1 = mean;
-  double x2 = mean + width;
-  //~ double y0 = 0.0;
-  double y1 = height;
-  //~ double y2 = 0.0;
-
-  // We will need at least a point at abscissa x0, x1 and x2,
-  // Create them if they don't exist or update them if they do.
-  ae_list_node<ae_point_2d*>* node_0 = NULL;
-  ae_list_node<ae_point_2d*>* node_1 = NULL;
-  ae_list_node<ae_point_2d*>* node_2 = NULL;
-
-  if ( x0 >= X_MIN )  node_0 = create_interpolated_point( x0 );
-                      node_1 = create_interpolated_point( x1, node_0 );
-  if ( x2 <= X_MAX )  node_2 = create_interpolated_point( x2, node_1 );
-
-
-  // Update all the points in the list having their abscisse in ]x0;x2[
-  ae_list_node<ae_point_2d*>* point_node;
-  ae_point_2d*  point;
-  if ( node_0 != NULL ) point_node = node_0->get_next();
-  else point_node = _points->get_first();
-
-  while ( point_node != node_2 )
-  {
-    point = point_node->get_obj();
-
-    if ( point_node == node_1 )
-    {
-      point->y += y1;
-    }
-    else
-    {
-      if ( point->x < x1 )
-      {
-        point->y += y1 * (point->x - x0) / (x1 - x0);
-      }
-      else
-      {
-        point->y += y1 * (x2 - point->x) / (x2 - x1);
-      }
-    }
-
-    point_node = point_node->get_next();
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-void ae_fuzzy_set::add( ae_fuzzy_set* to_add )
-{
-  // Add interpolated points (one point is needed for each abscissa present in either of the two point lists)
-  ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-  ae_list_node<ae_point_2d*>* point_to_add_node = to_add->get_points()->get_first();
-  ae_point_2d*  point;
-  ae_point_2d*  point_to_add;
-
-  while ( point_to_add_node != NULL )
-  {
-    point_to_add = point_to_add_node->get_obj();
-
-    point_node = create_interpolated_point( point_to_add->x, point_node );
-
-    point_to_add_node = point_to_add_node->get_next();
-  }
-
-
-  // Update each point's ordinate
-  point_node = _points->get_first();
-
-  while ( point_node != NULL )
-  {
-    point = point_node->get_obj();
-
-    point->y += to_add->get_y( point->x );  // It is possible to gain some execution time here
-                                            // by parsing  to_add's point list and using the
-                                            // get_y( double x, ae_list_node* list_entry ) function
-                                            // instead of get_y( double x )
-
-    point_node = point_node->get_next();
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-void ae_fuzzy_set::sub( ae_fuzzy_set* to_sub )
-{
-  // 1. Remove multiple discontinuities.
-  simplify();
-  to_sub->simplify();
-
-
-  // 2. Add.
-  ae_list_node<ae_point_2d*>* bn = _points->get_first();
-  ae_list_node<ae_point_2d*>* rn = (to_sub->_points)->get_first();
-  ae_list_node<ae_point_2d*>* next_bn = NULL;
-  ae_list_node<ae_point_2d*>* next_rn = NULL;
-  ae_point_2d* bpt = NULL;
-  ae_point_2d* rpt = NULL;
-  ae_point_2d* next_bpt = NULL;
-  ae_point_2d* next_rpt = NULL;
-  ae_point_2d* new_pt = NULL;
-  double xb, yb, xr, yr, next_xb, next_yb, next_xr, next_yr;
-  double yb_interpol, yr_interpol;
-  bool red_discont = false;
-  bool black_discont = false;
-  ae_list<ae_point_2d*>* result = new ae_list<ae_point_2d*>();
-
-  while ( bn != NULL || rn != NULL ) // there are more points to deal with
-  {
-    // get data for the black function
-    if ( bn != NULL )
-    {
-      black_discont = false;
-      bpt = bn->get_obj();
-      xb = bpt->x;
-      yb = bpt->y;
-      next_bn = bn->get_next();
-      if ( next_bn != NULL )
-      {
-        next_bpt = next_bn->get_obj();
-        next_xb = next_bpt->x;
-        next_yb = next_bpt->y;
-
-        if ( next_xb == xb )
-        {
-          black_discont = true;
-        }
-      }
-    }
-    else
-    {
-      // no more black point, do as if the black function were 0:
-      // simply copy the remaining red points (if any) in the result
-      // xb and yb have the same values as those of the last black point
-      yr_interpol = to_sub->get_y( xb );
-
-      if ( rn != NULL && yb != 0 )
-      {
-        new_pt = new ae_point_2d( xb, -yr_interpol );
-        assert( new_pt );
-        result->add( new_pt );
-      }
-
-      while ( rn != NULL )
-      {
-        rpt = rn->get_obj();
-        xr = rpt->x;
-        yr = rpt->y;
-        new_pt = new ae_point_2d( xr, -yr );
-        assert( new_pt );
-        result->add( new_pt );
-
-        rn = rn->get_next();
-      }
-
-      break;
-    }
-
-    // get data for the red function
-    if ( rn != NULL )
-    {
-      red_discont = false;
-      rpt = rn->get_obj();
-      xr = rpt->x;
-      yr = rpt->y;
-      next_rn = rn->get_next();
-
-      if ( next_rn != NULL )
-      {
-        next_rpt  = next_rn->get_obj();
-        next_xr   = next_rpt->x;
-        next_yr   = next_rpt->y;
-
-        if ( next_xr == xr )
-        {
-          red_discont = true;
-        }
-      }
-    }
-    else
-    {
-      // no more red point, do as if the red function were 0:
-      // simply copy the (eventual) remaining black points in the result
-      // xr and yr have the same values as those of the last red point
-      // printf("no more red point\n");
-      yb_interpol = get_y( xr );
-
-      if ( bn != NULL && yr != 0 )
-      {
-        new_pt = new ae_point_2d( xr, yb_interpol );
-        assert( new_pt );
-        result->add( new_pt );
-      }
-
-      while ( bn != NULL )
-      {
-        bpt = bn->get_obj();
-        xb = bpt->x;
-        yb = bpt->y;
-        new_pt = new ae_point_2d( xb, yb );
-        assert( new_pt );
-        result->add( new_pt );
-
-        bn = bn->get_next();
-      }
-      break;
-    }
-
-
-    // compare xb and xr
-    if ( xb == xr )
-    {
-      // ----------------- case 1 : xb == xr -----------------------
-      // there will be at at least one point P on x == xb == x_c
-
-      if ( ! red_discont && ! black_discont )
-      {
-        // case 1a : no discontinuity
-        // => P(x, yb + yr)
-        new_pt = new ae_point_2d( xb, yb - yr );
-        assert( new_pt );
-        result->add( new_pt );
-
-        bn = next_bn;
-        if ( bn != NULL ) next_bn = bn->get_next();
-        rn = next_rn;
-        if ( rn != NULL ) next_rn = rn->get_next();
-      }
-      else
-      {
-        if ( black_discont && ! red_discont )
-        {
-          // case 1b : discontinuity in the black function only
-          // => P-(x, yb- + yr) and P+(x, yb+ + yr)
-          // P+ is computed using the following black point
-          new_pt = new ae_point_2d( xb, yb - yr );
-          assert( new_pt );
-          result->add( new_pt );
-
-          new_pt = new ae_point_2d( xb, next_yb - yr );
-          assert( new_pt );
-          result->add( new_pt );
-
-          if ( next_bn != NULL ) bn = next_bn->get_next(); // jump over the next black point
-          if ( bn != NULL ) next_bn = bn->get_next();
-          rn = next_rn;
-          if ( rn != NULL ) next_rn = rn->get_next();
-        }
-        else
-        {
-          if ( ! black_discont && red_discont )
-          {
-            // case 1c : discontinuity in the red function only
-            // => P-(x, yb + yr-) and P+(x, yb + yr+)
-            // P+ is computed using the following red point
-            new_pt = new ae_point_2d( xb, yb - yr );
-            assert( new_pt );
-            result->add( new_pt );
-
-            new_pt = new ae_point_2d( xb, yb - next_yr );
-            assert( new_pt );
-            result->add( new_pt );
-
-            bn = next_bn;
-            if ( bn != NULL ) next_bn = bn->get_next();
-            if ( next_rn != NULL ) rn = next_rn->get_next(); // jump over the next red point
-            if ( rn != NULL ) next_rn = rn->get_next();
-          }
-          else
-          {
-            // case 1d : discontinuity in both functions
-            // => P-(x, yb- + yr-) and P+(x, yb+ + yr+)
-            // P+ is computed using both the following red and black points
-            new_pt = new ae_point_2d( xb, yb - yr );
-            assert( new_pt );
-            result->add( new_pt );
-
-            new_pt = new ae_point_2d( xb, next_yb - next_yr );
-            assert( new_pt );
-            result->add( new_pt );
-
-            if ( next_bn != NULL ) bn = next_bn->get_next(); // jump over the next black point
-            if ( bn != NULL ) next_bn = bn->get_next();
-            if ( next_rn != NULL ) rn = next_rn->get_next(); // jump over the next red point
-            if ( rn != NULL ) next_rn = rn->get_next();
-          }
-        }
-      }
-    }
-    else
-    {
-      // xb is the === zone:
-      //
-      // ==============|---|---|================
-      //           xr-eps  xr  xr+eps
-
-      if( xb < xr )
-      {
-        // ----------------- case 2 : xb < xr -----------------------
-        // xb is the === zone:
-        //
-        // ==============|---|---|-----------------
-        //           xr-eps  xr  xr+eps
-        //
-        // there will be at at least one point P on x == xb
-
-        yr_interpol = to_sub->get_y( xb );
-
-        if ( ! black_discont )
-        {
-          // case 2a : no discontinuity
-          // => P(xb, yb + red(xb))
-          new_pt = new ae_point_2d( xb, yb - yr_interpol );
-          assert( new_pt );
-          result->add( new_pt );
-
-          bn = next_bn;
-          if ( bn != NULL ) next_bn = bn->get_next();
-        }
-        else
-        {
-          // case 2b : discontinuity on xb in the black function
-          // => P-(xb, yb- + red(xb)) and P+(xb, yb+ + red(xb))
-          new_pt = new ae_point_2d( xb, yb - yr_interpol );
-          assert( new_pt );
-          result->add( new_pt );
-
-          new_pt = new ae_point_2d( xb, next_yb - yr_interpol );
-          assert( new_pt );
-          result->add( new_pt );
-
-          if ( next_bn != NULL ) bn = next_bn->get_next(); // jump over the next bn
-          if ( bn != NULL ) next_bn = bn->get_next();
-        }
-        // can there be a discontinuity on xr ? yes, but we will deal
-        // with it later, when min{xb,xr} will be xr
-
-        // bn goes one step further and rn doesn't move
-        // if there is a discontinuity on xb, the same thing will
-        // happen with the following black point
-      }
-      else
-      {
-        // ----------------- case 3 : xb > xr -----------------------
-        // xb is the === zone:
-        //
-        // --------------|---|---|===============
-        //           xr-eps  xr  xr+eps
-        //
-        // there will be at at least one point P on x == xr
-
-        yb_interpol = get_y( xr );
-
-        if ( ! red_discont )
-        {
-          // case 3a : no discontinuity
-          // => P(xr, yr + black(xr))
-          new_pt = new ae_point_2d( xr, yb_interpol - yr );
-          assert( new_pt );
-          result->add( new_pt );
-
-          rn = next_rn;
-          if ( rn != NULL ) next_rn = rn->get_next();
-        }
-        else
-        {
-          // case 2b : discontinuity on xr
-          // => P-(xr, yr- + black(xr)) and P+(xr, yr+ + black(xr))
-          new_pt = new ae_point_2d( xr, yb_interpol - yr );
-          assert( new_pt );
-          result->add( new_pt );
-
-          new_pt = new ae_point_2d( xr, yb_interpol - next_yr );
-          assert( new_pt );
-          result->add( new_pt );
-
-          if ( next_rn != NULL ) rn = next_rn->get_next(); // jump over next red point
-          if ( rn != NULL ) next_rn = rn->get_next();
-        }
-
-        // store xr, rn goes one step further and bn doesn't move
-        // if there is a discontinuity on xr, the same thing will
-        // happen with the following red point
-      }
-    }
-  }
-
-  _points->erase( true );
-  delete _points;
-  _points = result;
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-double ae_fuzzy_set::get_geometric_area( void ) const
-{
-  double area = 0;
-  double tmp, tmp2;
-  
-  ae_point_2d*  point =  _points->get_first()->get_obj();
-  ae_list_node<ae_point_2d*>* next_point_node = _points->get_first()->get_next();
-  ae_point_2d*  next_point = NULL;
-
-  while ( next_point_node != NULL )
-  {
-    next_point = next_point_node->get_obj();
-
-    if ( point->x != next_point->x )
-    {
-      if ( (point->y > 0 && next_point->y < 0) || (point->y < 0 && next_point->y > 0) )
-      {
-        // The segment [point, next_point] crosses the abscissa axis => We will compute the area in 2 parts
-        ae_point_2d* pt_zero  = new ae_point_2d( get_x( 0.0, point, next_point ), 0.0 );
-
-        tmp = (point->y + pt_zero->y) * (pt_zero->x - point->x) / 2.0;              // Negative if y1 is negative
-        tmp2 =  (pt_zero->y + next_point->y) * (next_point->x - pt_zero->x) / 2.0;  // Negative if y2 is negative
-
-        delete pt_zero;
-
-        area += ( tmp  >= 0 )? tmp  : -tmp;
-        area += ( tmp2 >= 0 )? tmp2 : -tmp2;
-      }
-      else
-      {
-        // The segment is entirely above or underneath the abscissa axis
-        tmp = (point->y + next_point->y) * (next_point->x - point->x) / 2.0;
-
-        area += ( tmp >= 0 )? tmp : -tmp;
-      }
-    }
-
-    point = next_point;
-    next_point_node = next_point_node->get_next();
-  }
-
-  return area;
-}
-
-double ae_fuzzy_set::get_geometric_area( double start_segment, double end_segment ) const
-{
-  // Fuzzy set first (resp last) point must be at x = X_MIN (resp x = X_MAX)
-  assert( _points->get_first() != _points->get_last() );
-  assert( _points->get_first()->get_obj()->x == X_MIN );
-  assert( _points->get_last()->get_obj()->x == X_MAX );
-  
-  // We must have ( X_MIN <= start_segment < end_segment <= X_MAX )
-  assert( start_segment >= X_MIN && start_segment < end_segment && end_segment <= X_MAX );
-  
-  double area = 0;
-  double tmp, tmp2;
-  
-  ae_list_node<ae_point_2d*>* point_node      = _points->get_first();
-  ae_list_node<ae_point_2d*>* next_point_node = point_node->get_next();
-  
-  ae_point_2d*  point       = point_node->get_obj();
-  ae_point_2d*  next_point  = NULL;
-
-  while ( next_point_node != NULL )
-  {
-    next_point = next_point_node->get_obj();
-    
-    // If there are no points at x = start_segment and x = end_segment, we must interpolate them
-    if ( point->x < start_segment && next_point->x > start_segment )
-    {
-      next_point      = new ae_point_2d( start_segment, get_y( start_segment, point_node ) );
-      next_point_node = _points->add_after( next_point, point_node );
-      
-      continue;
-    }
-    if ( point->x < end_segment && next_point->x > end_segment )
-    {
-      next_point      = new ae_point_2d( end_segment, get_y( end_segment, point_node ) );
-      next_point_node = _points->add_after( next_point, point_node );
-      
-      continue;
-    }
-
-    // If we are within the segment, compute the area
-    if ( point->x >= start_segment && next_point->x <= end_segment ) 
-    {
-      if ( point->x != next_point->x )
-      {
-        if ( (point->y > 0 && next_point->y < 0) || (point->y < 0 && next_point->y > 0) )
-        {
-          // The segment [point, next_point] crosses the abscissa axis => We will compute the area in 2 parts
-          ae_point_2d* pt_zero  = new ae_point_2d( get_x( 0.0, point, next_point ), 0.0 );
-
-          tmp = (point->y + pt_zero->y) * (pt_zero->x - point->x) / 2.0;              // Negative if y1 is negative
-          tmp2 =  (pt_zero->y + next_point->y) * (next_point->x - pt_zero->x) / 2.0;  // Negative if y2 is negative
-
-          delete pt_zero;
-
-          area += ( tmp  >= 0 )? tmp  : -tmp;
-          area += ( tmp2 >= 0 )? tmp2 : -tmp2;
-        }
-        else
-        {
-          // The segment is entirely above or underneath the abscissa axis
-          tmp = (point->y + next_point->y) * (next_point->x - point->x) / 2.0;
-
-          area += ( tmp >= 0 )? tmp : -tmp;
-        }
-      }
-    }
-    
-    point       = next_point;
-    point_node  = next_point_node;
-    next_point_node = next_point_node->get_next();
-  }
-  
-  return area;
-}
-
-
-void ae_fuzzy_set::add_upper_bound( double upper_bound )
-{
-  ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-  ae_point_2d*  point;
-
-  ae_list_node<ae_point_2d*>* prev_node;
-  ae_list_node<ae_point_2d*>* next_node;
-  ae_point_2d*  prev_point;
-  ae_point_2d*  next_point;
-
-  while ( point_node != NULL )
-  {
-    point = point_node->get_obj();
-
-    if ( point->y > upper_bound )
-    {
-      prev_node = point_node->get_prev();
-      next_node = point_node->get_next();
-
-      if ( prev_node != NULL )
-      {
-        prev_point = prev_node->get_obj();
-
-        if ( prev_point->y < upper_bound ) // In fact it can only be < or ==
-        {
-          // Create a point at the intersection of the segment and the ceiling defined by the upper bound
-          _points->add_after( new ae_point_2d( get_x( upper_bound, prev_point, point ), upper_bound ), prev_node );
-        }
-      }
-
-      if ( next_node != NULL )
-      {
-        next_point = next_node->get_obj();
-
-        if ( next_point->y < upper_bound )
-        {
-          // Create a point at the intersection of the segment and the ceiling defined by the upper bound
-          _points->add_after( new ae_point_2d( get_x( upper_bound, point, next_point ), upper_bound ), point_node );
-        }
-      }
-
-      // Lower current point down to upper_bound
-      point->y = upper_bound;
-    }
-
-    point_node = point_node->get_next();
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-void ae_fuzzy_set::add_lower_bound( double lower_bound )
-{
-  ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-  ae_point_2d*  point;
-
-  ae_list_node<ae_point_2d*>* prev_node;
-  ae_list_node<ae_point_2d*>* next_node;
-  ae_point_2d*  prev_point;
-  ae_point_2d*  next_point;
-
-  while ( point_node != NULL )
-  {
-    point = point_node->get_obj();
-
-    if ( point->y < lower_bound )
-    {
-      prev_node = point_node->get_prev();
-      next_node = point_node->get_next();
-
-      if ( prev_node != NULL )
-      {
-        prev_point = prev_node->get_obj();
-
-        if ( prev_point->y > lower_bound ) // In fact it can only be > or ==
-        {
-          // Create a point at the intersection of the segment and the floor defined by the lower bound
-          _points->add_after( new ae_point_2d( get_x( lower_bound, prev_point, point ), lower_bound ), prev_node );
-            
-          #ifdef DEBUG
-            _assert_order();
-          #endif
-        }
-        // else nothing to do
-      }
-
-      if ( next_node != NULL )
-      {
-        next_point = next_node->get_obj();
-
-        if ( next_point->y > lower_bound )
-        {
-          // Create a point at the intersection of the segment and the floor defined by the lower bound
-          _points->add_after( new ae_point_2d( get_x( lower_bound, point, next_point ), lower_bound ), point_node );
-            
-          #ifdef DEBUG
-            _assert_order();
-          #endif
-        }
-        // else nothing to do
-      }
-
-      // Raise current point up to lower_bound
-      point->y = lower_bound;
-    }
-
-    point_node = point_node->get_next();
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-
-bool ae_fuzzy_set::is_identical_to( const ae_fuzzy_set * other, double tolerance  ) const
-{
-  if ( _points->get_nb_elts() != other->_points->get_nb_elts())
-  {
-    return false;
-  }
-
-  ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-  ae_point_2d*  point = NULL;
-
-  ae_list_node<ae_point_2d*>* other_node = other->_points->get_first();
-  ae_point_2d*  other_point = NULL;
-
-  bool ok = true;
-
-  while ( ok && (point_node != NULL) )
-  {
-    point = point_node->get_obj();
-    other_point = other_node->get_obj();
-
-    if (fabs(point->x - other_point->x)> tolerance*(fabs(point->x) + fabs(other_point->x)) || fabs(point->y - other_point->y)>tolerance*(fabs(point->y) + fabs(other_point->y)))
-      {ok = false;}
-
-    point_node = point_node->get_next();
-    other_node = other_node->get_next();
-  }
-  
-  return ok;
-}
-
-
-void ae_fuzzy_set::save( gzFile backup_file ) const
-{
-  int16_t nb_points = (_points == NULL) ? 0 : _points->get_nb_elts();
-  gzwrite( backup_file, &nb_points, sizeof(nb_points) );
-  
-  if ( _points != NULL )
-  {
-    ae_list_node<ae_point_2d*>* point_node = _points->get_first();
-    ae_point_2d*  point;
-    for ( int16_t i = 0 ; i < nb_points ; i++ )
-    {
-      point = point_node->get_obj();
-      
-      point->save( backup_file );
-      
-      point_node = point_node->get_next();
-    }
-  }
-}
-
-
-void ae_fuzzy_set::load( gzFile backup_file )
-{
-  int16_t nb_points;
-  gzread( backup_file, &nb_points, sizeof(nb_points) );
-  
-  if ( nb_points > 0 ) _points = new ae_list<ae_point_2d*>();
-  
-  for ( int16_t i = 0 ; i < nb_points ; i++ )
-  {
-    _points->add( new ae_point_2d( backup_file ) );
-  }
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-double ae_fuzzy_set::get_y( double x, ae_list_node<ae_point_2d*>* list_entry ) const
-{
-  if ( list_entry == NULL ) list_entry = _points->get_first();
-
-  assert( x >= X_MIN && x <= X_MAX );
-  assert( list_entry != NULL );
-  assert( list_entry->get_obj()->x <= x );
-  assert( _points->get_nb_elts() >= 2 );
-
-  // Look for the first point of the list having point->x >= x
-  ae_list_node<ae_point_2d*>* point_node  = list_entry;
-  ae_point_2d*  point       = point_node->get_obj();
-
-  while ( point->x < x )
-  {
-    point_node = point_node->get_next();
-    point      = point_node->get_obj();
-  }
-
-  // If a point with abscissa x exists, return it's y, otherwise compute the needed y by interpolation
-  // from the 2 flanking points
-  if ( point->x == x ) return point->y;
-  else
-  {
-    ae_point_2d* prev_point = point_node->get_prev()->get_obj();
-    return prev_point->y + (point->y - prev_point->y) * (x - prev_point->x) / (point->x - prev_point->x);
-  }
-}
-
-ae_list_node<ae_point_2d*>* ae_fuzzy_set::create_interpolated_point( double x, ae_list_node<ae_point_2d*>* list_entry )
-{
-  if ( list_entry == NULL ) list_entry = _points->get_first();
-
-  assert( x >= X_MIN && x <= X_MAX );
-  assert( list_entry->get_obj()->x <= x );
-  assert( _points->get_nb_elts() >= 2 );
-
-  // Look for the first point of the list having point->x >= x
-  ae_list_node<ae_point_2d*>* point_node  = list_entry;
-  ae_point_2d*  point       = point_node->get_obj();
-
-  while ( point->x < x )
-  {
-    point_node = point_node->get_next();
-    point      = point_node->get_obj();
-  }
-
-  if ( point->x == x )
-  {
-    // The point already exists, nothing to do
-    return point_node;
-  }
-  else
-  {
-    point_node = _points->add_before( new ae_point_2d( x, get_y( x ) ), point_node );
-    return point_node;
-  }
-  
-  #ifdef DEBUG
-    _assert_order();
-  #endif
-}
-
-void ae_fuzzy_set::_assert_order( void )
-{
-  assert( (_points->get_first()->get_obj())->x == X_MIN );
-  assert( (_points->get_last()->get_obj())->x == X_MAX );
-  
-  ae_list_node<ae_point_2d*>* point_node  = _points->get_first();
-  ae_list_node<ae_point_2d*>* next_point_node = point_node->get_next();
-  ae_point_2d*  point;
-  ae_point_2d*  next_point;
-
-  while ( next_point_node != NULL )
-  {
-    point = point_node->get_obj();
-    next_point = next_point_node->get_obj();
-    
-    assert( point->x <= next_point->x );
-    
-    point_node = point_node->get_next();
-    next_point_node = next_point_node->get_next();
-  }
-}
-
diff --git a/src/libaevol/ae_fuzzy_set.h b/src/libaevol/ae_fuzzy_set.h
deleted file mode 100644
index 0f9c0ec..0000000
--- a/src/libaevol/ae_fuzzy_set.h
+++ /dev/null
@@ -1,210 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-/** \class
- *  \brief This class provides management tools for "fuzzy sets"
- *         abscissa are bound between MIN_X and MAX_X (defined elsewhere)
- *         A "fuzzy set" should always have at least two points of abscissa
- *         MIN_X and MAX_X
- */
- 
- 
-#ifndef __AE_FUZZY_SET_H__
-#define __AE_FUZZY_SET_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_list.h>
-#include <ae_point_2d.h>
-#include <ae_macros.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class exp_manager;
-
-
-
-
-
- 
-class ae_fuzzy_set : public ae_object
-{  
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_fuzzy_set( void );
-    ae_fuzzy_set( const ae_fuzzy_set &model );
-    ae_fuzzy_set( gzFile backup_file );
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_fuzzy_set( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline ae_list<ae_point_2d*>* get_points( void );
-  
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    inline void initialize( void );
-    void simplify( void );
-    void print_points( void ) const;
-    void add_triangle( double mean, double width, double height );
-    void add( ae_fuzzy_set* to_add );
-    void sub( ae_fuzzy_set* to_sub );
-    double get_geometric_area( void ) const;
-    double get_geometric_area( double start_segment, double end_segment ) const;
-    inline double get_y( double x ) const;
-    inline double get_x( double y, ae_point_2d* left_point, ae_point_2d* right_point ) const;
-    inline ae_list_node<ae_point_2d*>* create_interpolated_point( double x );
-    
-    void add_upper_bound( double upper_bound );
-    void add_lower_bound( double lower_bound );
-
-    bool is_identical_to( const ae_fuzzy_set * other, double tolerance) const;
-    
-    void save( gzFile backup_file ) const;
-    void load( gzFile backup_file );
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    /*
-    ae_fuzzy_set( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    */
-    /*
-    ae_fuzzy_set( const ae_fuzzy_set &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    */
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void _assert_order( void );
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    exp_manager*            _exp_m;
-    ae_list<ae_point_2d*>*  _points;
-  
-  
-  
-  
-  
-  private :
-    
-    // WARNING :  The 2 following functions are private because they are dangerous.
-    //            They are optimized versions of their omonyms, beginning their search at the given list entry.
-    //            The following conditions are MANDATORY : 
-    //              list_entry must be a node of the point list (_points)
-    //              the corresponding point's abscissa must be <= x
-    double get_y( double x, ae_list_node<ae_point_2d*>* list_entry ) const;
-    ae_list_node<ae_point_2d*>* create_interpolated_point( double x, ae_list_node<ae_point_2d*>* list_entry );
-};
-
-
-// =====================================================================
-//                          Accessors definitions
-// =====================================================================
-ae_list<ae_point_2d*>* ae_fuzzy_set::get_points( void )
-{
-  return _points;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-void ae_fuzzy_set::initialize( void )
-{
-  _points->erase( true );
-  _points->add( new ae_point_2d( X_MIN, 0.0 ) );
-  _points->add( new ae_point_2d( X_MAX, 0.0 ) );
-}
-
-double ae_fuzzy_set::get_y( double x ) const
-{
-  return get_y( x, _points->get_first() );
-}
-
-double ae_fuzzy_set::get_x( double y, ae_point_2d* left_point, ae_point_2d* right_point ) const
-{
-  assert( left_point != NULL );
-  assert( right_point != NULL );
-  assert( left_point->y != right_point->y );
-  assert( ( y >= right_point->y && y <= left_point->y ) || ( y >= left_point->y && y <= right_point->y ) );
-  
-  double tmp = left_point->x + (right_point->x - left_point->x) * (y - left_point->y) / (right_point->y - left_point->y);
-  
-  if ( tmp < left_point->x ) return left_point->x;
-  else if ( tmp > right_point->x ) return right_point->x;
-  else return tmp;
-}
-
-ae_list_node<ae_point_2d*>* ae_fuzzy_set::create_interpolated_point( double x )
-{
-  return create_interpolated_point( x, _points->get_first() );
-}
-
-
-#endif // __AE_FUZZY_SET_H__
diff --git a/src/libaevol/ae_fuzzy_set_X11.cpp b/src/libaevol/ae_fuzzy_set_X11.cpp
deleted file mode 100644
index 8002e15..0000000
--- a/src/libaevol/ae_fuzzy_set_X11.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_fuzzy_set_X11.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                           Class ae_fuzzy_set_X11                            #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_fuzzy_set_X11::ae_fuzzy_set_X11( void ) : ae_fuzzy_set()
-{
-}
-
-ae_fuzzy_set_X11::ae_fuzzy_set_X11( const ae_fuzzy_set &model ) : ae_fuzzy_set(model)
-{
-};
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_fuzzy_set_X11::~ae_fuzzy_set_X11( void )
-{
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_fuzzy_set_X11::display( ae_X11_window* win, color_map color, bool fill /*= false*/, bool bold /*= false*/ )
-{
-  double y_min = Y_MIN - 0.1 * Y_MAX; // Yields a bottom margin
-  double y_max = Y_MAX * 1.1;         // Yields a top margin
-  double delta_x = X_MAX - X_MIN;
-  double delta_y = y_max - y_min;
-  
-  ae_list_node<ae_point_2d*>* node = _points->get_first();
-  ae_point_2d*  cur_point   = NULL;
-  ae_point_2d*  next_point  = NULL;
-  int16_t cur_x;
-  int16_t cur_y;
-  int16_t next_x;
-  int16_t next_y;
-  
-  
-  while ( (node != NULL) && (node->get_next() != NULL) )
-  {
-    cur_point   = node->get_obj();
-    next_point  = node->get_next()->get_obj();
-    
-    // Display segment [cur_point, next_point]
-    cur_x   = (      (cur_point->x -  X_MIN) / delta_x  ) * win->get_width();
-    cur_y   = ( 1 - ((cur_point->y -  y_min) / delta_y) ) * win->get_height();
-    next_x  = (      (next_point->x - X_MIN) / delta_x  ) * win->get_width();
-    next_y  = ( 1 - ((next_point->y - y_min) / delta_y) ) * win->get_height();
-    
-    if ( fill )
-    {
-      char* fill_color;
-      for ( int16_t i = cur_x ; i < next_x ; i++ )
-      {
-        fill_color = ae_X11_window::get_color( ((double)i / win->get_width()) * (X_MAX - X_MIN) );
-        win->draw_line( i, ( 1 - ((0 -  y_min) / delta_y) ) * win->get_height(),
-                        i, cur_y + (((i - cur_x) * (next_y - cur_y)) / (next_x - cur_x)) , fill_color );
-        delete [] fill_color;
-      }
-    }
-    
-    win->draw_line( cur_x, cur_y, next_x, next_y, color, bold );
-    
-    node = node->get_next();
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_gaussian.h b/src/libaevol/ae_gaussian.h
deleted file mode 100644
index 34ea7aa..0000000
--- a/src/libaevol/ae_gaussian.h
+++ /dev/null
@@ -1,201 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
- 
- 
-#ifndef __AE_GAUSSIAN_H__
-#define __AE_GAUSSIAN_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
- 
-class ae_gaussian : public ae_object
-{  
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    inline ae_gaussian( double heigth, double mean, double width );
-    inline ae_gaussian( const ae_gaussian &model );
-    inline ae_gaussian( gzFile backup_file );
-  
-    // =================================================================
-    //                             Destructor
-    // =================================================================
-    virtual inline ~ae_gaussian( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline double get_height( void ) const;
-    inline double get_mean( void ) const;
-    inline double get_width( void ) const;
-    inline void   set_height( double height );
-    inline void   set_mean( double mean );
-    inline void   set_width( double width );
-  
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    inline double compute_y( double x );
-    
-    inline void save( gzFile backup_file );
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_gaussian( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    double _height;
-    double _mean;
-    double _width; // In fact half-width to the inflexion points
-};
-
-
-// =====================================================================
-//                               Constructors
-// =====================================================================
-inline ae_gaussian::ae_gaussian( double height, double mean, double width )
-{
-  _height = height;
-  _mean   = mean;
-  _width  = width;
-}
-
-inline ae_gaussian::ae_gaussian( const ae_gaussian &model )
-{
-  _height = model._height;
-  _mean   = model._mean;
-  _width  = model._width;
-}
-
-inline ae_gaussian::ae_gaussian( gzFile backup_file )
-{
-  gzread( backup_file, &_height,  sizeof(_height) );
-  gzread( backup_file, &_mean,    sizeof(_mean) );
-  gzread( backup_file, &_width,   sizeof(_width) );
-}
-
-// =====================================================================
-//                               Destructor
-// =====================================================================
-inline ae_gaussian::~ae_gaussian( void )
-{
-}
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline double ae_gaussian::get_height( void ) const
-{
-  return _height;
-}
-
-inline double ae_gaussian::get_mean( void ) const
-{
-  return _mean;
-}
-
-inline double ae_gaussian::get_width( void ) const
-{
-  return _width;
-}
-
-inline void ae_gaussian::set_height( double height )
-{
-  _height = height;
-}
-
-inline void ae_gaussian::set_mean( double mean )
-{
-  _mean = mean;
-}
-
-inline void ae_gaussian::set_width( double width )
-{
-  _width = width;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-double ae_gaussian::compute_y( double x )
-{
-  return _height * exp( -(x-_mean)*(x-_mean) / (2*_width*_width) );
-}
-
-void ae_gaussian::save( gzFile backup_file )
-{
-  gzwrite( backup_file, &_height, sizeof(_height) );
-  gzwrite( backup_file, &_mean, sizeof(_mean) );
-  gzwrite( backup_file, &_width, sizeof(_width) );
-}
-
-
-#endif // __AE_GAUSSIAN_H__
diff --git a/src/libaevol/ae_gene_mutation.cpp b/src/libaevol/ae_gene_mutation.cpp
deleted file mode 100644
index 47b53bf..0000000
--- a/src/libaevol/ae_gene_mutation.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class
- *  \brief
- */
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <assert.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-
-#include <ae_mutation.h>
-#include <ae_gene_mutation.h>
-#include <ae_rna.h>
-#include <ae_macros.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                        Class ae_gene_mutation                               #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-
-
-
-// Creates a copy of the mutation mut, but enriched with the generation when it occured
-// and the position where it occurred in the RNA, relative to the first bp of the promoter
-ae_gene_mutation::ae_gene_mutation(ae_mutation const & mut, int32_t gener, int32_t cdsPosBefore, ae_strand strandBefore, ae_gene_mutation_region region  ) : ae_mutation(mut)
-{
-  _generation = gener;
-  _impact_on_metabolic_error = 0.0; /* should be set to its real value when known */
-  _region = region;
-
-  /* Compute _position_relative_to_shine_dal */
-
-  switch ( _mut_type )
-    {
-    case SWITCH :
-      _position_relative_to_shine_dal = new int32_t;
-      if ( strandBefore == LEADING  ) {_position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;}
-      else                              {_position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];}
-      break;
-    case S_INS :
-      _position_relative_to_shine_dal = new int32_t;
-      if ( strandBefore == LEADING  ) {_position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;}
-      else                              {_position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];}
-      break;
-    case S_DEL :
-      _position_relative_to_shine_dal = new int32_t;
-      if ( strandBefore == LEADING  ) {_position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;}
-      else                              {_position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];}
-      break;
-    case DUPL : 
-      /* A duplication can affect a gene in two ways:
-         1) The reinsertion point of the duplicated segment is located within the gene => stored
-         2) The gene is partly or completely duplicated, but this does not change its sequence => nothing to store       
-      */
-      /* We should enter here only in case (1). Note that in this case, the relative positions for beginseg and endseg may be outside the gene */ 
-      _position_relative_to_shine_dal = new int32_t[3];
-      if ( strandBefore == LEADING  )
-        {
-          _position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;
-          _position_relative_to_shine_dal[1] = _pos[1] - cdsPosBefore;
-          _position_relative_to_shine_dal[2] = _pos[2] - cdsPosBefore;
-        }
-      else    
-        {
-          _position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];
-          _position_relative_to_shine_dal[1] = cdsPosBefore - _pos[1];
-          _position_relative_to_shine_dal[2] = cdsPosBefore - _pos[2];
-        }
-      break;
-    case DEL : 
-      _position_relative_to_shine_dal = new int32_t[2];
-      if ( strandBefore == LEADING  )
-        {
-          _position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;
-          _position_relative_to_shine_dal[1] = _pos[1] - cdsPosBefore;
-        }
-      else    
-        {
-          _position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];
-          _position_relative_to_shine_dal[1] = cdsPosBefore - _pos[1];
-        }
-      break;
-    case TRANS :
-      _position_relative_to_shine_dal = new int32_t[4];
-      if ( strandBefore == LEADING  )
-        {
-          _position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;
-          _position_relative_to_shine_dal[1] = _pos[1] - cdsPosBefore;
-          _position_relative_to_shine_dal[2] = _pos[2] - cdsPosBefore;
-          _position_relative_to_shine_dal[3] = _pos[3] - cdsPosBefore;
-        }
-      else    
-        {
-          _position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];
-          _position_relative_to_shine_dal[1] = cdsPosBefore - _pos[1];
-          _position_relative_to_shine_dal[2] = cdsPosBefore - _pos[2];
-          _position_relative_to_shine_dal[3] = cdsPosBefore - _pos[3];
-        }
-      break;
-    case INV :
-      _position_relative_to_shine_dal = new int32_t[2];
-      if ( strandBefore == LEADING  )
-        {
-          _position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;
-          _position_relative_to_shine_dal[1] = _pos[1] - cdsPosBefore;
-        }
-      else    
-        {
-          _position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];
-          _position_relative_to_shine_dal[1] = cdsPosBefore - _pos[1];
-        }
-      break;
-    case INSERT :
-      _position_relative_to_shine_dal = new int32_t;
-      if ( strandBefore == LEADING  ) _position_relative_to_shine_dal[0] = _pos[0] - cdsPosBefore;
-      else                                 _position_relative_to_shine_dal[0] = cdsPosBefore - _pos[0];
-      break;
-    default :
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-ae_gene_mutation::~ae_gene_mutation()
-{
-  /* ae_mutation::~ae_mutation() will be called automatically by the compiler for the other attributes */
-  switch ( _mut_type )
-  {
-  case SWITCH :
-    delete _position_relative_to_shine_dal;
-    break;
-  case S_INS :
-    delete _position_relative_to_shine_dal;
-    break;
-  case S_DEL :
-    delete _position_relative_to_shine_dal;
-    break;
-  case DUPL :
-    delete [] _position_relative_to_shine_dal;
-    break;
-  case DEL :
-    delete [] _position_relative_to_shine_dal;
-    break;
-  case TRANS :
-    delete [] _position_relative_to_shine_dal;
-    break;
-  case INV :
-      delete [] _position_relative_to_shine_dal;
-      break;
-  case INSERT :
-    delete _position_relative_to_shine_dal;
-      break;
-  default :
-    fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-    break;
-  }
-  
-} ;
-
-
-
-
-// =================================================================
-//                        Public methods
-// =================================================================
-
-// 0 if local mut, 1 if rearrangement, 2 if transfer
-int8_t ae_gene_mutation::type_of_event()
-{
-  if ((_mut_type == SWITCH) || (_mut_type == S_INS) || (_mut_type == S_DEL)) return 0;
-  else if ((_mut_type == DUPL) || (_mut_type == DEL) || (_mut_type == TRANS) || (_mut_type == INV)) return 1;
-  else return 2;
-    
-
-}
-
-
-
-// str must be at least of size 60
-void ae_gene_mutation::get_description_string_for_gene_mut(char * str)
-{ 
-   switch ( _mut_type )
-  {
-    case SWITCH :
-    {
-      sprintf( str, "%"PRId32" SWITCH %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _impact_on_metabolic_error );
-      break;
-    }
-    case S_INS :
-    {
-      sprintf( str, "%"PRId32" SMALL_INS %"PRId32" %"PRId32" %s %.10f ", _generation, _position_relative_to_shine_dal[0], _length[0], _seq, _impact_on_metabolic_error );
-      break;
-    }
-    case S_DEL :
-    {
-      sprintf( str, "%"PRId32" SMALL_DEL %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _length[0], _impact_on_metabolic_error );
-      break;
-    }
-    case DUPL :
-    {
-      sprintf( str, "%"PRId32" INSERTION_OF_DUPLICATED_DNA %"PRId32" %"PRId32" %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _position_relative_to_shine_dal[1], _position_relative_to_shine_dal[2], _length[0], _impact_on_metabolic_error);
-      break;
-    }
-    case DEL :
-    {
-      sprintf( str, "%"PRId32" LARGE_DEL %"PRId32" %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _position_relative_to_shine_dal[1], _length[0], _impact_on_metabolic_error );
-      break;
-    }
-    case TRANS :
-    {
-      sprintf( str, "%"PRId32" TRANSLOC %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _position_relative_to_shine_dal[1],  _position_relative_to_shine_dal[2],  _position_relative_to_shine_dal[3], _length[0], _impact_on_metabolic_error );    
-      break;
-    }
-    case INV :
-    {
-      sprintf( str, "%"PRId32" INV %"PRId32" %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _position_relative_to_shine_dal[1], _length[0], _impact_on_metabolic_error );
-      break;
-    }
-   case INSERT :
-    {
-      sprintf( str, "%"PRId32" INSERTION_OF_FOREIGN_DNA %"PRId32" %"PRId32" %.10f ", _generation, _position_relative_to_shine_dal[0], _length[0], _impact_on_metabolic_error );
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-
-   if (_region == CDS)            strcat(str, "CDS ");
-   else if (_region == UPSTREAM)  strcat(str, "UPSTREAM ");
-   else if (_region == BOTH)      strcat(str, "BOTH ");
-
-
-}
-
diff --git a/src/libaevol/ae_gene_mutation.h b/src/libaevol/ae_gene_mutation.h
deleted file mode 100644
index 66db10b..0000000
--- a/src/libaevol/ae_gene_mutation.h
+++ /dev/null
@@ -1,193 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-// 
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/*! \class ae_gene_mutation
-    \brief Currently used only by post-treatments, on a specific lineage, to monitor the fate of paralogs.
-         Each paralog maintains a list of the mutations it underwent. A gene mutation is a mutation, but
-         enriched with the generation when it occurred and the position where it occurred in the coding RNA
-         (relative to the first bp of the promoter).
-*/
- 
- 
- #ifndef __AE_GENE_MUTATION_H__
-#define  __AE_GENE_MUTATION_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_mutation.h>
-#include <ae_rna.h>
-#include <ae_enums.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-enum ae_gene_loss_type
-{
-  NOT_LOST_YET = 0,
-  LOST_BY_LOCAL_MUTATION  = 1,
-  DELETED = 2,
-  BROKEN_BY_REAR = 3,
-  DUPLICATED = 4
-};
-
-
-
-
-enum ae_gene_mutation_region
-{
-  UPSTREAM = 0,
-  CDS = 1,
-  BOTH = 2,
-};
-
-
-
-
-
-class ae_gene_mutation : public ae_mutation
-{
-  friend class ae_gene_tree_node;
-  
- public :
-
-  // =================================================================
-  //                             Constructors
-  // =================================================================
-  
-  // Creates a copy of the mutation mut, but enriched with the generation when it occured
-  // and the position where it occurred in the RNA, relative to the first bp of the promoter
-  ae_gene_mutation(ae_mutation const & mut, int32_t gener, int32_t cdsPosBefore, ae_strand strandBefore, ae_gene_mutation_region region );
-  
-  ae_gene_mutation( const ae_gene_mutation &model );
-  
-  // =================================================================
-  //                             Destructors
-  // =================================================================
-  
-  virtual ~ae_gene_mutation();
-  
-  // =================================================================
-  //                              Accessors
-  // =================================================================
-  
-  inline int32_t get_generation() const;
-  inline double get_impact_on_metabolic_error() const;
-  inline ae_gene_mutation_region get_region();
-  inline void set_impact_on_metabolic_error(double impact);
-  
- 
-  // =================================================================
-  //                            Public Methods
-  // =================================================================
-  void get_description_string_for_gene_mut(char * str); // str must be at least of size 60
-  int8_t type_of_event(); // 0 if local mut, 1 if rearrangement, 2 if transfer
-
-     
- protected :
-  
-  // =================================================================
-  //                         Forbidden Constructors
-  // =================================================================
-  
-  ae_gene_mutation( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  /* ae_gene_mutation( const ae_gene_mutation &model ) */
-  /*   { */
-  /*     printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ ); */
-  /*     exit( EXIT_FAILURE ); */
-  /*   }; */
-  
-  // =================================================================
-  //                           Protected Methods
-  // =================================================================
-  
-  // =================================================================
-  //                          Protected Attributes
-  // =================================================================
-  
-  int32_t*  _position_relative_to_shine_dal; /* array of positions similar to the _pos array of the ae_mutation class (size 1 for the switch, 2 for an inversion, etc.) */
-  int32_t   _generation;
-  double    _impact_on_metabolic_error;
-  ae_gene_mutation_region _region;
-  
-};
-
-
-
-
-
-// =====================================================================
-//                         Inline Accessors' definitions
-// =====================================================================
-
-inline int32_t ae_gene_mutation::get_generation() const
-{
-  return _generation;
-}
-
-inline double ae_gene_mutation::get_impact_on_metabolic_error() const
-{
-  return _impact_on_metabolic_error;
-
-}
-
-
-inline void ae_gene_mutation::set_impact_on_metabolic_error(double impact)
-{
-  _impact_on_metabolic_error = impact;
-}
-
-
-inline ae_gene_mutation_region ae_gene_mutation::get_region()
-{
-  return _region;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_GENE_MUTATION_H__
diff --git a/src/libaevol/ae_gene_tree.cpp b/src/libaevol/ae_gene_tree.cpp
deleted file mode 100644
index 9fcc28c..0000000
--- a/src/libaevol/ae_gene_tree.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class
- *  \brief
- */
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-
-#include <ae_gene_tree.h>
-#include <ae_gene_tree_node.h>
-
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                            Class ae_gene_tree                               #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-ae_gene_tree::ae_gene_tree( void )
-{
-  _root = NULL;
-  _begin_gener = 0;
-  _end_gener = 0;
-  _total_nb_nodes = 0;
-  _nb_internal_nodes = 0;
-  _nb_leaves = 0;
-  _nb_active_leaves = 0;
-  _creation_type = INITIALIZATION;
-}
-
-// Creates a tree with just a root node.
-ae_gene_tree::ae_gene_tree( int32_t nodeCreationDate, ae_protein * protein, ae_mutation * mut /* = NULL */ )
-{
-  _root = new ae_gene_tree_node(nodeCreationDate, protein);
-  if (mut == NULL)  _creation_type = INITIALIZATION;
-  else if ((mut->get_mut_type() == SWITCH) || (mut->get_mut_type() == S_INS) || (mut->get_mut_type() == S_DEL)) _creation_type = LOCAL_MUTATION;
-  else if ((mut->get_mut_type() == DUPL) || (mut->get_mut_type() == DEL) || (mut->get_mut_type() == TRANS) || (mut->get_mut_type() == INV) ) _creation_type = REARRANGEMENT;
-  else _creation_type = TRANSFER;
- 
-    
-  _begin_gener = nodeCreationDate;
-  _end_gener = nodeCreationDate;
-  _total_nb_nodes = 1;
-  _nb_internal_nodes = 0;
-  _nb_leaves = 1;
-  if (protein != NULL) _nb_active_leaves = 1; else _nb_active_leaves = 0;
-}
-
-
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-ae_gene_tree::~ae_gene_tree( void )
-{
-  delete _root;
-}
-
-
-// =================================================================
-//                           Public Methods
-// =================================================================
-
-void ae_gene_tree::set_end_gener_if_active_leaves(int32_t gener)
-{
-  if (_nb_active_leaves > 0) _end_gener = gener;
-}
-
-void ae_gene_tree::update_pointers_in_tree_leaves(ae_genetic_unit * unit)
-{
-  _root->update_pointers_in_subtree_leaves(unit);
-}
-
-void ae_gene_tree::anticipate_mutation_effect_on_genes_in_tree_leaves(ae_mutation * mut, int32_t lengthOfGeneticUnit)
-{
-  _root->anticipate_mutation_effect_on_genes_in_subtree_leaves(mut, lengthOfGeneticUnit);
-}
-
-void ae_gene_tree::register_actual_mutation_effect_on_genes_in_tree_leaves( ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error)
-{
-  _root->register_actual_mutation_effect_on_genes_in_subtree_leaves( this, mut, unit, gener, impact_on_metabolic_error);
-}
-
-// void ae_gene_tree::duplicate_this_gene( ae_gene_tree_node * node, int32_t duplicDate, ae_protein * newProtein )
-// {
-//   if (newProtein == node->_protein_pointer) {fprintf(stderr, "Error, duplication with the same protein\n"); exit(EXIT_FAILURE);}
-
-//   // Create a new node for the "old" DNA segment
-//   node->_left_child = new ae_gene_tree_node(duplicDate, node->_protein_pointer);
-//   node->_left_child->_node_creation_date = duplicDate;
-//   node->_left_child->_dna_creation_date = node->_dna_creation_date;
-//   node->_left_child->_parent_node = node;
-
-//   // Create a new node for the "new" DNA segment
-//   node->_right_child = new ae_gene_tree_node(duplicDate, newProtein);
-//   node->_right_child->_node_creation_date = duplicDate;
-//   node->_right_child->_dna_creation_date = duplicDate;
-//   node->_right_child->_parent_node = node;
-  
-//   // This node becomes internal, it represents an ancestral (obsolete) state of the gene
-//   node->_protein_pointer = NULL;
-//   for (int32_t i = 0; i < node->_nb_promoters; i++) {node->_rna_pointers[i] = NULL;}
-//   node->_gene_loss_type = DUPLICATED; 
-//   node->_gene_loss_date = duplicDate;
-
-//   // Update tree statistics
-//   _total_nb_nodes += 2;
-//   _nb_internal_nodes ++;
-//   _nb_leaves ++;  // - 1 + 2 (the ex-leaf becomes an internal node, 2 leaves are created)
-//   if (newProtein != NULL) _nb_active_leaves ++;
-//   if (duplicDate > _end_gener) _end_gener = duplicDate;
-// }
-
-
-// void ae_gene_tree::report_gene_mutation( ae_gene_tree_node * node, ae_gene_mutation * geneMut)
-// {
-//   node->_mutation_list->add(geneMut);
-//   if (geneMut->get_generation() > _end_gener) _end_gener = geneMut->get_generation();
-// }
- 
-
-
-// void ae_gene_tree::report_gene_loss( ae_gene_tree_node * node, int32_t geneLossDate, ae_gene_loss_type geneLossType)
-// {
-//   node->_gene_loss_date = geneLossDate;
-//   node->_gene_loss_type = geneLossType;
-//   node->_protein_pointer = NULL;
-//   for (int32_t i = 0; i < node->_nb_promoters; i++) {node->_rna_pointers[i] = NULL;}
-//   if (geneLossDate > _end_gener) _end_gener = geneLossDate;
-//   _nb_active_leaves --;
-// }
-  
-
-
-ae_gene_tree_node * ae_gene_tree::search_in_leaves(const ae_protein * protein)
-{
-  return _root->search_in_subtree_leaves(protein);
-}
- 
-
-void ae_gene_tree::print_to_screen(void)
-{
-  _root->print_subtree_to_screen();
-  printf("\n");
-}
-
-
-void ae_gene_tree::write_to_files(const char * topologyFileName, const char * nodeAttributesFileName, int32_t end_gener)
-{
-  FILE  * topology_file = fopen(topologyFileName, "w");
-  if (topology_file == NULL)
-    {
-      fprintf(stderr, "Error: cannot create file %s.\n", topologyFileName);
-      exit(EXIT_FAILURE);
-    }
-
-  FILE  * node_attributes_file = fopen(nodeAttributesFileName, "w");
-  if (node_attributes_file == NULL)
-    {
-      fprintf(stderr, "Error: cannot create file %s.\n", topologyFileName);
-      exit(EXIT_FAILURE);
-    }  
-
-
-  _root->write_subtree_to_files(topology_file, node_attributes_file, end_gener);
-  fprintf(topology_file, ";");
-
-  fclose(topology_file);
-  fclose(node_attributes_file);
-}
-
-
-// f must already be open 
-void ae_gene_tree::write_nodes_in_tabular_file(int32_t treeID, FILE * f)
-{
-  _root->write_subtree_nodes_in_tabular_file(treeID, f);
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
diff --git a/src/libaevol/ae_gene_tree.h b/src/libaevol/ae_gene_tree.h
deleted file mode 100644
index ed24ea8..0000000
--- a/src/libaevol/ae_gene_tree.h
+++ /dev/null
@@ -1,215 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-// 
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class ae_gene_tree_node
- *  \brief Currently used only by post-treatments, on a specific lineage, to monitor the fate of paralogs.
- *         Each node corresponds to a coding RNA. When it is duplicated, two new nodes are added in the tree,
- *         as children of the ancestral version. The left child corresponds to the original DNA segment, while
- *         the right child corresponds to the copy that was reinserted elsewhere, possibly in another genetic 
- *         unit.  
- */
- 
- 
- #ifndef __AE_GENE_TREE_H__
-#define  __AE_GENE_TREE_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_rna.h>
-
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-enum ae_gene_creation_type
-{
-  INITIALIZATION = 0,
-  LOCAL_MUTATION  = 1,
-  REARRANGEMENT = 2,
-  TRANSFER = 3
-};
-
-
-
-
-class ae_gene_tree_node;
-
- 
-class ae_gene_tree : public ae_object
-{  
-  friend class ae_gene_tree_node;
-
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_gene_tree( void );
-    ae_gene_tree( int32_t nodeCreationDate, ae_protein * protein, ae_mutation * mut = NULL ); // Creates a tree with just a root node.
-   
-
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_gene_tree( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    
-    inline ae_gene_creation_type get_creation_type() const;
-    inline int32_t get_begin_gener() const;
-    inline int32_t get_end_gener() const;
-    inline int32_t get_total_nb_nodes() const;
-    inline int32_t get_nb_internal_nodes() const;
-    inline int32_t get_nb_leaves() const;
-    inline int32_t get_nb_active_leaves() const;
-  
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-
-    void set_end_gener_if_active_leaves(int32_t gener);
-    void update_pointers_in_tree_leaves(ae_genetic_unit * unit);
-    void anticipate_mutation_effect_on_genes_in_tree_leaves(ae_mutation * mut, int32_t lengthOfGeneticUnit);
-    void register_actual_mutation_effect_on_genes_in_tree_leaves( ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error);
-
-    /* void duplicate_this_gene(ae_gene_tree_node * node, int32_t duplicDate, ae_protein * newProtein); */
-    /* void report_gene_mutation(ae_gene_tree_node * node, ae_gene_mutation * geneMut); */
-    /* void report_gene_loss(ae_gene_tree_node * node, int32_t geneLossDate, ae_gene_loss_type geneLossType); */
-
-    ae_gene_tree_node * search_in_leaves(const ae_protein * protein); // Returns NULL if not found
-    void print_to_screen(void); // for debug purposes
-    void write_to_files(const char * topologyFileName, const char * nodeAttributesFileName, int32_t end_gener); // Newick format for the topology file
-    void write_nodes_in_tabular_file(int32_t treeID, FILE * f);  // f must already be open 
-
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-
-    ae_gene_tree( const ae_gene_tree &model )
-      {
-        printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-        exit( EXIT_FAILURE );
-      };
-    
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-     
-    ae_gene_tree_node * _root;
-    ae_gene_creation_type _creation_type;
-    int32_t _begin_gener;
-    int32_t _end_gener;
-    int32_t _total_nb_nodes;
-    int32_t _nb_internal_nodes;
-    int32_t _nb_leaves;
-    int32_t _nb_active_leaves;
-    
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-
-inline ae_gene_creation_type ae_gene_tree::get_creation_type() const
-{
-  return _creation_type;
-}
-
-inline int32_t ae_gene_tree::get_begin_gener() const
-{
-  return _begin_gener;
-}
-
-inline int32_t ae_gene_tree::get_end_gener() const
-{
-  return _end_gener;
-}
-
-inline int32_t ae_gene_tree::get_total_nb_nodes() const
-{
-  return _total_nb_nodes;
-}
-
-inline int32_t ae_gene_tree::get_nb_internal_nodes() const
-{
-  return _nb_internal_nodes;
-}
-
-inline int32_t ae_gene_tree::get_nb_leaves() const
-{
-  return _nb_leaves;
-}
-
-inline int32_t ae_gene_tree::get_nb_active_leaves() const
-{
-  return _nb_active_leaves;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_GENE_TREE_H__
diff --git a/src/libaevol/ae_gene_tree_node.cpp b/src/libaevol/ae_gene_tree_node.cpp
deleted file mode 100644
index 3488683..0000000
--- a/src/libaevol/ae_gene_tree_node.cpp
+++ /dev/null
@@ -1,1216 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class
- *  \brief
- */
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <assert.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_gene_tree_node.h>
-#include <ae_gene_mutation.h>
-#include <ae_genetic_unit.h>
-
-
-
-//##############################################################################
-//                                                                             #
-//                          Class ae_gene_tree_node                            #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-int32_t     ae_gene_tree_node::_nextID = 0;
-
-
-// To search for a protein with a specific Shine-Dalgarno position and strand in an ae_list of proteins
-// This one has to be a plain int, to comply with the definition of bsearch()
-static int compare_protein_position( const void * searchedProteinPos, const void * candidateProteinInList ) 
-{
-  if ( *((int32_t *)searchedProteinPos) == ((ae_protein * )candidateProteinInList)->get_shine_dal_pos() ) return 0;
-  else return 1;
-}
-
-
-
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-ae_gene_tree_node::ae_gene_tree_node( int32_t nodeCreationDate, ae_protein * protein)
-{
-  _ID = ae_gene_tree_node::_nextID; 
-  ae_gene_tree_node::_nextID ++;
-
-  _dna_creation_date = nodeCreationDate;
-  _node_creation_date = nodeCreationDate;
-  _gene_loss_date  = -1;
-  _gene_loss_type  = NOT_LOST_YET;
-
-  _protein_pointer = protein;
-  _shine_dal_position = protein->get_shine_dal_pos();
-  _strand = protein->get_strand();
-
-  _nb_promoters = protein->get_rna_list()->get_nb_elts();
-  //printf("%d promoters at positions", _nb_promoters); // debug
-  _promoter_positions = new int32_t[_nb_promoters];
-  _rna_pointers = new ae_rna*[_nb_promoters];
-  ae_list_node<ae_rna*> * rnanode = protein->get_rna_list()->get_first();
-  ae_rna* rna = NULL;
-  int32_t i = 0;
-  while (rnanode != NULL)
-    {
-      rna = rnanode->get_obj();
-      _rna_pointers[i] = rna;
-      _promoter_positions[i] = rna->get_promoter_pos();
-      // printf(" %d, ", _promoter_positions[i] ); // debug
-      rnanode = rnanode->get_next();
-      i++;
-    }
-  // printf(" \n "); //debug 
-
-  _mutation_list = new ae_list<ae_gene_mutation*>();
-
-  _left_child  = NULL; 
-  _right_child = NULL; 
-  _parent_node = NULL; 
-
-  _cds_possibly_modified = false;
-  _proms_possibly_modified = false;
-  _gene_possibly_duplicated = false;
-  _cds_completely_deleted = false;
-  _putative_position_for_the_duplicate = -1;
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-ae_gene_tree_node::~ae_gene_tree_node( void )
-{
-  if (_left_child != NULL) delete _left_child;
-  if (_right_child != NULL) delete _right_child;
-  if (_promoter_positions != NULL) delete [] _promoter_positions;
-  if (_rna_pointers != NULL) delete [] _rna_pointers;
-  _mutation_list->erase(true);
-  delete _mutation_list;
-}
-
-
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-ae_gene_tree_node * ae_gene_tree_node::search_in_subtree_leaves(const ae_protein * protein)
-{
-  ae_gene_tree_node *result_left = NULL, *result_right = NULL;
-  if ((_left_child == NULL) && (_right_child == NULL)) // I am a leaf
-    {
-      if (_protein_pointer == protein) return this;
-      else return NULL;
-    }
-  else // I am an internal node
-    {
-      if (_left_child != NULL)  result_left = _left_child->search_in_subtree_leaves(protein);
-      if (_right_child != NULL) result_right = _right_child->search_in_subtree_leaves(protein);
-      if ((result_left == NULL) && (result_right == NULL)) return NULL;
-      else if ((result_left == NULL) && (result_right != NULL)) return result_right;
-      else if ((result_left != NULL) && (result_right == NULL)) return result_left;
-      else 
-        {
-          fprintf(stderr, "Error, the protein %p should not be found twice in the tree.\n", protein);
-          // get the _root address to print the whole tree to screen
-          ae_gene_tree_node * n = _parent_node, *root = this;
-          while (n!=NULL) {root = n; n = n->_parent_node; }
-          // here, n==NULL and root points on the root of the tree
-          root->print_subtree_to_screen();
-          exit(EXIT_FAILURE);
-        }
-    }
-}
-
-
-void ae_gene_tree_node::print_subtree_to_screen(void)
-{
-  // Postorder tree traversal
-
-  /* Left subtree */
-  if (_left_child != NULL)  _left_child->print_subtree_to_screen();
-
-  /* Right subtree */
-  if (_right_child != NULL) _right_child->print_subtree_to_screen();
-
-  /* Current tree node */
-  printf("Node ID: %"PRId32"\n", _ID);
-  if (_parent_node != NULL)   printf("Parent ID: %"PRId32"\n", _parent_node->_ID);
-  else                        printf("Parent ID: none\n");
-  if (_left_child != NULL)    printf("Left child ID: %"PRId32"\n", _left_child->_ID);
-  else                        printf("Left child ID: none\n");
-  if (_right_child != NULL)   printf("Right child ID: %"PRId32"\n", _right_child->_ID);
-  else                        printf("Right child ID: none\n");
-  printf("Node creation date: %"PRId32"\n", _node_creation_date);
-  printf("DNA creation date: %"PRId32"\n", _dna_creation_date);
-  switch(_gene_loss_type)
-    {
-    case NOT_LOST_YET:            printf("Node status: NOT_LOST_YET\n"); break;
-    case LOST_BY_LOCAL_MUTATION:  printf("Gene loss type: LOST_BY_LOCAL_MUTATION\n");  printf("Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case DELETED :                printf("Gene loss type: DELETED\n");  printf("Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case BROKEN_BY_REAR:          printf("Gene loss type: BROKEN_BY_REAR\n");  printf("Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case DUPLICATED:              printf("Node status: DUPLICATED\n");  printf("Duplication date: %"PRId32"\n", _gene_loss_date);break;
-    default: break;
-    }
-  printf("Protein pointer: %p, Shine-Dalgarno position: %"PRId32"\n", _protein_pointer, _shine_dal_position);
-  if( _strand == LEADING) printf("Strand: LEADING\n");
-  else                    printf("Strand: LAGGING\n");
-  for(int32_t i = 0; i < _nb_promoters; i++)
-    {
-      printf("Promoter at %"PRId32", rna pointer %p\n", _promoter_positions[i], _rna_pointers[i]);
-    }
-  printf("Number of mutations: %"PRId32"\n", _mutation_list->get_nb_elts());
-  ae_list_node<ae_gene_mutation*> * mnode = _mutation_list->get_first();
-  ae_gene_mutation * mut = NULL;
-  char str[128];
-  while(mnode != NULL)
-    {
-      mut = (ae_gene_mutation *) mnode->get_obj();
-      mut->get_description_string_for_gene_mut(str);
-      printf("  %s\n", str);
-      mnode = mnode->get_next();
-    }
-  printf("\n\n");
-}
-
-
-void ae_gene_tree_node::write_subtree_to_files(FILE * topologyFile, FILE * nodeAttributesFile, int32_t end_gener)
-{
-  // Newick format for the topology file (postorder tree traversal with parentheses and branch lengths)
-
-
-  if ((_left_child != NULL) || (_right_child != NULL))
-    {
-      fprintf(topologyFile, "(");
-      /* Left subtree */
-      if (_left_child != NULL) _left_child->write_subtree_to_files(topologyFile, nodeAttributesFile, end_gener);
-     fprintf(topologyFile, ", ");
-     /* Right subtree */
-     if (_right_child != NULL) _right_child->write_subtree_to_files(topologyFile, nodeAttributesFile, end_gener);
-     fprintf(topologyFile, ")");
-    }
-
-  /* Current tree node */
-  fprintf(topologyFile, "%"PRId32"", _ID);
-  if (_gene_loss_type == NOT_LOST_YET)  fprintf(topologyFile, ":%"PRId32"", end_gener - _node_creation_date);
-  else fprintf(topologyFile, ":%"PRId32"", _gene_loss_date - _node_creation_date);
-  
-
-  fprintf(nodeAttributesFile, "Node ID: %"PRId32"\n", _ID);
-  if (_parent_node != NULL)   fprintf(nodeAttributesFile, "Parent ID: %"PRId32"\n", _parent_node->_ID);
-  else                        fprintf(nodeAttributesFile, "Parent ID: none\n");
-  if (_left_child != NULL)    fprintf(nodeAttributesFile, "Left child ID: %"PRId32"\n", _left_child->_ID);
-  else                        fprintf(nodeAttributesFile, "Left child ID: none\n");
-  if (_right_child != NULL)   fprintf(nodeAttributesFile, "Right child ID: %"PRId32"\n", _right_child->_ID);
-  else                        fprintf(nodeAttributesFile, "Right child ID: none\n");
-  fprintf(nodeAttributesFile, "Node creation date: %"PRId32"\n", _node_creation_date);
-  fprintf(nodeAttributesFile, "DNA creation date: %"PRId32"\n", _dna_creation_date);
-  switch(_gene_loss_type)
-    {
-    case NOT_LOST_YET:            fprintf(nodeAttributesFile, "Node status: NOT_LOST_YET\n"); break;
-    case LOST_BY_LOCAL_MUTATION:  fprintf(nodeAttributesFile, "Gene loss type: LOST_BY_LOCAL_MUTATION\n"); fprintf(nodeAttributesFile, "Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case DELETED :                fprintf(nodeAttributesFile, "Gene loss type: DELETED\n"); fprintf(nodeAttributesFile, "Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case BROKEN_BY_REAR:          fprintf(nodeAttributesFile, "Gene loss type: BROKEN_BY_REAR\n"); fprintf(nodeAttributesFile, "Gene loss date: %"PRId32"\n", _gene_loss_date); break;
-    case DUPLICATED:              fprintf(nodeAttributesFile, "Node status:    DUPLICATED\n"); fprintf(nodeAttributesFile, "Duplication date: %"PRId32"\n", _gene_loss_date); break;
-    default: break;
-    }
-  if( _strand == LEADING) fprintf(nodeAttributesFile, "Strand: LEADING\n");
-  else                    fprintf(nodeAttributesFile, "Strand: LAGGING\n");
-  fprintf(nodeAttributesFile, "Shine-Dalgarno position: %"PRId32"\n", _shine_dal_position);
-  for (int32_t i= 0; i < _nb_promoters; i++)
-    {
-      fprintf(nodeAttributesFile, "Position of promoter %"PRId32": %"PRId32"\n", i+1, _promoter_positions[i]);
-    }
-  fprintf(nodeAttributesFile, "Number of mutations: %"PRId32"\n", _mutation_list->get_nb_elts());
-  ae_list_node<ae_gene_mutation*> * mnode = _mutation_list->get_first();
-  ae_gene_mutation * mut = NULL;
-  char str[128];
-  while(mnode != NULL)
-    {
-      mut = mnode->get_obj();
-      mut->get_description_string_for_gene_mut(str);
-      fprintf(nodeAttributesFile, "  %s", str);
-      fprintf(nodeAttributesFile, "\n");
-      mnode = mnode->get_next();
-    }
-
-  if (_gene_loss_type == NOT_LOST_YET)
-    {
-      assert( _protein_pointer != NULL );
-      fprintf(nodeAttributesFile, "  Shine-Dalgarno pos:%"PRId32", Stop pos: %"PRId32", M: %.8f, W: %.8f, H: %.8f, nb promoters: %"PRId32", conc: %.8f \n", \
-              _protein_pointer->get_shine_dal_pos(), _protein_pointer->get_last_STOP_base_pos(), \
-              _protein_pointer->get_mean(), _protein_pointer->get_width(), _protein_pointer->get_height(),  \
-              _protein_pointer->get_rna_list()->get_nb_elts(), _protein_pointer->get_concentration() );
-    }
-  fprintf(nodeAttributesFile, "\n\n");
-}
-
-
-
-// all attributes on a single line
-void ae_gene_tree_node::write_subtree_nodes_in_tabular_file(int32_t treeID, FILE * f)
-{
-  /* Left subtree */
-  if (_left_child != NULL) _left_child->write_subtree_nodes_in_tabular_file(treeID, f);
-  /* Right subtree */
-  if (_right_child != NULL)  _right_child->write_subtree_nodes_in_tabular_file(treeID, f);
-  
-
-  fprintf(f, "%"PRId32" ", treeID);
-  fprintf(f, "%"PRId32" ", _ID);
-  if (_parent_node != NULL)   fprintf(f, "%"PRId32" ", _parent_node->_ID);
-  else                        fprintf(f, "-1 ");
-  if (_left_child != NULL)    fprintf(f, "%"PRId32" ", _left_child->_ID);
-  else                        fprintf(f, "-1 ");
-  if (_right_child != NULL)   fprintf(f, "%"PRId32" ", _right_child->_ID);
-  else                        fprintf(f, "-1 ");
-  fprintf(f, "%"PRId32" ", _node_creation_date);
-  fprintf(f, "%"PRId32" ", _dna_creation_date);
-  switch(_gene_loss_type)
-    {
-    case NOT_LOST_YET:            fprintf(f, "NOT_LOST_YET "); break;
-    case LOST_BY_LOCAL_MUTATION:  fprintf(f, "LOST_BY_LOCAL_MUTATION "); break;
-    case DELETED :                fprintf(f, "DELETED "); break;
-    case BROKEN_BY_REAR:          fprintf(f, "BROKEN_BY_REAR "); break;
-    case DUPLICATED:              fprintf(f, "DUPLICATED ");  break;
-    default: break;
-    }
-  fprintf(f, "%"PRId32" ", _gene_loss_date); 
-  if (_strand == LEADING) fprintf(f, "LEADING ");
-  else                    fprintf(f, "LAGGING ");
-  fprintf(f, "%"PRId32" ", _shine_dal_position); 
-  fprintf(f, "%"PRId32" ", _nb_promoters); 
-  if (_gene_loss_type == NOT_LOST_YET)
-    {
-      assert( _protein_pointer != NULL );
-      fprintf(f, "%.8f %.8f %.8f %.8f ", \
-              _protein_pointer->get_mean(), _protein_pointer->get_width(), _protein_pointer->get_height(),  \
-              _protein_pointer->get_concentration() );
-    }
-  else {fprintf(f, "-1 -1 -1 -1 ");} 
-
-  fprintf(f, "%"PRId32" ", _mutation_list->get_nb_elts());
-  int32_t nb_localmut_upstream_neutral = 0, nb_localmut_upstream_benef = 0, nb_localmut_upstream_delet = 0;
-  int32_t nb_rear_upstream_neutral = 0, nb_rear_upstream_benef = 0, nb_rear_upstream_delet = 0;
-  int32_t nb_localmut_cds_neutral = 0, nb_localmut_cds_benef = 0, nb_localmut_cds_delet = 0;
-  int32_t nb_rear_cds_neutral = 0, nb_rear_cds_benef = 0, nb_rear_cds_delet = 0;
-  ae_list_node<ae_gene_mutation*> * mnode = _mutation_list->get_first();
-  ae_gene_mutation * mut = NULL;
-  if ((_gene_loss_type == DELETED) || (_gene_loss_type == LOST_BY_LOCAL_MUTATION) || (_gene_loss_type == BROKEN_BY_REAR))
-    {
-      // do not count the last event, it was disruptive
-      while(mnode->get_next() != NULL)  // TO DO protect against seg fault if no mutation in the list (should not happen if the gene was disrupted however)
-        {
-          mut = mnode->get_obj();
-          if      ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_localmut_upstream_neutral ++;}
-          else if ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_localmut_upstream_benef ++;}
-          else if ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_localmut_upstream_delet ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_localmut_cds_neutral ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_localmut_cds_benef ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_localmut_cds_delet ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_rear_upstream_neutral ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_rear_upstream_benef ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_rear_upstream_delet ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_rear_cds_neutral ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_rear_cds_benef ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_rear_cds_delet ++;}
-          mnode = mnode->get_next();
-        } 
-    }
-  else
-    {
-      while(mnode != NULL)
-        {
-          mut = mnode->get_obj();
-          if      ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_localmut_upstream_neutral ++;}
-          else if ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_localmut_upstream_benef ++;}
-          else if ((mut->type_of_event() == 0) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_localmut_upstream_delet ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_localmut_cds_neutral ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_localmut_cds_benef ++;}
-          else if ((mut->type_of_event() == 0) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_localmut_cds_delet ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_rear_upstream_neutral ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_rear_upstream_benef ++;}
-          else if ((mut->type_of_event() == 1) && (mut->get_region() == UPSTREAM) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_rear_upstream_delet ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() == 0.0)) {nb_rear_cds_neutral ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() < 0.0)) {nb_rear_cds_benef ++;}
-          else if ((mut->type_of_event() == 1) && ((mut->get_region() == CDS) || (mut->get_region() == BOTH)) && (mut->get_impact_on_metabolic_error() > 0.0)) {nb_rear_cds_delet ++;}
-          mnode = mnode->get_next();
-        } 
-    }
-  fprintf(f, "%"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" ", \
-          nb_localmut_upstream_neutral, nb_localmut_upstream_benef, nb_localmut_upstream_delet,  \
-          nb_localmut_cds_neutral, nb_localmut_cds_benef, nb_localmut_cds_delet, \
-          nb_rear_upstream_neutral, nb_rear_upstream_benef, nb_rear_upstream_delet, \
-          nb_rear_cds_neutral, nb_rear_cds_benef, nb_rear_cds_delet);
-  
-
-
-  fprintf(f, "\n");
-
-}
-
-
-
-// This is an auxiliary function for the method anticipate_mutation_effect_on_genes_in_subtree.
-// The segment should go from 'first' to 'last' (included) in the clockwise sense.
-// 'first' and 'last' should not be equal.
-static bool breakpoint_inside_segment(int32_t pos_brkpt, int32_t first, int32_t last)
-{
-  if (first < last) // most frequent case 
-    {
-      if( (first <= pos_brkpt) && (pos_brkpt <= last)) {return true;}
-      else {return false;}
-    }
-  else // special case where the segment overlaps ori
-    {
-      if( (first <= pos_brkpt) || (pos_brkpt <= last) ) {return true;}
-      else {return false;}
-    }
-} 
-
-
-// This is an auxiliary function for the method anticipate_mutation_effect_on_genes_in_subtree.
-// It return true if the subsegment [first, last] is totally included in the segment [pos1, pos2].
-// The subsegment should go from 'first' to 'last' in the clockwise sense and the segment should
-// go from 'pos1' to 'pos2' in the clockwise sense.
-static bool subsegment_totally_in_segment(int32_t pos1, int32_t pos2, int32_t first, int32_t last)
-{
-  if ( (first < last)  && (pos1 <= pos2) ) 
-    {
-      if ( ((first >= pos1) && (first <= pos2)) && ((last >= pos1) && (last <= pos2)) ) {return true; }
-      else {return false;}
-    }
-  else if ( (first < last) && (pos1 > pos2) )  // mut seg in 2 pieces but not the gene
-    {
-      if ( (first >= pos1) || (last <= pos2) )  // the gene is either completely in [pos1, genlen-1] or completely in [0, pos2]
-        {
-          return true;
-        }
-      else return false;
-    }
-  else if ( (first > last) && (pos1 <= pos2) )  // gene in two pieces but not mut seg, the gene cannot be totally included
-    {
-      return false;
-    }
-  else // both mut seg and the gene are in 2 pieces
-    {
-      if ((first >= pos1) && (last <= pos2)) {return true;}
-      else {return false;}
-    }
-}
-
-
-void ae_gene_tree_node::update_pointers_in_subtree_leaves(ae_genetic_unit * unit)
-{
- if ((_left_child != NULL) || (_right_child != NULL)) // I am a internal node
-    {
-      if (_left_child != NULL)   _left_child->update_pointers_in_subtree_leaves(unit);
-      if (_right_child != NULL)  _right_child->update_pointers_in_subtree_leaves(unit);
-    }
-  else // no child => I am a leaf => there is work to do for me !
-    {
-      if (_gene_loss_type != NOT_LOST_YET)
-        {
-          // inactive leaf
-          return;
-        }
-
-      ae_list_node<ae_protein*> * protnode = NULL;
-      ae_list_node<ae_rna*> * rnanode = NULL;
-      ae_rna * rna = NULL;
-      bool found = false;
-      int32_t i = 0;
-      if (_strand == LEADING) {protnode = (unit->get_protein_list()[LEADING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL);}
-      else                    {protnode = (unit->get_protein_list()[LAGGING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL); }
-     
-      if (found)
-        {
-          /* The strand and shine dal position are correct */
-          /* Update the protein and rna pointers and positions */
-          _protein_pointer = protnode->get_obj();
-          _nb_promoters = _protein_pointer->get_rna_list()->get_nb_elts();
-          if (_promoter_positions != NULL) delete [] _promoter_positions;
-          if (_rna_pointers != NULL) delete [] _rna_pointers;
-          _promoter_positions = new int32_t[_nb_promoters];
-          _rna_pointers = new ae_rna*[_nb_promoters];
-          rnanode = _protein_pointer->get_rna_list()->get_first();
-          rna = NULL;
-          i = 0;
-          while (rnanode != NULL)
-            {
-              rna = rnanode->get_obj();
-              _rna_pointers[i] = rna;
-              _promoter_positions[i] = rna->get_promoter_pos();
-              rnanode = rnanode->get_next();
-              i++;
-            }
-        }
-      else
-        {
-          fprintf(stderr, "Error: cannot find a protein that should be there.\n");
-          exit(EXIT_FAILURE);
-        }
-    }
-}
-
-void ae_gene_tree_node::anticipate_mutation_effect_on_genes_in_subtree_leaves(ae_mutation * mut, int32_t lengthOfGeneticUnit)
-{
-  if ((_left_child != NULL) || (_right_child != NULL)) // I am a internal node
-    {
-      if (_left_child != NULL)   _left_child->anticipate_mutation_effect_on_genes_in_subtree_leaves(mut, lengthOfGeneticUnit);
-      if (_right_child != NULL)  _right_child->anticipate_mutation_effect_on_genes_in_subtree_leaves(mut, lengthOfGeneticUnit);
-    }
-  else // no child => I am a leaf => there is work to do for me !
-    {
-      if (_gene_loss_type != NOT_LOST_YET)
-        {
-          // inactive leaf
-          return;
-        }
-
-      int32_t genlen = lengthOfGeneticUnit; // in bp
-      int32_t pos0 = -1, pos1 = -1, pos2 = -1, pos2bis = -1, pos3 = -1, mutlength = -1;
-      // int32_t pos1donor = -1, pos2donor = -1, pos3donor = -1;  ae_sense sense = DIRECT;  // related to transfer (TO DO)
-      bool invert = false;
-      ae_mutation_type type = mut->get_mut_type();
-      switch(type)
-        {
-        case SWITCH:
-          {
-            mut->get_infos_point_mutation(&pos0);
-            mutlength = 1;
-            break;
-          }
-        case S_INS:
-          {
-            mut->get_infos_small_insertion(&pos0, &mutlength);
-            break;
-          }
-        case S_DEL:
-          {
-            mut->get_infos_small_deletion(&pos0, &mutlength);
-            break;
-          }
-        case DUPL:
-          {
-            mut->get_infos_duplication(&pos1, &pos2, &pos0); 
-            // pos2 is actually not included in the segment, the real end of the segment is pos2 - 1
-            pos2bis = pos2;
-            pos2 = ae_utils::mod(pos2 - 1, genlen);
-            mutlength = mut->get_length();
-            break;
-          }
-        case DEL:
-          {
-            mut->get_infos_deletion(&pos1, &pos2); 
-            pos2bis = pos2;
-            pos2 = ae_utils::mod(pos2 - 1, genlen);
-            mutlength = mut->get_length();
-            break;
-          }
-        case TRANS:
-          {
-            mut->get_infos_translocation(&pos1, &pos2, &pos3, &pos0, &invert); // TO DO: check whether the 4 positions are also in absolute coordinates when rearrangements with alignments
-            pos2bis = pos2;
-            pos2 = ae_utils::mod(pos2 - 1, genlen);
-            mutlength = mut->get_length();
-            break;
-          }
-        case INV:
-          {
-            mut->get_infos_inversion(&pos1, &pos2);
-            pos2bis = pos2;
-            pos2 = ae_utils::mod(pos2 - 1, genlen); 
-            mutlength = mut->get_length();
-            break;
-          }
-        case INSERT:
-          {
-            // TO DO
-            break;
-          }
-        case INS_HT:
-          {
-            // TO DO
-            break;
-          }
-        case REPL_HT:
-          {
-            // TO DO
-            break;
-          }
-        default:
-          {
-            fprintf(stderr, "Error: unknown mutation type in ae_gene_tree_node::anticipate_mutation_effect_on_genes_in_subtree.\n");
-          }
-        }
-
-
-      int32_t first_cds, last_cds;
-      int32_t first_upstream, last_upstream; // "upstream region" is the segment between the furthest promoter and the Shine-Dalgarno sequence
-      int32_t nbprom = _protein_pointer->get_rna_list()->get_nb_elts();
-      assert(nbprom != 0);
-      assert(nbprom == _nb_promoters);
-      int32_t position_furthest_prom = -1, currentprompos = -1;
-      ae_list_node<ae_rna*> * rnanode = NULL;
-      ae_rna* rna = NULL;
-      int32_t i = 0;
-      if (_protein_pointer->get_strand() == LEADING)
-        {
-          first_cds = _protein_pointer->get_shine_dal_pos();
-          last_cds = _protein_pointer->get_last_STOP_base_pos( );
-          rnanode = _protein_pointer->get_rna_list()->get_first();
-          while (rnanode != NULL)
-            {
-              rna = rnanode->get_obj();
-              currentprompos = rna->get_promoter_pos();
-              if (currentprompos > first_cds) currentprompos = currentprompos - genlen; // negative value for promoters on the other side of ori
-              if ((position_furthest_prom == -1) || (position_furthest_prom < currentprompos)) // we need the smallest promoter position
-                {
-                  position_furthest_prom = rna->get_promoter_pos();
-                }
-              rnanode = rnanode->get_next();
-              i++;
-            }
-          position_furthest_prom = ae_utils::mod(position_furthest_prom, genlen); // restore a positive value if necessary
-          first_upstream = position_furthest_prom;
-          last_upstream = ae_utils::mod(first_cds - 1, genlen);
-        }
-      else
-        {
-          first_cds = _protein_pointer->get_last_STOP_base_pos( );
-          last_cds = _protein_pointer->get_shine_dal_pos();
-          rnanode = _protein_pointer->get_rna_list()->get_first();
-          while (rnanode != NULL)
-            {
-              rna = rnanode->get_obj();
-              currentprompos = rna->get_promoter_pos();
-              if (currentprompos < last_cds) currentprompos = currentprompos + genlen; // value larger than genlen for promoters on the other side of ori
-              if ((position_furthest_prom == -1) || (position_furthest_prom > currentprompos)) // we need the largest promoter position
-                {
-                  position_furthest_prom = rna->get_promoter_pos();
-                }
-              rnanode = rnanode->get_next();
-              i++;
-            }
-          position_furthest_prom = ae_utils::mod(position_furthest_prom, genlen); // restore a value < genlen if necessary
-          first_upstream = ae_utils::mod(last_cds - 1, genlen);
-          last_upstream = position_furthest_prom;
-        }
-
- 
-
-
-      switch(type)
-        {
-        case SWITCH:
-          {
-            if (breakpoint_inside_segment(pos0, first_cds, last_cds)) _cds_possibly_modified = true;
-            if (breakpoint_inside_segment(pos0, first_upstream, last_upstream)) _proms_possibly_modified = true;
-            break;
-          }
-        case S_INS:
-          {
-            if (breakpoint_inside_segment(pos0, first_cds, last_cds)) _cds_possibly_modified = true;
-            if (breakpoint_inside_segment(pos0, first_upstream, last_upstream)) _proms_possibly_modified = true;
-
-            if (_shine_dal_position >= pos0) _shine_dal_position = ae_utils::mod(_shine_dal_position + mutlength, genlen + mutlength);
-            for (i = 0; i <_nb_promoters; i++) 
-              {
-                if (_promoter_positions[i] >= pos0){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + mutlength, genlen + mutlength);}
-              }
-
-            break;
-          }
-        case S_DEL:
-          {
-            // If the Shine-Dalgarno position is in the small deleted segment, mark the cds as deleted
-            // (our gene tracking is based on the tracking of the Shine-Dalgarno position,
-            // and we cannot predict the position of a bp that was deleted: we lose track of the gene) 
-            if (mutlength == 1)
-              {
-                if (_protein_pointer->get_shine_dal_pos() == pos0)  _cds_completely_deleted = true;
-              }
-            else // mutlength > 1
-              {
-                if (breakpoint_inside_segment(_protein_pointer->get_shine_dal_pos(), pos0, ae_utils::mod(pos0 + mutlength - 1, genlen))) _cds_completely_deleted = true;   
-              }
-            
-            if (!(_cds_completely_deleted))
-              {
-                if (breakpoint_inside_segment(pos0, ae_utils::mod(first_cds - mutlength, genlen), last_cds)) _cds_possibly_modified = true;
-                if (breakpoint_inside_segment(pos0, ae_utils::mod(first_upstream - mutlength, genlen), last_upstream)) _proms_possibly_modified = true;
-                
-                if ( pos0 + mutlength <= genlen ) // the deletion does not contain the replication origin 
-                  {
-                    if (_shine_dal_position >= pos0) _shine_dal_position = ae_utils::mod(_shine_dal_position - mutlength, genlen - mutlength);
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if (_promoter_positions[i] >= pos0){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - mutlength, genlen - mutlength);}
-                      }
-                  }
-                else // the deletion contains the replication origin
-                  {
-                    int32_t nb_del_after_ori = mutlength - genlen + pos0;
-                    if (_shine_dal_position >= 0) _shine_dal_position = ae_utils::mod(_shine_dal_position - nb_del_after_ori, genlen - mutlength);
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if (_promoter_positions[i] >= 0){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - nb_del_after_ori, genlen - mutlength);}
-                      }
-                  }
-              }
-            break;
-          }
-        case DUPL:
-          {
-            if (subsegment_totally_in_segment(pos1, pos2, first_cds, last_cds)) 
-              {
-                _gene_possibly_duplicated = true;
-                _putative_position_for_the_duplicate = ae_utils::mod(ae_utils::mod(_shine_dal_position - pos1, genlen) + pos0, genlen + mutlength);
-              }
-            if (breakpoint_inside_segment(pos0, first_cds, last_cds)) _cds_possibly_modified = true;
-            if (breakpoint_inside_segment(pos0, first_upstream, last_upstream)) _proms_possibly_modified = true;
-
-            if (_shine_dal_position >= pos0) _shine_dal_position = ae_utils::mod(_shine_dal_position + mutlength, genlen + mutlength);
-            for (i = 0; i <_nb_promoters; i++) 
-              {
-                if (_promoter_positions[i] >= pos0){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + mutlength, genlen + mutlength);}
-              }
-   
-            break;
-          }
-        case DEL:
-          {
-            // If the Shine-Dalgarno is in the deleted segment, mark the cds as deleted
-            // (our gene tracking is based on the tracking of the Shine-Dalgarno position,
-            // and we cannot predict the position of a bp that was deleted: we lose track of the gene)
-           if (mutlength == 1)
-              {
-                if (_protein_pointer->get_shine_dal_pos() == pos1)  _cds_completely_deleted = true;
-              }
-            else // mutlength > 1
-              {
-                if (breakpoint_inside_segment(_protein_pointer->get_shine_dal_pos(), pos1, pos2)) _cds_completely_deleted = true;   
-              }
-            
-            if (!(_cds_completely_deleted))
-              {
-                if (breakpoint_inside_segment(pos1, first_cds, last_cds) || breakpoint_inside_segment(pos2, first_cds, last_cds)) _cds_possibly_modified = true;     
-                if (breakpoint_inside_segment(pos1, first_upstream, last_upstream) || breakpoint_inside_segment(pos2, first_upstream, last_upstream)) _proms_possibly_modified = true;   
-
-                if ( pos1 < pos2bis ) // the deletion does not contain the replication origin 
-                  {
-                    if (_shine_dal_position >= pos1) _shine_dal_position = ae_utils::mod(_shine_dal_position - mutlength, genlen - mutlength);
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if (_promoter_positions[i] >= pos1){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - mutlength, genlen - mutlength);}
-                      }
-                  }
-                else  // the deletion contains the replication origin
-                  {
-                    if (_shine_dal_position >= 0) _shine_dal_position = ae_utils::mod(_shine_dal_position - pos2bis, genlen - mutlength);
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if (_promoter_positions[i] >= 0){ _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - pos2bis, genlen - mutlength);}
-                      }
-                  }
-              }
-            break;
-          }
-        case TRANS:  
-          {
-            if (breakpoint_inside_segment(pos1, first_cds, last_cds)) _cds_possibly_modified = true;   // beginning of the excised segment   
-            if (breakpoint_inside_segment(pos2, first_cds, last_cds)) _cds_possibly_modified = true;  // end of the excised segment    
-            if (breakpoint_inside_segment(pos3, first_cds, last_cds)) _cds_possibly_modified = true;  // breakpoint inside the segment for the reinsertion  
-            if (breakpoint_inside_segment(pos0, first_cds, last_cds)) _cds_possibly_modified = true;  // reinsertion point in the genetic unit
-            if (breakpoint_inside_segment(pos1, first_upstream, last_upstream)) _proms_possibly_modified = true;   // beginning of the excised segment   
-            if (breakpoint_inside_segment(pos2, first_upstream, last_upstream)) _proms_possibly_modified = true;  // end of the excised segment    
-            if (breakpoint_inside_segment(pos3, first_upstream, last_upstream)) _proms_possibly_modified = true;  // breakpoint inside the segment for the reinsertion  
-            if (breakpoint_inside_segment(pos0, first_upstream, last_upstream)) _proms_possibly_modified = true;  // reinsertion point in the genetic unit
-
-            int32_t pos_min = ae_utils::min( pos1, ae_utils::min( pos2bis, ae_utils::min( pos3, pos0 ) ) );
-            int32_t pos_B, pos_C, pos_D, pos_E;
-            int32_t len_B, len_C, len_D;
-            if ( ! invert )
-              {
-                if ( pos_min == pos1 )          { pos_B = pos1; pos_C = pos3; pos_D = pos2bis; pos_E = pos0; }
-                else if ( pos_min == pos2bis )  { pos_B = pos2bis; pos_C = pos0; pos_D = pos1; pos_E = pos3; }
-                else if ( pos_min == pos3 )     { pos_B = pos3; pos_C = pos2bis; pos_D = pos0; pos_E = pos1; }
-                else                            { pos_B = pos0; pos_C = pos1; pos_D = pos3; pos_E = pos2bis; } // if ( pos_min == pos0 )
-                len_B = pos_C - pos_B;
-                len_C = pos_D - pos_C;
-                len_D = pos_E - pos_D;
-                if      ((_shine_dal_position >= pos_B) && (_shine_dal_position < pos_C))   _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D + len_C, genlen);
-                else if ((_shine_dal_position >= pos_C) && (_shine_dal_position < pos_D))   _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D - len_B, genlen);
-                else if ((_shine_dal_position >= pos_D) && (_shine_dal_position < pos_E))   _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B - len_C, genlen);
-                for (i = 0; i <_nb_promoters; i++) 
-                  {
-                    if      ((_promoter_positions[i] >= pos_B) && (_promoter_positions[i] < pos_C))  _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D + len_C, genlen);
-                    else if ((_promoter_positions[i] >= pos_C) && (_promoter_positions[i] < pos_D))  _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D - len_B, genlen);
-                    else if ((_promoter_positions[i] >= pos_D) && (_promoter_positions[i] < pos_E))  _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B - len_C, genlen);
-                  }
-              }
-            else // invert
-              {
-                if ( pos_min == pos1 )
-                  {
-                    pos_B = pos1; pos_C = pos3; pos_D = pos2bis; pos_E = pos0;
-                    len_B = pos_C - pos_B;
-                    len_C = pos_D - pos_C;
-                    len_D = pos_E - pos_D;
-                    if  ((_shine_dal_position >= pos_B) && (_shine_dal_position < pos_C))   
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_B + pos_C - _shine_dal_position -1 ; 
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_C) && (_shine_dal_position < pos_D)) 
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_C + pos_D - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_D) && (_shine_dal_position < pos_E))
-                      {
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B - len_C, genlen);
-                      }
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if  ((_promoter_positions[i] >= pos_B) && (_promoter_positions[i] < pos_C))   
-                          {
-                            _promoter_positions[i] = pos_B + pos_C - _promoter_positions[i] - 1; 
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_C) && (_promoter_positions[i] < pos_D)) 
-                          {
-                            _promoter_positions[i] = pos_C + pos_D - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_D) && (_promoter_positions[i] < pos_E))
-                          {
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B - len_C, genlen);
-                          }
-                      }
-                  }
-                else if ( pos_min == pos2bis )
-                  {
-                    pos_B = pos2bis; pos_C = pos0; pos_D = pos1; pos_E = pos3;
-                    len_B = pos_C - pos_B;
-                    len_C = pos_D - pos_C;
-                    len_D = pos_E - pos_D;
-                    if  ((_shine_dal_position >= pos_B) && (_shine_dal_position < pos_C))   
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_B + pos_C - _shine_dal_position - 1; 
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_C) && (_shine_dal_position < pos_D)) 
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_C + pos_D - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_D) && (_shine_dal_position < pos_E))
-                      {
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B - len_C, genlen);
-                      }
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if  ((_promoter_positions[i] >= pos_B) && (_promoter_positions[i] < pos_C))   
-                          {
-                            _promoter_positions[i] = pos_B + pos_C - _promoter_positions[i] - 1; 
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_C) && (_promoter_positions[i] < pos_D)) 
-                          {
-                            _promoter_positions[i] = pos_C + pos_D - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_D) && (_promoter_positions[i] < pos_E))
-                          {
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B - len_C, genlen);
-                          }
-                      }
-                  }
-                else if ( pos_min == pos3 )
-                  {
-                    pos_B = pos3; pos_C = pos2bis; pos_D = pos0; pos_E = pos1;
-                    len_B = pos_C - pos_B;
-                    len_C = pos_D - pos_C;
-                    len_D = pos_E - pos_D;
-                    if  ((_shine_dal_position >= pos_B) && (_shine_dal_position < pos_C))   
-                      {
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_C + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_C) && (_shine_dal_position < pos_D)) 
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_C + pos_D - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_D) && (_shine_dal_position < pos_E))
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_D + pos_E - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B, genlen);
-                      }
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if  ((_promoter_positions[i] >= pos_B) && (_promoter_positions[i] < pos_C))   
-                          {
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_C + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_C) && (_promoter_positions[i] < pos_D)) 
-                          {
-                            _promoter_positions[i] = pos_C + pos_D - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_D) && (_promoter_positions[i] < pos_E))
-                          {
-                            _promoter_positions[i] = pos_D + pos_E - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B, genlen);
-                          }
-                      }
-
-                  }
-                else // if ( pos_min == pos0 )
-                  {
-                    pos_B = pos0; pos_C = pos1; pos_D = pos3; pos_E = pos2bis;
-                    len_B = pos_C - pos_B;
-                    len_C = pos_D - pos_C;
-                    len_D = pos_E - pos_D;
-                    if  ((_shine_dal_position >= pos_B) && (_shine_dal_position < pos_C))   
-                      {
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position + len_C + len_D, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_C) && (_shine_dal_position < pos_D)) 
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_C + pos_D - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B, genlen);
-                      }
-                    else if ((_shine_dal_position >= pos_D) && (_shine_dal_position < pos_E))
-                      {
-                        if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                        _shine_dal_position = pos_D + pos_E - _shine_dal_position - 1;
-                        _shine_dal_position = ae_utils::mod(_shine_dal_position - len_B, genlen);
-                      }
-                    for (i = 0; i <_nb_promoters; i++) 
-                      {
-                        if  ((_promoter_positions[i] >= pos_B) && (_promoter_positions[i] < pos_C))   
-                          {
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] + len_C + len_D, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_C) && (_promoter_positions[i] < pos_D)) 
-                          {
-                            _promoter_positions[i] = pos_C + pos_D - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B, genlen);
-                          }
-                        else if ((_promoter_positions[i] >= pos_D) && (_promoter_positions[i] < pos_E))
-                          {
-                            _promoter_positions[i] = pos_D + pos_E - _promoter_positions[i] - 1;
-                            _promoter_positions[i] = ae_utils::mod(_promoter_positions[i] - len_B, genlen);
-                          }
-                      }
-                  }
-              }
-  
-            break;
-          }
-        case INV:
-          {
-            if (breakpoint_inside_segment(pos1, first_cds, last_cds)) _cds_possibly_modified = true;   
-            if (breakpoint_inside_segment(pos2, first_cds, last_cds)) _cds_possibly_modified = true; 
-            if (breakpoint_inside_segment(pos1, first_upstream, last_upstream)) _proms_possibly_modified = true;   // beginning of the excised segment   
-            if (breakpoint_inside_segment(pos2, first_upstream, last_upstream)) _proms_possibly_modified = true;  // end of the excised segment
-
-            if  ((_shine_dal_position >= pos1) && (_shine_dal_position < pos2bis))   
-              {
-                if (_strand == LEADING) {_strand = LAGGING;} else {_strand = LEADING;}
-                _shine_dal_position = ae_utils::mod(pos1 + pos2bis - _shine_dal_position - 1, genlen); 
-              }
-            break;
-          }
-        case INSERT:
-          {
-            // TO DO 
-            break;
-          }
-        case INS_HT:
-          {
-            // TO DO
-            break;
-          }
-        case REPL_HT:
-          {
-            // TO DO
-            break;
-          }
-        }
-    }
-}
-
-
-
-
-void ae_gene_tree_node::register_actual_mutation_effect_on_genes_in_subtree_leaves( ae_gene_tree * tree, ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error)
-{
-  if ((_left_child != NULL) || (_right_child != NULL)) // I am a internal node, just delegate work to others
-    {
-      if (_left_child != NULL)   _left_child->register_actual_mutation_effect_on_genes_in_subtree_leaves( tree, mut, unit, gener, impact_on_metabolic_error);
-      if (_right_child != NULL)  _right_child->register_actual_mutation_effect_on_genes_in_subtree_leaves( tree, mut, unit, gener, impact_on_metabolic_error);
-    }
-  else // no child => I am a leaf => there is work to do for me !
-    {
-
-      if (_gene_loss_type != NOT_LOST_YET)
-        {
-          // inactive leaf
-          return;
-        }
-
-
-      ae_list_node<ae_protein*> * protnode = NULL;
-      ae_list_node<ae_rna*> * rnanode = NULL;
-      ae_protein * tmpprot = NULL;
-      ae_rna * rna = NULL;
-      ae_gene_mutation * genemut = NULL;
-      bool found = false;
-      int32_t i = 0;
-
-
-      if (_cds_completely_deleted)
-        {
-          genemut = new ae_gene_mutation(*mut, gener, _shine_dal_position, _strand, CDS);
-          genemut->set_impact_on_metabolic_error(impact_on_metabolic_error);
-          _mutation_list->add(genemut);
-          if (gener > tree->_end_gener) tree->_end_gener = gener;
-    
-          _gene_loss_date = gener;
-          _gene_loss_type = DELETED;
-          _protein_pointer = NULL;
-          for (int32_t i = 0; i < _nb_promoters; i++) {_rna_pointers[i] = NULL;}
-          if (gener > tree->_end_gener) tree->_end_gener = gener;
-          (tree->_nb_active_leaves) --;
-          return;
-        }
-      
-        
-      if ( (!_cds_completely_deleted) && (!_cds_possibly_modified) && (!_proms_possibly_modified) )
-        {
-          // This CDS was not affected by the mutation (it could have be moved or duplicated however). 
-          // Just make sure that we have correctly predicted the positions of the SD sequence and of the promoters.
-      
-          if (_strand == LEADING) {protnode = (unit->get_protein_list()[LEADING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL);}
-          else                    {protnode = (unit->get_protein_list()[LAGGING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL); }
-     
-          if (found)
-            {
-              /* The strand and shine dal position are correct */
-              /* Update the protein and rna pointers and positions */
-              _protein_pointer = protnode->get_obj();
-              _nb_promoters = _protein_pointer->get_rna_list()->get_nb_elts();
-              if (_promoter_positions != NULL) delete [] _promoter_positions;
-              if (_rna_pointers != NULL) delete [] _rna_pointers;
-              _promoter_positions = new int32_t[_nb_promoters];
-              _rna_pointers = new ae_rna*[_nb_promoters];
-              rnanode = _protein_pointer->get_rna_list()->get_first();
-              rna = NULL;
-              i = 0;
-              while (rnanode != NULL)
-                {
-                  rna = rnanode->get_obj();
-                  _rna_pointers[i] = rna;
-                  _promoter_positions[i] = rna->get_promoter_pos();
-                  rnanode = rnanode->get_next();
-                  i++;
-                }
-            }
-          else
-            {
-              fprintf(stderr, "Error: cannot find a protein that should have survived.\n");
-              char str[100];
-              mut->get_generic_description_string(str);
-              printf("Mutation : %s\n", str);
-              printf("CDS should be at %d ", _shine_dal_position);
-              if (_strand == LEADING) printf("LEADING\n");
-              else printf("LAGGING\n");
-              unit->print_proteins();
-              exit(EXIT_FAILURE);
-            }
-        }
-  
-
-      if (_cds_possibly_modified || _proms_possibly_modified)
-        {
-          /* Record the impact of the mutation on the metabolic error */
-          if      ((_cds_possibly_modified) && (_proms_possibly_modified))   genemut = new ae_gene_mutation(*mut, gener, _shine_dal_position, _strand, BOTH);
-          else if ((_cds_possibly_modified) && (!_proms_possibly_modified))  genemut = new ae_gene_mutation(*mut, gener, _shine_dal_position, _strand, CDS);
-          else if ((!_cds_possibly_modified) && (_proms_possibly_modified))  genemut = new ae_gene_mutation(*mut, gener, _shine_dal_position, _strand, UPSTREAM);
-          genemut->set_impact_on_metabolic_error(impact_on_metabolic_error);
-          _mutation_list->add(genemut);
-          if (gener > tree->_end_gener) tree->_end_gener = gener;
-      
-          /* Check whether the protein survived the event */ 
-          if (_strand == LEADING) {protnode = (unit->get_protein_list()[LEADING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL);}
-          else                    {protnode = (unit->get_protein_list()[LAGGING])->bsearch(&_shine_dal_position, compare_protein_position); found = (protnode != NULL); }
-     
-          if (found) 
-            {
-              /* The strand and shine dal position are correct */
-              /* Update the protein and rna pointers and positions */
-              _protein_pointer = protnode->get_obj();
-              _nb_promoters = _protein_pointer->get_rna_list()->get_nb_elts();
-              if (_promoter_positions != NULL) delete [] _promoter_positions;
-              if (_rna_pointers != NULL) delete [] _rna_pointers;
-              _promoter_positions = new int32_t[_nb_promoters];
-              _rna_pointers = new ae_rna*[_nb_promoters];
-              rnanode = _protein_pointer->get_rna_list()->get_first();
-              rna = NULL;
-              i = 0;
-              while (rnanode != NULL)
-                {
-                  rna = rnanode->get_obj();
-                  _rna_pointers[i] = rna;
-                  _promoter_positions[i] = rna->get_promoter_pos();
-                  rnanode = rnanode->get_next();
-                  i++;
-                }
-            }
-          else
-            {
-              /* The protein does not exist anymore, the gene was killed by the event */
-              _gene_loss_date = gener;
-              if ((mut->get_mut_type() == SWITCH) || (mut->get_mut_type() == S_INS) || (mut->get_mut_type() == S_DEL)) _gene_loss_type = LOST_BY_LOCAL_MUTATION;
-              else if ((mut->get_mut_type() == DUPL) || (mut->get_mut_type() == DEL) || (mut->get_mut_type() == TRANS) || (mut->get_mut_type() == INV)) _gene_loss_type = BROKEN_BY_REAR;
-              _protein_pointer = NULL;
-              for (int32_t i = 0; i < _nb_promoters; i++) {_rna_pointers[i] = NULL;}
-              if (gener > tree->_end_gener) (tree->_end_gener) = gener;
-              (tree->_nb_active_leaves) --;
-              
-            }
-
-        }
- 
-
-      if (_gene_possibly_duplicated)
-        {
-          /* Check whether the duplicated CDS found a promoter */ 
-          /* It should be on the same strand as myself, at the _putative_position_for_the_duplicate */
-          if (_strand == LEADING) {protnode = (unit->get_protein_list()[LEADING])->bsearch(&_putative_position_for_the_duplicate, compare_protein_position); found = (protnode != NULL);}
-          else                    {protnode = (unit->get_protein_list()[LAGGING])->bsearch(&_putative_position_for_the_duplicate, compare_protein_position); found = (protnode != NULL);}
-      
-          if (found)
-            {
-              tmpprot = protnode->get_obj();
-
-              if (_protein_pointer != NULL)
-                {
-                  // Create a new node for the "old" DNA segment
-                  _left_child = new ae_gene_tree_node(gener, _protein_pointer);
-                  _left_child->_node_creation_date = gener;
-                  _left_child->_dna_creation_date = _dna_creation_date;
-                  _left_child->_parent_node = this;
-                }
-              else
-                {
-                  // Poor old gene was killed by the insertion of the duplicated segment
-                  // We do not create a left child
-                  _left_child = NULL;
-                }
-
-              // Create a new node for the "new" DNA segment
-              _right_child = new ae_gene_tree_node(gener, tmpprot);
-              _right_child->_node_creation_date = gener;
-              _right_child->_dna_creation_date = gener;
-              _right_child->_parent_node = this;
-          
-              // This node becomes internal, it represents an ancestral (obsolete) state of the gene
-              _protein_pointer = NULL;
-              for (int32_t i = 0; i < _nb_promoters; i++) {_rna_pointers[i] = NULL;}
-              _gene_loss_type = DUPLICATED; 
-              _gene_loss_date = gener;
-          
-              // Update tree statistics
-              if (_left_child != NULL)
-                {
-                  (tree->_total_nb_nodes) += 2;
-                  (tree->_nb_internal_nodes) ++;
-                  (tree->_nb_leaves) ++;  // - 1 + 2 (the ex-leaf becomes an internal node, 2 leaves are created)
-
-                }
-              else
-                {
-                  (tree->_total_nb_nodes) += 1;
-                  (tree->_nb_internal_nodes) ++;
-                  // (tree->_nb_leaves) remains unchanged  <==  - 1 + 1 (the ex-leaf becomes an internal node, 1 leave is created)
-                }
-              if (tmpprot != NULL) (tree->_nb_active_leaves) ++;
-              if (gener > tree->_end_gener) (tree->_end_gener) = gener;
-            }
-          // else nothing to do, the duplication was only partial, not a complete gene duplication 
-        }
-
-
-      /* Get ready for the next mutation */
-      _cds_possibly_modified = false;
-      _proms_possibly_modified = false;
-      _gene_possibly_duplicated = false;
-      _cds_completely_deleted = false;
-      _putative_position_for_the_duplicate = -1;
-    }
-
-}
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-
diff --git a/src/libaevol/ae_gene_tree_node.h b/src/libaevol/ae_gene_tree_node.h
deleted file mode 100644
index 71699ab..0000000
--- a/src/libaevol/ae_gene_tree_node.h
+++ /dev/null
@@ -1,189 +0,0 @@
-//*****************************************************************************
-//
-//                         aevol - Artificial Evolution
-//
-// Copyright (C) 2004  LIRIS.
-// Web: https://liris.cnrs.fr/
-// E-mail: carole.knibbe at liris.cnrs.fr
-// Original Authors : Guillaume Beslon, Carole Knibbe, Virginie Lefort
-//                    David Parsons
-// 
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//*****************************************************************************
-
-
-/** \class ae_gene_tree_node
- *  \brief Currently used only by post-treatments, on a specific lineage, to monitor the fate of paralogs.
- *         Each node corresponds to a coding RNA. When it is duplicated, two new nodes are added in the tree,
- *         as children of the ancestral version. The left child corresponds to the original DNA segment, while
- *         the right child corresponds to the copy that was reinserted elsewhere, possibly in another genetic 
- *         unit.  
- */
- 
- 
- #ifndef __AE_GENE_TREE_NODE_H__
-#define  __AE_GENE_TREE_NODE_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_rna.h>
-#include <ae_list.h>
-#include <ae_gene_mutation.h>
-#include <ae_gene_tree.h>
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
- 
-class ae_gene_tree_node : public ae_object
-{  
-  friend class ae_gene_tree;
-
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-
-    ae_gene_tree_node( int32_t nodeCreationDate, ae_protein * protein); 
-
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_gene_tree_node( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline ae_list<ae_gene_mutation*>* get_mutation_list() const;
-    inline ae_gene_loss_type get_gene_loss_type() const;
-  
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    ae_gene_tree_node * search_in_subtree_leaves(const ae_protein * protein);
-    void print_subtree_to_screen(void); // for debug purposes
-    void write_subtree_to_files(FILE * topologyFile, FILE * nodeAttributesFile, int32_t end_gener);
-    void write_subtree_nodes_in_tabular_file(int32_t treeID, FILE *f); // f must already be open
-    void update_pointers_in_subtree_leaves(ae_genetic_unit * unit);
-    void anticipate_mutation_effect_on_genes_in_subtree_leaves(ae_mutation * mut, int32_t lengthOfGeneticUnit);
-    void register_actual_mutation_effect_on_genes_in_subtree_leaves( ae_gene_tree * tree, ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error);
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_gene_tree_node( void )
-      {
-        printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-        exit( EXIT_FAILURE );
-      };
-    ae_gene_tree_node( const ae_gene_tree_node &model )
-      {
-        printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-        exit( EXIT_FAILURE );
-      };
-    
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-      static int32_t     _nextID;
-    
-    int32_t             _ID;
-    int32_t             _dna_creation_date;   // generation when the DNA of this gene copy was created. For left nodes, equals the creation date of the parent node. 
-    int32_t             _node_creation_date;  // generation when this node was created. For right nodes, equals the dna creation date. 
-    int32_t             _gene_loss_date;      // generation when the gene was lost: became a pseudogene, or was deleted, or was broken by a rearrangement
-    ae_gene_loss_type   _gene_loss_type;      // NOT_LOST_YET or LOST_BY_LOCAL_MUTATION or DELETED or BROKEN_BY_REAR
-    ae_strand           _strand;
-    int32_t             _shine_dal_position;
-    int32_t             _nb_promoters;
-    int32_t *           _promoter_positions;
-    ae_protein *        _protein_pointer;     // for a leaf (current state of a gene), points to the potein object
-                                              // for an internal node (ancestral state of a gene), points to NULL
-    ae_rna **           _rna_pointers;         // for a leaf (current state of a gene), points to the RNA object 
-                                              // for an internal node (ancestral state of a gene), points to NULL
-    ae_list<ae_gene_mutation*> * _mutation_list;       // list of ae_gene_mutations since the creation date of the node, i.e. since the last duplication
-
-
-    ae_gene_tree_node * _left_child;    // NULL until the gene is duplicated, then points to the copy lying on the original DNA segment 
-    ae_gene_tree_node * _right_child;   // NULL until the gene is duplicated, then points to the copy lying on the duplicated DNA segment 
-                                        // (which was reinserted elsewhere in the genome, possibly on another genetic unit)
-    ae_gene_tree_node * _parent_node;   // points to the node that corresponds to the state of the gene before the last duplication (NULL for the root of the gene tree)
-
-    bool _cds_possibly_modified;
-    bool _cds_completely_deleted;
-    bool _proms_possibly_modified;
-    bool _gene_possibly_duplicated;
-    int32_t _putative_position_for_the_duplicate;
-    
-    
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline ae_list<ae_gene_mutation*>* ae_gene_tree_node::get_mutation_list() const
-{
-  return _mutation_list;
-}
-
-inline ae_gene_loss_type ae_gene_tree_node::get_gene_loss_type() const
-{
-  return _gene_loss_type;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_GENE_TREE_NODE_H__
diff --git a/src/libaevol/ae_genetic_unit.cpp b/src/libaevol/ae_genetic_unit.cpp
deleted file mode 100644
index 7a41764..0000000
--- a/src/libaevol/ae_genetic_unit.cpp
+++ /dev/null
@@ -1,4168 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <assert.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_genetic_unit.h>
-
-
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_codon.h>
-#include <ae_mutation.h>
-#include <ae_enums.h>
-
-#ifdef __REGUL
-  #include <ae_individual_R.h>
-#else
-  #include <ae_individual.h>
-#endif
-
-
-
-
-// =================================================================
-//                       Miscellaneous Functions
-// =================================================================
-int compare_prot_pos( const void* pos, const void* prot ) // This function has to be a plain int
-                                                            // to comply with the definition of bsearch()
-{
-  if ( ((ae_protein*)prot)->get_shine_dal_pos() == *(int32_t*)pos ) return 0;
-  else return 1;
-}
-
-//##############################################################################
-//                                                                             #
-//                            Class ae_genetic_unit                            #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-/*!
-  \brief Create a new genetic unit for indiv with a random DNA sequence of length length
-
-  Promoters will be looked for on the whole sequence but no further process
-  will be performed.
-*/
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, int32_t length )
-{
-  _indiv = indiv;
-  _exp_m = indiv->get_exp_m();
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-
-  _min_gu_length = -1;
-  _max_gu_length = -1;
-
-  _dna = new ae_dna( this, length );
-
-  // Create empty rna and protein lists
-  _rna_list           = new ae_list<ae_rna*>*[2];
-  _rna_list[LEADING]  = new ae_list<ae_rna*>();
-  _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value,
-  //      it is not used for the whole phenotype computation
-
-  // _dist_to_target_per_segment depends on the segmentation of the environment
-  // and will hence be newed at evaluation time
-  _dist_to_target_per_segment = NULL;
-
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  // Look for promoters
-  locate_promoters();
-
-  init_statistical_data();
-}
-
-/*!
-  \brief Create a new genetic unit for indiv with sequence seq [of size length] [and containing promoters prom_list]
-
-  Promoters will be looked for if prom_list is not provided (this may take some time).
-
-  WARNING :
-    seq will be used directly which means the caller must not delete it
-    The same goes for prom_list if it is provided.
-*/
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, char* seq, int32_t length, ae_list<ae_rna*>** prom_list /*= NULL*/ )
-{
-  _exp_m = indiv->get_exp_m();
-  _indiv = indiv;
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-
-  _min_gu_length = -1;
-  _max_gu_length = -1;
-
-  _dna = new ae_dna( this, seq, length );
-
-  if ( prom_list != NULL )
-  {
-    // Copy rna lists
-    _rna_list = prom_list;
-    ae_dna::set_GU( _rna_list, this );
-  }
-  else
-  {
-    // Create empty rna lists
-    _rna_list           = new ae_list<ae_rna*>*[2];
-    _rna_list[LEADING]  = new ae_list<ae_rna*>();
-    _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-    // Look for promoters
-    locate_promoters();
-  }
-
-  // Create empty protein lists
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value,
-  //      it is not used for the whole phenotype computation
-
-  // Initialize all the fitness-related stuff
-  _dist_to_target_per_segment = NULL;
-
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  init_statistical_data();
-}
-
-
-
-
-
-/*!
-  \brief Copy constructor.
-
-  Copies the DNA and recomputes all the rest.
-  It is slower than copying as much as possible and regenerate only what is necessary but it works whatever the state of the model GU.
-*/
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, const ae_genetic_unit &model )
-{
-  _exp_m = indiv->get_exp_m();
-  _indiv = indiv;
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-
-  _distance_to_target_computed  = model._distance_to_target_computed;
-  _fitness_computed             = model._fitness_computed;
-
-  _min_gu_length = model._min_gu_length;
-  _max_gu_length = model._max_gu_length;
-
-  // Copy DNA
-  _dna = new ae_dna( this, *(model._dna) );
-
-  // Create empty rna and protein lists
-  _rna_list           = new ae_list<ae_rna*>*[2];
-  _rna_list[LEADING]  = new ae_list<ae_rna*>();
-  _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value, not used for the whole phenotype computation
-  _dist_to_target_per_segment = NULL;
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  // Compute everything
-  init_statistical_data();
-  locate_promoters();
-  do_transcription();
-  do_translation();
-  compute_phenotypic_contribution();
-}
-
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, ae_genetic_unit* const parent )
-{
-  _exp_m = indiv->get_exp_m();
-  _indiv = indiv;
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-
-  _min_gu_length = parent->_min_gu_length;
-  _max_gu_length = parent->_max_gu_length;
-
-  // Copy DNA
-  _dna = new ae_dna( this, parent->_dna );
-
-  // Copy promoter list (_rna_list)
-  // Note that the length of the RNA will have to be recomputed (do_transcription)
-  _rna_list     = new ae_list<ae_rna*>*[2];
-
-  for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    _rna_list[strand] = new ae_list<ae_rna*>();
-
-    ae_list_node<ae_rna*>* rna_node = parent->_rna_list[strand]->get_first();
-    ae_rna* rna;
-
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-
-      #ifndef __REGUL
-        _rna_list[strand]->add( new ae_rna( this, *rna ) );
-      #else
-        _rna_list[strand]->add( new ae_rna_R( this, *(dynamic_cast<ae_rna_R*>(rna)) ) );
-      #endif
-
-      rna_node = rna_node->get_next();
-    }
-  }
-
-  // Create an empty protein list
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value, not used for the whole phenotype computation
-
-  // Initialize all the fitness-related stuff
-  _dist_to_target_per_segment = NULL;
-
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  init_statistical_data();
-}
-
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, gzFile backup_file )
-{
-  _exp_m = indiv->get_exp_m();
-  _indiv = indiv;
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-
-  _dna = new ae_dna( this, backup_file );
-
-  gzread( backup_file, &_min_gu_length, sizeof(_min_gu_length) );
-  gzread( backup_file, &_max_gu_length, sizeof(_max_gu_length) );
-
-  _rna_list           = new ae_list<ae_rna*>*[2];
-  _rna_list[LEADING]  = new ae_list<ae_rna*>();
-  _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value, not used for the whole phenotype computation
-
-  // Initialize all the fitness-related stuff
-  _dist_to_target_per_segment = NULL;
-
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-
-  // Look for promoters
-  locate_promoters();
-
-  init_statistical_data();
-}
-
-/*!
-  \brief Create a new genetic unit for indiv with a sequence saved in a text file
-
-  Promoters will be looked for on the whole sequence but no further process
-  will be performed.
-*/
-ae_genetic_unit::ae_genetic_unit( ae_individual* indiv, char* organism_file_name )
-{
-  _exp_m = indiv->get_exp_m();
-  _indiv = indiv;
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-
-  _dna = new ae_dna( this, organism_file_name );
-
-  // Create empty rna and protein lists
-  _rna_list           = new ae_list<ae_rna*>*[2];
-  _rna_list[LEADING]  = new ae_list<ae_rna*>();
-  _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-  _protein_list           = new ae_list<ae_protein*>*[2];
-  _protein_list[LEADING]  = new ae_list<ae_protein*>();
-  _protein_list[LAGGING]  = new ae_list<ae_protein*>();
-
-  // Create empty fuzzy sets for the phenotypic contributions
-  _activ_contribution = new ae_fuzzy_set();
-  _inhib_contribution = new ae_fuzzy_set();
-  _phenotypic_contribution = NULL;
-  // NB : _phenotypic_contribution is only an indicative value,
-  //      it is not used for the whole phenotype computation
-
-  // Initialize all the fitness-related stuff
-  _dist_to_target_per_segment = NULL;
-
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  // Look for promoters
-  locate_promoters();
-
-  init_statistical_data();
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_genetic_unit::~ae_genetic_unit( void )
-{
-  assert( _protein_list           != NULL );
-  assert( _protein_list[LEADING]  != NULL );
-  assert( _protein_list[LAGGING]  != NULL );
-  _protein_list[LEADING]->erase( true );
-  _protein_list[LAGGING]->erase( true );
-  delete _protein_list[LEADING];
-  delete _protein_list[LAGGING];
-  delete [] _protein_list;
-
-  assert( _rna_list           != NULL );
-  assert( _rna_list[LEADING]  != NULL );
-  assert( _rna_list[LAGGING]  != NULL );
-  _rna_list[LEADING]->erase( true );
-  _rna_list[LAGGING]->erase( true );
-  delete _rna_list[LEADING];
-  delete _rna_list[LAGGING];
-  delete [] _rna_list;
-
-  delete _dna;
-  delete _activ_contribution;
-  delete _inhib_contribution;
-  if ( _phenotypic_contribution != NULL ) delete _phenotypic_contribution;
-
-  delete [] _dist_to_target_per_segment;
-
-  assert( _dist_to_target_by_feature != NULL );
-  delete [] _dist_to_target_by_feature;
-  assert( _fitness_by_feature != NULL );
-  delete [] _fitness_by_feature;
-
-  delete [] _beginning_neutral_regions;
-  delete [] _end_neutral_regions;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_genetic_unit::locate_promoters( void )
-{
-  // Look for promoters in the genome and create a new ae_rna
-  // in the corresponding strand's RNA list
-  int8_t dist; // Hamming distance of the sequence from the promoter consensus
-
-  // Empty RNA list
-  _rna_list[LEADING]->erase( true );
-  _rna_list[LAGGING]->erase( true );
-
-  if ( _dna->get_length() >= PROM_SIZE )
-  {
-    for ( int32_t i = 0 ; i < _dna->get_length() ; i++ )
-    {
-      if ( is_promoter( LEADING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-      {
-        #ifndef __REGUL
-          _rna_list[LEADING]->add( new ae_rna( this, LEADING, i, dist ) );
-        #else
-          _rna_list[LEADING]->add( new ae_rna_R( this, LEADING, i, dist ) );
-        #endif
-      }
-      if ( is_promoter( LAGGING, _dna->get_length() - i - 1, dist ) )
-      {
-        #ifndef __REGUL
-          _rna_list[LAGGING]->add( new ae_rna( this, LAGGING, _dna->get_length() - i - 1, dist ) );
-        #else
-          _rna_list[LAGGING]->add( new ae_rna_R( this, LAGGING, _dna->get_length() - i - 1, dist ) );
-        #endif
-      }
-    }
-  }
-}
-
-void ae_genetic_unit::do_transcription( void )
-{
-  if ( _transcribed ) return;
-  _transcribed = true;
-
-  ae_list_node<ae_rna*>* rna_node    = NULL;
-  ae_rna* rna = NULL;
-  int32_t transcript_start  = -1;
-  int32_t genome_length     = _dna->get_length();
-
-  // If the genome is not long enough to bear a promoter and a terminator,
-  // we set all its RNAs to a length of -1
-  if ( genome_length < PROM_SIZE + TERM_SIZE )
-  {
-    rna_node = _rna_list[LEADING]->get_first();
-    while ( rna_node != NULL )
-    {
-      rna_node->get_obj()->set_transcript_length( -1 );
-      rna_node = rna_node->get_next();
-    }
-
-    rna_node = _rna_list[LAGGING]->get_first();
-    while ( rna_node != NULL )
-    {
-      rna_node->get_obj()->set_transcript_length( -1 );
-      rna_node = rna_node->get_next();
-    }
-
-    return;
-  }
-
-  // ----------------
-  //  LEADING strand
-  // ----------------
-  rna_node = _rna_list[LEADING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-    transcript_start = rna->get_first_transcribed_pos();
-    rna->set_transcript_length( -1 );
-
-    int32_t i;
-    for ( i = 0 ; i < genome_length ; i++ )
-    {
-      if ( is_terminator( LEADING, transcript_start + i ) )
-      {
-        // Found terminator => set transcript's length
-        rna->set_transcript_length( i + TERM_SIZE );
-
-        // Deduce the length of all the RNAs that share the same terminator
-        // These are the RNAs whose promoter is entirely (and strictly) included
-        // between the promoter and the terminator of the RNA we have just treated.
-        // They are hence the RNAs whose promoter starts at most i bases after the
-        // current rna's promoter
-        ae_list_node<ae_rna*>* rna_node_2  = rna_node->get_next();
-        ae_rna* rna_2 = NULL;
-        while ( rna_node_2 != NULL )
-        {
-          rna_2 = rna_node_2->get_obj();
-
-          // We know rna_2 is after rna => rna_2->pos > rna->pos (LEADING strand) because the list is sorted
-          if ( rna_2->get_promoter_pos() - rna->get_promoter_pos() <= i )
-          {
-            rna_2->set_transcript_length( i - (rna_2->get_promoter_pos() - rna->get_promoter_pos()) + TERM_SIZE );
-
-            // Step forward in RNA list
-            rna_node = rna_node_2;
-          }
-          else
-          {
-            // The promoter of rna_2 is after (or contains a part of) the terminator of rna,
-            // we will need to search its own terminator
-            break;
-          }
-
-          rna_node_2 = rna_node_2->get_next();
-        }
-
-        // Terminator found for this RNA, nothing else to do (for this RNA)
-        break;
-      }
-    }
-
-    if (i == genome_length)
-      {
-        // We have searched the whole genome and found no terminator for this promoter.
-        // We consider that no RNA can actually be produced, hence we set the transcript
-        // length to -1. This will prevent the search for coding sequences downstream of this promoter.
-        // However, we do not destroy the ae_rna object, it must still be kept in memory and
-        // transmitted to the offspring in case a mutation recreates a terminator.
-        rna->set_transcript_length( -1 );
-      }
-
-    rna_node = rna_node->get_next();
-  }
-
-  // ----------------
-  //  LAGGING strand
-  // ----------------
-  rna_node = _rna_list[LAGGING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-    transcript_start = rna->get_first_transcribed_pos();
-    rna->set_transcript_length( -1 );
-
-    int32_t i;
-    for ( i = 0 ; i < genome_length ; i++ )
-    {
-      if ( is_terminator( LAGGING, transcript_start - i ) )
-      {
-        // Found terminator => set transcript's length
-        rna->set_transcript_length( i + TERM_SIZE );
-
-        // Deduce the length of all the RNAs that share the same terminator
-        // These are the RNAs whose promoter is entirely (and strictly) included
-        // between the promoter and the terminator of the RNA we have just treated.
-        // They are hence the RNAs whose promoter starts at most i bases after the
-        // current rna's promoter
-        ae_list_node<ae_rna*>* rna_node_2  = rna_node->get_next();
-        ae_rna* rna_2 = NULL;
-        while ( rna_node_2 != NULL )
-        {
-          rna_2 = rna_node_2->get_obj();
-
-          // We know rna_2 is after rna => rna_2->pos < rna->pos (LAGGING strand) because the list is sorted
-          if ( rna->get_promoter_pos() - rna_2->get_promoter_pos() <= i )
-          {
-            rna_2->set_transcript_length( i - (rna->get_promoter_pos() - rna_2->get_promoter_pos()) + TERM_SIZE );
-
-            // Step forward in RNA list
-            rna_node = rna_node_2;
-          }
-          else
-          {
-            // The promoter of rna_2 is after (or contains a part of) the terminator of rna,
-            // we will need to search its own terminator
-            break;
-          }
-
-          rna_node_2 = rna_node_2->get_next();
-        }
-
-        // Terminator found for this RNA, nothing else to do (for this RNA)
-        break;
-      }
-    }
-
-    if (i == genome_length)
-      {
-        // We have searched the whole genome and found no terminator for this promoter.
-        // We consider that no RNA can actually be produced, hence we set the transcript
-        // length to -1. This will prevent the search for coding sequences downstream of this promoter.
-        // However, we do not destroy the ae_rna object, it must still be kept in memory and
-        // transmitted to the offspring in case a mutation recreates a terminator.
-        rna->set_transcript_length( -1 );
-      }
-
-    rna_node = rna_node->get_next();
-  }
-
-
-  /******************** DEBUG (print rnas' sequences, positions and strands ********************/
-  /*for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    rna_node = _rna_list[strand]->get_first();
-
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-
-      char* seq = new char[PROM_SIZE + rna->get_transcript_length() + 1];
-
-      //~ if ( rna->get_promoter_pos() + PROM_SIZE + rna->get_transcript_length() < _dna->get_length() )
-      //~ {
-        //~ memcpy( seq, &_dna->get_data()[rna->get_promoter_pos()], PROM_SIZE + rna->get_transcript_length()  );
-      //~ }
-      //~ else
-      //~ {
-        //~ memcpy( seq, &_dna->get_data()[rna->get_promoter_pos()], _dna->get_length() - rna->get_promoter_pos()  );
-        //~ memcpy( &seq[_dna->get_length() - rna->get_promoter_pos()], _dna->get_data(),
-        //~ PROM_SIZE + rna->get_transcript_length() - (_dna->get_length() - rna->get_promoter_pos())  );
-      //~ }
-
-      //~ seq[PROM_SIZE + rna->get_transcript_length() ] = '\0';
-
-      //~ printf( "rna seq : %s\n", seq );
-      printf( "RNA at pos : %"PRId32"      length : %"PRId32"\n", rna->get_promoter_pos(), rna->get_transcript_length() );
-      printf( "  strand : %s    basal_level : %f\n", (rna->get_strand() == LEADING)?"LEADING":"LAGGING", rna->get_basal_level() );
-      //~ getchar();
-
-      rna_node = rna_node->get_next();
-    }
-  }*/
-  /******************** END DEBUG ********************/
-}
-
-void ae_genetic_unit::do_translation( void )
-{
-  if ( _translated ) return;
-  _translated = true;
-  if ( ! _transcribed ) do_transcription();
-
-  ae_list_node<ae_rna*>* rna_node    = NULL;
-  ae_rna* rna = NULL;
-  int32_t transcript_start  = -1;
-  int32_t transcript_length = -1;
-  int32_t genome_length     = _dna->get_length();
-
-  // ----------------
-  //  LEADING strand
-  // ----------------
-  rna_node = _rna_list[LEADING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-    transcript_start  = rna->get_first_transcribed_pos();
-    transcript_length = rna->get_transcript_length();
-
-    // Try every position where a translation process could occur
-    // Minimum number of bases needed is SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE
-    // (3 codons for START + STOP + at least one amino-acid)
-    for ( int32_t i = 0 ; transcript_length - i >= SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE ; i++ )
-    {
-      if (  ( is_shine_dalgarno( LEADING, ae_utils::mod(transcript_start + i, genome_length) ) ) &&
-            ( is_start( LEADING, ae_utils::mod(transcript_start + i + SHINE_DAL_SIZE + SHINE_START_SPACER, genome_length) ) ) )
-      {
-        // We found a translation initiation, we can now build the protein until we find a STOP codon or until we reach the end
-        // of the transcript (in which case the protein is not valid)
-
-
-        // First of all, we will check whether this CDS has already been translated (because it is present on another RNA
-        // In that case, we don't need to tranlate it again, we only need to increase the protein's concentration according to
-        // the promoter transcription level
-        int32_t shine_dal_pos = ae_utils::mod(transcript_start + i, genome_length);
-        ae_list_node<ae_protein*>* protein_node = _protein_list[LEADING]->bsearch( &shine_dal_pos, compare_prot_pos );
-
-        if ( protein_node != NULL )
-        {
-          ae_protein* protein = protein_node->get_obj();
-          protein->add_RNA( rna );
-          rna->add_transcribed_protein( protein );
-        }
-        else
-        {
-          // Build codon list and make new protein when stop found
-          int32_t j = i + SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE; // next codon to examine
-          ae_codon* codon;
-          ae_list<ae_codon*>* codon_list = new ae_list<ae_codon*>();
-          //~ int32_t nb_m, nb_w, nb_h;  // Number of M, W, H-codons found in the gene
-          //~ nb_m = nb_w = nb_h = 0; // TODO : usefull?
-
-          while ( (transcript_length - j >= CODON_SIZE) )
-          {
-            codon = new ae_codon( _dna, LEADING, ae_utils::mod(transcript_start + j, genome_length) );
-
-            if ( codon->is_stop() )
-            {
-              if ( codon_list->is_empty() == false ) // at least one amino-acid
-              {
-                // The protein is valid, create the corresponding object
-                ae_protein* protein;
-                #ifndef __REGUL
-                  protein = new ae_protein( this, codon_list, LEADING, shine_dal_pos, rna );
-                #else
-                  protein = new ae_protein_R( this, codon_list, LEADING, shine_dal_pos, rna );
-                #endif
-
-                // The codon list will be kept in the protein
-                codon_list = NULL;
-
-                _protein_list[LEADING]->add( protein );
-                rna->add_transcribed_protein( protein );
-
-                if ( protein->get_is_functional() )
-                {
-                  _nb_fun_genes++;
-                  //~ _overall_size_fun_genes += ( protein->get_length() + 2 ) * CODON_SIZE;
-                  _overall_size_fun_genes += protein->get_length() * CODON_SIZE;
-
-                  if ( protein->get_height() > 0 )  _nb_genes_activ++;
-                  else                              _nb_genes_inhib++;
-                }
-                else
-                {
-                  _nb_non_fun_genes++;
-                  //~ _overall_size_non_fun_genes += ( protein->get_length() + 2 ) * CODON_SIZE;
-                  _overall_size_non_fun_genes += protein->get_length() * CODON_SIZE;
-                }
-              }
-
-              delete codon;
-              break;
-            }
-            else
-            {
-              codon_list->add( codon );
-            }
-
-            j += CODON_SIZE;
-          }
-
-          // The codon list is no longer useful, delete it with all its items
-          // TODO : memory leek in RAEVOL?
-//          #ifndef __REGUL
-            if ( codon_list != NULL )
-            {
-              codon_list->erase( true );
-              delete codon_list;
-            }
-//          #endif
-        }
-      }
-    }
-
-    // Statistics
-    if ( ! rna->get_transcribed_proteins()->is_empty() ) // coding RNA
-    {
-      _nb_coding_RNAs++;
-      _overall_size_coding_RNAs += rna->get_transcript_length();
-    }
-    else // non-coding RNA
-    {
-      _nb_non_coding_RNAs++;
-      _overall_size_non_coding_RNAs += rna->get_transcript_length();
-    }
-
-    rna_node = rna_node->get_next();
-  }
-
-  // ----------------
-  //  LAGGING strand
-  // ----------------
-  rna_node = _rna_list[LAGGING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-    transcript_start  = rna->get_first_transcribed_pos();
-    transcript_length = rna->get_transcript_length();
-
-    // Try every position where a translation process could occur
-    // Minimum number of bases needed is SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE
-    // (3 codons for START + STOP + at least one amino-acid)
-    for ( int32_t i = 0 ; transcript_length - i >= SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE ; i++ )
-    {
-      if (  ( is_shine_dalgarno( LAGGING, ae_utils::mod(transcript_start - i, genome_length) ) ) &&
-            ( is_start( LAGGING, ae_utils::mod(transcript_start - i - SHINE_DAL_SIZE - SHINE_START_SPACER, genome_length) ) ) )
-      {
-        // We found a translation initiation, we can now build the protein until we find a STOP codon or until we reach the end
-        // of the transcript (in which case the protein is not valid)
-
-        // First of all, we will check whether this CDS has already been translated (because it is present on another RNA
-        // In that case, we don't need to tranlate it again, we only need to increase the protein's concentration according to
-        // the promoter strength
-        int32_t shine_dal_pos = ae_utils::mod(transcript_start - i, genome_length);
-        ae_list_node<ae_protein*>* protein_node = _protein_list[LAGGING]->bsearch( &shine_dal_pos, compare_prot_pos );
-
-        if ( protein_node != NULL )
-        {
-          ae_protein* protein = protein_node->get_obj();
-          protein->add_RNA( rna );
-          rna->add_transcribed_protein( protein );
-        }
-        else
-        {
-          // Build codon list and make new protein when stop found
-          int32_t j = i + SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE; // next codon to examine
-          ae_codon* codon;
-          ae_list<ae_codon*>* codon_list = new ae_list<ae_codon*>();
-          //~ int32_t nb_m, nb_w, nb_h; // Number of M, W, H-codons found in the gene
-          //~ nb_m = nb_w = nb_h = 0;
-
-          while ( (transcript_length - j >= CODON_SIZE) )
-          {
-            codon = new ae_codon( _dna, LAGGING, ae_utils::mod(transcript_start - j, genome_length) );
-
-            if ( codon->is_stop() )
-            {
-              if ( codon_list->is_empty() == false ) // at least one amino-acid
-              {
-                // The protein is valid, create the corresponding object
-                ae_protein* protein;
-                #ifndef __REGUL
-                  protein = new ae_protein( this, codon_list, LAGGING, shine_dal_pos, rna );
-                #else
-                  protein = new ae_protein_R( this, codon_list, LAGGING, shine_dal_pos, rna );
-                #endif
-
-                // The codon list will be kept in the protein
-                codon_list = NULL;
-
-                _protein_list[LAGGING]->add( protein );
-                rna->add_transcribed_protein( protein );
-
-                if ( protein->get_is_functional() )
-                {
-                  _nb_fun_genes++;
-                  //~ _overall_size_fun_genes += ( protein->get_length() + 2 ) * CODON_SIZE;
-                  _overall_size_fun_genes += protein->get_length() * CODON_SIZE;
-
-                  if ( protein->get_height() > 0 )  _nb_genes_activ++;
-                  else                              _nb_genes_inhib++;
-                }
-                else
-                {
-                  _nb_non_fun_genes++;
-                  _overall_size_non_fun_genes += ( protein->get_length() + 2 ) * CODON_SIZE;
-                }
-              }
-
-              delete codon;
-              break;
-            }
-            else
-            {
-              codon_list->add( codon );
-            }
-
-            j += CODON_SIZE;
-          }
-
-          // The codon list is no longer useful, delete it with all its items
-          // TODO : memory leek in RAEVOL?
-//          #ifndef __REGUL
-            if ( codon_list != NULL )
-            {
-              codon_list->erase( true );
-              delete codon_list;
-            }
-//          #endif
-        }
-      }
-    }
-
-    // Statistics
-    if ( ! rna->get_transcribed_proteins()->is_empty() ) // coding RNA
-    {
-      _nb_coding_RNAs++;
-      _overall_size_coding_RNAs += rna->get_transcript_length();
-    }
-    else // non-coding RNA
-    {
-      _nb_non_coding_RNAs++;
-      _overall_size_non_coding_RNAs += rna->get_transcript_length();
-    }
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::compute_phenotypic_contribution( void )
-{
-  if ( _phenotypic_contributions_computed ) return;
-  _phenotypic_contributions_computed = true;
-  if ( ! _translated ) do_translation();
-
-  ae_list_node<ae_protein*>* prot_node;
-  ae_protein*   prot;
-
-  // LEADING strand
-  prot_node = _protein_list[LEADING]->get_first();
-  while ( prot_node != NULL )
-  {
-    prot = prot_node->get_obj();
-
-    if ( prot->get_is_functional() )
-    {
-      if ( prot->get_height() > 0 )
-      {
-        _activ_contribution->add_triangle(  prot->get_mean(),
-                                            prot->get_width(),
-                                            prot->get_height() * prot->get_concentration() );
-      }
-      else
-      {
-        _inhib_contribution->add_triangle(  prot->get_mean(),
-                                            prot->get_width(),
-                                            prot->get_height() * prot->get_concentration() );
-      }
-    }
-
-    prot_node = prot_node->get_next();
-  }
-
-  // LAGGING strand
-  prot_node = _protein_list[LAGGING]->get_first();
-  while ( prot_node != NULL )
-  {
-    prot = prot_node->get_obj();
-
-    if ( prot->get_is_functional() )
-    {
-      if ( prot->get_height() > 0 )
-      {
-        _activ_contribution->add_triangle(  prot->get_mean(),
-                                            prot->get_width(),
-                                            prot->get_height() * prot->get_concentration() );
-      }
-      else
-      {
-        _inhib_contribution->add_triangle(  prot->get_mean(),
-                                            prot->get_width(),
-                                            prot->get_height() * prot->get_concentration() );
-      }
-    }
-
-    prot_node = prot_node->get_next();
-  }
-
-
-  // It is not necessary to add a lower bound to _activ_contribution as there can be no negative y
-  // The same goes for the upper bound for _inhib_contribution
-  _activ_contribution->add_upper_bound(   Y_MAX );
-  _inhib_contribution->add_lower_bound( - Y_MAX );
-  _activ_contribution->simplify();
-  _inhib_contribution->simplify();
-
-  if ( _exp_m->get_output_m()->get_compute_phen_contrib_by_GU() )
-  {
-    _phenotypic_contribution = new ae_phenotype();
-    _phenotypic_contribution->add( _activ_contribution );
-    _phenotypic_contribution->add( _inhib_contribution );
-    _phenotypic_contribution->simplify();
-  }
-}
-
-/*!
-  \brief Compute the areas between the phenotype and the environment for each environmental segment.
-
-  If the environment is not segmented, the total area is computed
-*/
-void ae_genetic_unit::compute_distance_to_target( ae_environment* env )
-{
-  if ( _distance_to_target_computed ) return; // _distance_to_target has already been computed, nothing to do.
-  _distance_to_target_computed = true;
-
-  compute_phenotypic_contribution();
-
-  // Compute the difference between the (whole) phenotype and the environment
-  ae_fuzzy_set* delta = new ae_fuzzy_set( *_phenotypic_contribution );
-  delta->sub( env );
-
-  ae_env_segment** segments = env->get_segments();
-
-  // TODO : We should take into account that we compute the areas in order (from the leftmost segment, rightwards)
-  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have
-  //      already been through them!)
-
-  if ( _dist_to_target_per_segment == NULL )
-  {
-    _dist_to_target_per_segment = new double [env->get_nb_segments()]; // Can not be allocated in constructor because number of segments is then unknow
-  }
-  for ( int16_t i = 0 ; i < env->get_nb_segments() ; i++ )
-  {
-    _dist_to_target_per_segment[i] = delta->get_geometric_area( segments[i]->start, segments[i]->stop );
-    _dist_to_target_by_feature[segments[i]->feature] += _dist_to_target_per_segment[i];
-  }
-
-  delete delta;
-}
-
-/*!
-  \brief Compute a "proper" fitness value (one that increases when the individual is fitter).
-
-  The behaviour of this function depends on many parameters and most notably on whether it is
-  a "composite" fitness or not, and on the selection scheme.
-*/
-void ae_genetic_unit::compute_fitness( ae_environment* env )
-{
-  if ( _fitness_computed ) return; // Fitness has already been computed, nothing to do.
-  _fitness_computed = true;
-
-#ifdef NORMALIZED_FITNESS
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    if (env->get_area_by_feature(i)==0.)
-    {
-      _fitness_by_feature[i] = 0.;
-    }
-    else
-    {
-      _fitness_by_feature[i] =  ( env->get_area_by_feature(i) - _dist_to_target_by_feature[i] ) / env->get_area_by_feature(i);
-      if ( (_fitness_by_feature[i] < 0.) && (i != METABOLISM) ) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good)
-      {
-        _fitness_by_feature[i] = 0.;
-      }
-    }
-  }
-
-  if ((! _indiv->get_placed_in_population()) || (! _exp_m->get_with_secretion() ))
-  {
-    _fitness = _fitness_by_feature[METABOLISM];
-  }
-  else
-  {
-    _fitness =  _fitness_by_feature[METABOLISM] * ( 1 + _exp_m->get_secretion_contrib_to_fitness() * ( _indiv->get_grid_cell()->get_compound_amount() - _exp_m->get_secretion_cost() * _fitness_by_feature[SECRETION] ) );
-  }
-
-  if ( _exp_m->get_selection_scheme() == FITNESS_PROPORTIONATE ) // Then the exponential selection is integrated inside the fitness value
-  {
-    _fitness = exp( -_exp_m->get_selection_pressure() * (1 - _fitness) );
-  }
-
-#else
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    if ( i == SECRETION )
-    {
-      _fitness_by_feature[SECRETION] =  exp( -_exp_m->get_selection_pressure() * _dist_to_target_by_feature[SECRETION] )
-                                      - exp( -_exp_m->get_selection_pressure() * env->get_area_by_feature(SECRETION) );
-
-      if ( _fitness_by_feature[i] < 0 )
-      {
-        _fitness_by_feature[i] = 0;
-      }
-    }
-    else
-    {
-      _fitness_by_feature[i] = exp( -_exp_m->get_selection_pressure() * _dist_to_target_by_feature[i] );
-    }
-  }
-
-  // Calculate combined, total fitness here!
-  // Multiply the contribution of metabolism and the amount of compound in the environment
-  if ((! _indiv->get_placed_in_population()) || (! _exp_m->get_with_secretion() ))
-  {
-    _fitness = _fitness_by_feature[METABOLISM] ;
-  }
-  else
-  {
-    _fitness =  _fitness_by_feature[METABOLISM] *
-                ( 1 + _exp_m->get_secretion_contrib_to_fitness() * _indiv->get_grid_cell()->get_compound_amount()
-                    - _exp_m->get_secretion_cost() * _fitness_by_feature[SECRETION] );
-  }
-
-#endif
-
-}
-
-
-void ae_genetic_unit::reset_expression( void )
-{
-  // useful if the DNA sequence has changed (cf post-treatment programs
-  // which replay mutations)
-
-  _transcribed                        = false;
-  _translated                         = false;
-  _phenotypic_contributions_computed  = false;
-  _non_coding_computed                = false;
-
-
-  // I do not erase the RNA lists, because they were updated
-  // during the mutations (cf ae_dna::undergo_this_mutation)
-  // TODO : Reinitialize _transcribed proteins ?
-
-  _protein_list[LEADING]->erase(true);
-  _protein_list[LAGGING]->erase(true);
-
-  if ( _activ_contribution != NULL )
-  {
-    delete _activ_contribution;
-    _activ_contribution = new ae_fuzzy_set();
-  }
-
-  if ( _inhib_contribution != NULL )
-  {
-    delete _inhib_contribution;
-    _inhib_contribution = new ae_fuzzy_set();
-  }
-
-  if ( _phenotypic_contribution != NULL )
-  {
-    delete _phenotypic_contribution; // Not re-created now, will be conditionally allocated in compute_phenotypic_contribution
-  }
-
-  init_statistical_data();
-}
-
-
-
-void ae_genetic_unit::print_coding_rnas()
-{
-  printf( "  LEADING \n" );
-  ae_list_node<ae_rna*>* a_node = _rna_list[LEADING]->get_first();
-  ae_rna * rna = NULL;
-  while (a_node != NULL)
-    {
-      rna = (ae_rna *) a_node->get_obj();
-      a_node = a_node->get_next();
-      if (rna->is_coding() == false) continue;
-      printf("Promoter at %"PRId32", last transcribed position at %"PRId32"\n", rna->get_promoter_pos(), rna->get_last_transcribed_pos());
-    }
-
-  printf( "  LAGGING \n" );
-  a_node = _rna_list[LAGGING]->get_first();
-  rna = NULL;
-  while (a_node != NULL)
-    {
-      rna = (ae_rna *) a_node->get_obj();
-      a_node = a_node->get_next();
-      if (rna->is_coding() == false) continue;
-      printf("Promoter at %"PRId32", last transcribed position at %"PRId32"\n", rna->get_promoter_pos(), rna->get_last_transcribed_pos());
-    }
-}
-
-
-void ae_genetic_unit::print_rnas( ae_list<ae_rna*>* rnas, ae_strand strand )
-{
-  ae_list_node<ae_rna*>* rna_node = NULL;
-  ae_rna* rna = NULL;
-
-  printf( "  %s ( %"PRId32" )\n", strand == LEADING ? "LEADING" : "LAGGING", rnas->get_nb_elts() );
-  rna_node = rnas->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-
-    assert( rna->get_strand() == strand );
-
-    printf( "    Promoter on %s at %"PRId32"\n", strand == LEADING ? "LEADING" : "LAGGING", rna->get_promoter_pos() );
-    //~ printf( "      length %"PRId32"  basal_level %f\n", rna->get_transcript_length(), rna->get_basal_level() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::print_proteins( void ) const
-{
-  ae_list_node<ae_protein*>* prot_node = NULL;
-  ae_protein*   prot      = NULL;
-
-  printf( "  LEADING ( %"PRId32" )\n", _protein_list[LEADING]->get_nb_elts() );
-  prot_node = _protein_list[LEADING]->get_first();
-
-  while ( prot_node != NULL )
-  {
-    prot = prot_node->get_obj();
-
-    printf( "    Gene on LEADING at %"PRId32" (%"PRId32") (%f %f %f) (%f) %s\n",
-            prot->get_shine_dal_pos(), prot->get_length(),
-            prot->get_mean(), prot->get_width(), prot->get_height(), prot->get_concentration(),
-            prot->get_is_functional() ? "functional" : "non functional" );
-
-    prot_node = prot_node->get_next();
-  }
-
-
-  printf( "  LAGGING ( %"PRId32" )\n", _protein_list[LAGGING]->get_nb_elts() );
-  prot_node = _protein_list[LAGGING]->get_first();
-
-  while ( prot_node != NULL )
-  {
-    prot = prot_node->get_obj();
-
-    printf( "    Gene on LAGGING at %"PRId32" (%"PRId32") (%f %f %f) (%f) %s\n",
-            prot->get_shine_dal_pos(), prot->get_length(),
-            prot->get_mean(), prot->get_width(), prot->get_height(), prot->get_concentration(),
-            prot->get_is_functional() ? "functional" : "non functional" );
-
-    prot_node = prot_node->get_next();
-  }
-}
-
-bool ae_genetic_unit::is_promoter( ae_strand strand, int32_t pos, int8_t& dist ) const
-{
-  //~ printf( "=============================================== is_promoter\n" );
-  //~ printf( "pos : %"PRId32"\n", pos );
-
-  const char* genome  = _dna->get_data();
-  int32_t  len        = _dna->get_length();
-
-  dist = 0;
-
-  if ( strand == LEADING )
-  {
-    //~ printf( "LEADING\n" );
-    for ( int16_t i = 0 ; i < PROM_SIZE ; i++ )
-    {
-      //~ printf( "  i : %"PRId32" dist : %"PRId8"\n", i, dist );
-      if ( genome[(pos+i)%len] != PROM_SEQ[i] )
-      {
-        dist++;
-        if ( dist > PROM_MAX_DIFF )
-        {
-          //~ printf( "=============================================== END is_promoter\n" );
-          return false;
-        }
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    //~ printf( "LAGGING\n" );
-    for ( int16_t i = 0 ; i < PROM_SIZE ; i++ )
-    {
-      //~ printf( "  i : %"PRId32" dist : %"PRId8"\n", i, dist );
-      if ( genome[ae_utils::mod((pos-i),len)] == PROM_SEQ[i] ) // == and not != because we are on the complementary strand...
-      {
-        dist++;
-        if ( dist > PROM_MAX_DIFF )
-        {
-          //~ printf( "=============================================== END is_promoter\n" );
-          return false;
-        }
-      }
-    }
-  }
-
-
-  //~ printf( "=============================================== END is_promoter\n" );
-  return true;
-}
-
-bool ae_genetic_unit::is_terminator( ae_strand strand, int32_t pos ) const
-{
-  const char* genome  = _dna->get_data();
-  int32_t  len        = _dna->get_length();
-
-  if ( strand == LEADING )
-  {
-    for ( int16_t i = 0 ; i < TERM_STEM_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod(pos+i,len)] == genome[ae_utils::mod(pos+(TERM_SIZE-1)-i,len)] ) return false;
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int16_t i = 0 ; i < TERM_STEM_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod(pos-i,len)] == genome[ae_utils::mod(pos-(TERM_SIZE-1)+i,len)] ) return false;
-    }
-  }
-
-  return true;
-}
-
-bool ae_genetic_unit::is_shine_dalgarno( ae_strand strand, int32_t pos ) const
-{
-  const char* genome  = _dna->get_data();
-  int32_t  len        = _dna->get_length();
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < SHINE_DAL_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod((pos+i),len)] != SHINE_DAL_SEQ[i] )
-      {
-        return false;
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < SHINE_DAL_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod((pos-i),len)] == SHINE_DAL_SEQ[i] ) // == and not != because we are on the complementary strand...
-      {
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
-int8_t ae_genetic_unit::get_codon( ae_strand strand, int32_t pos ) const
-{
-  const char* genome  = _dna->get_data();
-  int32_t  len        = _dna->get_length();
-  int8_t codon        = 0;
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod((pos+i),len)] == '1' )
-      {
-        codon += 1 << ( CODON_SIZE - i - 1 ); //pow( 2, CODON_SIZE - i - 1 );
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( genome[ae_utils::mod((pos-i),len)] != '1' ) // == and not != because we are on the complementary strand...
-      {
-        codon += 1 << ( CODON_SIZE - i - 1 ); //pow( 2, CODON_SIZE - i - 1 );
-      }
-    }
-  }
-
-  return codon;
-}
-
-void ae_genetic_unit::compute_non_coding( void )
-{
-  if ( _non_coding_computed ) return;
-  _non_coding_computed = true;
-
-  // Create a table of <genome_length> bools initialized to false (non-coding)
-  int32_t genome_length = _dna->get_length();
-
-  // Including Shine-Dalgarno, spacer, START and STOP
-  bool* belongs_to_CDS;
-  bool* belongs_to_functional_CDS;
-  bool* belongs_to_non_functional_CDS; // non-functional CDSs are those that have a null area or that lack a kind of codons (M, W or H)
-
-  // Including Promoters and terminators
-  bool* belongs_to_RNA;
-  bool* belongs_to_coding_RNA;
-  bool* belongs_to_non_coding_RNA;
-
-  // Genes + prom + term (but not UTRs)
-  bool* is_essential_DNA;
-  bool* is_essential_DNA_including_nf_genes; // Adds non-functional genes + promoters & terminators
-
-  bool* is_not_neutral;            // prom + term + everything in between (as opposed to neutral)
-
-
-  belongs_to_CDS                      = new bool[genome_length];
-  belongs_to_functional_CDS           = new bool[genome_length];
-  belongs_to_non_functional_CDS       = new bool[genome_length];
-  belongs_to_RNA                      = new bool[genome_length];
-  belongs_to_coding_RNA               = new bool[genome_length];
-  belongs_to_non_coding_RNA           = new bool[genome_length];
-  is_essential_DNA                    = new bool[genome_length];
-  is_essential_DNA_including_nf_genes = new bool[genome_length];
-  is_not_neutral                      = new bool[genome_length];
-
-  memset( belongs_to_CDS,                      0, genome_length );
-  memset( belongs_to_functional_CDS,           0, genome_length );
-  memset( belongs_to_non_functional_CDS,       0, genome_length );
-  memset( belongs_to_RNA,                      0, genome_length );
-  memset( belongs_to_coding_RNA,               0, genome_length );
-  memset( belongs_to_non_coding_RNA,           0, genome_length );
-  memset( is_essential_DNA,                    0, genome_length );
-  memset( is_essential_DNA_including_nf_genes, 0, genome_length );
-  memset( is_not_neutral,                      0, genome_length );
-
-
-  // Parse protein lists and mark the corresponding bases as coding
-  for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    ae_list_node<ae_protein*>* prot_node = _protein_list[strand]->get_first();
-    ae_protein* prot = NULL;
-
-    while ( prot_node != NULL )
-    {
-      prot = prot_node->get_obj();
-      int32_t first;
-      int32_t last;
-
-      if ( strand == LEADING )
-      {
-        first = prot->get_shine_dal_pos();
-        last  = prot->get_last_STOP_base_pos();
-      }
-      else // ( strand == LAGGING )
-      {
-        last  = prot->get_shine_dal_pos();
-        first = prot->get_last_STOP_base_pos();
-      }
-
-      if ( first <= last )
-      {
-        for ( int32_t i = first ; i <= last ; i++ )
-        {
-          belongs_to_CDS[i] = true;
-          if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-          is_essential_DNA_including_nf_genes[i] = true;
-        }
-      }
-      else
-      {
-        for ( int32_t i = first ; i < genome_length ; i++ )
-        {
-          belongs_to_CDS[i] = true;
-          if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-          is_essential_DNA_including_nf_genes[i] = true;
-        }
-        for ( int32_t i = 0 ; i <= last ; i++ )
-        {
-          belongs_to_CDS[i] = true;
-          if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-          is_essential_DNA_including_nf_genes[i] = true;
-        }
-      }
-
-      // Include the promoter and terminator to essential DNA
-      // Mark everything between promoter and terminator as not neutral
-      ae_list_node<ae_rna*>* rna_node  = prot->get_rna_list()->get_first();
-      ae_rna*       rna       = NULL;
-
-      while ( rna_node != NULL )
-      {
-        rna = rna_node->get_obj();
-
-        int32_t prom_first;
-        int32_t prom_last;
-        int32_t term_first;
-        int32_t term_last;
-        int32_t rna_first;
-        int32_t rna_last;
-
-        if ( strand == LEADING )
-        {
-          prom_first  = rna->get_promoter_pos();
-          prom_last   = ae_utils::mod( prom_first + PROM_SIZE - 1, _dna->get_length() );
-          term_last   = rna->get_last_transcribed_pos();
-          term_first  = ae_utils::mod( term_last - TERM_SIZE + 1, _dna->get_length() );
-          rna_first   = prom_first;
-          rna_last    = term_last;
-        }
-        else
-        {
-          prom_last   = rna->get_promoter_pos();
-          prom_first  = ae_utils::mod( prom_last - PROM_SIZE + 1, _dna->get_length() );
-          term_first  = rna->get_last_transcribed_pos();
-          term_last   = ae_utils::mod( term_first + TERM_SIZE - 1, _dna->get_length() );
-          rna_first   = term_first;
-          rna_last    = prom_last;
-        }
-        //~ printf( "\n" );
-        //~ if ( strand == LEADING ) printf( "LEADING\n" );
-        //~ else printf( "LAGGING\n" );
-        //~ printf( "prom_first : %ld    prom_last %ld   (size %ld)\n", prom_first, prom_last, _dna->get_length() );
-        //~ printf( "term_first : %ld    term_last %ld   (size %ld)\n", term_first, term_last, _dna->get_length() );
-        //~ getchar();
-
-        // Let us begin with "non-neutral" regions...
-      	if ( rna_first <= rna_last )
-      	{
-      	  for ( int32_t i = rna_first ; i <= rna_last ; i++ ) { is_not_neutral[i] = true; }
-      	}
-      	else
-      	{
-      	  for ( int32_t i = rna_first ; i < genome_length ; i++ ) { is_not_neutral[i] = true; }
-      	  for ( int32_t i = 0 ; i <= rna_last ; i++ ) { is_not_neutral[i] = true; }
-      	}
-
-      	// ...and go on with essential DNA
-        //~ printf( "prom " );
-        if ( prom_first <= prom_last )
-        {
-          for ( int32_t i = prom_first ; i <= prom_last ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = prom_first ; i < genome_length ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= prom_last ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-        }
-        //~ printf( "\n" );
-
-        //~ printf( "term " );
-        if ( term_first <= term_last )
-        {
-          for ( int32_t i = term_first ; i <= term_last ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = term_first ; i < genome_length ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= term_last ; i++ )
-          {
-            //~ printf( "%ld ", i );
-            if ( prot->get_is_functional() ) is_essential_DNA[i] = true;
-            is_essential_DNA_including_nf_genes[i] = true;
-          }
-        }
-        //~ printf( "\n" );
-        //~ getchar();
-
-        rna_node = rna_node->get_next();
-      }
-
-
-
-
-      if ( prot->get_is_functional() )
-      {
-        if ( first <= last )
-        {
-          for ( int32_t i = first ; i <= last ; i++ )
-          {
-            belongs_to_functional_CDS[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = first ; i < genome_length ; i++ )
-          {
-            belongs_to_functional_CDS[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= last ; i++ )
-          {
-            belongs_to_functional_CDS[i] = true;
-          }
-        }
-      }
-      else // degenerated protein
-      {
-        if ( first <= last )
-        {
-          for ( int32_t i = first ; i <= last ; i++ )
-          {
-            belongs_to_non_functional_CDS[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = first ; i < genome_length ; i++ )
-          {
-            belongs_to_non_functional_CDS[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= last ; i++ )
-          {
-            belongs_to_non_functional_CDS[i] = true;
-          }
-        }
-      }
-
-      prot_node = prot_node->get_next();
-    }
-  }
-
-
-  // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs)
-  for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    ae_list_node<ae_rna*>* rna_node  = _rna_list[strand]->get_first();
-    ae_rna* rna = NULL;
-
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-
-      int32_t first;
-      int32_t last;
-
-      if ( strand == LEADING )
-      {
-
-        first = rna->get_promoter_pos();
-        last  = rna->get_last_transcribed_pos();
-
-      }
-      else // ( strand == LAGGING )
-      {
-        last  = rna->get_promoter_pos();
-
-        first = rna->get_last_transcribed_pos();
-      }
-
-      if ( first <= last )
-      {
-        for ( int32_t i = first ; i <= last ; i++ )
-        {
-          belongs_to_RNA[i] = true;
-        }
-      }
-      else
-      {
-        for ( int32_t i = first ; i < genome_length ; i++ )
-        {
-          belongs_to_RNA[i] = true;
-        }
-        for ( int32_t i = 0 ; i <= last ; i++ )
-        {
-          belongs_to_RNA[i] = true;
-        }
-      }
-
-      if ( ! rna->get_transcribed_proteins()->is_empty() ) // coding RNA
-      {
-        if ( first <= last )
-        {
-          for ( int32_t i = first ; i <= last ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = first ; i < genome_length ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= last ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-        }
-      }
-      else // non coding RNA
-      {
-        if ( first <= last )
-        {
-          for ( int32_t i = first ; i <= last ; i++ )
-          {
-            belongs_to_non_coding_RNA[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = first ; i < genome_length ; i++ )
-          {
-            belongs_to_non_coding_RNA[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= last ; i++ )
-          {
-            belongs_to_non_coding_RNA[i] = true;
-          }
-        }
-      }
-
-      rna_node = rna_node->get_next();
-    }
-  }
-
-  // Count non-coding bases
-  _nb_bases_in_0_CDS                = 0;
-  _nb_bases_in_0_functional_CDS     = 0;
-  _nb_bases_in_0_non_functional_CDS = 0;
-  _nb_bases_in_0_RNA                = 0;
-  _nb_bases_in_0_coding_RNA         = 0;
-  _nb_bases_in_0_non_coding_RNA     = 0;
-  _nb_bases_non_essential                     = 0;
-  _nb_bases_non_essential_including_nf_genes  = 0;
-  _nb_bases_in_neutral_regions        = 0;
-  _nb_neutral_regions                 = 0;
-
-  // We do not know how many neutral regions there will be, but
-  // there should be less than _nb_coding_RNAs + 1
-  // As we will see, there may be a shift in values so we take size _nb_coding_RNAs + 2
-  int32_t* tmp_beginning_neutral_regions = new int32_t [ _nb_coding_RNAs + 2 ];
-  int32_t* tmp_end_neutral_regions = new int32_t [ _nb_coding_RNAs + 2 ];
-  memset( tmp_beginning_neutral_regions, -1, _nb_coding_RNAs + 2 );
-  memset( tmp_end_neutral_regions, -1, _nb_coding_RNAs + 2 );
-
-  for ( int32_t i = 0 ; i < genome_length ; i++ )
-  {
-    if ( belongs_to_CDS[i] == false )
-    {
-      _nb_bases_in_0_CDS++;
-    }
-    if ( belongs_to_functional_CDS[i] == false )
-    {
-      _nb_bases_in_0_functional_CDS++;
-    }
-    if ( belongs_to_non_functional_CDS[i] == false )
-    {
-      _nb_bases_in_0_non_functional_CDS++;
-    }
-    if ( belongs_to_RNA[i] == false )
-    {
-      _nb_bases_in_0_RNA++;
-    }
-    if ( belongs_to_coding_RNA[i] == false )
-    {
-      _nb_bases_in_0_coding_RNA++;
-    }
-    if ( belongs_to_non_coding_RNA[i] == false )
-    {
-      _nb_bases_in_0_non_coding_RNA++;
-    }
-    if ( is_essential_DNA[i] == false )
-    {
-      _nb_bases_non_essential++;
-    }
-    if ( is_essential_DNA_including_nf_genes[i] == false )
-    {
-      _nb_bases_non_essential_including_nf_genes++;
-    }
-    if ( is_not_neutral[i] == false )
-    {
-      _nb_bases_in_neutral_regions++;
-    }
-    if ( i != 0 )
-    {
-      if ( is_not_neutral[i] != is_not_neutral[i-1] )
-      {
-        if ( is_not_neutral[i-1] == true ) // beginning of a neutral region
-        {
-          tmp_beginning_neutral_regions [ _nb_neutral_regions ] = i;
-        }
-        else // end of a neutral region
-        {
-          tmp_end_neutral_regions [ _nb_neutral_regions ] = i-1;
-          _nb_neutral_regions++;
-        }
-      }
-    }
-    else // i = 0
-    {
-      // we arbitrarily set 0 as the beginning of a neutral region (linkage with end of genetic unit
-      // will be done later)
-      if ( is_not_neutral[0] == false ) { tmp_beginning_neutral_regions [ _nb_neutral_regions ] = 0; }
-    }
-  }
-
-  // we have to treat specifically the last base of the genetic unit in order to link neutral regions
-  // at the end and the beginning of genetic unit
-  int32_t shift = 0;
-  if ( is_not_neutral[genome_length-1] == false )
-  {
-    if ( is_not_neutral[0] == true ) // end of a neutral region
-    {
-      tmp_end_neutral_regions[ _nb_neutral_regions ] = genome_length-1;
-      _nb_neutral_regions++;
-    }
-    else // neutral region goes on after base 0, linkage to be done
-    {
-      if ( _nb_neutral_regions != 0 )
-      {
-        tmp_end_neutral_regions[ _nb_neutral_regions ] = tmp_end_neutral_regions[ 0 ];
-        // the first neutral region is only a subpart of the last one, it should not be
-        // taken into account. When we transfer values to the final array, we introduce a shift
-        shift = 1;
-        // we do not ++ _nb_neutral_regions as it was already counted
-      }
-      else // no neutral region detected until now -> all the genetic unit is neutral
-      {
-        // as all the chromosome is neutral, we indicate 0 as the beginning of the region
-        // and genome_length - 1 as its end
-        tmp_end_neutral_regions[ 0 ] = genome_length - 1;
-        _nb_neutral_regions++;
-      }
-    }
-  }
-
-  // now that we know how many neutral regions there are, we can transfer data to correctly sized arrays
-  assert( _nb_neutral_regions <= _nb_coding_RNAs + 1 );
-  if ( _beginning_neutral_regions != NULL ) { delete [] _beginning_neutral_regions; }
-  if ( _end_neutral_regions != NULL )       { delete [] _end_neutral_regions; }
-
-  if ( _nb_neutral_regions > 0 ) // as unlikely as it seems, there may be no neutral region
-  {
-    _beginning_neutral_regions = new int32_t [ _nb_neutral_regions ];
-    _end_neutral_regions = new int32_t [ _nb_neutral_regions ];
-    // transfer from tmp to attributes
-    for (int32_t i = 0; i < _nb_neutral_regions; i++)
-    {
-      _beginning_neutral_regions[i] = tmp_beginning_neutral_regions[i+shift];
-      _end_neutral_regions[i]       = tmp_end_neutral_regions[i+shift];
-    }
-  }
-  else // _nb_neutral_regions == 0
-  {
-    _beginning_neutral_regions = NULL;
-    _end_neutral_regions       = NULL;
-  }
-
-  delete [] tmp_beginning_neutral_regions;
-  delete [] tmp_end_neutral_regions;
-
-  delete [] belongs_to_CDS;
-  delete [] belongs_to_functional_CDS;
-  delete [] belongs_to_non_functional_CDS;
-  delete [] belongs_to_RNA;
-  delete [] belongs_to_coding_RNA;
-  delete [] belongs_to_non_coding_RNA;
-  delete [] is_essential_DNA;
-  delete [] is_essential_DNA_including_nf_genes;
-  delete [] is_not_neutral;
-}
-
-void ae_genetic_unit::duplicate_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** duplicated_promoters )
-{
-  // 1) Get promoters to be duplicated
-  get_promoters_included_in( pos_1, pos_2, duplicated_promoters );
-
-  // 2) Set RNAs' position as their position on the duplicated segment
-  ae_list_node<ae_rna*>* rna_node  = NULL;
-
-  // -- LEADING --
-  rna_node = duplicated_promoters[LEADING]->get_first();
-  while ( rna_node != NULL )
-  {
-
-#ifndef __REGUL
-    // Make a copy of current RNA
-    ae_rna* copy = new ae_rna( this, *(rna_node->get_obj()) );
-#else
-    // Make a copy of current RNA
-    ae_rna_R* copy = new ae_rna_R( this, *(rna_node->get_obj()) );
-#endif
-
-    // Set RNA's position as it's position on the duplicated segment
-    copy->shift_position( -pos_1, _dna->get_length() );
-
-    // Replace current object by the copy
-    // Do not delete the replaced object as it is still a valid promoter in the individual's promoter list
-    rna_node->set_obj( copy );
-
-    rna_node = rna_node->get_next();
-  }
-
-  // -- LAGGING --
-  rna_node = duplicated_promoters[LAGGING]->get_first();
-  while ( rna_node != NULL )
-  {
-
-#ifndef __REGUL
-    // Make a copy of current RNA
-    ae_rna* copy = new ae_rna( this, *(rna_node->get_obj()) );
-#else
-    // Make a copy of current RNA
-    ae_rna_R* copy = new ae_rna_R( this, *(rna_node->get_obj()) );
-#endif
-    // Set RNA's position as it's position on the duplicated segment
-    copy->shift_position( -pos_1, _dna->get_length() );
-
-    // Replace current object by the copy (don't delete the replaced object as it is still a valid promoter)
-    rna_node->set_obj( copy );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** promoters )
-{
-  assert( pos_1 >= 0 && pos_1 <= _dna->get_length() && pos_2 >= 0 && pos_2 <= _dna->get_length() );
-
-  if ( pos_1 < pos_2 )
-  {
-    int32_t seg_length = pos_2 - pos_1;
-
-    if ( seg_length >= PROM_SIZE )
-    {
-      get_leading_promoters_starting_between( pos_1, pos_2 - PROM_SIZE + 1, promoters[LEADING] );
-      get_lagging_promoters_starting_between( pos_1 + PROM_SIZE - 1, pos_2, promoters[LAGGING] );
-    }
-  }
-  else
-  {
-    int32_t seg_length = _dna->get_length() + pos_2 - pos_1;
-
-    if ( seg_length >= PROM_SIZE )
-    {
-      bool is_near_end_of_genome        = ( pos_1 + PROM_SIZE > _dna->get_length() );
-      bool is_near_beginning_of_genome  = ( pos_2 - PROM_SIZE < 0 );
-
-      if ( !is_near_end_of_genome && !is_near_beginning_of_genome )
-      {
-        get_leading_promoters_starting_after( pos_1, promoters[LEADING] );
-        get_leading_promoters_starting_before( pos_2 - PROM_SIZE + 1, promoters[LEADING] );
-        get_lagging_promoters_starting_before( pos_2, promoters[LAGGING] );
-        get_lagging_promoters_starting_after( pos_1 + PROM_SIZE - 1, promoters[LAGGING] );
-      }
-      else if ( !is_near_end_of_genome ) // => && is_near_beginning_of_genome
-      {
-        get_leading_promoters_starting_between( pos_1, pos_2 + _dna->get_length() - PROM_SIZE + 1,
-                                                promoters[LEADING] );
-        get_lagging_promoters_starting_before( pos_2, promoters[LAGGING] );
-        get_lagging_promoters_starting_after( pos_1 + PROM_SIZE - 1, promoters[LAGGING] );
-      }
-      else if ( !is_near_beginning_of_genome ) // => && is_near_end_of_genome
-      {
-        get_leading_promoters_starting_after( pos_1, promoters[LEADING] );
-        get_leading_promoters_starting_before( pos_2 - PROM_SIZE + 1, promoters[LEADING] );
-        get_lagging_promoters_starting_between( pos_1 - _dna->get_length() + PROM_SIZE - 1, pos_2,
-                                                promoters[LAGGING] );
-      }
-      else // is_near_end_of_genome && is_near_beginning_of_genome
-      {
-        get_leading_promoters_starting_between( pos_1, pos_2 + _dna->get_length() - PROM_SIZE + 1,
-                                                promoters[LEADING] );
-        get_lagging_promoters_starting_between( pos_1 - _dna->get_length() + PROM_SIZE - 1, pos_2,
-                                                promoters[LAGGING] );
-      }
-    }
-  }
-}
-
-void ae_genetic_unit::get_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* leading_promoters )
-{
-  assert( pos_1 >= 0 && pos_1 < pos_2 && pos_2 <= _dna->get_length() );
-
-  // Go to first RNA after pos_1
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_1 )
-  {
-    rna_node  = rna_node->get_next();
-  }
-
-  // Add RNAs to new_list until we pass pos_2 (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-  {
-    leading_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* lagging_promoters )
-{
-  assert( pos_1 >= 0 && pos_1 < pos_2 && pos_2 <= _dna->get_length() );
-
-  // Go to first RNA before pos_2
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_2 )
-  {
-    rna_node = rna_node->get_next();
-  }
-
-  // Add RNAs to new_list until we pass pos_1 (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_1 )
-  {
-    lagging_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_leading_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* leading_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  // Go to first RNA after pos
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    rna_node  = rna_node->get_next();
-  }
-
-  // Add RNAs to new_list until we reach the end of the list
-  while ( rna_node != NULL )
-  {
-    leading_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_leading_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* leading_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-  // Add RNAs to new_list until we pass pos (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    leading_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_lagging_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* lagging_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  // Go to first RNA before pos
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    rna_node  = rna_node->get_next();
-  }
-
-  // Add RNAs to new_list until we reach the end of the list
-  while ( rna_node != NULL )
-  {
-    lagging_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::get_lagging_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* lagging_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-  // Add RNAs to new_list until we pass pos (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    lagging_promoters->add( rna_node->get_obj() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::invert_promoters_included_in( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 <= pos_2 && pos_2 <= _dna->get_length() );
-
-  int32_t segment_length = pos_2 - pos_1;
-
-  if ( segment_length >= PROM_SIZE )
-  {
-    ae_list<ae_rna*>** inverted_promoters = new ae_list<ae_rna*>*[2];
-    inverted_promoters[LEADING] = new ae_list<ae_rna*>();
-    inverted_promoters[LAGGING] = new ae_list<ae_rna*>();
-
-    //~ print_rnas();
-
-    // 1) Extract the promoters completely included on the segment to be inverted
-    extract_promoters_included_in( pos_1, pos_2, inverted_promoters );
-
-    //~ print_rnas( inverted_promoters );
-
-    // 2) Invert segment's promoters
-    ae_genetic_unit::invert_promoters( inverted_promoters, pos_1, pos_2 );
-
-    // 3) Reinsert the inverted promoters
-    insert_promoters( inverted_promoters );
-
-    delete inverted_promoters[LEADING];
-    delete inverted_promoters[LAGGING];
-    delete [] inverted_promoters;
-  }
-}
-
-/*!
-  \brief Invert all the promoters of promoter_lists for a sequence of length seq_length.
-*/
-/*static*/ void ae_genetic_unit::invert_promoters( ae_list<ae_rna*>** promoter_lists, int32_t seq_length )
-{
-  ae_genetic_unit::invert_promoters( promoter_lists, 0, seq_length );
-}
-
-/*!
-  \brief Invert all the promoters of promoter_lists knowing that they represent the promoters of a subsequence beginning at pos_1 and ending at pos_2.
-
-  WARNING : This function is pretty specific, make sure you understand its precise behaviour before using it.
-*/
-/*static*/ void ae_genetic_unit::invert_promoters( ae_list<ae_rna*>** promoter_lists, int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 <= pos_2 ); // Could check (pos_2 < length) but another parameter would be necessary
-
-  // Exchange LEADING and LAGGING lists
-  ae_list<ae_rna*>* tmp   = promoter_lists[LEADING];
-  promoter_lists[LEADING] = promoter_lists[LAGGING];
-  promoter_lists[LAGGING] = tmp;
-
-  // Update the position and strand of each promoter to be inverted...
-  ae_list_node<ae_rna*>* rna_node  = NULL;
-  ae_rna* rna             = NULL;
-
-  // ...on the former LAGGING strand (becoming the LEADING strand)
-  rna_node = promoter_lists[LEADING]->get_first();
-  int i = 0;
-  while ( rna_node != NULL )
-  {
-    i++;
-    rna = rna_node->get_obj();
-    assert( rna->get_strand() == LAGGING );
-    assert( rna->get_promoter_pos() >= pos_1 && rna->get_promoter_pos() < pos_2 );
-    rna->set_promoter_pos( pos_1 + pos_2 - rna->get_promoter_pos() - 1 );
-    rna->set_strand( LEADING );
-
-    rna_node = rna_node->get_next();
-  }
-
-
-  // ... and on the former LEADING strand (becoming the LAGGING strand)
-  rna_node = promoter_lists[LAGGING]->get_first();
-  i = 0;
-  while ( rna_node != NULL )
-  {
-    i++;
-    rna = rna_node->get_obj();
-    assert( rna->get_strand() == LEADING );
-    assert( rna->get_promoter_pos() >= pos_1 && rna->get_promoter_pos() < pos_2 );
-    rna->set_promoter_pos( pos_1 + pos_2 - rna->get_promoter_pos() - 1);
-    rna->set_strand( LAGGING );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-void ae_genetic_unit::extract_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos_1 >= 0 && pos_1 < pos_2 && pos_2 <= _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the first promoters in the interval
-  ae_list_node<ae_rna*>* node_first = NULL;
-  rna_node = _rna_list[LEADING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_1 )
-  {
-    rna_node  = rna_node->get_next();
-  }
-  if ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-  {
-    node_first = rna_node;
-  }
-
-  if ( node_first != NULL )
-  {
-    // Find the last promoters in the interval
-    ae_list_node<ae_rna*>* node_last = node_first;
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      node_last = rna_node;
-      rna_node  = rna_node->get_next();
-    }
-
-    // Extract the promoters (remove them from the individual's list and put them in extracted_promoters)
-    //~ print_rnas();
-    ae_list<ae_rna*>* tmp_list = _rna_list[LEADING]->extract_sublist( node_first, node_last );
-    //~ printf( "----------------------------------------------------\n" );
-    //~ print_rnas( tmp_list, LEADING );
-    //~ printf( "-------------------------==========-----------------\n" );
-    extracted_promoters->merge( tmp_list );
-    delete tmp_list;
-  }
-}
-
-void ae_genetic_unit::extract_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos_1 >= 0 && pos_1 < pos_2 && pos_2 <= _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the first promoters in the interval (if any)
-  ae_list_node<ae_rna*>* node_first = NULL;
-  rna_node = _rna_list[LAGGING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_2 )
-  {
-    rna_node  = rna_node->get_next();
-  }
-  if ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_1 )
-  {
-    node_first = rna_node;
-  }
-
-  // BREAKPOINT (contenu de extracted_promoters)
-
-  if ( node_first != NULL )
-  {
-    // Find the last promoters in the interval
-    ae_list_node<ae_rna*>* node_last = NULL;
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_1 )
-    {
-      node_last = rna_node;
-      rna_node  = rna_node->get_next();
-    }
-
-    //~ // <DEBUG>
-    //~ printf( "_rna_list[LAGGING]  (first : %p last : %p)\n", _rna_list[LAGGING]->get_first(), _rna_list[LAGGING]->get_last() );
-    //~ ae_list_node* anode = _rna_list[LAGGING]->get_first();
-    //~ while ( anode )
-    //~ {
-      //~ printf( "  node : %p\n", anode );
-      //~ anode = anode->get_next();
-    //~ }
-    //~ // </DEBUG>
-
-    // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
-    //~ printf( "tmp_list = _rna_list[LAGGING]->extract_sublist( %p, %p);\n", node_first, node_last );
-    ae_list<ae_rna*>* tmp_list = _rna_list[LAGGING]->extract_sublist( node_first, node_last );
-
-    //~ // <DEBUG>
-    //~ printf( "tmp_list  (first : %p last : %p)\n", tmp_list->get_first(), tmp_list->get_last() );
-    //~ anode = tmp_list->get_first();
-    //~ while ( anode )
-    //~ {
-      //~ printf( "  node : %p\n", anode );
-      //~ anode = anode->get_next();
-    //~ }
-    //~ printf( "_rna_list[LAGGING]  (first : %p last : %p)\n", _rna_list[LAGGING]->get_first(), _rna_list[LAGGING]->get_last() );
-    //~ anode = _rna_list[LAGGING]->get_first();
-    //~ while ( anode )
-    //~ {
-      //~ printf( "  node : %p\n", anode );
-      //~ anode = anode->get_next();
-    //~ }
-    //~ // </DEBUG>
-
-    extracted_promoters->merge( tmp_list );
-
-    delete tmp_list;
-  }
-}
-
-void ae_genetic_unit::extract_leading_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the first promoters in the interval
-  ae_list_node<ae_rna*>* node_first = NULL;
-  rna_node = _rna_list[LEADING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    rna_node = rna_node->get_next();
-  }
-  node_first = rna_node;
-
-  if ( node_first != NULL )
-  {
-    // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
-    ae_list<ae_rna*>* tmp_list = _rna_list[LEADING]->extract_ending_sublist( node_first );
-    extracted_promoters->merge( tmp_list );
-    delete tmp_list;
-  }
-}
-
-void ae_genetic_unit::extract_leading_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the last promoters in the interval
-  rna_node = _rna_list[LEADING]->get_first();
-
-  // Find the last promoters in the interval
-  ae_list_node<ae_rna*>* node_last = NULL;
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    node_last = rna_node;
-    rna_node  = rna_node->get_next();
-  }
-
-  if ( node_last != NULL )
-  {
-    // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
-    ae_list<ae_rna*>* tmp_list = _rna_list[LEADING]->extract_starting_sublist( node_last );
-    extracted_promoters->merge( tmp_list );
-    delete tmp_list;
-  }
-}
-
-void ae_genetic_unit::extract_lagging_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the first promoters in the interval
-  ae_list_node<ae_rna*>* node_first = NULL;
-  rna_node = _rna_list[LAGGING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    rna_node  = rna_node->get_next();
-  }
-  node_first = rna_node;
-
-  if ( node_first != NULL )
-  {
-    // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
-    ae_list<ae_rna*>* tmp_list = _rna_list[LAGGING]->extract_ending_sublist( node_first );
-    extracted_promoters->merge( tmp_list );
-    delete tmp_list;
-  }
-}
-
-void ae_genetic_unit::extract_lagging_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* extracted_promoters )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = NULL;
-
-  // Find the last promoters in the interval
-  rna_node = _rna_list[LAGGING]->get_first();
-
-  // Find the last promoters in the interval
-  ae_list_node<ae_rna*>* node_last = NULL;
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    node_last = rna_node;
-    rna_node  = rna_node->get_next();
-  }
-
-  if ( node_last != NULL )
-  {
-    // Extract the promoters (remove them from the individual's list and put the in extracted_promoters)
-    ae_list<ae_rna*>* tmp_list = _rna_list[LAGGING]->extract_starting_sublist( node_last );
-    extracted_promoters->merge( tmp_list );
-    delete tmp_list;
-  }
-}
-
-/*!
-  \brief Shift all the promoters in <promoters_to_shift> by <delta_pos> in a sequence of length <seq_length>.
-
-  Every promoter in double stranded list <promoters_to_shift> will be shifted by <delta_pos>,
-  then a modulo <seq_length> will be applied
-*/
-/*static*/ void ae_genetic_unit::shift_promoters( ae_list<ae_rna*>** promoters_to_shift, int32_t delta_pos, int32_t seq_length )
-{
-  ae_list_node<ae_rna*>* rna_node  = NULL;
-
-  // -- LEADING --
-  rna_node = promoters_to_shift[LEADING]->get_first();
-  while ( rna_node != NULL )
-  {
-    rna_node->get_obj()->shift_position( delta_pos, seq_length );
-    rna_node = rna_node->get_next();
-  }
-
-  // -- LAGGING --
-  rna_node = promoters_to_shift[LAGGING]->get_first();
-  while ( rna_node != NULL )
-  {
-    rna_node->get_obj()->shift_position( delta_pos, seq_length );
-    rna_node = rna_node->get_next();
-  }
-}
-
-/*!
-  \brief Insert promoters in double stranded list <promoters_to_insert> into <this->_rna_list>.
-
-  The promoters in <promoters_to_insert> must already be at their rightful position according to <this>
-  and the positions of the promoters from <promoters_to_insert> and <this->_rna_list> must not be interlaced
-  i.e. no promoter in <this->_rna_list> must have a position in [first_prom_to_insert->pos ; last_prom_to_insert->pos]
-*/
-void ae_genetic_unit::insert_promoters( ae_list<ae_rna*>** promoters_to_insert )
-{
-  ae_list_node<ae_rna*>* rna_node            = NULL;
-  ae_list_node<ae_rna*>* rna_node_to_insert  = NULL;
-
-  // -- LEADING --
-  if ( promoters_to_insert[LEADING]->get_nb_elts() > 0 )
-  {
-    // Get to the right position in individual's list (first promoter after the inserted segment)
-    int32_t pos_last_leading_to_insert = promoters_to_insert[LEADING]->get_last()->get_obj()->get_promoter_pos();
-    rna_node = _rna_list[LEADING]->get_first();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_last_leading_to_insert )
-    {
-      rna_node = rna_node->get_next();
-    }
-
-    // Insert the promoters in the individual's RNA list
-    rna_node_to_insert = promoters_to_insert[LEADING]->get_first();
-    while ( rna_node_to_insert != NULL )
-    {
-      if ( rna_node != NULL )
-      {
-        _rna_list[LEADING]->add_before( rna_node_to_insert->get_obj(), rna_node );
-      }
-      else
-      {
-        _rna_list[LEADING]->add( rna_node_to_insert->get_obj() );
-      }
-
-      rna_node_to_insert = rna_node_to_insert->get_next();
-    }
-  }
-
-  // -- LAGGING --
-  if ( promoters_to_insert[LAGGING]->get_nb_elts() > 0 )
-  {
-    // Get to the right position in individual's list (first promoter after the inserted segment)
-    int32_t pos_last_lagging_to_insert = promoters_to_insert[LAGGING]->get_last()->get_obj()->get_promoter_pos();
-    rna_node = _rna_list[LAGGING]->get_first();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_last_lagging_to_insert )
-    {
-      rna_node = rna_node->get_next();
-    }
-
-    // Insert the promoters in the individual's RNA list
-    rna_node_to_insert = promoters_to_insert[LAGGING]->get_first();
-    while ( rna_node_to_insert != NULL )
-    {
-      if ( rna_node != NULL )
-      {
-        _rna_list[LAGGING]->add_before( rna_node_to_insert->get_obj(), rna_node );
-      }
-      else
-      {
-        _rna_list[LAGGING]->add( rna_node_to_insert->get_obj() );
-      }
-
-      rna_node_to_insert = rna_node_to_insert->get_next();
-    }
-  }
-}
-
-/*!
-  Insert promoters in double stranded list <promoters_to_insert> into <this->_rna_list> at position <pos>
-
-  The promoters in <promoters_to_insert> must be at their rightful position according to a stand-alone sequence
-  (i.e. at a RELATIVE position). Their position will be updated automatically.
-*/
-void ae_genetic_unit::insert_promoters_at( ae_list<ae_rna*>** promoters_to_insert, int32_t pos )
-{
-  ae_list_node<ae_rna*>* rna_node = NULL;
-  ae_list_node<ae_rna*>* inserted_rna_node = NULL;
-
-  // -- LEADING --
-  if ( promoters_to_insert[LEADING]->get_nb_elts() > 0 )
-  {
-    // Get to the right position in individual's list (first promoter after the inserted segment)
-    rna_node = _rna_list[LEADING]->get_first();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-    {
-      rna_node = rna_node->get_next();
-    }
-
-    // Insert the promoters in the individual's RNA list
-    inserted_rna_node = promoters_to_insert[LEADING]->get_first();
-    while ( inserted_rna_node != NULL )
-    {
-      // Update promoter position
-      inserted_rna_node->get_obj()->shift_position( pos, _dna->get_length() );
-
-      // Insert
-      if ( rna_node != NULL )
-      {
-        _rna_list[LEADING]->add_before( inserted_rna_node->get_obj(), rna_node );
-      }
-      else
-      {
-        _rna_list[LEADING]->add( inserted_rna_node->get_obj() );
-      }
-
-      inserted_rna_node = inserted_rna_node->get_next();
-    }
-  }
-
-  // -- LAGGING --
-  if ( promoters_to_insert[LAGGING]->get_nb_elts() > 0 )
-  {
-    // Get to the right position in individual's list (first promoter after the inserted segment)
-    rna_node = _rna_list[LAGGING]->get_first();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-    {
-      rna_node = rna_node->get_next();
-    }
-
-    // Insert the duplicated promoters in the individual's RNA list
-    inserted_rna_node = promoters_to_insert[LAGGING]->get_first();
-    while ( inserted_rna_node != NULL )
-    {
-      // Update promoter position
-      inserted_rna_node->get_obj()->shift_position( pos, _dna->get_length() );
-
-      // Insert
-      if ( rna_node != NULL )
-      {
-        _rna_list[LAGGING]->add_before( inserted_rna_node->get_obj(), rna_node );
-      }
-      else
-      {
-        _rna_list[LAGGING]->add( inserted_rna_node->get_obj() );
-      }
-
-      inserted_rna_node = inserted_rna_node->get_next();
-    }
-  }
-}
-
-
-/*!
-  \brief Remove the RNAs of the LEADING strand whose starting positions lie in [pos_1 ; pos_2[
-*/
-void ae_genetic_unit::remove_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 < _dna->get_length() && pos_2 >= 0 && pos_2 <= _dna->get_length() );
-
-  if ( pos_1 > pos_2 )
-  {
-    remove_leading_promoters_starting_after( pos_1 );
-    remove_leading_promoters_starting_before( pos_2 );
-  }
-  else
-  {
-    ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-    // Go to first RNA after pos_1
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_1 )
-    {
-      rna_node  = rna_node->get_next();
-    }
-
-    // Delete RNAs until we pass pos_2 (or we reach the end of the list)
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      ae_list_node<ae_rna*>* next_node = rna_node->get_next();
-      //~ printf( "remove LEADING promoter at [%"PRId32", %"PRId32"]\n", rna_node->get_obj()->get_promoter_pos(),
-              //~ ae_utils::mod( rna_node->get_obj()->get_promoter_pos() + PROM_SIZE, _dna->get_length() ) );
-
-      _rna_list[LEADING]->remove( rna_node, true, true );
-
-      rna_node = next_node;
-    }
-  }
-}
-
-
-/*!
-  \brief Remove the RNAs of the LAGGING strand whose starting positions lie in [pos_1 ; pos_2[
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::remove_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 <= _dna->get_length() && pos_2 >= 0 && pos_2 <= _dna->get_length() );
-
-  if ( pos_1 == _dna->get_length() ) pos_1 = 0;
-  if ( pos_2 == 0 )                  pos_2 = _dna->get_length();
-
-  if ( pos_1 > pos_2 )
-  {
-    remove_lagging_promoters_starting_after( pos_1 );
-    remove_lagging_promoters_starting_before( pos_2 );
-  }
-  else
-  {
-    ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-    // Go to first RNA before pos_2
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_2 )
-    {
-      rna_node  = rna_node->get_next();
-    }
-
-    // Delete RNAs until we pass pos_1 (or we reach the end of the list)
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos_1 )
-    {
-      ae_list_node<ae_rna*>* next_node = rna_node->get_next();
-
-      //~ printf( "remove LAGGING promoter at [%"PRId32", %"PRId32"]\n", rna_node->get_obj()->get_promoter_pos(),
-              //~ ae_utils::mod( rna_node->get_obj()->get_promoter_pos() - PROM_SIZE, _dna->get_length() ) );
-      _rna_list[LAGGING]->remove( rna_node, true, true );
-
-      rna_node = next_node;
-    }
-  }
-}
-
-
-/*!
-  \brief Remove the promoters from the LEADING strand whose starting positions are < pos
-*/
-void ae_genetic_unit::remove_leading_promoters_starting_before( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-  // Delete RNAs until we reach pos (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    ae_list_node<ae_rna*>* next_node = rna_node->get_next();
-
-    _rna_list[LEADING]->remove( rna_node, true, true );
-
-    rna_node = next_node;
-  }
-}
-
-
-/*!
-  \brief Remove the promoters from the LAGGING strand whose starting positions are < pos
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::remove_lagging_promoters_starting_before( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_last();
-
-  // Delete RNAs until we reach pos (or we reach the beginning of the list )
-  ae_list_node<ae_rna*>* prev_node = NULL;
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    prev_node = rna_node->get_prev();
-
-    _rna_list[LAGGING]->remove( rna_node, true, true );
-
-    rna_node = prev_node;
-  }
-}
-
-
-/*!
-  \brief Remove the promoters from the LEADING strand whose starting positions are >= pos
-*/
-void ae_genetic_unit::remove_leading_promoters_starting_after( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  ae_list_node<ae_rna*>* rna_node = _rna_list[LEADING]->get_last();
-
-  // Delete RNAs until we pass pos ( or we reach the beginning of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    ae_list_node<ae_rna*>* prev_node = rna_node->get_prev();
-    //~ printf( "remove LEADING promoter at [%"PRId32", %"PRId32"]\n", rna_node->get_obj()->get_promoter_pos(),
-            //~ ae_utils::mod( rna_node->get_obj()->get_promoter_pos() + PROM_SIZE, _dna->get_length() ) );
-
-    _rna_list[LEADING]->remove( rna_node, true, true );
-
-    rna_node = prev_node;
-  }
-}
-
-
-/*!
-  \brief Remove the promoters from the LAGGING strand whose starting positions are >= pos
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::remove_lagging_promoters_starting_after( int32_t pos )
-{
-  assert( pos < _dna->get_length() && pos >= 0 );
-
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-  // Delete RNAs until we pass pos (or we reach the end of the list)
-  ae_list_node<ae_rna*>* next_node = NULL;
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    next_node = rna_node->get_next();
-
-    //~ printf( "remove LAGGING promoter at [%"PRId32", %"PRId32"]\n", rna_node->get_obj()->get_promoter_pos(),
-            //~ ae_utils::mod( rna_node->get_obj()->get_promoter_pos() - PROM_SIZE, _dna->get_length() ) );
-    _rna_list[LAGGING]->remove( rna_node, true, true );
-
-    rna_node  = next_node;
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LEADING strand whose starting positions would lie in [pos_1 ; pos_2[
-*/
-void ae_genetic_unit::look_for_new_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 < _dna->get_length() && pos_2 >= 0 && pos_2 < _dna->get_length() );
-
-  // When pos_1 > pos_2, we will perform the search in 2 steps.
-  // As positions  0 and _dna->get_length() are equivalent, it's preferable to
-  // keep 0 for pos_1 and _dna->get_length() for pos_2.
-  //~ if ( pos_2 == 0 ) pos_2 = _dna->get_length();
-
-
-  if ( pos_1 >= pos_2 )
-  {
-    look_for_new_leading_promoters_starting_after( pos_1 );
-    look_for_new_leading_promoters_starting_before( pos_2 );
-  }
-  else
-  {
-    int8_t dist; // Hamming distance of the sequence from the promoter consensus
-
-    for ( int32_t i = pos_1 ; i < pos_2 ; i++ )
-    {
-      if ( is_promoter( LEADING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-      {
-        //~ char tmp[255];
-        //~ memcpy( tmp, &_dna->get_data()[i], PROM_SIZE * sizeof(char) );
-        //~ printf( "new promoter found on the LEADING strand at position %"PRId32" : %s\n", i, tmp );
-
-        // Look for the right place to insert the new promoter in the list
-        ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-        while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < i )
-        {
-          rna_node = rna_node->get_next();
-        }
-
-        if ( rna_node == NULL )
-        {
-          // Add at the end of the list
-          #ifndef __REGUL
-            _rna_list[LEADING]->add( new ae_rna( this, LEADING, i, dist ) );
-          #else
-            _rna_list[LEADING]->add( new ae_rna_R( this, LEADING, i, dist ) );
-          #endif
-        }
-        else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-        {
-          // Add before rna_node
-          #ifndef __REGUL
-            _rna_list[LEADING]->add_before( new ae_rna( this, LEADING, i, dist ), rna_node );
-          #else
-            _rna_list[LEADING]->add_before( new ae_rna_R( this, LEADING, i, dist ), rna_node );
-          #endif
-        }
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LAGGIN strand whose starting positions would lie in [pos_1 ; pos_2[
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::look_for_new_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2 )
-{
-  assert( pos_1 >= 0 && pos_1 < _dna->get_length() && pos_2 >= 0 && pos_2 < _dna->get_length() );
-
-  // When pos_1 > pos_2, we will perform the search in 2 steps.
-  // As positions  0 and _dna->get_length() are equivalent, it's preferable to
-  // keep 0 for pos_1 and _dna->get_length() for pos_2.
-  //~ if ( pos_1 == _dna->get_length() ) pos_1 = 0;
-  //~ if ( pos_2 == 0 )                  pos_2 = _dna->get_length();
-
-  if ( pos_1 >= pos_2 )
-  {
-    look_for_new_lagging_promoters_starting_after( pos_1 );
-    look_for_new_lagging_promoters_starting_before( pos_2 );
-  }
-  else
-  {
-    int8_t dist; // Hamming distance of the sequence from the promoter consensus
-    ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-    for ( int32_t i = pos_2 - 1 ; i >= pos_1 ; i-- )
-    {
-      if ( is_promoter( LAGGING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-      {
-        assert ( i >= 0 && i < _dna->get_length() );
-
-        // Look for the right place to insert the new promoter in the list
-        while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() > i )
-        {
-          rna_node = rna_node->get_next();
-        }
-
-        if ( rna_node == NULL )
-        {
-          // Add at the end of the list
-          #ifndef __REGUL
-            _rna_list[LAGGING]->add( new ae_rna( this, LAGGING, i, dist ) );
-          #else
-            _rna_list[LAGGING]->add( new ae_rna_R( this, LAGGING, i, dist ) );
-          #endif
-        }
-        else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-        {
-          // Add before rna_node
-          #ifndef __REGUL
-            _rna_list[LAGGING]->add_before( new ae_rna( this, LAGGING, i, dist ), rna_node );
-          #else
-            _rna_list[LAGGING]->add_before( new ae_rna_R( this, LAGGING, i, dist ), rna_node );
-          #endif
-        }
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LEADING strand whose starting positions would be >= pos
-*/
-void ae_genetic_unit::look_for_new_leading_promoters_starting_after( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-
-  // Hamming distance of the sequence from the promoter consensus
-  int8_t dist;
-
-  // rna list node used to find the new promoter's place in the list
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-
-  for ( int32_t i = pos ; i < _dna->get_length() ; i++ )
-  {
-    if ( is_promoter( LEADING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-    {
-      //~ char tmp[255];
-      //~ memcpy( tmp, &_dna->get_data()[i], PROM_SIZE * sizeof(char) );
-      //~ printf( "new promoter found on the LEADING strand at position %"PRId32" : %s\n", i, tmp );
-
-      // Look for the right place to insert the new promoter in the list
-      while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < i )
-      {
-        rna_node = rna_node->get_next();
-      }
-
-      if ( rna_node == NULL )
-      {
-        // Add at the end of the list
-        #ifndef __REGUL
-          _rna_list[LEADING]->add( new ae_rna( this, LEADING, i, dist ) );
-        #else
-          _rna_list[LEADING]->add( new ae_rna_R( this, LEADING, i, dist ) );
-        #endif
-      }
-      else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-      {
-        // Add before rna_node
-        #ifndef __REGUL
-          _rna_list[LEADING]->add_before( new ae_rna( this, LEADING, i, dist ), rna_node );
-        #else
-          _rna_list[LEADING]->add_before( new ae_rna_R( this, LEADING, i, dist ), rna_node );
-        #endif
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LAGGING strand whose starting positions would be >= pos
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::look_for_new_lagging_promoters_starting_after( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-
-  // Hamming distance of the sequence from the promoter consensus
-  int8_t dist;
-
-  // rna list node used to find the new promoter's place in the list
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-
-  for ( int32_t i = _dna->get_length() - 1 ; i >= pos ; i-- )
-  {
-    if ( is_promoter( LAGGING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-    {
-      assert ( i >= 0 && i < _dna->get_length() );
-
-      // Look for the right place to insert the new promoter in the list
-      while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() > i )
-      {
-        rna_node = rna_node->get_next();
-      }
-
-      if ( rna_node == NULL )
-      {
-        // Add at the end of the list
-        #ifndef __REGUL
-          _rna_list[LAGGING]->add( new ae_rna( this, LAGGING, i, dist ) );
-        #else
-          _rna_list[LAGGING]->add( new ae_rna_R( this, LAGGING, i, dist ) );
-        #endif
-      }
-      else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-      {
-        // Add before rna_node
-        #ifndef __REGUL
-          _rna_list[LAGGING]->add_before( new ae_rna( this, LAGGING, i, dist ), rna_node );
-        #else
-          _rna_list[LAGGING]->add_before( new ae_rna_R( this, LAGGING, i, dist ), rna_node );
-        #endif
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LEADING strand whose starting positions would be < pos
-*/
-void ae_genetic_unit::look_for_new_leading_promoters_starting_before( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-
-  // Hamming distance of the sequence from the promoter consensus
-  int8_t dist;
-
-  // rna list node used to find the new promoter's place in the list
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-
-  for ( int32_t i = 0 ; i < pos ; i++ )
-  {
-    if ( is_promoter( LEADING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-    {
-      //~ char tmp[255];
-      //~ memcpy( tmp, &_dna->get_data()[i], PROM_SIZE * sizeof(char) );
-      //~ printf( "new promoter found on the LEADING strand at position %"PRId32" : %s\n", i, tmp );
-
-      // Look for the right place to insert the new promoter in the list
-      while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < i )
-      {
-        rna_node = rna_node->get_next();
-      }
-
-      if ( rna_node == NULL )
-      {
-        // Add at the end of the list
-        #ifndef __REGUL
-          _rna_list[LEADING]->add( new ae_rna( this, LEADING, i, dist ) );
-        #else
-          _rna_list[LEADING]->add( new ae_rna_R( this, LEADING, i, dist ) );
-        #endif
-      }
-      else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-      {
-        // Add before rna_node
-        #ifndef __REGUL
-          _rna_list[LEADING]->add_before( new ae_rna( this, LEADING, i, dist ), rna_node );
-        #else
-          _rna_list[LEADING]->add_before( new ae_rna_R( this, LEADING, i, dist ), rna_node );
-        #endif
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Look for new promoters on the LAGGING strand whose starting positions would be < pos
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::look_for_new_lagging_promoters_starting_before( int32_t pos )
-{
-  assert( pos >= 0 && pos < _dna->get_length() );
-
-  // Hamming distance of the sequence from the promoter consensus
-  int8_t dist;
-
-  // rna list node used to find the new promoter's place in the list
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-
-
-  for ( int32_t i = pos - 1 ; i >= 0 ; i-- )
-  {
-    if ( is_promoter( LAGGING, i, dist ) ) // dist takes the hamming distance of the sequence from the consensus
-    {
-      assert ( i >= 0 && i < _dna->get_length() );
-
-      // Look for the right place to insert the new promoter in the list
-      while( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() > i )
-      {
-        rna_node = rna_node->get_next();
-      }
-
-      if ( rna_node == NULL )
-      {
-        // Add at the end of the list
-        #ifndef __REGUL
-          _rna_list[LAGGING]->add( new ae_rna( this, LAGGING, i, dist ) );
-        #else
-          _rna_list[LAGGING]->add( new ae_rna_R( this, LAGGING, i, dist ) );
-        #endif
-      }
-      else if ( rna_node->get_obj()->get_promoter_pos() != i ) // If not already in list
-      {
-        // Add before rna_node
-        #ifndef __REGUL
-          _rna_list[LAGGING]->add_before( new ae_rna( this, LAGGING, i, dist ), rna_node );
-        #else
-          _rna_list[LAGGING]->add_before( new ae_rna_R( this, LAGGING, i, dist ), rna_node );
-        #endif
-      }
-    }
-  }
-}
-
-
-/*!
-  \brief Shift (by delta_post) the positions of the promoters from the LEADING strand whose starting positions are >= pos.
-*/
-void ae_genetic_unit::move_all_leading_promoters_after( int32_t pos, int32_t delta_pos )
-{
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-
-  // Go to first RNA after pos
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos )
-  {
-    //~ printf( "don't move leading promoter at position %"PRId32"\n", rna_node->get_obj()->get_promoter_pos() );
-    rna_node = rna_node->get_next();
-  }
-
-  // Update all the remaining RNAs
-  while ( rna_node != NULL )
-  {
-    //~ printf( "move leading promoter at position %"PRId32"\n", rna_node->get_obj()->get_promoter_pos() );
-    rna_node->get_obj()->shift_position( delta_pos, _dna->get_length() );
-    //~ printf( "new position : %"PRId32"\n", rna_node->get_obj()->get_promoter_pos() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-
-/*!
-  \brief Shift (by delta_post) the positions of the promoters from the LAGGING strand whose starting positions are >= pos.
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::move_all_lagging_promoters_after( int32_t pos, int32_t delta_pos )
-{
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_first();
-  ae_rna*       rna;
-
-  // Update RNAs until we pass pos (or we reach the end of the list)
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() >= pos )
-  {
-    rna = rna_node->get_obj();
-    if ( rna->get_promoter_pos() < pos ) break;
-
-    rna->shift_position( delta_pos, _dna->get_length() );
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-
-/*!
-  \brief Copy (into new_promoter_list) the promoters from the LEADING strand whose starting positions lie in [pos_1 ; pos_2[
-*/
-void ae_genetic_unit::copy_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* new_promoter_list )
-{
-  // 1) Go to first RNA to copy
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LEADING]->get_first();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_1 )
-  {
-    //~ printf( "don't move leading promoter at position %"PRId32"\n", rna_node->get_obj()->get_promoter_pos() );
-    rna_node = rna_node->get_next();
-  }
-
-  // 2) Copy RNAs
-  if ( pos_1 < pos_2 )
-  {
-    // Copy from pos_1 to pos_2
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      new_promoter_list->add( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_next();
-    }
-  }
-  else
-  {
-    // Copy from pos_1 to the end of the list
-    while ( rna_node != NULL )
-    {
-      new_promoter_list->add( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_next();
-    }
-
-    // Copy from the beginning of the list to pos_2
-    rna_node  = _rna_list[LEADING]->get_first();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      new_promoter_list->add( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_next();
-    }
-  }
-}
-
-
-/*!
-  \brief Copy (into new_promoter_list) the promoters from the LAGGING strand whose starting positions lie in [pos_1 ; pos_2[
-
-  NOTE : A lagging promoter whose starting position is pos spans [pos-PROM_SIZE+1 ; pos], not [pos-PROM_SIZE ; pos[
-
-  Assuming (PROM_SIZE == 4), the LAGGING promoter whose starting position is pos spans the cells filled with X on the following cartoon:
-  \verbatim
-     -------------------------------
-    |   |   | X | X | X | X |   |   |
-     -------------------------------
-                        ^
-                       pos
-  \endverbatim
-*/
-void ae_genetic_unit::copy_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* new_promoter_list )
-{
-  // Go to first RNA to copy
-  ae_list_node<ae_rna*>* rna_node  = _rna_list[LAGGING]->get_last();
-  while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_1 )
-  {
-    rna_node  = rna_node->get_prev();
-  }
-
-  // Copy RNAs
-  if ( pos_1 < pos_2 )
-  {
-    // Copy from pos_1 to pos_2
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      new_promoter_list->add_front( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_prev();
-    }
-  }
-  else
-  {
-    // Copy from pos_1 to the beginning of the list (we are going backwards)
-    while ( rna_node != NULL )
-    {
-      new_promoter_list->add_front( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_prev();
-    }
-
-    // Copy from the end of the list to pos_2 (we are going backwards)
-    rna_node  = _rna_list[LAGGING]->get_last();
-    while ( rna_node != NULL && rna_node->get_obj()->get_promoter_pos() < pos_2 )
-    {
-      new_promoter_list->add_front( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      rna_node = rna_node->get_prev();
-    }
-  }
-}
-
-void ae_genetic_unit::save( gzFile backup_file )
-{
-  _dna->save( backup_file );
-  gzwrite( backup_file, &_min_gu_length, sizeof(_min_gu_length) );
-  gzwrite( backup_file, &_max_gu_length, sizeof(_max_gu_length) );
-}
-
-int32_t ae_genetic_unit::get_nb_terminators( void )
-{
-  int32_t nb_term = 0;
-
-  if ( _dna->get_length() >= TERM_SIZE )
-  {
-    for ( int32_t i = 0 ; i < _dna->get_length() ; i++ )
-    {
-      if ( is_terminator( LEADING, i ) )  // No need to count on both the LEADING and the LAGGING strand
-                                          // as terminators are "shared"
-      {
-        nb_term++;
-      }
-    }
-  }
-
-  return nb_term;
-}
-
-#ifdef DEBUG
-  void ae_genetic_unit::assert_promoters( void )
-  {
-    // Check that the lists are ordered correctly
-    assert_promoters_order();
-
-    // Make a backup of the genetic unit's lists of RNAs
-    ae_list<ae_rna*>** old_rna_list = _rna_list;
-
-    _rna_list           = new ae_list<ae_rna*>*[2];
-    _rna_list[LEADING]  = new ae_list<ae_rna*>();
-    _rna_list[LAGGING]  = new ae_list<ae_rna*>();
-
-    locate_promoters();
-
-    // Compare lists
-    ae_list_node<ae_rna*>*  node_old  = NULL;
-    ae_list_node<ae_rna*>*  node_new  = NULL;
-    ae_rna* rna_old   = NULL;
-    ae_rna* rna_new   = NULL;
-
-    for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-    {
-      node_old  = old_rna_list[strand]->get_first();
-      node_new  = _rna_list[strand]->get_first();
-
-      while ( node_old != NULL || node_new != NULL )
-      {
-        if( node_old == NULL || node_new == NULL )
-        {
-          printf( "****************************** NB_ELTS problem ******************************\n" );
-          printf( "should be : \n" );
-          print_rnas( _rna_list );
-          printf( "is : \n" );
-          print_rnas( old_rna_list );
-          printf( "****************************************************************************\n" );
-          printf( "  genome length : %"PRId32"\n", _dna->get_length() );
-          assert( node_old != NULL && node_new != NULL );
-        }
-
-        rna_old = node_old->get_obj();
-        rna_new = node_new->get_obj();
-
-        if ( rna_old->get_strand() != rna_new->get_strand() )
-        {
-          printf( "****************************** STRAND problem ******************************\n" );
-          printf( "should be : \n" );
-          print_rnas( _rna_list );
-          printf( "is : \n" );
-          print_rnas( old_rna_list );
-          printf( "****************************************************************************\n" );
-          printf( "  %"PRId32" (%s) : %f    vs    %"PRId32" (%s) : %f\n",
-                  rna_old->get_promoter_pos(), rna_old->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_old->get_basal_level(),
-                  rna_new->get_promoter_pos(), rna_new->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_new->get_basal_level() );
-          printf( "  genome length : %"PRId32"\n", _dna->get_length() );
-          assert( rna_old->get_strand() == rna_new->get_strand() );
-        }
-
-        if ( rna_old->get_promoter_pos() != rna_new->get_promoter_pos() )
-        {
-          printf( "***************************** POSITION problem *****************************\n" );
-          printf( "should be : \n" );
-          print_rnas( _rna_list );
-          printf( "is : \n" );
-          print_rnas( old_rna_list );
-          printf( "****************************************************************************\n" );
-          printf( "  %"PRId32" (%s) : %f    vs    %"PRId32" (%s) : %f\n",
-                  rna_old->get_promoter_pos(), rna_old->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_old->get_basal_level(),
-                  rna_new->get_promoter_pos(), rna_new->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_new->get_basal_level() );
-          printf( "  genome length : %"PRId32"\n", _dna->get_length() );
-          assert( rna_old->get_promoter_pos() == rna_new->get_promoter_pos()  );
-        }
-
-        if ( rna_old->get_basal_level() != rna_new->get_basal_level() )
-        {
-          printf( "*************************** BASAL LEVEL problem ****************************\n" );
-          printf( "should be : \n" );
-          print_rnas( _rna_list );
-          printf( "is : \n" );
-          print_rnas( old_rna_list );
-          printf( "****************************************************************************\n" );
-          printf( "  %"PRId32" (%s) : %f    vs    %"PRId32" (%s) : %f\n",
-                  rna_old->get_promoter_pos(), rna_old->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_old->get_basal_level(),
-                  rna_new->get_promoter_pos(), rna_new->get_strand() == LEADING ? "LEADING" : "LAGGING", rna_new->get_basal_level() );
-          printf( "  genome length : %"PRId32"\n", _dna->get_length() );
-          assert( rna_old->get_basal_level() == rna_new->get_basal_level() );
-        }
-
-        node_old = node_old->get_next();
-        node_new = node_new->get_next();
-      }
-    }
-
-    _rna_list[LEADING]->erase( true );
-    _rna_list[LAGGING]->erase( true );
-    delete _rna_list[LEADING];
-    delete _rna_list[LAGGING];
-    delete [] _rna_list;
-
-    _rna_list = old_rna_list;
-  }
-
-  void ae_genetic_unit::assert_promoters_order( void )
-  {
-    ae_list_node<ae_rna*>* node1 = NULL;
-    ae_list_node<ae_rna*>* node2 = NULL;
-    ae_rna* rna1 = NULL;
-    ae_rna* rna2 = NULL;
-
-    for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-    {
-      if ( _rna_list[strand]->get_nb_elts() >= 2 )
-      {
-        node1 = _rna_list[strand]->get_first();
-        node2 = node1->get_next();
-
-        while ( node2 != NULL )
-        {
-          rna1 = node1->get_obj();
-          rna2 = node2->get_obj();
-
-          if ( strand == LEADING )
-          {
-            if( rna1->get_promoter_pos() >= rna2->get_promoter_pos() )
-            {
-              printf( "********************** ORDER problem (LEADING) ***********************\n" );
-              print_rnas();
-              printf( "****************************************************************************\n" );
-              assert( rna1->get_promoter_pos() < rna2->get_promoter_pos() );
-            }
-          }
-          else
-          {
-            if( rna1->get_promoter_pos() <= rna2->get_promoter_pos() )
-            {
-              printf( "*********************** ORDER problem (LAGGING) ***********************\n" );
-              print_rnas();
-              printf( "****************************************************************************\n" );
-              assert( rna1->get_promoter_pos() > rna2->get_promoter_pos() );
-            }
-          }
-
-          node1 = node2;
-          node2 = node2->get_next();
-        }
-      }
-    }
-  }
-#endif
-
-/*!
-  \brief Retrieve for each base if it belongs or not to coding RNA
-
-  \return Boolean table of sequence length size with for each base if it belongs or not to coding RNA
-*/
-bool* ae_genetic_unit::is_belonging_to_coding_RNA( void )
-{
-  int32_t genome_length = _dna->get_length();
-  bool* belongs_to_coding_RNA = new bool[genome_length];
-  memset( belongs_to_coding_RNA,0, genome_length );
-
-  // Parse RNA lists and mark the corresponding bases as coding (only for the coding RNAs)
-  for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  {
-    ae_list_node<ae_rna*>* rna_node  = _rna_list[strand]->get_first();
-    ae_rna* rna = NULL;
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-
-      int32_t first;
-      int32_t last;
-
-      if ( strand == LEADING )
-      {
-        first = rna->get_promoter_pos();
-        last  = rna->get_last_transcribed_pos();
-      }
-      else // ( strand == LAGGING )
-      {
-        last  = rna->get_promoter_pos();
-        first = rna->get_last_transcribed_pos();
-      }
-
-      if ( ! rna->get_transcribed_proteins()->is_empty() ) // coding RNA
-      {
-        if ( first <= last )
-        {
-          for ( int32_t i = first ; i <= last ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-        }
-        else
-        {
-          for ( int32_t i = first ; i < genome_length ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-          for ( int32_t i = 0 ; i <= last ; i++ )
-          {
-            belongs_to_coding_RNA[i] = true;
-          }
-        }
-      }
-      rna_node = rna_node->get_next();
-    }
-  }
-  return(belongs_to_coding_RNA);
-}
-
-/*!
-  \brief Remove the bases that are not in coding RNA
-
-  Remove the bases that are not in coding RNA and test at each loss that fitness is not changed
-*/
-void ae_genetic_unit::remove_non_coding_bases( void)
-{
-  ae_environment* env = _exp_m->get_env() ;
-
-  reset_expression();
-  locate_promoters();
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-  compute_phenotypic_contribution();
-  if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-  {
-    compute_distance_to_target(env);
-  }
-  compute_fitness(env);
-  double initial_fitness = get_fitness();
-
-  int32_t genome_length = _dna->get_length();
-  bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA();
-
-  int32_t non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-  int32_t start = 0;
-  int32_t end = 0;
-
-
-  for ( int32_t i = genome_length-1 ; i >= 0 ; i-- )
-  {
-    if ( belongs_to_coding_RNA[i] == false )
-    {
-      end = i+1;
-      while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false )
-      {
-        i--;
-      }
-      start = i;
-      _dna->remove(start,end);
-
-      locate_promoters();
-      reset_expression();
-      _distance_to_target_computed        = false;
-      _fitness_computed                   = false;
-      compute_phenotypic_contribution();
-      if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-      {
-        compute_distance_to_target(env);
-      }
-      compute_fitness(env);
-      assert(get_fitness()==initial_fitness);
-
-      _non_coding_computed = false;
-      non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-    }
-  }
-
-  locate_promoters();
-  reset_expression();
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-  compute_phenotypic_contribution();
-  if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-  {
-    compute_distance_to_target(env);
-  }
-  compute_fitness(env);
-  assert(get_fitness()==initial_fitness);
-
-  _non_coding_computed = false;
-  non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-  assert(non_coding_bases_nb==0);
-
-  delete [] belongs_to_coding_RNA;
-}
-
-/*!
-  \brief Double the bases that are not in coding RNA
-
-  Double the bases that are not in coding RNA by addition of random bases and test at each addition that fitness is not changed
-*/
-void ae_genetic_unit::double_non_coding_bases(void)
-{
-  ae_environment* env = _exp_m->get_env() ;
-
-  reset_expression();
-  locate_promoters();
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-  compute_phenotypic_contribution();
-  if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-  {
-    compute_distance_to_target(env);
-  }
-  compute_fitness(env);
-  double initial_fitness = get_fitness();
-
-  int32_t genome_length = _dna->get_length();
-  bool* belongs_to_coding_RNA = is_belonging_to_coding_RNA();
-
-  _non_coding_computed = false;
-  int32_t inital_non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-  int32_t start = 0;
-  int32_t end = 0;
-  int32_t length = 0;
-  int32_t pos = 0;
-  char * random_portion = NULL;
-  bool insertion_ok = false;
-  int32_t non_coding_bases_nb_before_fitness = get_nb_bases_in_0_coding_RNA();
-  int32_t non_coding_bases_nb_after_fitness = get_nb_bases_in_0_coding_RNA();
-
-  int32_t non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-
-  for ( int32_t i = genome_length-1 ; i >= 0 ; i-- )
-  {
-    if ( belongs_to_coding_RNA[i] == false )
-    {
-      end = i+1;
-      while((i-1) >=0 && belongs_to_coding_RNA[(i-1)] == false )
-      {
-        i--;
-      }
-      start = i;
-      length = end-start;
-
-      insertion_ok = false;
-      while(not insertion_ok)
-      {
-        random_portion = new char [length+1];
-        for ( int32_t j = 0 ; j < length ; j++ )
-        {
-          random_portion[j] = '0' + _indiv->get_mut_prng()->random( NB_BASE );
-        }
-        random_portion[length] = 0;
-        pos = _indiv->get_mut_prng()->random( length )+start;
-        _dna->insert(pos, random_portion);
-
-        _non_coding_computed = false;
-        non_coding_bases_nb_before_fitness = get_nb_bases_in_0_coding_RNA();
-
-        locate_promoters();
-        reset_expression();
-        _distance_to_target_computed        = false;
-        _fitness_computed                   = false;
-        compute_phenotypic_contribution();
-        if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-        {
-          compute_distance_to_target(env);
-        }
-        compute_fitness(env);
-        assert(get_fitness()==initial_fitness);
-
-        _non_coding_computed = false;
-        non_coding_bases_nb_after_fitness = get_nb_bases_in_0_coding_RNA();
-
-        if (non_coding_bases_nb_before_fitness != non_coding_bases_nb_after_fitness)
-        {
-          _dna->remove(pos, pos + length);
-        }
-        else
-        {
-          insertion_ok = true;
-        }
-
-      }
-      _non_coding_computed = false;
-
-      delete [] random_portion;
-      random_portion = NULL;
-    }
-  }
-
-  locate_promoters();
-  reset_expression();
-  _distance_to_target_computed        = false;
-  _fitness_computed                   = false;
-  compute_phenotypic_contribution();
-  if(_exp_m->get_output_m()->get_compute_phen_contrib_by_GU())
-  {
-    compute_distance_to_target(env);
-  }
-  compute_fitness(env);
-  assert(get_fitness()==initial_fitness);
-
-  _non_coding_computed = false;
-  non_coding_bases_nb = get_nb_bases_in_0_coding_RNA();
-  assert(non_coding_bases_nb == 2*inital_non_coding_bases_nb);
-
-  delete [] belongs_to_coding_RNA;
-}
-
-
-// This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes.
-// The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be:
-//  - the beginning of the promoter if the gene is on the leading strand
-//  - or the end of the terminator if the gene is on the lagging strand.
-static bool breakpoint_inside_gene(int32_t pos_brkpt, int32_t first, int32_t last)
-{
-  if (first < last) // most frequent case
-    {
-      if( (first <= pos_brkpt) && (pos_brkpt <= last)) {return true;}
-      else {return false;}
-    }
-  else // special case where the RNA overlaps ori
-    {
-      if( (first <= pos_brkpt) || (pos_brkpt <= last) ) {return true;}
-      else {return false;}
-    }
-}
-
-
-// This is an auxiliary function for the method ae_genetic_unit::compute_nb_of_affected_genes.
-// It return true if the gene is totally included in the segment [pos1, pos2].
-// The gene should go from 'first' to 'last' in the clockwise sense, implying that 'first' should be:
-//  - the beginning of the promoter if the gene is on the leading strand
-//  - or the end of the terminator if the gene is on the lagging strand.
-static bool gene_totally_in_segment(int32_t pos1, int32_t pos2, int32_t first, int32_t last)
-{
-  if ( (first < last)  && (pos1 <= pos2) )
-    {
-      if ( ((first >= pos1) && (first <= pos2)) && ((last >= pos1) && (last <= pos2)) ) {return true; }
-      else {return false;}
-    }
-  else if ( (first < last) && (pos1 > pos2) )  // mut seg in 2 pieces but not the gene
-    {
-      if ( (first >= pos1) || (last <= pos2) )  // the gene is either completely in [pos1, genlen-1] or completely in [0, pos2]
-        {
-          return true;
-        }
-      else return false;
-    }
-  else if ( (first > last) && (pos1 <= pos2) )  // gene in two pieces but not mut seg, the gene cannot be totally included
-    {
-      return false;
-    }
-  else // both mut seg and the gene are in 2 pieces
-    {
-      if ((first >= pos1) && (last <= pos2)) {return true;}
-      else {return false;}
-    }
-}
-
-
-
-// WARNING: This method works properly only in the case of a single genetic unit (no plasmid).
-// Translocations between different genetic units is not managed.
-void ae_genetic_unit::compute_nb_of_affected_genes(ae_mutation * mut, int & nb_genes_at_breakpoints, int & nb_genes_in_segment, int & nb_genes_in_replaced_segment)
-{
-  nb_genes_at_breakpoints = 0;
-  nb_genes_in_segment = 0;
-  nb_genes_in_replaced_segment = 0;
-  int32_t genlen = get_seq_length(); // length of the genetic unit, in bp
-
-  int32_t pos0 = -1, pos1 = -1, pos2 = -1, pos3 = -1, mutlength = -1;
-  int32_t pos1donor = -1, pos2donor = -1, pos3donor = -1;
-  char * seq = NULL;
-  int32_t first, last;
-  bool invert = false;
-  ae_sense sense = DIRECT;
-  ae_mutation_type type = mut->get_mut_type();
-  switch(type)
-    {
-    case SWITCH:
-      {
-        mut->get_infos_point_mutation(&pos0);
-        mutlength = 1;
-        break;
-      }
-    case S_INS:
-      {
-        mut->get_infos_small_insertion(&pos0, &mutlength);
-        break;
-      }
-    case S_DEL:
-      {
-        mut->get_infos_small_deletion(&pos0, &mutlength);
-        break;
-      }
-    case DUPL:
-      {
-        mut->get_infos_duplication(&pos1, &pos2, &pos0);
-        // pos2 is actually not included in the segment, the real end of the segment is pos2 - 1
-        pos2 = ae_utils::mod(pos2 - 1, genlen);
-        mutlength = mut->get_length();
-        break;
-      }
-    case DEL:
-      {
-        mut->get_infos_deletion(&pos1, &pos2);
-        pos2 = ae_utils::mod(pos2 - 1, genlen);
-        mutlength = mut->get_length();
-        break;
-      }
-    case TRANS:
-      {
-        mut->get_infos_translocation(&pos1, &pos2, &pos3, &pos0, &invert);
-        pos2 = ae_utils::mod(pos2 - 1, genlen);
-        mutlength = mut->get_length();
-        break;
-      }
-    case INV:
-      {
-        mut->get_infos_inversion(&pos1, &pos2);
-        pos2 = ae_utils::mod(pos2 - 1, genlen);
-        mutlength = mut->get_length();
-        break;
-      }
-    case INSERT:
-      {
-        mut->get_infos_insertion(&pos0, &mutlength);
-        seq = new char[mutlength+1];
-        mut->get_sequence_insertion(seq);
-        // Make a temporary genetic unit and translate it to count how many genes are on the inserted segment
-        ae_genetic_unit * tmpunit = new ae_genetic_unit( _indiv, seq, mutlength);
-        tmpunit->do_transcription();
-        tmpunit->do_translation();
-        nb_genes_in_segment = tmpunit->get_nb_coding_RNAs();
-        delete tmpunit;
-        seq = NULL;
-        break;
-      }
-    case INS_HT:
-      {
-        mut->get_infos_ins_HT(&pos1donor, &pos2donor, &pos0, &pos3donor, &sense, &mutlength );
-        seq = new char[mutlength+1];
-        mut->get_sequence_ins_HT(seq);
-
-        // Make a temporary genetic unit and translate it to count how many genes were on the exogenote
-        ae_genetic_unit * tmpunit = new ae_genetic_unit( _indiv, seq, mutlength);
-        tmpunit->do_transcription();
-        tmpunit->do_translation();
-        nb_genes_in_segment = tmpunit->get_nb_coding_RNAs();
-
-        // Check whether the pos3donor breakpoint killed one or several of those genes, in that case decrement nb_genes_in_segment
-        ae_list_node<ae_rna*>* a_node = tmpunit->_rna_list[LEADING]->get_first();
-        ae_rna * rna = NULL;
-        while (a_node != NULL)
-          {
-            rna = (ae_rna *) a_node->get_obj();
-            a_node = a_node->get_next();
-            if (rna->is_coding() == false) continue;
-
-            first = rna->get_promoter_pos();
-            last = rna->get_last_transcribed_pos();
-
-            if (breakpoint_inside_gene(pos3donor, first, last)) nb_genes_in_segment --;
-          }
-        a_node = tmpunit->_rna_list[LAGGING]->get_first();
-        rna = NULL;
-        while (a_node != NULL)
-          {
-            rna = (ae_rna *) a_node->get_obj();
-            a_node = a_node->get_next();
-            if (rna->is_coding() == false) continue;
-
-            last = rna->get_promoter_pos();
-            first = rna->get_last_transcribed_pos();
-
-            if (breakpoint_inside_gene(pos3donor, first, last)) nb_genes_in_segment --;
-          }
-        delete tmpunit;
-        seq = NULL;
-        break;
-      }
-    case REPL_HT:
-      {
-        mut->get_infos_repl_HT(&pos1, &pos1donor, &pos2, &pos2donor, &sense, &mutlength );
-        pos2 = ae_utils::mod(pos2 - 1, genlen);
-        seq = new char[mutlength+1];  // seq in the sequence in the donor
-        mut->get_sequence_repl_HT(seq);
-
-        // Make a temporary genetic unit and translate it to count how many genes were on the donor segment
-        ae_genetic_unit * tmpunit = new ae_genetic_unit( _indiv, seq, mutlength);
-        tmpunit->do_transcription();
-        tmpunit->do_translation();
-        nb_genes_in_segment = tmpunit->get_nb_coding_RNAs();
-
-        // Remove the genes that overlap ori in this temporary unit, as the transferred segment was actually linear
-        ae_list_node<ae_rna*>* a_node = tmpunit->_rna_list[LEADING]->get_first();
-        ae_rna * rna = NULL;
-        while (a_node != NULL)
-          {
-            rna = (ae_rna *) a_node->get_obj();
-            a_node = a_node->get_next();
-            if (rna->is_coding() == false) continue;
-
-            first = rna->get_promoter_pos();
-            last = rna->get_last_transcribed_pos();
-            if (first > last) nb_genes_in_segment --;
-          }
-        a_node = tmpunit->_rna_list[LAGGING]->get_first();
-        rna = NULL;
-        while (a_node != NULL)
-          {
-            rna = (ae_rna *) a_node->get_obj();
-            a_node = a_node->get_next();
-            if (rna->is_coding() == false) continue;
-
-            first = rna->get_last_transcribed_pos();
-            last = rna->get_promoter_pos();
-            if (first > last) nb_genes_in_segment --;
-          }
-
-        delete tmpunit;
-        seq = NULL;
-        break;
-      }
-    default:
-      {
-        fprintf(stderr, "Error: unknown mutation type in ae_genetic_unit::compute_nb_of_affected_genes.\n");
-      }
-    }
-
-  ae_list_node<ae_rna*>* a_node = _rna_list[LEADING]->get_first();
-  ae_rna * rna = NULL;
-  while (a_node != NULL)
-    {
-      rna = (ae_rna *) a_node->get_obj();
-      a_node = a_node->get_next();
-      if (rna->is_coding() == false) continue;
-
-      first = rna->get_promoter_pos();
-      last = rna->get_last_transcribed_pos();
-
-      switch(type)
-        {
-        case SWITCH:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case S_INS:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case S_DEL:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case DUPL:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case DEL:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;     // else because the gene must not be counted twice if both p1 and p2 are in the same gene
-            break;
-          }
-        case TRANS:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;   // beginning of the excised segment
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;   // end of the excised segment
-            else if (breakpoint_inside_gene(pos3, first, last)) nb_genes_at_breakpoints ++;   // breakpoint inside the segment for the reinsertion
-            else if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;   // reinsertion point in the genetic unit
-            break;
-          }
-        case INV:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case INSERT:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case INS_HT:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case REPL_HT:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_replaced_segment ++; // the whole gene sequence was replaced by the donor DNA
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;  // the gene was disrupted by the breakpoint p1
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;  // the gene was disrupted by the breakpoint p2
-            break;
-          }
-        }
-
-    }
-
-
-  a_node = _rna_list[LAGGING]->get_first();
-  while (a_node != NULL)
-    {
-      rna = (ae_rna *) a_node->get_obj();
-      a_node = a_node->get_next();
-      if (rna->is_coding() == false) continue;
-
-      first = rna->get_last_transcribed_pos();
-      last = rna->get_promoter_pos();
-
-     switch(type)
-        {
-        case SWITCH:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case S_INS:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case S_DEL:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case DUPL:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case DEL:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case TRANS:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;   // beginning of the excised segment
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;   // end of the excised segment
-            else if (breakpoint_inside_gene(pos3, first, last)) nb_genes_at_breakpoints ++;   // breakpoint inside the segment for the reinsertion
-            else if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;   // reinsertion point in the genetic unit
-            break;
-          }
-        case INV:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_segment ++;
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case INSERT:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case INS_HT:
-          {
-            if (breakpoint_inside_gene(pos0, first, last)) nb_genes_at_breakpoints ++;
-            break;
-          }
-        case REPL_HT:
-          {
-            if (gene_totally_in_segment(pos1, pos2, first, last)) nb_genes_in_replaced_segment ++; // the whole gene sequence was replaced by the donor DNA
-            if (breakpoint_inside_gene(pos1, first, last)) nb_genes_at_breakpoints ++;  // the gene was disrupted by the breakpoint p1
-            else if (breakpoint_inside_gene(pos2, first, last)) nb_genes_at_breakpoints ++;  // the gene was disrupted by the breakpoint p2
-            break;
-          }
-        }
-    }
-
-  //  if (type == REPL_HT) printf("%d genes in the replaced segment, %d in the donor\n", nb_genes_in_replaced_segment, nb_genes_in_segment);
-
-  if (seq != NULL) delete [] seq;
-}
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_genetic_unit::init_statistical_data( void ) // TODO : integrate into compute_statistical_data
-{
-  //~ _nb_promoters[LEADING]        = 0;
-  //~ _nb_promoters[LAGGING]        = 0;
-  //~ _nb_genes[LEADING]            = 0;
-  //~ _nb_genes[LAGGING]            = 0;
-  //~ _average_gene_size            = 0;
-  //~ _average_functional_gene_size = 0;
-  //~ _nb_coding_bp                 = 0;
-  //~ _clustering                   = 0;
-
-  _nb_coding_RNAs               = 0;
-  _nb_non_coding_RNAs           = 0;
-  _overall_size_coding_RNAs     = 0;
-  _overall_size_non_coding_RNAs = 0;
-  _nb_genes_activ               = 0;
-  _nb_genes_inhib               = 0;
-  _nb_fun_genes                 = 0;
-  _nb_non_fun_genes             = 0;
-  _overall_size_fun_genes       = 0;
-  _overall_size_non_fun_genes   = 0;
-
-  _nb_bases_in_0_CDS                = -1;
-  _nb_bases_in_0_functional_CDS     = -1;
-  _nb_bases_in_0_non_functional_CDS = -1;
-  _nb_bases_in_0_RNA                = -1;
-  _nb_bases_in_0_coding_RNA         = -1;
-  _nb_bases_in_0_non_coding_RNA     = -1;
-  _nb_bases_non_essential                     = -1;
-  _nb_bases_non_essential_including_nf_genes  = -1;
-
-  _modularity = -1;
-
-  _beginning_neutral_regions = NULL;
-  _end_neutral_regions = NULL;
-}
-
diff --git a/src/libaevol/ae_genetic_unit.h b/src/libaevol/ae_genetic_unit.h
deleted file mode 100644
index 45546f3..0000000
--- a/src/libaevol/ae_genetic_unit.h
+++ /dev/null
@@ -1,857 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// ****************************************************************************
-
-
-#ifndef __AE_GENETIC_UNIT_H__
-#define __AE_GENETIC_UNIT_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_dna.h>
-#include <ae_rna.h>
-#include <ae_protein.h>
-#include <ae_fuzzy_set.h>
-#include <ae_environment.h>
-#include <ae_utils.h>
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
-
-
-
-
-
-class ae_genetic_unit : public ae_object
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_genetic_unit( ae_individual* indiv, int32_t length );
-    ae_genetic_unit( ae_individual* indiv, char* seq, int32_t length, ae_list<ae_rna*>** prom_list = NULL );
-    ae_genetic_unit( ae_individual* indiv, const ae_genetic_unit &model );
-    ae_genetic_unit( ae_individual* indiv, ae_genetic_unit* const parent );
-    ae_genetic_unit( ae_individual* indiv, gzFile backup_file );
-    ae_genetic_unit( ae_individual* indiv, char* organism_file_name );
-
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_genetic_unit( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline ae_exp_manager*  get_exp_m( void ) const;
-    inline ae_individual*   get_indiv( void )                   const;
-    inline ae_dna*          get_dna( void )                     const;
-    inline ae_fuzzy_set*    get_activ_contribution( void )      const;
-    inline ae_fuzzy_set*    get_inhib_contribution( void )      const;
-    inline ae_fuzzy_set*    get_phenotypic_contribution( void ) const;
-
-    inline ae_list<ae_rna*>** get_rna_list( void )                const;
-    inline ae_list<ae_protein*>** get_protein_list( void ) const;
-
-
-    // Direct DNA access
-    inline const char*  get_sequence( void ) const;
-    inline int32_t      get_seq_length( void ) const;
-
-
-    // Statistical data
-    inline int32_t  get_nb_coding_RNAs( void )                    const;
-    inline int32_t  get_nb_non_coding_RNAs( void )                const;
-    inline double   get_overall_size_coding_RNAs( void )          const;
-    inline double   get_av_size_coding_RNAs( void )               const;
-    inline double   get_overall_size_non_coding_RNAs( void )      const;
-    inline double   get_av_size_non_coding_RNAs( void )           const;
-    inline int32_t  get_nb_genes_activ( void )                    const;
-    inline int32_t  get_nb_genes_inhib( void )                    const;
-    inline int32_t  get_nb_functional_genes( void )               const;
-    inline int32_t  get_nb_non_functional_genes( void )           const;
-    inline double   get_overall_size_functional_genes( void )     const;
-    inline double   get_av_size_functional_genes( void )          const;
-    inline double   get_overall_size_non_functional_genes( void ) const;
-    inline double   get_av_size_non_functional_genes( void )      const;
-
-    inline int32_t  get_nb_bases_in_0_CDS( void );
-    inline int32_t  get_nb_bases_in_0_functional_CDS( void );
-    inline int32_t  get_nb_bases_in_0_non_functional_CDS( void );
-    inline int32_t  get_nb_bases_in_0_RNA( void );
-    inline int32_t  get_nb_bases_in_0_coding_RNA( void );
-    inline int32_t  get_nb_bases_in_0_non_coding_RNA( void );
-
-    inline int32_t  get_nb_bases_non_essential( void );
-    inline int32_t  get_nb_bases_non_essential_including_nf_genes( void );
-
-    inline int32_t  get_nb_bases_in_neutral_regions( void );
-    inline int32_t  get_nb_neutral_regions( void );
-    inline int32_t* get_beginning_neutral_regions( void );
-    inline int32_t* get_end_neutral_regions( void );
-
-    inline double   get_modularity( void )                        const;
-
-    inline double   get_dist_to_target_by_feature( ae_env_axis_feature feature )  const;
-    inline double   get_fitness( void )                                           const;
-    inline double   get_fitness_by_feature( ae_env_axis_feature feature )         const;
-
-    inline int32_t  get_min_gu_length( void ) const;
-    inline int32_t  get_max_gu_length( void ) const;
-
-
-    inline void  set_rna_list( ae_list<ae_rna*>** new_list );
-
-    inline void set_min_gu_length( int32_t min_gu_length );
-    inline void set_max_gu_length( int32_t max_gu_length );
-
-    inline void set_exp_m( ae_exp_manager* exp_m );
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void locate_promoters( void );
-    void do_transcription( void );
-    void do_translation( void );
-    void compute_phenotypic_contribution( void );
-
-    // DM: these two are identical to functions from ae_individual
-    void compute_distance_to_target( ae_environment* envir );
-    void compute_fitness( ae_environment* envir );
-
-    void reset_expression( void ); // useful for post-treatment programs
-
-    inline void print_rnas( void ) const;
-    void print_coding_rnas( void );
-    inline static void print_rnas( ae_list<ae_rna*>** rnas );
-    static void print_rnas( ae_list<ae_rna*>* rnas, ae_strand strand );
-    void print_proteins( void ) const;
-
-    bool        is_promoter( ae_strand strand, int32_t pos, int8_t& dist ) const;
-    bool        is_terminator( ae_strand strand, int32_t pos ) const;
-    bool        is_shine_dalgarno( ae_strand strand, int32_t pos ) const;
-    inline bool is_start( ae_strand strand, int32_t pos ) const;
-    inline bool is_stop( ae_strand strand, int32_t pos ) const;
-    int8_t      get_codon( ae_strand strand, int32_t pos ) const;
-
-    void compute_non_coding( void );
-
-
-    void duplicate_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** duplicated_promoters );
-
-    void get_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** promoters );
-    void get_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* leading_promoters );
-    void get_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* lagging_promoters );
-    void get_leading_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* leading_promoters );
-    void get_leading_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* leading_promoters );
-    void get_lagging_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* lagging_promoters );
-    void get_lagging_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* lagging_promoters );
-
-    void invert_promoters_included_in( int32_t pos_1, int32_t pos_2 );
-    static void invert_promoters( ae_list<ae_rna*>** promoter_lists, int32_t seq_length );
-    static void invert_promoters( ae_list<ae_rna*>** promoter_lists, int32_t pos_1, int32_t pos_2 ); // See WARNING
-
-    inline void extract_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** extracted_promoters );
-    inline void extract_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** extracted_promoters );
-    void extract_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* extracted_promoters );
-    void extract_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* extracted_promoters );
-    void extract_leading_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* extracted_promoters );
-    void extract_leading_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* extracted_promoters );
-    void extract_lagging_promoters_starting_before( int32_t pos, ae_list<ae_rna*>* extracted_promoters );
-    void extract_lagging_promoters_starting_after( int32_t pos, ae_list<ae_rna*>* extracted_promoters );
-
-    static void shift_promoters( ae_list<ae_rna*>** promoters_to_shift, int32_t delta_pos, int32_t seq_length );
-    void insert_promoters( ae_list<ae_rna*>** promoters_to_insert );
-    void insert_promoters_at( ae_list<ae_rna*>** promoters_to_insert, int32_t pos );
-
-    inline void remove_promoters_around( int32_t pos );
-    inline void remove_promoters_around( int32_t pos_1, int32_t pos_2 );
-    inline void remove_all_promoters( void );
-
-    inline void look_for_new_promoters_around( int32_t pos );
-    inline void look_for_new_promoters_around( int32_t pos_1, int32_t pos_2 );
-
-    inline void move_all_promoters_after( int32_t pos, int32_t delta_pos );
-    void move_all_leading_promoters_after( int32_t pos, int32_t delta_pos );
-    void move_all_lagging_promoters_after( int32_t pos, int32_t delta_pos );
-
-    // Not implemented!!!
-    //~ inline void duplicate_promoters_starting_between( int32_t pos_1, int32_t pos_2, int32_t delta_pos );
-    //~ void duplicate_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, int32_t delta_pos );
-    //~ void duplicate_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, int32_t delta_pos );
-
-    inline void copy_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** new_promoter_lists );
-    inline void copy_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** new_promoter_lists );
-    void copy_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* new_promoter_list );
-    void copy_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>* new_promoter_list );
-    //~ inline void copy_all_promoters( ae_list** new_promoter_lists );
-
-    void save( gzFile backup_file );
-
-    int32_t get_nb_terminators( void );
-
-    //~ // set the genetic unit of all promoters to the appropriate
-    //~ void reasign_promoter_genetic_unit (void);
-
-    #ifdef DEBUG
-      void assert_promoters( void );
-      void assert_promoters_order( void );
-    #endif
-
-    bool* is_belonging_to_coding_RNA(void);
-    void remove_non_coding_bases( void);
-    void double_non_coding_bases(void);
-
-    // WARNING: The method below works properly only in the case of a single genetic unit (no plasmid).
-    // Translocations between different genetic units is not managed.
-    void compute_nb_of_affected_genes(ae_mutation * mut, int & nb_genes_at_breakpoints, int & nb_genes_in_segment, int & nb_genes_in_replaced_segment);
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_genetic_unit( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_genetic_unit( const ae_genetic_unit &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void init_statistical_data( void );
-
-    void remove_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2 );
-    void remove_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2 );
-    void remove_leading_promoters_starting_before( int32_t pos );
-    void remove_lagging_promoters_starting_before( int32_t pos );
-    void remove_leading_promoters_starting_after( int32_t pos );
-    void remove_lagging_promoters_starting_after( int32_t pos );
-
-    void look_for_new_leading_promoters_starting_between( int32_t pos_1, int32_t pos_2 );
-    void look_for_new_lagging_promoters_starting_between( int32_t pos_1, int32_t pos_2 );
-    void look_for_new_leading_promoters_starting_after( int32_t pos );
-    void look_for_new_lagging_promoters_starting_after( int32_t pos );
-    void look_for_new_leading_promoters_starting_before( int32_t pos );
-    void look_for_new_lagging_promoters_starting_before( int32_t pos );
-
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-
-    ae_individual*  _indiv;
-    ae_dna*         _dna;
-    ae_fuzzy_set*   _activ_contribution;
-    ae_fuzzy_set*   _inhib_contribution;
-    ae_fuzzy_set*   _phenotypic_contribution;
-    // NB : _phenotypic_contribution is only an indicative value, not used for the whole phenotype computation
-
-    ae_list<ae_rna*>**     _rna_list;
-    ae_list<ae_protein*>** _protein_list;
-
-    // DM: For plasmid work, we sometimes *need* all the data (e.g. fitness, secretion) calculated for each GU
-    double* _dist_to_target_per_segment;
-    double* _dist_to_target_by_feature;
-    double* _fitness_by_feature;
-    double  _fitness;
-
-    // Statistical data (intrinsic for this genetic unit)
-    int32_t _nb_coding_RNAs;                // Number of coding RNAs (at least one gene on RNA)
-    int32_t _nb_non_coding_RNAs;            // Number of non-coding-RNAs
-    double  _overall_size_coding_RNAs;      // Average size of coding RNAs
-    double  _overall_size_non_coding_RNAs;  // Average size of non-coding RNAs
-    int32_t _nb_genes_activ;                // Number of genes realizing a function
-    int32_t _nb_genes_inhib;                // Number of genes inhibitting a function
-    int32_t _nb_fun_genes;                  // Number of functional genes
-    int32_t _nb_non_fun_genes;              // Number of non-functional genes
-    double  _overall_size_fun_genes;        // Average size of functional genes
-    double  _overall_size_non_fun_genes;    // Average size of non-functional genes
-
-
-    int32_t _nb_bases_in_0_CDS;                // Number of bases that are not included in any gene
-    int32_t _nb_bases_in_0_functional_CDS;     // Number of bases that are not included in any non-degenerated gene
-    int32_t _nb_bases_in_0_non_functional_CDS; // Number of bases that are not included in any degenerated gene
-
-    int32_t _nb_bases_in_0_RNA;                // Number of bases that are not included in any RNA
-    int32_t _nb_bases_in_0_coding_RNA;         // Number of bases that are not included in any coding RNA
-                                               // (RNAs containing at least one CDS)
-    int32_t _nb_bases_in_0_non_coding_RNA;     // Number of bases that are not included in any non coding RNA
-
-    int32_t _nb_bases_non_essential;                    // Number of bases that are not included in any non-degenerated gene or involved in its expression
-    int32_t _nb_bases_non_essential_including_nf_genes; // Number of bases that are not included in any gene or involved in its expression
-    int32_t _nb_bases_in_neutral_regions;   // Number of bases that are not included in a neutral region
-                                            // A base is considered neutral when neither itself NOR its corresponding base on the other
-                                            // strand belongs to a coding promoter->terminator region (both included)
-    int32_t _nb_neutral_regions;            // Number of neutral regions
-    int32_t* _beginning_neutral_regions;    // Beginning of neutral regions
-    int32_t* _end_neutral_regions;          // Corresponding ends of neutral regions
-
-    double  _modularity;  // Ratio between the pairwise distance between genes whose corresponding
-                          // phenotypic triangles overlap and the average intergenic distance
-                          // (ignoring non-functional genes)
-
-    int32_t _min_gu_length;
-    int32_t _max_gu_length;
-
-    // TODO : check and comment what it is for
-    //~ int32_t _nb_promoters[2];
-    //~ int32_t _nb_genes[2];
-    //~ int32_t _nb_functional_genes[2];
-    //~ double  _average_gene_size;
-    //~ double  _average_functional_gene_size;
-    //~ int32_t _nb_coding_bp;
-    //~ double  _clustering;
-
-    // We keep trace of what we have already computed to avoid double computation (mainly in post-treaments)
-    bool _transcribed;
-    bool _translated;
-    bool _phenotypic_contributions_computed;
-    bool _non_coding_computed;
-    bool _distance_to_target_computed;
-    bool _fitness_computed;
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline ae_exp_manager* ae_genetic_unit::get_exp_m( void ) const
-{
-  return _exp_m;
-}
-
-inline ae_individual* ae_genetic_unit::get_indiv( void ) const
-{
-  return _indiv;
-}
-
-inline ae_dna* ae_genetic_unit::get_dna( void ) const
-{
-  return _dna;
-}
-
-inline ae_list<ae_rna*>** ae_genetic_unit::get_rna_list( void ) const
-{
-  return _rna_list;
-}
-
-inline ae_list<ae_protein*>** ae_genetic_unit::get_protein_list( void ) const
-{
-  assert( _protein_list );
-  assert( _protein_list[LEADING] );
-  assert( _protein_list[LAGGING] );
-
-  return _protein_list;
-}
-
-inline ae_fuzzy_set* ae_genetic_unit::get_activ_contribution( void ) const
-{
-  return _activ_contribution;
-}
-
-inline ae_fuzzy_set* ae_genetic_unit::get_inhib_contribution( void ) const
-{
-  return _inhib_contribution;
-}
-
-inline ae_fuzzy_set* ae_genetic_unit::get_phenotypic_contribution( void ) const
-{
-  assert(_phenotypic_contribution != NULL);
-  return _phenotypic_contribution;
-}
-
-/*!
-  Returns the DNA sequence
-*/
-inline const char* ae_genetic_unit::get_sequence( void ) const
-{
-  return _dna->get_data();
-}
-
-/*!
-  Returns the DNA sequence length
-*/
-inline int32_t ae_genetic_unit::get_seq_length( void ) const
-{
-  return _dna->get_length();
-}
-
-inline int32_t ae_genetic_unit::get_nb_coding_RNAs( void ) const
-{
-  return _nb_coding_RNAs;
-}
-
-inline int32_t ae_genetic_unit::get_nb_non_coding_RNAs( void ) const
-{
-  return _nb_non_coding_RNAs;
-}
-
-inline double ae_genetic_unit::get_overall_size_coding_RNAs( void ) const
-{
-  return _overall_size_coding_RNAs;
-}
-
-inline double ae_genetic_unit::get_av_size_coding_RNAs( void ) const
-{
-  if ( _nb_coding_RNAs != 0 )
-  {
-    return _overall_size_coding_RNAs / _nb_coding_RNAs;
-  }
-  else return 0.0;
-}
-
-inline double ae_genetic_unit::get_overall_size_non_coding_RNAs( void ) const
-{
-  return _overall_size_non_coding_RNAs;
-}
-
-inline double ae_genetic_unit::get_av_size_non_coding_RNAs( void ) const
-{
-  if ( _nb_non_coding_RNAs != 0 )
-  {
-    return _overall_size_non_coding_RNAs / _nb_non_coding_RNAs;
-  }
-  else return 0.0;
-}
-
-inline int32_t ae_genetic_unit::get_nb_genes_activ( void ) const
-{
-  return _nb_genes_activ;
-}
-
-inline int32_t ae_genetic_unit::get_nb_genes_inhib( void ) const
-{
-  return _nb_genes_inhib;
-}
-
-inline int32_t ae_genetic_unit::get_nb_functional_genes( void ) const
-{
-  return _nb_fun_genes;
-}
-
-inline int32_t ae_genetic_unit::get_nb_non_functional_genes( void ) const
-{
-  return _nb_non_fun_genes;
-}
-
-inline double ae_genetic_unit::get_overall_size_functional_genes( void ) const
-{
-  return _overall_size_fun_genes;
-}
-
-inline double ae_genetic_unit::get_av_size_functional_genes( void ) const
-{
-  if ( _nb_fun_genes != 0 )
-  {
-    return _overall_size_fun_genes / _nb_fun_genes;
-  }
-  else return 0.0;
-}
-
-inline double ae_genetic_unit::get_overall_size_non_functional_genes( void ) const
-{
-  return _overall_size_non_fun_genes;
-}
-
-inline double ae_genetic_unit::get_av_size_non_functional_genes( void ) const
-{
-  if ( _nb_non_fun_genes != 0 )
-  {
-    return _overall_size_non_fun_genes / _nb_non_fun_genes;
-  }
-  else return 0.0;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_CDS( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_CDS;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_functional_CDS( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_functional_CDS;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_non_functional_CDS( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_non_functional_CDS;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_RNA( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_RNA;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_coding_RNA( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_coding_RNA;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_0_non_coding_RNA( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_non_coding_RNA;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_non_essential( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_non_essential;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_non_essential_including_nf_genes( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_non_essential_including_nf_genes;
-}
-
-inline int32_t ae_genetic_unit::get_nb_bases_in_neutral_regions( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_neutral_regions;
-}
-
-inline int32_t ae_genetic_unit::get_nb_neutral_regions( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_neutral_regions;
-}
-
-inline int32_t* ae_genetic_unit::get_beginning_neutral_regions( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _beginning_neutral_regions;
-}
-
-inline int32_t* ae_genetic_unit::get_end_neutral_regions( void )
-{
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _end_neutral_regions;
-}
-
-inline double ae_genetic_unit::get_modularity( void ) const
-{
-  return _modularity;
-}
-
-inline double ae_genetic_unit::get_dist_to_target_by_feature( ae_env_axis_feature feature ) const
-{
-   assert( _distance_to_target_computed );
-
-  return _dist_to_target_by_feature[feature];
-}
-
-inline double ae_genetic_unit::get_fitness( void ) const
-{
-  assert( _fitness_computed );
-
-  return _fitness;
-}
-
-inline double ae_genetic_unit::get_fitness_by_feature( ae_env_axis_feature feature ) const
-{
-  assert( _fitness_computed );
-
-  return _fitness_by_feature[feature];
-}
-
-inline int32_t ae_genetic_unit::get_min_gu_length( void ) const
-{
-  return _min_gu_length;
-}
-
-inline int32_t ae_genetic_unit::get_max_gu_length( void ) const
-{
-  return _max_gu_length;
-}
-
-inline void ae_genetic_unit::set_rna_list( ae_list<ae_rna*>** new_list )
-{
-  _rna_list = new_list;
-} // TODO : erase that! // NOTE : Why?
-
-inline void ae_genetic_unit::set_min_gu_length( int32_t min_gu_length )
-{
-  _min_gu_length = min_gu_length;
-}
-
-inline void ae_genetic_unit::set_max_gu_length( int32_t max_gu_length )
-{
-  _max_gu_length = max_gu_length;
-}
-
-inline void ae_genetic_unit::set_exp_m( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_genetic_unit::print_rnas( void ) const
-{
-  print_rnas( _rna_list );
-}
-
-inline /* static */ void ae_genetic_unit::print_rnas( ae_list<ae_rna*>** rnas )
-{
-  print_rnas( rnas[LEADING], LEADING );
-  print_rnas( rnas[LAGGING], LAGGING );
-}
-
-inline bool ae_genetic_unit::is_start( ae_strand strand, int32_t index ) const
-{
-  return ( get_codon( strand, index ) == CODON_START );
-}
-
-inline bool ae_genetic_unit::is_stop( ae_strand strand, int32_t index ) const
-{
-  return ( get_codon( strand, index ) == CODON_STOP );
-}
-
-inline void ae_genetic_unit::remove_all_promoters( void )
-{
-  _rna_list[LEADING]->erase( true );
-  _rna_list[LAGGING]->erase( true );
-}
-
-inline void ae_genetic_unit::move_all_promoters_after( int32_t pos, int32_t delta_pos )
-{
-  move_all_leading_promoters_after( pos, delta_pos );
-  move_all_lagging_promoters_after( pos, delta_pos );
-}
-
-inline void ae_genetic_unit::extract_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** extracted_promoters )
-{
-  assert( pos_1 >= 0 && pos_1 < pos_2 && pos_2 <= _dna->get_length() );
-  if ( pos_2 - pos_1 >= PROM_SIZE )
-  {
-    extract_leading_promoters_starting_between( pos_1, pos_2 - PROM_SIZE + 1, extracted_promoters[LEADING] );
-    extract_lagging_promoters_starting_between( pos_1 + PROM_SIZE - 1, pos_2, extracted_promoters[LAGGING] );
-  }
-}
-
-inline void ae_genetic_unit::extract_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** extracted_promoters )
-{
-  extract_leading_promoters_starting_between( pos_1, pos_2, extracted_promoters[LEADING] );
-  extract_lagging_promoters_starting_between( pos_1, pos_2, extracted_promoters[LAGGING] );
-}
-
-
-/*!
-  \brief  Remove those promoters that would be broken if the chromosome was cut at pos.
-
-  Remove promoters that include BOTH the base before AND after pos (marked X in the cartoon below).
-  If the genome is smaller than the size of a promoter, all the promoters will be removed.
-
-  \verbatim
-     -------------------------------------------------------
-    |   |   |   |   | X | X |   |   |   |   |   |   |   |   |
-     -------------------------------------------------------
-    ^                   ^
-    0                  pos
-  \endverbatim
-*/
-inline void ae_genetic_unit::remove_promoters_around( int32_t pos )
-{
-  if ( _dna->get_length() >= PROM_SIZE )
-  {
-    remove_leading_promoters_starting_between( ae_utils::mod(pos - PROM_SIZE + 1, _dna->get_length()), pos );
-    remove_lagging_promoters_starting_between( pos, ae_utils::mod(pos + PROM_SIZE - 1, _dna->get_length()) );
-  }
-  else
-  {
-    remove_all_promoters();
-  }
-}
-
-
-/*!
-  \brief  Remove those promoters that would be broken if the sequence [pos_1 ; pos_2[ was deleted.
-
-  Remove promoters that     * include BOTH the base before AND after pos_1 (marked X in the cartoon below).
-                            * include BOTH the base before AND after pos_2 (marked Y in the cartoon below).
-                            * are completely contained between pos_1 and pos_2.
-  If the remaining sequence, i.e. [pos_2 ; pos_1[ is smaller than the size of a promoter, all the promoters will be removed.
-
-  \verbatim
-     -------------------------------------------------------
-    |   |   |   |   | X | X |   |   |   | Y | Y |   |   |   |
-     -------------------------------------------------------
-    ^                   ^                   ^
-    0                 pos_1               pos_2
-  \endverbatim
-*/
-inline void ae_genetic_unit::remove_promoters_around( int32_t pos_1, int32_t pos_2 )
-{
-  if ( ae_utils::mod(pos_1 - pos_2, _dna->get_length()) >= PROM_SIZE )
-  {
-    remove_leading_promoters_starting_between( ae_utils::mod(pos_1 - PROM_SIZE + 1, _dna->get_length()), pos_2 );
-    remove_lagging_promoters_starting_between( pos_1, ae_utils::mod(pos_2 + PROM_SIZE - 1, _dna->get_length()) );
-  }
-  else
-  {
-    remove_all_promoters();
-  }
-}
-
-
-/*!
-  \brief  Look for promoters that are astride pos and add them to the list of promoters (_rna_list).
-
-  Look for promoters that include BOTH the base before AND after pos (marked X in the cartoon below).
-  If the genome is smaller than the size of a promoter, no search is performed.
-
-  \verbatim
-     -------------------------------------------------------
-    |   |   |   |   | X | X |   |   |   |   |   |   |   |   |
-     -------------------------------------------------------
-    ^                   ^
-    0                  pos
-  \endverbatim
-*/
-inline void ae_genetic_unit::look_for_new_promoters_around( int32_t pos )
-{
-  assert( pos >= 0 && pos <= _dna->get_length() );
-
-  if ( _dna->get_length() >= PROM_SIZE )
-  {
-    look_for_new_leading_promoters_starting_between(  ae_utils::mod(pos - PROM_SIZE + 1, _dna->get_length()),
-                                                      ae_utils::mod(pos                , _dna->get_length()) );
-    look_for_new_lagging_promoters_starting_between(  ae_utils::mod(pos                , _dna->get_length()),
-                                                      ae_utils::mod(pos + PROM_SIZE - 1, _dna->get_length()) );
-  }
-}
-
-
-/*!
-  \brief  Look for promoters that contain at least 1 base lying in [pos_1 ; pos_2[ and add them to the list of promoters (_rna_list).
-
-  Look for promoters that   * include BOTH the base before AND after pos_1 (marked X in the cartoon below).
-                            * include BOTH the base before AND after pos_2 (marked Y in the cartoon below).
-                            * are completely contained between pos_1 and pos_2.
-  If the genome is smaller than the size of a promoter, no search is performed.
-
-  \verbatim
-     -------------------------------------------------------
-    |   |   |   |   | X | X |   |   |   | Y | Y |   |   |   |
-     -------------------------------------------------------
-    ^                   ^                   ^
-    0                 pos_1               pos_2
-  \endverbatim
-*/
-inline void ae_genetic_unit::look_for_new_promoters_around( int32_t pos_1, int32_t pos_2 )
-{
-  //~ if ( ae_utils::mod( pos_1 - pos_2, _dna->get_length()) == PROM_SIZE - 1 )
-  //~ {
-    //~ // We have to look at every possible position on the genome.
-    //~ locate_promoters();
-  //~ }
-  /*else*/ if ( _dna->get_length() >= PROM_SIZE )
-  {
-    look_for_new_leading_promoters_starting_between( ae_utils::mod(pos_1 - PROM_SIZE + 1, _dna->get_length()), pos_2 );
-    look_for_new_lagging_promoters_starting_between( pos_1, ae_utils::mod(pos_2 + PROM_SIZE - 1, _dna->get_length()) );
-  }
-}
-
-//~ inline void ae_genetic_unit::duplicate_promoters_starting_between( int32_t pos_1, int32_t pos_2, int32_t delta_pos )
-//~ {
-  //~ duplicate_leading_promoters_starting_between( pos_1, pos_2, delta_pos );
-  //~ duplicate_lagging_promoters_starting_between( pos_1, pos_2, delta_pos );
-//~ }
-
-inline void ae_genetic_unit::copy_promoters_included_in( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** new_promoter_lists )
-{
-  if ( ae_utils::mod( pos_2 - pos_1 - 1, _dna->get_length() ) + 1 >= PROM_SIZE )
-  {
-    copy_leading_promoters_starting_between( pos_1, ae_utils::mod( pos_2 - PROM_SIZE + 1, _dna->get_length() ), new_promoter_lists[LEADING] );
-    copy_lagging_promoters_starting_between( ae_utils::mod( pos_1 + PROM_SIZE - 1, _dna->get_length() ), pos_2, new_promoter_lists[LAGGING] );
-  }
-}
-
-inline void ae_genetic_unit::copy_promoters_starting_between( int32_t pos_1, int32_t pos_2, ae_list<ae_rna*>** new_promoter_lists )
-{
-  copy_leading_promoters_starting_between( pos_1, pos_2, new_promoter_lists[LEADING] );
-  copy_lagging_promoters_starting_between( pos_1, pos_2, new_promoter_lists[LAGGING] );
-}
-
-//~ inline void ae_genetic_unit::copy_all_promoters( ae_list<ae_rna*>** new_promoter_lists )
-//~ {
-  //~ ae_list_node<ae_rna*>* rna_node = NULL;
-
-  //~ for ( int8_t strand = LEADING ; strand <= LAGGING ; strand++ )
-  //~ {
-    //~ rna_node = _rna_list[strand]->get_first();
-
-    //~ while ( rna_node != NULL )
-    //~ {
-      //~ new_promoter_lists[strand]->add( new ae_rna( this, *(rna_node->get_obj()) ) );
-
-      //~ rna_node = rna_node->get_next();
-    //~ }
-  //~ }
-//~ }
-
-#endif // __ae_genetic_unit_H__
diff --git a/src/libaevol/ae_grid_cell.h b/src/libaevol/ae_grid_cell.h
deleted file mode 100644
index 84b85c9..0000000
--- a/src/libaevol/ae_grid_cell.h
+++ /dev/null
@@ -1,202 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef __AE_GRID_CELL_H__
-#define __AE_GRID_CELL_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_individual.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_grid_cell : public ae_object
-{
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_grid_cell( int16_t x, int16_t y, ae_individual* indiv );
-    ae_grid_cell( gzFile backup_file );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_grid_cell( void );
-
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-    inline int16_t get_x( void ) const;
-    inline int16_t get_y( void ) const;
-    inline double get_compound_amount( void ) const;
-    inline ae_individual* get_individual( void ) const;
-  
-    inline double get_secreted_amount( void ) const;
-    inline double get_metabolic_fitness( void ) const;
-    inline double get_total_fitness( void ) const;
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-    inline void set_compound_amount( double compound_amount );
-    inline void set_individual( ae_individual * indiv );
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void save( gzFile backup_file ) const;
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_grid_cell( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    //~ ae_grid_cell( const ae_grid_cell &model )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    // Position on the grid
-    int16_t _x;
-    int16_t _y;
-
-    // Amount of secreted compound currently present in the grid cell 
-    double _compound_amount; 
-    
-    // pointer to the individual in this cell 
-    ae_individual * _individual; 
-
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-inline int16_t ae_grid_cell::get_x( void ) const
-{
-  return _x;
-}
-
-inline int16_t ae_grid_cell::get_y( void ) const
-{
-  return _y;
-}
-
-inline double ae_grid_cell::get_compound_amount( void ) const
-{
-  return _compound_amount;
-}
-
-inline ae_individual* ae_grid_cell::get_individual( void ) const
-{
-  return _individual;
-}
-
-inline double ae_grid_cell::get_secreted_amount( void ) const
-{
-  return _individual->get_fitness_by_feature( SECRETION );
-}
-
-inline double ae_grid_cell::get_metabolic_fitness( void ) const
-{
-  return _individual->get_fitness_by_feature( METABOLISM );
-}
-
-inline double ae_grid_cell::get_total_fitness( void ) const
-{
-  return _individual->get_fitness();
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-inline void ae_grid_cell::set_compound_amount(double compound_amount)
-{
-  _compound_amount = compound_amount;
-}
-
-inline void ae_grid_cell::set_individual( ae_individual * indiv )
-{
-  _individual = indiv;
-  if ( _individual->get_grid_cell() != this )
-  {
-    _individual->set_grid_cell( this );
-  }
-}
-
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_GRID_CELL_H__
diff --git a/src/libaevol/ae_individual.cpp b/src/libaevol/ae_individual.cpp
deleted file mode 100644
index c6ca190..0000000
--- a/src/libaevol/ae_individual.cpp
+++ /dev/null
@@ -1,1567 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <math.h>
-#include <sys/stat.h>
-#include <algorithm>
-#include <assert.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_codon.h>
-#include <ae_exp_setup.h>
-#include <ae_exp_manager.h>
-#include <ae_grid_cell.h>
-#include <ae_genetic_unit.h>
-#include <ae_population.h>
-#include <ae_vis_a_vis.h>
-#include <ae_utils.h>
-
-#ifdef __NO_X
-  #ifdef __REGUL
-    #include <ae_individual_R.h>
-  #else
-    #include <ae_individual.h>
-  #endif
-#elif defined __X11
-  #ifdef __REGUL
-    #include <ae_individual_R_X11.h>
-  #else
-    #include <ae_individual_X11.h>
-  #endif
-#endif
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_individual                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-/*!
-
-*/
-ae_individual::ae_individual( ae_exp_manager* exp_m,
-                              ae_jumping_mt* mut_prng,
-                              ae_jumping_mt* stoch_prng,
-                              ae_params_mut* param_mut,
-                              double w_max,
-                              int32_t min_genome_length,
-                              int32_t max_genome_length,
-                              bool allow_plasmids,
-                              int32_t id,
-                              char* strain_name,
-                              int32_t age )
-{
-  // Experiment manager
-  _exp_m = exp_m;
-
-  // PRNGs
-  _mut_prng   = mut_prng;
-  _stoch_prng = stoch_prng;
-
-  // Replication Report
-  _replic_report = NULL;
-
-  // ID and rank of the indiv ; name and "age" of the strain
-  set_id( id );
-  _rank = -1; // TODO: UNRANKED
-  _age = age;
-  _strain_name = new char[strlen(strain_name)+1];
-  strcpy(_strain_name, strain_name);
-
-  _phenotype_activ  = NULL;
-  _phenotype_inhib  = NULL;
-  _phenotype        = NULL;
-
-  _dist_to_target_by_segment  = NULL;
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  for (int i=0; i<NB_FEATURES; i++)
-  {
-    _dist_to_target_by_feature[i]=0;
-  }
-  _fitness_by_feature         = new double [NB_FEATURES];
-  for (int i=0; i<NB_FEATURES; i++)
-  {
-    _fitness_by_feature[i]=0;
-  }
-
-  _fitness = 0.0;
-  // When using structured population, this is the cell the individual is in
-  _grid_cell = NULL;
-
-  // The chromosome and plasmids (if allowed)
-  _genetic_unit_list = new ae_list<ae_genetic_unit*>();
-
-  _protein_list = new ae_list<ae_protein*>();
-  _rna_list     = new ae_list<ae_rna*>();
-
-  // Generic probes
-  _int_probes     = new int32_t[5];
-  _double_probes  = new double[5];
-  for ( int8_t i = 0 ; i < 5 ; i++ )
-  {
-    _int_probes[i]    = 0;
-    _double_probes[i] = 0.0;
-  }
-
-  // Mutation rates etc...
-  _mut_params = new ae_params_mut( *param_mut );
-
-  // Artificial chemistry
-  _w_max = w_max;
-
-  // Genome size constraints
-  _min_genome_length = min_genome_length;
-  _max_genome_length = max_genome_length;
-
-  // Plasmids settings
-  _allow_plasmids         = allow_plasmids;
-
-
-  // --------------------------------------------------
-  // "State" of the individual
-  // --------------------------------------------------
-  _evaluated                    = false;
-  _transcribed                  = false;
-  _translated                   = false;
-  _folded                       = false;
-  _phenotype_computed           = false;
-  _distance_to_target_computed  = false;
-  _fitness_computed             = false;
-  _statistical_data_computed    = false;
-  _non_coding_computed          = false;
-  _modularity_computed          = false;
-  _placed_in_population         = false;
-
-
-
-  // ----------------------------------------
-  // Statistical data
-  // ----------------------------------------
-  // Genome, RNAs and genes size and stuff
-  _total_genome_size  = 0;
-
-  _nb_coding_RNAs     = 0;
-  _nb_non_coding_RNAs = 0;
-
-  _overall_size_coding_RNAs     = 0.0;
-  _overall_size_non_coding_RNAs = 0.0;
-
-  _nb_genes_activ           = 0;
-  _nb_genes_inhib           = 0;
-  _nb_functional_genes      = 0;
-  _nb_non_functional_genes  = 0;
-
-  _overall_size_functional_genes      = 0.0;
-  _overall_size_non_functional_genes  = 0.0;
-
-  // Coding / non-coding
-  _nb_bases_in_0_CDS                = 0;
-  _nb_bases_in_0_functional_CDS     = 0;
-  _nb_bases_in_0_non_functional_CDS = 0;
-  _nb_bases_in_0_RNA                = 0;
-  _nb_bases_in_0_coding_RNA         = 0;
-  _nb_bases_in_0_non_coding_RNA     = 0;
-  _nb_bases_in_neutral_regions      = 0;
-  _nb_neutral_regions               = 0;
-
-  _modularity = 0.0;
-}
-
-/*!
-  This constructor retreives an individual from a backup file.
-
-  Since this generation has already been processed, no unnecessary calculation (e.g. fitness) will be done.
-  No transcription, translation or other process of that kind is performed.
-*/
-ae_individual::ae_individual( ae_exp_manager* exp_m, gzFile backup_file )
-{
-  _exp_m = exp_m;
-
-  // Retrieve the name and "age" of the strain
-  int8_t strain_string_len;
-  gzread(backup_file, &strain_string_len, sizeof(strain_string_len));
-  _strain_name = new char[strain_string_len+1];
-  gzread(backup_file, _strain_name, strain_string_len+1);
-  gzread( backup_file, &_age, sizeof(_age) );
-
-  // Retrieve the PRNGs
-  #ifdef DISTRIBUTED_PRNG
-    _mut_prng   = new ae_jumping_mt( backup_file );
-    _stoch_prng = new ae_jumping_mt( backup_file );
-  #else
-    if (exp_m == NULL)
-    {
-      // Detached mode
-      _mut_prng   = NULL;
-      _stoch_prng = NULL;
-    }
-    else
-    {
-      _mut_prng   = exp_m->get_pop()->get_mut_prng();
-      _stoch_prng = exp_m->get_pop()->get_stoch_prng();
-    }
-  #endif
-
-  // Retreive id and rank
-  gzread( backup_file, &_id,    sizeof(_id) );
-  gzread( backup_file, &_rank,  sizeof(_rank) );
-
-  // Retrieve spatial coordinates
-  int16_t x;
-  int16_t y;
-  gzread( backup_file, &x, sizeof(x) );
-  gzread( backup_file, &y, sizeof(y) );
-  if ( _exp_m != NULL && _exp_m->is_spatially_structured() )
-  {
-    set_grid_cell( _exp_m->get_grid_cell( x, y ) );
-  }
-
-  // Retreive generic probes
-  _int_probes     = new int32_t[5];
-  _double_probes  = new double[5];
-  gzread( backup_file, _int_probes,     5 * sizeof(*_int_probes) );
-  gzread( backup_file, _double_probes,  5 * sizeof(*_double_probes) );
-
-  // Retrieve mutational parameters
-  _mut_params = new ae_params_mut( backup_file );
-
-  // ------------------------------------------------- Phenotypic stochasticity
-  gzread( backup_file, &_with_stochasticity, sizeof(_with_stochasticity) );
-
-  // Retrieve artificial chemistry parameters
-  gzread( backup_file, &_w_max, sizeof(_w_max) );
-
-  // Retrieve genome size constraints
-  gzread( backup_file, &_min_genome_length, sizeof(_min_genome_length) );
-  gzread( backup_file, &_max_genome_length, sizeof(_max_genome_length) );
-
-  // Retrieve plasmids settings
-  int8_t tmp_allow_plasmids;
-  gzread( backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids) );
-  _allow_plasmids = tmp_allow_plasmids ? 1 : 0;
-
-  // Retreive genetic units
-  _genetic_unit_list = new ae_list<ae_genetic_unit*>();
-  int16_t nb_gen_units;
-  gzread( backup_file, &nb_gen_units,  sizeof(nb_gen_units) );
-
-  for ( int16_t i = 0 ; i < nb_gen_units ; i++ )
-  {
-    _genetic_unit_list->add( new ae_genetic_unit( this, backup_file ) );
-  }
-
-  // --------------------------------------------------------------------------------------------
-  // No more data to retreive, the following are only structural initializations (no data is set)
-  // --------------------------------------------------------------------------------------------
-
-  // Create empty fuzzy sets for activation and inhibition
-  _phenotype_activ  = NULL;
-  _phenotype_inhib  = NULL;
-  _phenotype        = NULL;
-
-  _dist_to_target_by_segment  = NULL;
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-
-  // Replication report, protein list and rna list initialization
-  _replic_report = NULL;  // We are reloading from a backup, the replication report for the loaded generation
-                          // is already in the tree file corresponding to this generation and needs not be re-written.
-                          // NB : If the replication report is needed in future development, it will have to be
-                          // loaded from the tree file.
-
-  _protein_list = new ae_list<ae_protein*>();
-  _rna_list     = new ae_list<ae_rna*>();
-
-
-  // Initialize the computational state of the individual
-  _evaluated                    = false;
-  _transcribed                  = false;
-  _translated                   = false;
-  _folded                       = false;
-  _phenotype_computed           = false;
-  _distance_to_target_computed  = false;
-  _fitness_computed             = false;
-  _statistical_data_computed    = false;
-  _non_coding_computed          = false;
-  _modularity_computed          = false;
-
-  _placed_in_population = false;
-
-
-  // Initialize statistical data
-  _total_genome_size                  = 0;
-  _nb_coding_RNAs                     = 0;
-  _nb_non_coding_RNAs                 = 0;
-  _overall_size_coding_RNAs           = 0;
-  _overall_size_non_coding_RNAs       = 0;
-  _nb_genes_activ                     = 0;
-  _nb_genes_inhib                     = 0;
-  _nb_functional_genes                = 0;
-  _nb_non_functional_genes            = 0;
-  _overall_size_functional_genes      = 0;
-  _overall_size_non_functional_genes  = 0;
-
-  _nb_bases_in_0_CDS                  = -1;
-  _nb_bases_in_0_functional_CDS       = -1;
-  _nb_bases_in_0_non_functional_CDS   = -1;
-  _nb_bases_in_0_RNA                  = -1;
-  _nb_bases_in_0_coding_RNA           = -1;
-  _nb_bases_in_0_non_coding_RNA       = -1;
-  _nb_bases_in_neutral_regions        = -1;
-  _nb_neutral_regions                 = -1;
-
-  _modularity = -1;
-
-  //evaluate();
-}
-
-// Copy constructor
-ae_individual::ae_individual( const ae_individual &model, bool replication_report_copy /* = FALSE */ )
-{
-  _exp_m = model._exp_m;
-
-  // PRNGs
-  #ifdef DISTRIBUTED_PRNG
-    _mut_prng   = new ae_jumping_mt( *(model._mut_prng) );
-    _stoch_prng = new ae_jumping_mt( *(model._stoch_prng) );
-  #else
-    _mut_prng   = model._mut_prng;
-    _stoch_prng = model._stoch_prng;
-  #endif
-
-  int strain_string_len = strlen(model._strain_name);
-  _strain_name = new char[strain_string_len+1];
-  memcpy(_strain_name, model._strain_name, strain_string_len+1);
-  _age  = model._age;
-
-  _id   = model._id;
-  _rank = model._rank;
-
-  _evaluated                    = false;//model._evaluated;
-  _transcribed                  = false;//model._transcribed;
-  _translated                   = false;//model._translated;
-  _folded                       = false;//model._folded;
-  _phenotype_computed           = model._phenotype_computed;
-
-  _with_stochasticity = model._with_stochasticity;
-
-  // Artificial chemistry parameters
-  _w_max = model._w_max;
-
-  // The distance to target and what results from it depend on the environment
-  // and must hence be recomputed with the (possibly different) environment.
-  _distance_to_target_computed  = false;
-  _fitness_computed             = false;
-  _statistical_data_computed    = model._statistical_data_computed;
-
-  _non_coding_computed          = model._non_coding_computed;
-  _modularity_computed          = model._modularity_computed;
-
-  _placed_in_population         = model._placed_in_population;
-  _grid_cell = model._grid_cell;
-
-  // Create an empty list of genetic units
-  _genetic_unit_list = new ae_list<ae_genetic_unit*>();
-
-
-  // Copy model's genetic units
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = model._genetic_unit_list->get_first();
-  while ( gen_unit_node != NULL )
-  {
-    _genetic_unit_list->add( new ae_genetic_unit( this, *(gen_unit_node->get_obj()) ) );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-
-  // Copy phenotype
-  if ( _phenotype_computed )
-  {
-    _phenotype_activ  = new ae_fuzzy_set( *(model._phenotype_activ) );
-    _phenotype_inhib  = new ae_fuzzy_set( *(model._phenotype_inhib) );
-    _phenotype        = new ae_phenotype( this, *(model._phenotype) );
-  }
-  else
-  {
-    _phenotype_activ  = NULL;
-    _phenotype_inhib  = NULL;
-    _phenotype        = NULL;
-  }
-
-
-  // Copy fitness-related stuff
-  _dist_to_target_by_segment  = NULL;
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = model._dist_to_target_by_feature[i];
-    _fitness_by_feature[i] = model._fitness_by_feature[i];
-  }
-
-  _fitness = model._fitness;
-
-
-  // Copy statistical data
-  _total_genome_size                  = model._total_genome_size;
-  _nb_coding_RNAs                     = model._nb_coding_RNAs;
-  _nb_non_coding_RNAs                 = model._nb_non_coding_RNAs;
-  _overall_size_coding_RNAs           = model._overall_size_coding_RNAs;
-  _overall_size_non_coding_RNAs       = model._overall_size_non_coding_RNAs;
-  _nb_genes_activ                     = model._nb_genes_activ;
-  _nb_genes_inhib                     = model._nb_genes_inhib;
-  _nb_functional_genes                = model._nb_functional_genes;
-  _nb_non_functional_genes            = model._nb_non_functional_genes;
-  _overall_size_functional_genes      = model._overall_size_functional_genes;
-  _overall_size_non_functional_genes  = model._overall_size_non_functional_genes;
-
-  _nb_bases_in_0_CDS                  = model._nb_bases_in_0_CDS;
-  _nb_bases_in_0_functional_CDS       = model._nb_bases_in_0_functional_CDS;
-  _nb_bases_in_0_non_functional_CDS   = model._nb_bases_in_0_non_functional_CDS;
-  _nb_bases_in_0_RNA                  = model._nb_bases_in_0_RNA;
-  _nb_bases_in_0_coding_RNA           = model._nb_bases_in_0_coding_RNA;
-  _nb_bases_in_0_non_coding_RNA       = model._nb_bases_in_0_non_coding_RNA;
-  _nb_bases_in_neutral_regions        = model._nb_bases_in_neutral_regions;
-  _nb_neutral_regions                 = model._nb_neutral_regions;
-
-  _modularity = model._modularity;
-
-
-  // Create a new replication report to store mutational events
-  if ( replication_report_copy && _exp_m->get_output_m()->get_record_tree() && (_exp_m->get_output_m()->get_tree_mode() == NORMAL) && (model._replic_report != NULL))
-  {
-    _replic_report = new ae_replication_report( *model._replic_report );
-    _replic_report->set_indiv(this);
-    // TODO: remove this after checking it is the old way
-    //_exp_m->get_output_m()->get_tree()->set_replic_report( _id, _replic_report );
-  }
-  else
-  {
-    _replic_report = NULL;
-  }
-
-  _protein_list = new ae_list<ae_protein*>();
-  _rna_list     = new ae_list<ae_rna*>();
-
-  // Generic probes
-  _int_probes     = new int32_t[5];
-  _double_probes  = new double[5];
-  for ( int8_t i = 0 ; i < 5 ; i++ )
-  {
-    _int_probes[i]    = model._int_probes[i];
-    _double_probes[i] = model._double_probes[i];
-  }
-
-  // Mutation rates etc...
-  _mut_params = new ae_params_mut( *(model._mut_params) );
-
-
-  // Genome size constraints
-  _min_genome_length = model._min_genome_length;
-  _max_genome_length = model._max_genome_length;
-
-  // Plasmids settings
-  _allow_plasmids         = model._allow_plasmids;
-
-  evaluate();
-}
-
-/*!
-  This constructor creates a new individual with the same genome as it's parent.
-  The location of promoters will be copied but no further process will be performed.
-
-  The phenotype and the fitness are not set, neither is the statistical data.
-*/
-ae_individual::ae_individual( ae_individual* const parent, int32_t id, ae_jumping_mt* mut_prng, ae_jumping_mt* stoch_prng )
-{
-  _exp_m = parent->_exp_m;
-
-  // PRNGs
-  _mut_prng   = mut_prng;
-  _stoch_prng = stoch_prng;
-
-  int strain_string_len = strlen(parent->_strain_name);
-  _strain_name = new char[strain_string_len+1];
-  memcpy(_strain_name, parent->_strain_name, strain_string_len+1);
-  _age  = parent->_age + 1;
-
-  _id   = id;
-  _rank = -1;
-
-  _evaluated                    = false;
-  _transcribed                  = false;
-  _translated                   = false;
-  _folded                       = false;
-  _phenotype_computed           = false;
-  _distance_to_target_computed  = false;
-  _fitness_computed             = false;
-  _statistical_data_computed    = false;
-  _non_coding_computed          = false;
-  _modularity_computed          = false;
-
-  _placed_in_population = false;
-  _grid_cell = NULL;
-
-  _with_stochasticity = parent->_with_stochasticity;
-
-  // Artificial chemistry parameters
-  _w_max = parent->_w_max;
-
-  // Create new genetic units with their DNA copied from here
-  // NOTE : The RNA lists (one per genetic unit) will also be copied so that we don't
-  // need to look for promoters on the whole genome
-  _genetic_unit_list = new ae_list<ae_genetic_unit*>();
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = parent->_genetic_unit_list->get_first();
-  while ( gen_unit_node != NULL )
-  {
-    _genetic_unit_list->add( new ae_genetic_unit( this, gen_unit_node->get_obj() ) );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  _phenotype_activ  = NULL;
-  _phenotype_inhib  = NULL;
-  _phenotype        = NULL;
-
-  // Initialize all the fitness-related stuff
-  _dist_to_target_by_segment  = NULL;
-  _dist_to_target_by_feature  = new double [NB_FEATURES];
-  _fitness_by_feature         = new double [NB_FEATURES];
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  // Create a new replication report to store mutational events
-  if ( _exp_m->get_output_m()->get_record_tree() && _exp_m->get_output_m()->get_tree_mode() == NORMAL )
-  {
-    _replic_report = new ae_replication_report( this, parent );
-
-    // TODO: remove this after checking it is the old way
-    //_exp_m->get_output_m()->get_tree()->set_replic_report( _id, _replic_report );
-  }
-  else
-  {
-    _replic_report = NULL;
-  }
-
-  // Create protein and RNA access lists
-  _protein_list = new ae_list<ae_protein*>();
-  _rna_list     = new ae_list<ae_rna*>();
-
-  // Generic probes
-  _int_probes     = new int32_t[5];
-  _double_probes  = new double[5];
-  for ( int8_t i = 0 ; i < 5 ; i++ )
-  {
-    _int_probes[i]    = parent->_int_probes[i];
-    _double_probes[i] = parent->_double_probes[i];
-  }
-
-  // Mutation rates etc...
-  _mut_params = new ae_params_mut( *(parent->_mut_params) );
-
-  // Genome size constraints
-  _min_genome_length = parent->_min_genome_length;
-  _max_genome_length = parent->_max_genome_length;
-
-  // Plasmids settings
-  _allow_plasmids         = parent->_allow_plasmids;
-
-  // Initialize statistical data
-  _total_genome_size                  = 0;
-  _nb_coding_RNAs                     = 0;
-  _nb_non_coding_RNAs                 = 0;
-  _overall_size_coding_RNAs           = 0;
-  _overall_size_non_coding_RNAs       = 0;
-  _nb_genes_activ                     = 0;
-  _nb_genes_inhib                     = 0;
-  _nb_functional_genes                = 0;
-  _nb_non_functional_genes            = 0;
-  _overall_size_functional_genes      = 0;
-  _overall_size_non_functional_genes  = 0;
-
-  _nb_bases_in_0_CDS                  = -1;
-  _nb_bases_in_0_functional_CDS       = -1;
-  _nb_bases_in_0_non_functional_CDS   = -1;
-  _nb_bases_in_0_RNA                  = -1;
-  _nb_bases_in_0_coding_RNA           = -1;
-  _nb_bases_in_0_non_coding_RNA       = -1;
-  _nb_bases_in_neutral_regions        = -1;
-  _nb_neutral_regions                 = -1;
-
-  _modularity = -1;
-
-  //evaluate();
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_individual::~ae_individual( void )
-{
-  #ifdef DISTRIBUTED_PRNG
-    delete _mut_prng;
-    delete _stoch_prng;
-  #endif
-
-  delete [] _strain_name;
-
-  // The _replic_report pointer is destroyed, but not the report itself,
-  // it will be deleted later, when the tree is written on disk and emptied.
-
-  assert( _protein_list != NULL );
-  _protein_list->erase( false );
-  delete _protein_list;
-
-  assert( _rna_list != NULL );
-  _rna_list->erase( false );
-  delete _rna_list;
-
-  assert( _genetic_unit_list != NULL );
-  _genetic_unit_list->erase( true );
-  // When the unit is destoyed, its dna is destroyed too, thus the pointer
-  // to the ae_dna_replication_report is destroyed. But the
-  // dna_replic_report object itself is not deleted, its address is
-  // still contained in the global replic_report object in the tree.
-  delete _genetic_unit_list;
-
-  delete _phenotype_activ;
-  delete _phenotype_inhib;
-  delete _phenotype;
-
-  if ( _dist_to_target_by_segment != NULL ) delete [] _dist_to_target_by_segment;
-  delete [] _dist_to_target_by_feature;
-
-  delete [] _fitness_by_feature;
-
-  // Generic probes
-  delete [] _int_probes;
-  delete [] _double_probes;
-
-  delete _mut_params;
-
-  /*if(_replic_report!= NULL)
-  {
-    delete _replic_report;
-  }*/
-}
-
-// =================================================================
-//                        Non-inline Accessors
-// =================================================================
-void ae_individual::set_exp_m( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-
-  // Update pointer to exp_manager in each GU
-  ae_list_node<ae_genetic_unit*>* GU_node = _genetic_unit_list->get_first();
-  while ( GU_node != NULL )
-  {
-    GU_node->get_obj()->set_exp_m(_exp_m);
-    GU_node = GU_node->get_next();
-  }
-}
-
-/*!
-  TODO
-*/
-void ae_individual::set_grid_cell( ae_grid_cell* grid_cell )
-{
-  _placed_in_population = true;
-  _grid_cell = grid_cell;
-  if ( _grid_cell->get_individual() != this )
-  {
-    _grid_cell->set_individual( this );
-  }
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_individual::compute_phenotype( void )
-{
-  if ( _phenotype_computed ) return; // Phenotype has already been computed, nothing to do.
-  _phenotype_computed = true;
-
-  // Make sure the transcription, translation and folding stages have taken place
-  do_transcription_translation_folding();
-
-
-  // We will use two fuzzy sets :
-  //   * _phenotype_activ for the proteins realising a set of functions
-  //   * _phenotype_inhib for the proteins inhibiting a set of functions
-  // The phenotype will then be given by the sum of these 2 fuzzy sets
-  _phenotype_activ = new ae_fuzzy_set();
-  _phenotype_inhib = new ae_fuzzy_set();
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit;
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    _phenotype_activ->add( gen_unit->get_activ_contribution() );
-    _phenotype_inhib->add( gen_unit->get_inhib_contribution() );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  _phenotype_activ->add_upper_bound(   Y_MAX );
-  _phenotype_inhib->add_lower_bound( - Y_MAX );
-
-  _phenotype = new ae_phenotype();
-  _phenotype->add( _phenotype_activ );
-  _phenotype->add( _phenotype_inhib );
-  _phenotype->add_lower_bound( Y_MIN );
-  _phenotype->simplify();
-}
-
-void ae_individual::compute_distance_to_target( ae_environment* envir )
-// Compute the areas between the phenotype and the environment for each environmental segment
-// If the environment is not segmented, the total area is computed
-{
-  if ( _distance_to_target_computed ) return; // _distance_to_target has already been computed, nothing to do.
-  _distance_to_target_computed = true;
-
-  if ( ! _phenotype_computed ) compute_phenotype();
-
-  // Compute the difference between the (whole) phenotype and the environment
-  ae_fuzzy_set* delta = new ae_fuzzy_set( *_phenotype );
-  delta->sub( envir );
-
-  ae_env_segment** segments = envir->get_segments();
-  _dist_to_target_by_segment = new double [envir->get_nb_segments()];
-  for ( int8_t i = 0 ; i < envir->get_nb_segments() ; i++ )
-  {
-    _dist_to_target_by_segment[i] = 0;
-  }
-
-  // TODO : We should take into account that we compute the areas in order (from the leftmost segment, rightwards)
-  //   => We shouldn't parse the whole list of points on the left of the segment we are considering (we have
-  //      already been through them!)
-
-  for ( int16_t i = 0 ; i < envir->get_nb_segments() ; i++ )
-  {
-    _dist_to_target_by_segment[i] = delta->get_geometric_area( segments[i]->start, segments[i]->stop );
-    _dist_to_target_by_feature[segments[i]->feature] += _dist_to_target_by_segment[i];
-  }
-
-  delete delta;
-}
-
-/*!
-  Computation of a "proper" fitness value (one that increases when the individual is fitter)
-
-  Computation of a "proper" fitness value (one that increases when the individual is fitter)
-  The behaviour of this function depends on many parameters and most notably on whether it is
-  a "composite" fitness or not, and on the selection scheme.
-*/
-void ae_individual::compute_fitness( ae_environment* envir )
-{
-  if ( _fitness_computed ) return; // Fitness has already been computed, nothing to do.
-  _fitness_computed = true;
-
-  #ifdef NORMALIZED_FITNESS
-    for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-    {
-      if (envir->get_area_by_feature(i)==0.)
-      {
-        _fitness_by_feature[i] = 0.;
-      }
-      else
-      {
-        _fitness_by_feature[i] =  ( envir->get_area_by_feature(i) - _dist_to_target_by_feature[i] ) / envir->get_area_by_feature(i);
-        if ( (_fitness_by_feature[i] < 0.) && (i != METABOLISM) ) // non-metabolic fitness can NOT be lower than zero (we do not want individual to secrete a negative quantity of public good)
-        {
-          _fitness_by_feature[i] = 0.;
-        }
-      }
-    }
-
-    if ( ( ! _placed_in_population ) || (! _exp_m->get_with_secretion() ))
-    {
-      _fitness = _fitness_by_feature[METABOLISM];
-    }
-    else
-    {
-      _fitness =  _fitness_by_feature[METABOLISM] * ( 1 + _exp_m->get_secretion_contrib_to_fitness() * ( _grid_cell->get_compound_amount() - _exp_m->get_secretion_cost() * _fitness_by_feature[SECRETION] ) );
-    }
-
-    if ( _exp_m->get_selection_scheme() == FITNESS_PROPORTIONATE ) // Then the exponential selection is integrated inside the fitness value
-    {
-      _fitness = exp( -_exp_m->get_selection_pressure() * (1 - _fitness) );
-    }
-  #else
-    for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-    {
-      if ( i == SECRETION )
-      {
-        _fitness_by_feature[SECRETION] =  exp( - _exp_m->get_selection_pressure() * _dist_to_target_by_feature[SECRETION] )
-                                        - exp( - _exp_m->get_selection_pressure() * envir->get_area_by_feature(SECRETION) );
-
-        if ( _fitness_by_feature[i] < 0 )
-        {
-          _fitness_by_feature[i] = 0;
-        }
-      }
-      else
-      {
-        _fitness_by_feature[i] = exp( - _exp_m->get_selection_pressure() * _dist_to_target_by_feature[i] );
-      }
-    }
-
-    // Calculate combined, total fitness here!
-    // Multiply the contribution of metabolism and the amount of compound in the environment
-    if ( ( ! _placed_in_population ) || (! _exp_m->get_with_secretion() ))
-    {
-      _fitness =  _fitness_by_feature[METABOLISM] ;
-    }
-    else
-    {
-      _fitness =  _fitness_by_feature[METABOLISM]
-                  *  ( 1 + _exp_m->get_secretion_contrib_to_fitness() * _grid_cell->get_compound_amount()
-                         - _exp_m->get_secretion_cost() * _fitness_by_feature[SECRETION] );
-    }
-  #endif
-}
-
-void ae_individual::reevaluate( ae_environment* envir /*= NULL*/ )
-{
-  // useful for post-treatment programs that replay mutations
-  // on a single individual playing the role of the successive
-  // ancestors
-
-  _evaluated                    = false;
-  _transcribed                  = false;
-  _translated                   = false;
-  _folded                       = false;
-  _phenotype_computed           = false;
-  _distance_to_target_computed  = false;
-  _fitness_computed             = false;
-  _statistical_data_computed    = false;
-  _non_coding_computed          = false;
-  _modularity_computed          = false;
-
-  if ( envir == NULL ) envir = _exp_m->get_env();
-
-
-  ae_list_node<ae_genetic_unit*>* unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit * unit = NULL;
-  while (unit_node != NULL)
-  {
-    unit = unit_node->get_obj();
-    unit->reset_expression();
-    unit_node = unit_node->get_next();
-  }
-
-  if ( _phenotype_activ != NULL )
-  {
-    delete _phenotype_activ;
-    _phenotype_activ = NULL;
-  }
-
-  if (_phenotype_inhib != NULL)
-  {
-    delete _phenotype_inhib;
-    _phenotype_inhib = NULL;
-  }
-
-  if (_phenotype != NULL)
-  {
-    delete _phenotype;
-    _phenotype = NULL;
-  }
-
-  // Initialize all the fitness-related stuff
-  delete [] _dist_to_target_by_segment;
-
-  for ( int8_t i = 0 ; i < NB_FEATURES ; i++ )
-  {
-    _dist_to_target_by_feature[i] = 0.0;
-    _fitness_by_feature[i]        = 0.0;
-  }
-
-  //For each RNA / individual / genetic_unit delete proteins it knows
-  //Deleting the protein it self is made only once
-
-  _rna_list->erase( false );
-  _protein_list->erase( false );
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_list_node<ae_rna*>* rna_node = NULL;
-  ae_rna*           rna = NULL;
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-    {
-      gen_unit = gen_unit_node->get_obj();
-
-      rna_node = (gen_unit->get_rna_list()[LEADING])->get_first();
-      while(rna_node !=NULL)
-      {
-        rna = rna_node->get_obj();
-        rna->get_transcribed_proteins()->erase( false );
-        rna_node = rna_node->get_next();
-      }
-      rna_node = (gen_unit->get_rna_list()[LAGGING])->get_first();
-      while(rna_node !=NULL)
-      {
-        rna = rna_node->get_obj();
-        rna->get_transcribed_proteins()->erase( false );
-        rna_node = rna_node->get_next();
-      }
-
-      (gen_unit->get_protein_list()[LEADING])->erase( true );
-      (gen_unit->get_protein_list()[LAGGING])->erase( true );
-
-      gen_unit_node = gen_unit_node->get_next();
-    }
-
-  // Initialize statistical data
-  _total_genome_size                  = 0;
-  _nb_coding_RNAs                     = 0;
-  _nb_non_coding_RNAs                 = 0;
-  _overall_size_coding_RNAs           = 0;
-  _overall_size_non_coding_RNAs       = 0;
-  _nb_genes_activ                     = 0;
-  _nb_genes_inhib                     = 0;
-  _nb_functional_genes                = 0;
-  _nb_non_functional_genes            = 0;
-  _overall_size_functional_genes      = 0;
-  _overall_size_non_functional_genes  = 0;
-
-  _nb_bases_in_0_CDS                  = -1;
-  _nb_bases_in_0_functional_CDS       = -1;
-  _nb_bases_in_0_non_functional_CDS   = -1;
-  _nb_bases_in_0_RNA                  = -1;
-  _nb_bases_in_0_coding_RNA           = -1;
-  _nb_bases_in_0_non_coding_RNA       = -1;
-  _nb_bases_in_neutral_regions        = -1;
-  _nb_neutral_regions                 = -1;
-
-  _modularity = -1;
-
-  evaluate( envir );
-}
-
-void ae_individual::do_transcription( void )
-{
-  if ( _transcribed == true ) return; // Transcription has already been performed, nothing to do.
-  _transcribed = true;
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    gen_unit->do_transcription();
-    _rna_list->add_list( gen_unit->get_rna_list()[LEADING] );
-    _rna_list->add_list( gen_unit->get_rna_list()[LAGGING] );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-void ae_individual::do_translation( void )
-{
-  if ( _translated == true ) return; // ARNs have already been translated, nothing to do.
-  _translated = true;
-  if ( _transcribed == false ) do_transcription();
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    gen_unit->do_translation();
-    _protein_list->add_list( gen_unit->get_protein_list()[LEADING] );
-    _protein_list->add_list( gen_unit->get_protein_list()[LAGGING] );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-void ae_individual::do_folding( void )
-{
-  if ( _folded == true ) return; // Proteins have already been folded, nothing to do.
-  _folded = true;
-  if ( _translated == false ) do_translation();
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    gen_unit->compute_phenotypic_contribution();
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-void ae_individual::evaluate( ae_environment* envir /*= NULL*/ )
-{
-  if ( _evaluated == true ) return; // Individual has already been evaluated, nothing to do.
-  _evaluated = true;
-
-  if ( envir == NULL ) envir = _exp_m->get_env();
-
-  // ----------------------------------------------------------------------
-  // 1) Transcription - Translation - Folding
-  // ----------------------------------------------------------------------
-  do_transcription_translation_folding();
-  //~ print_rna_list();
-  //~ print_protein_list();
-
-  // ----------------------------------------------------------------------
-  // 2) Compute phenotype and compare it to the environment => fitness
-  // ----------------------------------------------------------------------
-  compute_phenotype();
-  compute_distance_to_target( envir );
-  compute_fitness( envir );
-
-  if ( _exp_m->get_output_m()->get_compute_phen_contrib_by_GU() )
-  {
-    ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-    ae_genetic_unit*  gen_unit = NULL;
-
-    while ( gen_unit_node != NULL )
-    {
-      gen_unit = gen_unit_node->get_obj();
-      gen_unit->compute_distance_to_target( envir );
-      gen_unit->compute_fitness( envir );
-      gen_unit_node = gen_unit_node->get_next();
-    }
-  }
-}
-
-
-void ae_individual::inject_GU( ae_individual* donor )
-{
-  // Add the GU at the end of the list
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = donor->get_genetic_unit_list()->get_last();
-  ae_genetic_unit* temp_GU = new ae_genetic_unit( this, *(gen_unit_node->get_obj()) );
-  _genetic_unit_list->add( temp_GU );
-}
-
-void ae_individual::inject_2GUs( ae_individual* partner )
-{
-  //We swap GUs from the end of the list
-  ae_list_node<ae_genetic_unit*>* gen_unit_node_1 = partner->get_genetic_unit_list()->get_last();
-  ae_list_node<ae_genetic_unit*>* gen_unit_node_2 = _genetic_unit_list->get_last();
-
-  ae_genetic_unit* temp_GU_1 = new ae_genetic_unit( this, *(gen_unit_node_1->get_obj()) );
-  ae_genetic_unit* temp_GU_2 = new ae_genetic_unit( this, *(gen_unit_node_2->get_obj()) );
-
-  _genetic_unit_list->add( temp_GU_1 );
-  partner->get_genetic_unit_list()->add( temp_GU_2 );
-}
-
-void ae_individual::compute_statistical_data( void )
-{
-  if ( _statistical_data_computed ) return; // Statistical data has already been computed, nothing to do.
-  _statistical_data_computed = true;
-
-  if ( not _phenotype_computed )
-  {
-    compute_phenotype();
-  }
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit      = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    _total_genome_size                 += gen_unit->get_dna()->get_length();
-    _nb_coding_RNAs                    += gen_unit->get_nb_coding_RNAs();
-    _nb_non_coding_RNAs                += gen_unit->get_nb_non_coding_RNAs();
-    _overall_size_coding_RNAs          += gen_unit->get_overall_size_coding_RNAs();
-    _overall_size_non_coding_RNAs      += gen_unit->get_overall_size_non_coding_RNAs();
-    _nb_genes_activ                    += gen_unit->get_nb_genes_activ();
-    _nb_genes_inhib                    += gen_unit->get_nb_genes_inhib();
-    _nb_functional_genes               += gen_unit->get_nb_functional_genes();
-    _nb_non_functional_genes           += gen_unit->get_nb_non_functional_genes();
-    _overall_size_functional_genes     += gen_unit->get_overall_size_functional_genes();
-    _overall_size_non_functional_genes += gen_unit->get_overall_size_non_functional_genes();
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  if ( _replic_report != NULL )
-  {
-    // Finalize statistical data in the replication report
-    _replic_report->signal_end_of_replication();
-  }
-}
-
-void ae_individual::compute_non_coding( void )
-{
-  if ( _non_coding_computed ) return; // _non_coding has already been computed, nothing to do.
-  _non_coding_computed = true;
-
-  _nb_bases_in_0_CDS                  = 0;
-  _nb_bases_in_0_functional_CDS       = 0;
-  _nb_bases_in_0_non_functional_CDS   = 0;
-  _nb_bases_in_0_RNA                  = 0;
-  _nb_bases_in_0_coding_RNA           = 0;
-  _nb_bases_in_0_non_coding_RNA       = 0;
-  _nb_bases_in_neutral_regions        = 0;
-  _nb_neutral_regions                 = 0;
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    _nb_bases_in_0_CDS                  += gen_unit->get_nb_bases_in_0_CDS();
-    _nb_bases_in_0_functional_CDS       += gen_unit->get_nb_bases_in_0_functional_CDS();
-    _nb_bases_in_0_non_functional_CDS   += gen_unit->get_nb_bases_in_0_non_functional_CDS();
-    _nb_bases_in_0_RNA                  += gen_unit->get_nb_bases_in_0_RNA();
-    _nb_bases_in_0_coding_RNA           += gen_unit->get_nb_bases_in_0_coding_RNA();
-    _nb_bases_in_0_non_coding_RNA       += gen_unit->get_nb_bases_in_0_non_coding_RNA();
-    _nb_bases_in_neutral_regions        += gen_unit->get_nb_bases_in_neutral_regions();
-    _nb_neutral_regions                 += gen_unit->get_nb_neutral_regions();
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-void ae_individual::save( gzFile backup_file ) const
-{
-  // Write the name and "age" of the strain
-  int8_t strain_string_len = strlen(_strain_name);
-  gzwrite(backup_file, &strain_string_len, sizeof(strain_string_len));
-  gzwrite(backup_file, _strain_name, strain_string_len+1);
-  gzwrite(backup_file, &_age, sizeof(_age));
-
-  #ifdef DISTRIBUTED_PRNG
-    // Write the PRNG's state
-    _mut_prng->save( backup_file );
-    _stoch_prng->save( backup_file );
-  #endif
-
-  // Write id and rank
-  gzwrite( backup_file, &_id,   sizeof(_id) );
-  gzwrite( backup_file, &_rank, sizeof(_rank) );
-
-  // Write the position of the individual (or -1, -1 if there is no spatial structure)
-  int16_t x = -1;
-  int16_t y = -1;
-  if ( _exp_m->is_spatially_structured() )
-  {
-    x = _grid_cell->get_x();
-    y = _grid_cell->get_y();
-  }
-  gzwrite( backup_file, &x, sizeof(x) );
-  gzwrite( backup_file, &y, sizeof(y) );
-
-  // Write generic probes
-  gzwrite( backup_file, _int_probes,    5 * sizeof(*_int_probes) );
-  gzwrite( backup_file, _double_probes, 5 * sizeof(*_double_probes) );
-
-  // Write mutational parameters
-  _mut_params->save( backup_file );
-
-  // ------------------------------------------------- Phenotypic stochasticity
-  gzwrite( backup_file, &_with_stochasticity, sizeof(_with_stochasticity) );
-
-  // Write artificial chemistry parameters
-  gzwrite( backup_file, &_w_max, sizeof(_w_max) );
-
-  // Write genome size constraints
-  gzwrite( backup_file, &_min_genome_length, sizeof(_min_genome_length) );
-  gzwrite( backup_file, &_max_genome_length, sizeof(_max_genome_length) );
-
-  // Write plasmids settings
-  int8_t tmp_allow_plasmids = _allow_plasmids;
-  gzwrite( backup_file, &tmp_allow_plasmids, sizeof(tmp_allow_plasmids) );
-
-  // Write genetic units
-  int16_t nb_gen_units = _genetic_unit_list->get_nb_elts();
-  gzwrite( backup_file, &nb_gen_units,  sizeof(nb_gen_units) );
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit;
-  for ( int16_t i = 0 ; i < nb_gen_units ; i++ )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    gen_unit->save( backup_file );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-int32_t ae_individual::get_nb_terminators( void )
-{
-  int32_t nb_term = 0;
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit      = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    nb_term += gen_unit->get_nb_terminators();
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  return nb_term;
-}
-
-
-/*!
-  \brief Compute reproduction statistics and statistics about the offsprings of the current individual
-
-  * Make nb_children replications of the current individual.
-  * For each replication, determine if the offsprings is neutral, beneficial or deleterious by comparison of fitness with the current individual (the parent)
-  * If statistics about offsprings are required (offsprings_statistics != NULL), fitness mean, fitness variance, size mean, size variance, functional gene number mean, functional gene number variance fo the nb_children offsprings are computed
-  * If information about each children are required ( replication_file != NULL), fitness, genome_size, nb of functional genes, number of coding bases, number of transcribed but not translated bases, number of non transcribed bases of each offsprings are written in replication_file
-
-  \param nb_children              number of replications made to have the statistics
-  \param reproduction_statistics  statistics about the replications (proportion of neutral offsprings, proportion of beneficial offsprings, proportion of deleterious offsprings)
-  \param offsprings_statistics    statistics about the nb_children offsprings (fitness mean, fitness variance, size mean, size variance, functional gene number mean,
-                                    functional gene number variance) compute if not null
-  \param replication_file         file with information about each children of the current individual (fitness, genome_size, nb of functional genes, number of coding bases,
-                                    number of transcribed but not translated bases, number of non transcribed bases) if not null
-*/
-void ae_individual::compute_experimental_f_nu( int32_t nb_children, double* reproduction_statistics, double* offsprings_statistics, FILE* replication_file)
-{
-  double initial_fitness = get_fitness();
-
-  if(reproduction_statistics != NULL)
-  {
-    reproduction_statistics[0] = 0; // proportion of neutral offsprings
-    reproduction_statistics[1] = 0; // proportion of beneficial offsprings
-    reproduction_statistics[2] = 0; // proportion of deleterious offsprings
-  }
-  else
-  {
-    printf( "%s:%d: error: reproduction_statistics was not initialized\n", __FILE__, __LINE__);
-    exit( EXIT_FAILURE );
-  }
-  if(offsprings_statistics != NULL)
-  {
-    offsprings_statistics[0] = 0; // offspring fitness mean
-    offsprings_statistics[1] = 0; // offspring fitness variance
-    offsprings_statistics[2] = 0; // offspring size mean
-    offsprings_statistics[3] = 0; // offspring size variance
-    offsprings_statistics[4] = 0; // offspring functional gene number mean
-    offsprings_statistics[5] = 0; // offspring functional gene number variance
-  }
-
-  // ------------------------------------------
-  //      Simulate fitness degradation
-  // ------------------------------------------
-
-  double fitness_child = 0.0;
-  double metabolic_error_child = 0.0;
-
-  // replicate this individual to create 'nb_children' children
-  ae_individual * child = NULL;
-
-  int32_t genome_size = 0;
-  int32_t nb_functional_genes = 0;
-  int32_t nb_bases_in_0_functional_CDS = 0;
-  int32_t nb_bases_in_0_coding_RNA = 0;
-
-  for (int i = 0; i < nb_children; i++)
-  {
-    child = _exp_m->get_exp_s()->get_sel()->do_replication( this, _id );
-    fitness_child = child->get_fitness();
-    metabolic_error_child = child->get_dist_to_target_by_feature( METABOLISM );
-
-    if ( fabs(initial_fitness - fitness_child) < 1e-10*std::max(initial_fitness, fitness_child) )
-    {
-      reproduction_statistics[0] += 1;
-    }
-    else if ( fitness_child > initial_fitness )
-    {
-      reproduction_statistics[1] += 1;
-    }
-    else
-    {
-      reproduction_statistics[2] += 1;
-    }
-
-    genome_size = child->get_total_genome_size();
-    nb_functional_genes = child->get_nb_functional_genes();
-    nb_bases_in_0_functional_CDS = child->get_nb_bases_in_0_functional_CDS();
-    nb_bases_in_0_coding_RNA = child->get_nb_bases_in_0_coding_RNA();
-
-    if(offsprings_statistics != NULL)
-    {
-      offsprings_statistics[0] += fitness_child;
-      offsprings_statistics[1] += pow(fitness_child,2);
-      offsprings_statistics[2] += (double)genome_size;
-      offsprings_statistics[3] += pow((double)genome_size,2);
-      offsprings_statistics[4] += (double)nb_functional_genes;
-      offsprings_statistics[5] += pow((double)nb_functional_genes,2);
-    }
-
-    if(replication_file != NULL)
-    {
-      fprintf(replication_file, "%le %le %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n", fitness_child, metabolic_error_child, genome_size, nb_functional_genes, genome_size-nb_bases_in_0_functional_CDS, nb_bases_in_0_functional_CDS-nb_bases_in_0_coding_RNA, nb_bases_in_0_coding_RNA);
-    }
-
-    delete child;
-  }
-
-  //compute Fv
-  reproduction_statistics[0] /= (double) nb_children;
-  reproduction_statistics[1] /= (double) nb_children;
-  reproduction_statistics[2] /= (double) nb_children;
-
-  if(offsprings_statistics != NULL)
-  {
-    offsprings_statistics[0] /= (double) nb_children;
-    offsprings_statistics[1] /= (double) nb_children;
-    offsprings_statistics[2] /= (double) nb_children;
-    offsprings_statistics[3] /= (double) nb_children;
-    offsprings_statistics[4] /= (double) nb_children;
-    offsprings_statistics[5] /= (double) nb_children;
-
-    offsprings_statistics[1] -= pow(offsprings_statistics[0],2);
-    offsprings_statistics[3] -= pow(offsprings_statistics[2],2);
-    offsprings_statistics[5] -= pow(offsprings_statistics[4],2);
-  }
-}
-
-
-/*!
-  \brief Compute reproduction theoretical proportion of neutral offsprings
-
-  Compute the theoretical proportion of neutral offsprings given the Carole's formula, based on the mutations and rearrangement rates and not on multiple replications
-
-  \return theoretical proportion of neutral offsprings
-*/
-double ae_individual::compute_theoritical_f_nu( void )
-{
-  // We first have to collect information about genome structure.
-  // Abbreviations are chosen according to Carole's formula.
-  // Please notice that compared to the formula we have the beginning
-  // and ends of neutral regions instead of 'functional regions'
-  ae_genetic_unit* chromosome = get_genetic_unit_list()->get_first()->get_obj();
-  int32_t L       = chromosome->get_dna()->get_length();
-  int32_t N_G     = chromosome->get_nb_neutral_regions(); // which is not exactly Carole's original definition
-  int32_t* b_i    = chromosome->get_beginning_neutral_regions();
-  int32_t* e_i    = chromosome->get_end_neutral_regions();
-  int32_t lambda  = chromosome->get_nb_bases_in_neutral_regions();
-  int32_t l       = L - lambda; // nb bases in 'functional regions'
-
-  int32_t* lambda_i = NULL;  // nb bases in ith neutral region
-  if ( N_G > 0 ) // all the chromosome may be functional
-  {
-    lambda_i = new int32_t [ N_G ];
-
-    for ( int32_t i = 0; i < N_G - 1; i++)
-    {
-      lambda_i[i] = e_i[i] - b_i[i] + 1;
-    }
-    if ( b_i[N_G-1] > e_i[N_G-1] ) // last neutral region is overlapping on the beginning of chromosome
-    {
-      lambda_i[N_G-1] = ( e_i[N_G-1] + L ) - b_i[N_G-1] + 1;
-    }
-    else // no overlap
-    {
-      lambda_i[N_G-1] = e_i[N_G-1] - b_i[N_G-1] + 1;
-    }
-  }
-
-  // we now compute the probabilities of neutral reproduction for
-  // each type of mutation and rearrangement and update Fv
-  double Fv = 1;
-
-  // mutation + insertion + deletion
-  double nu_local_mutation = 1 - ((double) l)/L;
-  Fv  = pow( 1 - get_point_mutation_rate()  * ( 1 - nu_local_mutation ), L);
-  Fv *= pow( 1 - get_small_insertion_rate() * ( 1 - nu_local_mutation ), L);
-  Fv *= pow( 1 - get_small_deletion_rate()  * ( 1 - nu_local_mutation ), L);
-
-  // inversion ~ two local mutations
-  double nu_inversion = nu_local_mutation * nu_local_mutation;
-  Fv *= pow( 1 - get_inversion_rate()       * ( 1 - nu_inversion )     , L);
-
-  // translocation ~ inversion + insertion (mathematically)
-  Fv *= pow( 1 - get_translocation_rate()   * ( 1 - nu_inversion * nu_local_mutation ), L);
-
-  // long deletion
-  double nu_deletion = 0; // if N_G == 0, a deletion is always not neutral
-  for ( int32_t i = 0; i < N_G; i++) { nu_deletion += lambda_i[i] * (lambda_i[i] + 1); }
-  nu_deletion /= ((double) 2*L*L);
-  Fv *= pow( 1 - get_deletion_rate()        * ( 1 - nu_deletion )      , L);
-
-  // duplication ~ big deletion + insertion
-  Fv *= pow( 1 - get_duplication_rate()     * ( 1 - nu_deletion * nu_local_mutation ), L);
-
-  if ( lambda_i != NULL ) delete [] lambda_i;
-
-  return Fv;
-}
-
-/*!
-  \brief Remove the bases that are not in coding RNA
-
-  Remove the bases that are not in coding RNA and test at each loss that fitness is not changed
-*/
-void ae_individual::remove_non_coding_bases(void)
-{
-  //reevaluate(_exp_m->get_env());
-  //double initial_fitness = get_fitness();
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-    gen_unit->remove_non_coding_bases();
-
-    //reevaluate(_exp_m->get_env());
-    //assert(get_fitness()==initial_fitness);
-    gen_unit_node = gen_unit_node->get_next();
-  }
-  _non_coding_computed = false;
-  assert(get_nb_bases_in_0_coding_RNA()==0);
-}
-
-/*!
-  \brief Double the bases that are not in coding RNA
-
-  Double the bases that are not in coding RNA by addition of random bases and test at each addition that fitness is not changed
-*/
-void ae_individual::double_non_coding_bases(void)
-{
-  //reevaluate(_exp_m->get_env());
-  //double initial_fitness = get_fitness();
-  _statistical_data_computed = false;
-  _non_coding_computed = false;
-  _total_genome_size                  = 0;
-  int32_t initial_non_coding_base_nb = get_nb_bases_in_0_coding_RNA();
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-    gen_unit->double_non_coding_bases();
-
-    //reevaluate(_exp_m->get_env());
-    //assert(get_fitness()==initial_fitness);
-    gen_unit_node = gen_unit_node->get_next();
-  }
-  _statistical_data_computed = false;
-  _non_coding_computed = false;
-  _total_genome_size                  = 0;
-
-  assert(get_nb_bases_in_0_coding_RNA()==2*initial_non_coding_base_nb);
-}
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_individual::make_protein_list( void )
-{
-  assert( _protein_list != NULL );
-
-  // Clean list
-  _protein_list->erase( false );
-
-  // Make a copy of each genetic unit's protein list
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit      = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    _protein_list->add_list( gen_unit->get_protein_list()[LEADING] );
-    _protein_list->add_list( gen_unit->get_protein_list()[LAGGING] );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
-
-void ae_individual::make_rna_list( void )
-{
-  assert( _rna_list != NULL );
-
-  // Clean list
-  _rna_list->erase( false );
-
-  // Make a copy of each genetic unit's rna list
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    _rna_list->add_list( gen_unit->get_rna_list()[LEADING] );
-    _rna_list->add_list( gen_unit->get_rna_list()[LAGGING] );
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-}
diff --git a/src/libaevol/ae_individual.h b/src/libaevol/ae_individual.h
deleted file mode 100644
index f26c1be..0000000
--- a/src/libaevol/ae_individual.h
+++ /dev/null
@@ -1,1581 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// ****************************************************************************
-
-
-#ifndef __AE_INDIVIDUAL_H__
-#define __AE_INDIVIDUAL_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <zlib.h>
-#include <assert.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_list.h>
-#include <ae_environment.h>
-#include <ae_genetic_unit.h>
-#include <ae_dna.h>
-#include <ae_rna.h>
-#include <ae_protein.h>
-#include <ae_phenotype.h>
-#include <ae_replication_report.h>
-#include <ae_params_mut.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-class ae_grid_cell;
-
-
-
-
-
-
-class ae_individual : public ae_object
-{
-  friend class ae_dna;
-
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_individual(  ae_exp_manager* exp_m,
-                    ae_jumping_mt* mut_prng,
-                    ae_jumping_mt* stoch_prng,
-                    ae_params_mut* param_mut,
-                    double w_max,
-                    int32_t min_genome_length,
-                    int32_t max_genome_length,
-                    bool allow_plasmids,
-                    int32_t id,
-                    char* strain_name,
-                    int32_t age );
-
-    ae_individual( ae_exp_manager* exp_m, gzFile backup_file );
-    ae_individual( const ae_individual &model, bool replication_report_copy = false );
-    ae_individual(  ae_individual* const parent, int32_t id,
-                    ae_jumping_mt* mut_prng, ae_jumping_mt* stoch_prng );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_individual( void );
-
-    // =================================================================
-    //                        Accessors: Getters
-    // =================================================================
-    inline const char*  get_strain_name(void) const;
-    inline int32_t      get_age(void) const;
-
-    inline ae_exp_manager*  get_exp_m( void ) const;
-    inline int16_t          get_nb_genetic_units( void ) const;
-    inline int32_t          get_amount_of_dna( void ) const;
-    inline ae_genetic_unit* get_genetic_unit( int16_t num_unit ) const;
-    inline double           get_dist_to_target_by_feature( ae_env_axis_feature feature ) const;
-    inline double           get_fitness( void ) const;
-    inline double           get_fitness_by_feature( ae_env_axis_feature feature ) const;
-    inline ae_grid_cell*    get_grid_cell( void ) const;
-    inline bool             get_placed_in_population( void ) const;
-    inline ae_jumping_mt*   get_mut_prng( void ) const;
-    inline ae_jumping_mt*   get_stoch_prng( void ) const;
-
-    inline ae_list<ae_genetic_unit*>* get_genetic_unit_list( void )     const;
-    inline const char* get_genetic_unit_sequence   ( int16_t num_unit ) const;
-    inline int32_t     get_genetic_unit_seq_length ( int16_t num_unit ) const;
-
-    inline int32_t get_id( void ) const;
-    inline int32_t get_rank( void ) const;
-
-
-    inline ae_fuzzy_set* get_phenotype_activ( void ) const;
-    inline ae_fuzzy_set* get_phenotype_inhib( void ) const;
-    inline ae_phenotype* get_phenotype( void )       const;
-
-    inline double* get_dist_to_target_by_segment( void ) const;
-
-    inline ae_replication_report* get_replic_report( void ) const;
-
-    inline ae_list<ae_protein*>*  get_protein_list( void )  const;
-    inline ae_list<ae_rna*>*      get_rna_list( void )      const;
-
-    inline int32_t get_nb_plasmids( void )  const;
-    inline int32_t get_nb_gen_units( void ) const;
-
-    inline double get_w_max( void ) const;
-
-    // Genome size constraints
-    inline int32_t get_min_genome_length( void ) const;
-    inline int32_t get_max_genome_length( void ) const;
-
-    // Plasmids settings
-    inline bool     get_allow_plasmids( void ) const;
-
-    // Mutation rates etc...
-    inline double   get_point_mutation_rate( void ) const;
-    inline double   get_small_insertion_rate( void ) const;
-    inline double   get_small_deletion_rate( void ) const;
-    inline int16_t  get_max_indel_size( void ) const;
-
-    inline double get_duplication_rate( void ) const;
-    inline double get_deletion_rate( void ) const;
-    inline double get_translocation_rate( void ) const;
-    inline double get_inversion_rate( void ) const;
-    inline double get_neighbourhood_rate( void ) const;
-    inline double get_duplication_proportion( void ) const;
-    inline double get_deletion_proportion( void ) const;
-    inline double get_translocation_proportion( void ) const;
-    inline double get_inversion_proportion( void ) const;
-
-    // Transfer
-    inline bool   get_with_4pts_trans( void ) const;
-    inline bool   get_with_HT( void ) const;
-    inline bool   get_repl_HT_with_close_points( void ) const;
-    inline double get_HT_ins_rate( void ) const;
-    inline double get_HT_repl_rate( void ) const;
-    inline double get_repl_HT_detach_rate( void ) const;
-
-    // ------------------------------------------------------------ Alignements
-    inline bool  get_with_alignments(void) const;
-    inline ae_align_fun_shape get_align_fun_shape( void ) const;
-    inline double  get_align_sigm_lambda( void ) const;
-    inline int16_t get_align_sigm_mean( void ) const;
-    inline int16_t get_align_lin_min( void ) const;
-    inline int16_t get_align_lin_max( void ) const;
-
-    // Maximum shift of one seq on the other
-    inline int16_t get_align_max_shift( void ) const;
-    // Work zone half length
-    inline int16_t get_align_w_zone_h_len( void ) const;
-    // Corresponding residues match bonus
-    inline int16_t get_align_match_bonus( void ) const;
-    // Corresponding residues mismatch cost
-    inline int16_t get_align_mismatch_cost( void ) const;
-
-
-    // ----------------------------------------------- Phenotypic stochasticity
-    inline bool get_with_stochasticity( void ) const;
-
-    // Statistical data
-    inline int32_t  get_total_genome_size( void ); // TODO: duplicate with get_amount_of_dna?
-    inline int32_t  get_nb_coding_RNAs( void );
-    inline int32_t  get_nb_non_coding_RNAs( void );
-    inline double   get_overall_size_coding_RNAs( void );
-    inline double   get_av_size_coding_RNAs( void );
-    inline double   get_overall_size_non_coding_RNAs( void );
-    inline double   get_av_size_non_coding_RNAs( void );
-    inline int32_t  get_nb_genes_activ( void );
-    inline int32_t  get_nb_genes_inhib( void );
-    inline int32_t  get_nb_functional_genes( void );
-    inline int32_t  get_nb_non_functional_genes( void );
-    inline double   get_overall_size_functional_genes( void );
-    inline double   get_av_size_functional_genes( void );
-    inline double   get_overall_size_non_functional_genes( void );
-    inline double   get_av_size_non_functional_genes( void );
-
-    inline int32_t  get_nb_bases_in_0_CDS( void );
-    inline int32_t  get_nb_bases_in_0_functional_CDS( void );
-    inline int32_t  get_nb_bases_in_0_non_functional_CDS( void );
-    inline int32_t  get_nb_bases_in_0_RNA( void );
-    inline int32_t  get_nb_bases_in_0_coding_RNA( void );
-    inline int32_t  get_nb_bases_in_0_non_coding_RNA( void );
-    inline int32_t  get_nb_bases_in_neutral_regions( void );
-    inline int32_t  get_nb_neutral_regions( void );
-
-    inline double get_modularity( void ); // Not const
-
-    inline int32_t* get_int_probes ( void ) const;
-    inline double* get_double_probes ( void) const;
-
-
-    // =================================================================
-    //                        Accessors: Setters
-    // =================================================================
-    inline void set_strain_name(char* name);
-
-    void set_exp_m( ae_exp_manager* exp_m );
-    inline void set_id( int32_t id );
-    inline void set_rank( int32_t rank );
-
-    void set_grid_cell( ae_grid_cell* grid_cell );
-    inline void set_placed_in_population( bool placed_in_population );
-
-    inline void set_replication_report( ae_replication_report * rep );
-
-    inline void reset_dist_to_target_by_segment( double * dist_to_target_by_segment );
-
-    inline void set_w_max( double w_max );
-
-    // Genome size constraints
-    inline void set_min_genome_length( int32_t min_genome_length );
-    inline void set_max_genome_length( int32_t max_genome_length );
-
-    inline void add_GU( char * &sequence, int32_t length );
-
-    // Mutation rates etc...
-    inline void set_point_mutation_rate( double point_mutation_rate);
-    inline void set_small_insertion_rate( double small_insertion_rate);
-    inline void set_small_deletion_rate( double small_deletion_rate);
-    inline void set_max_indel_size( int16_t max_indel_size);
-
-    inline void set_duplication_rate( double duplication_rate);
-    inline void set_deletion_rate( double deletion_rate);
-    inline void set_translocation_rate( double translocation_rate);
-    inline void set_inversion_rate( double inversion_rate);
-    inline void set_neighbourhood_rate( double neighbourhood_rate);
-    inline void set_duplication_proportion( double duplication_proportion);
-    inline void set_deletion_proportion( double deletion_proportion);
-    inline void set_translocation_proportion( double translocation_proportion);
-    inline void set_inversion_proportion( double inversion_proportion);
-
-    // Transfer
-    inline void set_with_4pts_trans( bool with_4pts_trans );
-    inline void set_with_alignments( bool with_alignments );
-    inline void set_with_HT( bool with_HT );
-    inline void set_repl_HT_with_close_points( bool repl_HT_with_close_points);
-    inline void set_HT_ins_rate( double HT_ins_rate );
-    inline void set_HT_repl_rate( double HT_repl_rate );
-    inline void set_repl_HT_detach_rate( double repl_HT_detach_rate );
-
-    // ----------------------------------------------- Phenotypic stochasticity
-    inline void set_with_stochasticity( bool with_stoch );
-
-    inline void set_mut_prng( ae_jumping_mt* prng );
-    inline void set_stoch_prng( ae_jumping_mt* prng );
-
-    //------------------------------------------------ Generic probes
-    inline void set_int_probes ( int32_t* int_probes);
-    inline void set_double_probes ( double* double_probes);
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    inline void renew_dist_to_target_by_feature( void );
-    inline void renew_fitness_by_feature( void );
-
-    void inject_GU( ae_individual* donor );
-    void inject_2GUs( ae_individual* partner );
-
-    virtual void evaluate( ae_environment* envir = NULL );
-    virtual void reevaluate( ae_environment* envir = NULL );
-    inline void do_transcription_translation_folding( void );
-    void do_transcription( void );
-    void do_translation( void );
-    void do_folding( void );
-    void compute_phenotype( void );
-    void compute_distance_to_target( ae_environment* envir );
-
-    // Computation of a "proper" fitness value (one that increases when the individual is fitter)
-    // The behaviour of this function depends on many parameters and most notably on whether it is
-    // a "composite" fitness or not, and on the selection scheme.
-    void compute_fitness( ae_environment* envir );
-
-    void compute_statistical_data();
-    void compute_non_coding( void );
-
-    virtual void save( gzFile backup_file ) const;
-
-    int32_t get_nb_terminators( void );
-
-    #ifdef DEBUG
-      inline void print_rna_list( void );
-      inline void print_protein_list( void );
-
-      inline void assert_promoters( void );
-      inline void assert_promoters_order( void );
-    #endif
-
-    void compute_experimental_f_nu( int32_t nb_children, double* reproduction_statistics, double* offsprings_statistics = NULL, FILE* replication_file = NULL);
-    double compute_theoritical_f_nu( void );
-    // These functions compute the probability of neutral reproduction (F_nu).
-    // The first method replicates the individual "nb_children" times and counts how often
-    // a child has the same fitness as its parent (and if second argument not NULL, how often
-    // a child has same or better fitness and stores the result at the adress contained in the
-    // pointer). Results are proportions.
-    // The second is an estimate based on genome structure as defined by Carole.
-    // They have been implemented on the chromosome only !
-
-    void remove_non_coding_bases(void);
-    void double_non_coding_bases(void);
-
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_individual( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    virtual void make_protein_list( void );
-    virtual void make_rna_list( void );
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-
-    // Name and "Age" of the strain
-    char*   _strain_name;
-    int32_t _age;
-
-    // Random number generator
-    ae_jumping_mt* _mut_prng;
-    ae_jumping_mt* _stoch_prng;
-
-    // Individual ID and rank of the individual in the population
-    // WARNING : The ID is no longer corresponding to the rank of the individual.
-    //           The reason for this change is that we now need an identifier for the individuals
-    //           as soon as they are created (the rank is only known when all the individuals have been evaluated).
-    //           The rank will now be handled in a specific new attribute. (1 for the worst indiv, POP_SIZE for the best)
-    int32_t  _id;   // [0 ; POP_SIZE[
-    int32_t  _rank; // [1 ; POP_SIZE]
-
-    // Total activation (resp. inhibition) of metabolic functions
-    ae_fuzzy_set* _phenotype_activ;
-    ae_fuzzy_set* _phenotype_inhib;
-
-    // The phenotype, roughly corresponding to the sum of activ and inhib
-    ae_phenotype* _phenotype;
-
-    // Table containing the partial area of the "gap" (difference between the phenotype and the environment)
-    // for each environmental segment.
-    // Note: if the environment is not segmented, there will be a single cell in this table
-    double* _dist_to_target_by_segment;
-
-    // This table contains the aggregated area of the gap for each type of segment (ae_env_axis_feature).
-    // When the environment is not segmented, the only meaningfull value will be held in _dist_to_target[METABOLISM]
-    double* _dist_to_target_by_feature;
-
-    // This table contains the fitness contribution for each type of segment (ae_env_axis_feature).
-    // For metabolic segment, this is the metabolic fitness contribution;
-    // For secretion segment, this is the amount of compound that gets secreted into the environment;
-    // Note: total fitness is the combination of metabolic fitness and the amount of compound present in the environment,
-    //       not the amount of compound secreted by the individual.
-    double* _fitness_by_feature;
-
-    // THE fitness
-    double _fitness;
-
-    // When using structured population, this is the cell the individual is in
-    ae_grid_cell* _grid_cell;
-
-    // The chromosome and plasmids (if allowed)
-    ae_list<ae_genetic_unit*>* _genetic_unit_list;
-
-    // Report of all the mutational events undergone during the individuals creation,
-    // i.e. during the replication that gave birth to this individual
-    ae_replication_report* _replic_report;
-
-    // Access lists to all the proteins/RNAs of the individual.
-    // Please note that these proteins/RNAs are actually managed (i.e. newed and deleted) via genetic units.
-    ae_list<ae_protein*>* _protein_list;
-    ae_list<ae_rna*>*     _rna_list;
-
-    // Generic probes
-    int32_t*  _int_probes;        // Table of 5 int32_t values to be used as one wishes
-    double*   _double_probes;     // Table of 5 double values to be used as one wishes
-
-    // Mutation rates etc...
-    ae_params_mut* _mut_params;
-
-    // ----------------------------------------------- Phenotypic stochasticity
-    bool _with_stochasticity;
-
-    // Artificial chemistry
-    double _w_max;
-
-    // Genome size constraints
-    int32_t _min_genome_length;
-    int32_t _max_genome_length;
-
-    // Plasmids settings
-    bool _allow_plasmids;
-
-
-
-    // --------------------------------------------------
-    // "State" of the individual
-    // --------------------------------------------------
-    // We keep trace of what we have already computed to avoid double computation (mainly in post-treaments)
-    bool _evaluated;
-    bool _transcribed;
-    bool _translated;
-    bool _folded;
-    bool _phenotype_computed;
-    bool _distance_to_target_computed;
-    bool _fitness_computed;
-    bool _statistical_data_computed;
-    bool _non_coding_computed;
-    bool _modularity_computed;
-
-    bool _placed_in_population; // TODO: spatial ?
-
-
-
-    // ----------------------------------------
-    // Statistical data
-    // ----------------------------------------
-    // Genome, RNAs and genes size and stuff
-    int32_t _total_genome_size;                 // Sum of sizes of the genetic units
-    int32_t _nb_coding_RNAs;                    // Number of coding RNAs (at least one gene on RNA)
-    int32_t _nb_non_coding_RNAs;                // Number of non-coding-RNAs
-    double  _overall_size_coding_RNAs;          // Average size of coding RNAs
-    double  _overall_size_non_coding_RNAs;      // Average size of non-coding RNAs
-    int32_t _nb_genes_activ;                    // Number of genes realizing a function
-    int32_t _nb_genes_inhib;                    // Number of genes inhibitting a function
-    int32_t _nb_functional_genes;               // Number of functional genes
-    int32_t _nb_non_functional_genes;           // Number of non-functional genes
-    double  _overall_size_functional_genes;     // Average size of functional genes
-    double  _overall_size_non_functional_genes; // Average size of non-functional genes
-
-    // Mutation/Rearrangement statistics are managed in the replication report
-
-    // Coding / non-coding
-    int32_t _nb_bases_in_0_CDS;               // Number of bases that are not included in any gene
-    int32_t _nb_bases_in_0_functional_CDS;    // Number of bases that are not included in any functional gene
-    int32_t _nb_bases_in_0_non_functional_CDS;// Number of bases that are not included in any degenerated gene
-    int32_t _nb_bases_in_0_RNA;               // Number of bases that are not included in any RNA
-    int32_t _nb_bases_in_0_coding_RNA;        // Number of bases that are not included in any coding RNA
-                                              // (RNAs containing at least one CDS)
-    int32_t _nb_bases_in_0_non_coding_RNA;    // Number of bases that are not included in any non coding RNA
-    int32_t _nb_bases_in_neutral_regions;     // Number of bases that are in a neutral region
-                                              // A base is considered neutral when neither itself NOR its corresponding base on the other
-                                              // strand belongs to a coding promoter->terminator region (both included)
-    int32_t _nb_neutral_regions;              // Number of neutral regions
-
-    double _modularity; // Ratio between the pairwise distance between genes whose corresponding
-                        // phenotypic triangles overlap and the average intergenic distance
-                        // (ignoring non-functional genes)void compute_phenotype( void );
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-/*!
-  TODO
-*/
-inline const char* ae_individual::get_strain_name(void) const
-{
-  return _strain_name;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_age(void) const
-{
-  return _age;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_id( void ) const
-{
-  return _id;
-}
-
-/*!
-  TODO
-*/
-inline double* ae_individual::get_dist_to_target_by_segment( void ) const
-{
-  return _dist_to_target_by_segment;
-}
-
-/*!
-  Get the individual's rank in the population (1 for the worst indiv, POP_SIZE for the best)
-
-  Warning: be sure you call sort_individuals() before using get_rank_in_population
-*/
-inline int32_t ae_individual::get_rank( void ) const
-{
-  return _rank;
-}
-
-/*!
-  TODO
-*/
-inline ae_exp_manager* ae_individual::get_exp_m( void ) const
-{
-  return _exp_m;
-}
-
-/*!
-  TODO
-*/
-inline ae_jumping_mt* ae_individual::get_mut_prng( void ) const
-{
-  return _mut_prng;
-}
-
-/*!
-  TODO
-*/
-inline ae_jumping_mt* ae_individual::get_stoch_prng( void ) const
-{
-  return _stoch_prng;
-}
-
-/*!
-  Returns the number of genetic units
-*/
-inline int16_t ae_individual::get_nb_genetic_units( void ) const
-{
-  return _genetic_unit_list->get_nb_elts();
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_amount_of_dna( void ) const
-{
-  int32_t amount = 0;
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-  ae_genetic_unit* gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = gen_unit_node->get_obj();
-
-    amount += gen_unit->get_dna()->get_length();
-
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  return amount;
-}
-
-/*!
-  Returns the list of genetic units
-*/
-inline ae_list<ae_genetic_unit*>* ae_individual::get_genetic_unit_list( void ) const
-{
-  return _genetic_unit_list;
-}
-
-/*!
-  Returns genetic unit number <num_unit> (0 for main chromosome)
-*/
-inline ae_genetic_unit* ae_individual::get_genetic_unit( int16_t num_unit ) const
-{
-  assert( num_unit < _genetic_unit_list->get_nb_elts() );
-
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = _genetic_unit_list->get_first();
-
-  for ( int16_t i = 0 ; i < num_unit ; i++ )
-  {
-    gen_unit_node = gen_unit_node->get_next();
-  }
-
-  return gen_unit_node->get_obj();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_dist_to_target_by_feature( ae_env_axis_feature feature ) const
-{
-  assert( _distance_to_target_computed );
-
-  return _dist_to_target_by_feature[feature];
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_fitness( void ) const
-{
-  assert( _fitness_computed );
-
-  return _fitness;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_fitness_by_feature( ae_env_axis_feature feature ) const
-{
-  assert( _fitness_computed );
-
-  return _fitness_by_feature[feature];
-}
-
-/*!
-  TODO
-*/
-inline ae_grid_cell* ae_individual::get_grid_cell( void ) const
-{
-  return _grid_cell;
-}
-
-/*!
-  TODO
-*/
-inline bool ae_individual::get_placed_in_population ( void ) const
-{
-  return _placed_in_population;
-}
-
-/*!
-  Returns the sequence of genetic unit number <num_unit> (0 for main chromosome)
-*/
-inline const char* ae_individual::get_genetic_unit_sequence( int16_t num_unit ) const
-{
-  return get_genetic_unit( num_unit )->get_sequence();
-}
-
-/*!
-  Returns the sequence length of genetic unit number <num_unit> (0 for main chromosome)
-*/
-inline int32_t ae_individual::get_genetic_unit_seq_length( int16_t num_unit ) const
-{
-  return get_genetic_unit( num_unit )->get_seq_length();
-}
-
-/*!
-  TODO
-*/
-ae_fuzzy_set* ae_individual::get_phenotype_activ( void ) const
-{
-  return _phenotype_activ;
-}
-
-/*!
-  TODO
-*/
-ae_fuzzy_set* ae_individual::get_phenotype_inhib( void ) const
-{
-  return _phenotype_inhib;
-}
-
-/*!
-  TODO
-*/
-ae_phenotype* ae_individual::get_phenotype( void ) const
-{
-  return _phenotype;
-}
-
-/*!
-  TODO
-*/
-ae_replication_report* ae_individual::get_replic_report( void ) const
-{
-  return _replic_report;
-}
-
-/*!
-  TODO
-*/
-inline ae_list<ae_protein*>* ae_individual::get_protein_list( void ) const
-{
-  assert( _protein_list );
-
-  return _protein_list;
-}
-
-/*!
-  TODO
-*/
-inline ae_list<ae_rna*>* ae_individual::get_rna_list( void ) const
-{
-  return _rna_list;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_plasmids( void ) const
-{
-  return _genetic_unit_list->get_nb_elts() - 1;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_gen_units( void ) const
-{
-  return _genetic_unit_list->get_nb_elts();
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_total_genome_size( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _total_genome_size;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_coding_RNAs;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_non_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_non_coding_RNAs;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_overall_size_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _overall_size_coding_RNAs;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_av_size_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( _nb_coding_RNAs != 0 )
-  {
-    return _overall_size_coding_RNAs / _nb_coding_RNAs;
-  }
-  else return 0.0;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_overall_size_non_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _overall_size_non_coding_RNAs;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_av_size_non_coding_RNAs( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( _nb_non_coding_RNAs != 0 )
-  {
-    return _overall_size_non_coding_RNAs / _nb_non_coding_RNAs;
-  }
-  else return 0.0;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_genes_activ( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_genes_activ;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_genes_inhib( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_genes_inhib;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_functional_genes;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_non_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _nb_non_functional_genes;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_overall_size_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _overall_size_functional_genes;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_av_size_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( _nb_functional_genes != 0 )
-  {
-    return _overall_size_functional_genes / _nb_functional_genes;
-  }
-  else return 0.0;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_overall_size_non_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  return _overall_size_non_functional_genes;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_av_size_non_functional_genes( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( _nb_non_functional_genes != 0 )
-  {
-    return _overall_size_non_functional_genes / _nb_non_functional_genes;
-  }
-  else return 0.0;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_CDS( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_CDS;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_functional_CDS( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_functional_CDS;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_non_functional_CDS( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_non_functional_CDS;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_RNA( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_RNA;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_coding_RNA( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_coding_RNA;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_0_non_coding_RNA( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_0_non_coding_RNA;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_bases_in_neutral_regions( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_bases_in_neutral_regions;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_nb_neutral_regions( void )
-{
-  if ( ! _statistical_data_computed ) compute_statistical_data();
-  if ( ! _non_coding_computed ) compute_non_coding();
-  return _nb_neutral_regions;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_modularity( void )
-{
-  printf("\n  WARNING : modularity measure not yet implemented.\n");
-  //~ if ( _modularity < 0 ) compute_modularity();
-  //~ return _modularity;
-  return 0;
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_w_max( void ) const
-{
-  return _w_max;
-}
-
-// ------------------------------------------------------------- Mutation rates
-/*!
-  TODO
-*/
-inline double ae_individual::get_point_mutation_rate( void ) const
-{
-  return _mut_params->get_point_mutation_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_small_insertion_rate( void ) const
-{
-  return _mut_params->get_small_insertion_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_small_deletion_rate( void ) const
-{
-  return _mut_params->get_small_deletion_rate();
-}
-
-/*!
-  TODO
-*/
-inline int16_t ae_individual::get_max_indel_size( void ) const
-{
-  return _mut_params->get_max_indel_size();
-}
-
-// ---------------------------------- Rearrangement rates (without alignements)
-/*!
-  TODO
-*/
-inline double ae_individual::get_duplication_rate( void ) const
-{
-  return _mut_params->get_duplication_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_deletion_rate( void ) const
-{
-  return _mut_params->get_deletion_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_translocation_rate( void ) const
-{
-  return _mut_params->get_translocation_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_inversion_rate( void ) const
-{
-  return _mut_params->get_inversion_rate();
-}
-
-// ------------------------------------- Rearrangement rates (with alignements)
-/*!
-  TODO
-*/
-inline double ae_individual::get_neighbourhood_rate( void ) const
-{
-  return _mut_params->get_neighbourhood_rate();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_duplication_proportion( void ) const
-{
-  return _mut_params->get_duplication_proportion();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_deletion_proportion( void ) const
-{
-  return _mut_params->get_deletion_proportion();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_translocation_proportion( void ) const
-{
-  return _mut_params->get_translocation_proportion();
-}
-
-/*!
-  TODO
-*/
-inline double ae_individual::get_inversion_proportion( void ) const
-{
-  return _mut_params->get_inversion_proportion();
-}
-
-// ---------------------------------------------------------------- Transfer
-inline bool ae_individual::get_with_4pts_trans( void ) const
-{
-  return _mut_params->get_with_4pts_trans();
-}
-
-inline bool ae_individual::get_with_HT( void ) const
-{
-  return _mut_params->get_with_HT();
-}
-
-inline bool ae_individual::get_repl_HT_with_close_points( void ) const
-{
-  return _mut_params->get_repl_HT_with_close_points();
-}
-
-inline double ae_individual::get_HT_ins_rate( void ) const
-{
-  return _mut_params->get_HT_ins_rate();
-}
-
-inline double ae_individual::get_HT_repl_rate( void ) const
-{
-  return _mut_params->get_HT_repl_rate();
-}
-
-inline double ae_individual::get_repl_HT_detach_rate( void ) const
-{
-  return _mut_params->get_repl_HT_detach_rate();
-}
-
-
-// ---------------------------------------------------------------- Alignements
-inline bool ae_individual::get_with_alignments(void) const
-{
- return _mut_params->get_with_alignments();
-}
-
-inline ae_align_fun_shape ae_individual::get_align_fun_shape( void ) const
-{
- return _mut_params->get_align_fun_shape();
-}
-
-inline double ae_individual::get_align_sigm_lambda( void ) const
-{
- return _mut_params->get_align_sigm_lambda();
-}
-
-inline int16_t ae_individual::get_align_sigm_mean( void ) const
-{
- return _mut_params->get_align_sigm_mean();
-}
-
-inline int16_t ae_individual::get_align_lin_min( void ) const
-{
- return _mut_params->get_align_lin_min();
-}
-
-inline int16_t ae_individual::get_align_lin_max( void ) const
-{
- return _mut_params->get_align_lin_max();
-}
-
-inline int16_t ae_individual::get_align_max_shift( void ) const
-{
- return _mut_params->get_align_max_shift();
-}
-
-inline int16_t ae_individual::get_align_w_zone_h_len( void ) const
-{
- return _mut_params->get_align_w_zone_h_len();
-}
-
-inline int16_t ae_individual::get_align_match_bonus( void ) const
-{
- return _mut_params->get_align_match_bonus();
-}
-
-inline int16_t ae_individual::get_align_mismatch_cost( void ) const
-{
- return _mut_params->get_align_mismatch_cost();
-}
-
-/*!
-  TODO
-*/
-inline bool ae_individual::get_with_stochasticity( void ) const
-{
-  return _with_stochasticity;
-}
-
-// Genome size constraints
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_min_genome_length( void ) const
-{
-  return _min_genome_length;
-}
-
-/*!
-  TODO
-*/
-inline int32_t ae_individual::get_max_genome_length( void ) const
-{
-  return _max_genome_length;
-}
-
-// Plasmids settings
-/*!
-  TODO
-*/
-inline bool ae_individual::get_allow_plasmids( void ) const
-{
-  return _allow_plasmids;
-}
-
-/*!
-  \brief Return the _int_probes
-
-  \return _int_probes
-*/
-inline int32_t* ae_individual::get_int_probes ( void ) const
-{
-  return _int_probes;
-}
-
-/*!
-  \brief Return the _double_probes
-
-  \return _double_probes
-*/
-inline double* ae_individual::get_double_probes ( void) const
-{
-  return _double_probes;
-}
-
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-inline void ae_individual::set_strain_name(char* name)
-{
-  assert(name && strlen(name) < INT8_MAX); // Conservative, could be <=
-  int8_t name_len = strlen(name);
-  delete [] _strain_name;
-  _strain_name = new char[name_len+1];
-  memcpy(_strain_name, name, name_len+1);
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::set_id( int32_t id )
-{
-  _id = id;
-
-  if ( _replic_report != NULL )
-  {
-    _replic_report->set_id( id );
-  }
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::set_rank( int32_t rank )
-{
-  _rank = rank;
-
-  if ( _replic_report != NULL )
-  {
-    _replic_report->set_rank( rank );
-  }
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::set_placed_in_population( bool placed_in_population )
-{
-  _placed_in_population = placed_in_population;
-}
-
-/*!
-  Set the individual's replication report
-  To be used by post-treatment only
-*/
-inline void ae_individual::set_replication_report( ae_replication_report * rep )
-{
-  _replic_report = rep;
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::set_w_max( double w_max )
-{
-  _w_max = w_max;
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::add_GU( char * &sequence, int32_t length )
-{
-  _genetic_unit_list->add( new ae_genetic_unit( this, sequence, length ) );
-}
-
-// Genome size constraints
-/*!
-  TODO
-*/
-inline void ae_individual::set_min_genome_length( int32_t min_genome_length )
-{
-  _min_genome_length = min_genome_length;
-}
-
-/*!
-  TODO
-*/
-inline void ae_individual::set_max_genome_length( int32_t max_genome_length )
-{
-  _max_genome_length = max_genome_length;
-}
-
-
-inline void ae_individual::set_point_mutation_rate( double point_mutation_rate)
-{
-  _mut_params->set_point_mutation_rate(point_mutation_rate);
-}
-
-inline void ae_individual::set_small_insertion_rate( double small_insertion_rate)
-{
-  _mut_params->set_small_insertion_rate(small_insertion_rate);
-}
-
-inline void ae_individual::set_small_deletion_rate( double small_deletion_rate)
-{
-  _mut_params->set_small_deletion_rate(small_deletion_rate);
-}
-
-inline void ae_individual::set_max_indel_size( int16_t max_indel_size)
-{
-  _mut_params->set_max_indel_size(max_indel_size);
-}
-
-inline void ae_individual::set_duplication_rate( double duplication_rate)
-{
-  _mut_params->set_duplication_rate(duplication_rate);
-}
-
-inline void ae_individual::set_deletion_rate( double deletion_rate)
-{
-  _mut_params->set_deletion_rate(deletion_rate);
-}
-
-inline void ae_individual::set_translocation_rate( double translocation_rate)
-{
-  _mut_params->set_translocation_rate(translocation_rate);
-}
-
-inline void ae_individual::set_inversion_rate( double inversion_rate)
-{
-  _mut_params->set_inversion_rate(inversion_rate);
-}
-
-inline void ae_individual::set_neighbourhood_rate( double neighbourhood_rate)
-{
-  _mut_params->set_neighbourhood_rate(neighbourhood_rate);
-}
-
-inline void ae_individual::set_duplication_proportion( double duplication_proportion)
-{
-  _mut_params->set_duplication_proportion(duplication_proportion);
-}
-
-inline void ae_individual::set_deletion_proportion( double deletion_proportion)
-{
-  _mut_params->set_deletion_proportion(deletion_proportion);
-}
-
-inline void ae_individual::set_translocation_proportion( double translocation_proportion)
-{
-  _mut_params->set_translocation_proportion(translocation_proportion);
-}
-
-inline void ae_individual::set_inversion_proportion( double inversion_proportion)
-{
-  _mut_params->set_inversion_proportion(inversion_proportion);
-}
-
-inline void ae_individual::set_with_4pts_trans( bool with_4pts_trans )
-{
-	_mut_params->set_with_4pts_trans(with_4pts_trans);
-}
-
-inline void ae_individual::set_with_alignments( bool with_alignments )
-{
-	_mut_params->set_with_alignments(with_alignments);
-}
-
-inline void ae_individual::set_with_HT( bool with_HT )
-{
-	_mut_params->set_with_HT(with_HT);
-}
-
-inline void ae_individual::set_repl_HT_with_close_points( bool repl_HT_with_close_points)
-{
-	_mut_params->set_repl_HT_with_close_points(repl_HT_with_close_points);
-}
-
-inline void ae_individual::set_HT_ins_rate( double HT_ins_rate )
-{
-	_mut_params->set_HT_ins_rate(HT_ins_rate);
-}
-
-inline void ae_individual::set_HT_repl_rate( double HT_repl_rate )
-{
-	_mut_params->set_HT_repl_rate(HT_repl_rate);
-}
-
-inline void ae_individual::set_repl_HT_detach_rate( double repl_HT_detach_rate )
-{
-	_mut_params->set_repl_HT_detach_rate(repl_HT_detach_rate);
-}
-
-
-inline void ae_individual::set_with_stochasticity( bool with_stoch )
-{
-  _with_stochasticity = with_stoch;
-}
-
-inline void ae_individual::set_stoch_prng( ae_jumping_mt* prng )
-{
-  _stoch_prng = prng;
-}
-
-inline void ae_individual::set_mut_prng( ae_jumping_mt* prng )
-{
-  _mut_prng = prng;
-}
-
-/*!
-  \brief Change the _int_probes
-
-  \param int_probes 5 int32_t* that constitute a probe
-*/
-inline void ae_individual::set_int_probes ( int32_t* int_probes)
-{
-  _int_probes = int_probes;
-}
-
-/*!
-  \brief Change the _double_probes
-
-  \param double_probes 5 double* that constitute a probe
-*/
-inline void ae_individual::set_double_probes ( double* double_probes)
-{
-  _double_probes = double_probes;
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-inline void ae_individual::reset_dist_to_target_by_segment( double* dist_to_target_by_segment )
-{
-  if ( _dist_to_target_by_segment != NULL ) delete [] _dist_to_target_by_segment;
-  _dist_to_target_by_segment = dist_to_target_by_segment;
-}
-
-inline void ae_individual::renew_dist_to_target_by_feature( void )
-{
-  if ( _dist_to_target_by_feature != NULL ) delete [] _dist_to_target_by_feature;
-  _dist_to_target_by_feature = new double [NB_FEATURES];
-}
-
-
-inline void ae_individual::renew_fitness_by_feature( void )
-{
-  if ( _fitness_by_feature != NULL ) delete [] _fitness_by_feature;
-  _fitness_by_feature = new double [NB_FEATURES];
-}
-
-void ae_individual::do_transcription_translation_folding( void )
-{
-  if ( _transcribed == true && _translated == true && _folded == true ) return;
-
-  do_transcription();
-  do_translation();
-  do_folding();
-
-  make_protein_list();
-}
-
-#ifdef DEBUG
-  inline void ae_individual::print_rna_list( void )
-  {
-    ae_list_node<ae_rna*>* rna_node  = _rna_list->get_first();
-    ae_rna*       rna       = NULL;
-
-    while ( rna_node != NULL )
-    {
-      rna = rna_node->get_obj();
-
-      printf( "RNA at pos : %"PRId32"      length : %"PRId32" bp\n", rna->get_promoter_pos(), rna->get_transcript_length() );
-      printf( "  strand : %s    basal level : %f\n", (rna->get_strand() == LEADING)?"LEADING":"LAGGING", rna->get_basal_level() );
-
-      rna_node = rna_node->get_next();
-    }
-  }
-
-  inline void ae_individual::print_protein_list( void )
-  {
-    ae_list_node<ae_protein*>* prot_node = _protein_list->get_first();
-    ae_protein*   prot = NULL;
-
-    while ( prot_node != NULL )
-    {
-      prot = prot_node->get_obj();
-
-      char* prot_sequence = prot->get_AA_sequence();
-      printf( "prot %p at pos : %"PRId32"      length : %"PRId32" AAs\n", prot, prot->get_first_translated_pos(), prot->get_length() );
-      printf( "  strand : %s    concentration : %f\n", (prot->get_strand() == LEADING)?"LEADING":"LAGGING", prot->get_concentration() );
-      printf( "  sequence : %s\n", prot_sequence );
-      printf( "  mean : %f      width : %f      height : %f\n", prot->get_mean(), prot->get_width(), prot->get_height() );
-      delete prot_sequence;
-
-      prot_node = prot_node->get_next();
-    }
-  }
-
-  inline void ae_individual::assert_promoters( void )
-  {
-    // Perform assertion for each genetic unit
-    ae_list_node<ae_genetic_unit*>*     gen_unit_node = _genetic_unit_list->get_first();
-    ae_genetic_unit*  gen_unit      = NULL;
-
-    while ( gen_unit_node != NULL )
-    {
-      gen_unit = gen_unit_node->get_obj();
-
-      gen_unit->assert_promoters();
-
-      gen_unit_node = gen_unit_node->get_next();
-    }
-  }
-
-  inline void ae_individual::assert_promoters_order( void )
-  {
-    // Perform assertion for each genetic unit
-    ae_list_node<ae_genetic_unit*>*     gen_unit_node = _genetic_unit_list->get_first();
-    ae_genetic_unit*  gen_unit      = NULL;
-
-    while ( gen_unit_node != NULL )
-    {
-      gen_unit = gen_unit_node->get_obj();
-
-      gen_unit->assert_promoters_order();
-
-      gen_unit_node = gen_unit_node->get_next();
-    }
-  }
-#endif
-
-
-#endif // __AE_INDIVIDUAL_H__
diff --git a/src/libaevol/ae_individual_X11.cpp b/src/libaevol/ae_individual_X11.cpp
deleted file mode 100644
index 46fe8b7..0000000
--- a/src/libaevol/ae_individual_X11.cpp
+++ /dev/null
@@ -1,890 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_individual_X11.h>
-
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_utils.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                           Class ae_individual_X11                           #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_individual_X11::ae_individual_X11( ae_exp_manager* exp_m,
-                                      ae_jumping_mt* mut_prng,
-                                      ae_jumping_mt* stoch_prng,
-                                      ae_params_mut* param_mut,
-                                      double w_max,
-                                      int32_t min_genome_length,
-                                      int32_t max_genome_length,
-                                      bool allow_plasmids,
-                                      int32_t id,
-                                      char* strain_name,
-                                      int32_t age )
-        : ae_individual(  exp_m, mut_prng, stoch_prng, param_mut, w_max,
-                          min_genome_length, max_genome_length, allow_plasmids,
-                          id, strain_name, age )
-{
-  init_occupied_sectors();
-}
-
-ae_individual_X11::ae_individual_X11( ae_exp_manager* exp_manager, gzFile backup_file )
-        : ae_individual( exp_manager, backup_file )
-{
-  init_occupied_sectors();
-}
-
-ae_individual_X11::ae_individual_X11( const ae_individual_X11 &model, bool replication_report_copy  )
-        : ae_individual( model, replication_report_copy  )
-{
-  init_occupied_sectors();
-}
-
-ae_individual_X11::ae_individual_X11( ae_individual_X11* const parent, int32_t id, ae_jumping_mt* mut_prng, ae_jumping_mt* stoch_prng )
-        : ae_individual( parent, id, mut_prng, stoch_prng )
-{
-  init_occupied_sectors();
-}
-
-/*ae_individual_X11::ae_individual_X11( char* genome, int32_t genome_size ) : ae_individual( genome, genome_size )
-{
-  init_occupied_sectors();
-}*/
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_individual_X11::~ae_individual_X11( void )
-{
-  for ( int16_t layer = 0 ; layer < _outmost_layer ; layer++ )
-  {
-    delete [] _occupied_sectors[LEADING][layer];
-    delete [] _occupied_sectors[LAGGING][layer];
-  }
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_individual_X11::display( void )
-{
-}
-
-void ae_individual_X11::display_cdss( ae_X11_window* win )
-{
-  // Retreive the genetic unit corresponding to the main chromosome
-  ae_genetic_unit* gen_unit = get_genetic_unit(0);
-  int32_t genome_length = gen_unit->get_dna()->get_length();
-
-  // Display the number of CDSs
-  char display_string[40];
-  sprintf( display_string, "Main chromosome size : %"PRId32"bp", genome_length );
-  win->draw_string( 15, 25, display_string );
-  sprintf( display_string, "Leading : %"PRId32" CDSs", gen_unit->get_protein_list()[LEADING]->get_nb_elts() );
-  win->draw_string( 15, 40, display_string );
-  sprintf( display_string, "Lagging : %"PRId32" CDSs", gen_unit->get_protein_list()[LAGGING]->get_nb_elts() );
-  win->draw_string( 15, 55, display_string );
-
-  // Compute display diameter according to genome length and window size
-  int16_t canvas_width;
-  if ( _allow_plasmids ) canvas_width = win->get_width() / 2;
-  else canvas_width = win->get_width();
-  int16_t canvas_height = win->get_height();
-
-  int16_t canvas_size = ae_utils::min( canvas_width, canvas_width );
-  int16_t diam        = round( canvas_size * log( (double)genome_length ) / 16 );
-
-  // Prevent diameter from getting greater than 2/3 of the window size
-  if ( diam > 2 * canvas_size / 3 )
-  {
-    diam = 2 * canvas_size / 3;
-  }
-
-  // Compute coordinates of the upper-left corner of the containing square
-  int16_t pos_x = (canvas_width - diam) / 2;
-  int16_t pos_y = (canvas_height - diam) / 2;
-
-  // Draw main circle
-  win->draw_circle( pos_x, pos_y, diam );
-
-  // Sector occupation management
-  reset_sectors();
-
-
-  // ---------------
-  //  Draw each CDS
-  // ---------------
-  ae_list_node<ae_protein*>* cds_node  = NULL;
-  ae_protein*   cds       = NULL;
-
-  // NB : As we want OriC to be at the "top" of the circle and the orientation
-  //      to be clockwise, the drawing angle (theta) will be given as
-  //      (90 - alpha), alpha being the "classical" trigonometric angle
-  int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
-  int16_t theta_first, theta_last; // Transposed angles on the trigonometric circle (degrees)
-  int16_t nb_sect;
-  // Same as above with precision = 1/64 degree
-  int16_t alpha_first_64, alpha_last_64;
-  int16_t theta_first_64, theta_last_64;
-  int16_t nb_sect_64;
-
-  // ----------------
-  //  LEADING strand
-  // ----------------
-  cds_node = gen_unit->get_protein_list()[LEADING]->get_first();
-
-  while ( cds_node != NULL )
-  {
-    cds = cds_node->get_obj();
-
-    // Alpha : angles from OriC (in degrees)
-    // Theta : angles on the trigonometric circle (in degrees)
-    // nb_sect : "length" in degrees of the arc to be drawn
-    alpha_first   = (int16_t) round(  360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-    alpha_last    = (int16_t) round(  360 * ((double)cds->get_last_translated_pos()  / (double)genome_length ));
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    nb_sect       = ae_utils::mod( alpha_last - alpha_first + 1,  360 );
-
-    // These are the same as above but with a higher precision (1/64 degrees)
-    alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-    alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds->get_last_translated_pos() / (double)genome_length ));
-    theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-    theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-    nb_sect_64       = ae_utils::mod( alpha_last_64 - alpha_first_64 + 1,  64 * 360 );
-
-
-    // Look for the inmost layer that has all the sectors between
-    // theta_first and theta_last free
-    int16_t layer = 0;
-    bool sectors_free = false;
-    while ( ! sectors_free )
-    {
-      sectors_free = true;
-
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        if ( _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] )
-        {
-          sectors_free = false;
-          break;
-        }
-      }
-
-      if ( sectors_free )
-      {
-        break; // All the needed sectors are free on the current layer
-      }
-      else
-      {
-        layer++;
-
-        if ( layer >= _outmost_layer )
-        {
-          add_layer();
-          break; // An added layer is necessarily free, no need to look further
-        }
-      }
-    }
-
-    // Mark sectors to be drawn as occupied
-    for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-    {
-      _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] = true;
-    }
-    // Mark flanking sectors as occupied
-    _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first+1, 360)] = true;
-    _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-nb_sect, 360)] = true;
-
-
-    // Draw
-    const int8_t cds_layer_spacing = 5; // TODO : param?
-    layer++; // index starting at 0 but needed to start at 1
-
-    int16_t diam2 = diam + (layer * 2 * cds_layer_spacing);
-    pos_x         = (int16_t) round( (double)(canvas_width  - diam2 ) / 2.0 );
-    pos_y         = (int16_t) round( (double)(canvas_height - diam2 ) / 2.0 );
-
-    char* color = ae_X11_window::get_color( cds->get_mean() );
-    win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color );
-    delete [] color;
-
-    cds_node = cds_node->get_next();
-  }
-
-  // ----------------
-  //  LAGGING strand
-  // ----------------
-  cds_node = gen_unit->get_protein_list()[LAGGING]->get_first();
-
-  while ( cds_node != NULL )
-  {
-    cds = cds_node->get_obj();
-
-    // Alpha : angles from OriC (in degrees)
-    // Theta : angles on the trigonometric circle (in degrees)
-    // nb_sect : "length" in degrees of the arc to be drawn
-    alpha_first   = (int16_t) round(  360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-    alpha_last    = (int16_t) round(  360 * ((double)cds->get_last_translated_pos()  / (double)genome_length ));
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    nb_sect = ae_utils::mod( alpha_first - alpha_last + 1,  360 );
-
-    // These are the same as above but with a higher precision (1/64 degrees)
-    alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-    alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds->get_last_translated_pos() / (double)genome_length ));
-    theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-    theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-    nb_sect_64 = ae_utils::mod( alpha_first_64 - alpha_last_64 + 1,  64 * 360 );
-
-
-    // Look for the inmost layer that has all the sectors between
-    // theta_first and theta_last free
-    int16_t layer = 0;
-    bool sectors_free = false;
-    while ( ! sectors_free )
-    {
-      sectors_free = true;
-
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        if ( _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] )
-        {
-          sectors_free = false;
-          break;
-        }
-      }
-
-      if ( sectors_free )
-      {
-        break; // All the needed sectors are free on the current layer
-      }
-      else
-      {
-        layer++;
-
-        if ( layer >= _outmost_layer )
-        {
-          add_layer();
-          break; // An added layer is necessarily free, no need to look further
-        }
-      }
-    }
-
-    // Mark sectors to be drawn as occupied
-    for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-    {
-      _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] = true;
-    }
-    // Mark flanking sectors as occupied
-    _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first-1, 360)] = true;
-    _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+nb_sect, 360)] = true;
-
-
-    // Draw
-    const int8_t cds_layer_spacing = 5; // TODO : param?
-    layer++; // index starting at 0 but needed to start at 1
-
-    int16_t diam2 = diam - (layer * 2 * cds_layer_spacing);
-    pos_x         = (int16_t) round( (double)(canvas_width  - diam2 ) / 2.0 );
-    pos_y         = (int16_t) round( (double)(canvas_height - diam2 ) / 2.0 );
-
-    char* color = ae_X11_window::get_color( cds->get_mean() );
-    win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color );
-    delete [] color;
-
-    cds_node = cds_node->get_next();
-  }
-
-
-
-
-
-
-
-
-
-  // --------------------------------------------------------------------------This is temporary, it is a big copy-paste of what's above.
-  if ( _allow_plasmids )
-  {
-    // Retreive the genetic unit corresponding to the plasmid
-    ae_genetic_unit* gen_unit = get_genetic_unit(1);
-    if ( gen_unit == NULL ) return;
-
-    int32_t genome_length = gen_unit->get_dna()->get_length();
-
-
-    // Compute display diameter according to genome length and window size
-    int16_t canvas_width;
-    int16_t canvas_height;
-    int16_t canvas_size ;
-    if ( _allow_plasmids )
-    {
-      canvas_width  = win->get_width() / 2;
-      canvas_size   = canvas_width;
-    }
-    else
-    {
-      canvas_width  = win->get_width();
-      canvas_size   = ae_utils::min( canvas_width, canvas_width );
-    }
-    canvas_height = win->get_height();
-
-    int16_t diam  = round( canvas_size * log( (double)genome_length ) / 16 );
-
-    // Prevent diameter from getting greater than 2/3 of the window size
-    if ( diam > 2 * canvas_size / 3 )
-    {
-      diam = 2 * canvas_size / 3;
-    }
-
-    // Compute coordinates of the upper-left corner of the containing square
-    int16_t pos_x = canvas_width + (canvas_width - diam) / 2;
-    int16_t pos_y = (canvas_height - diam) / 2;
-
-
-    // Draw main circle
-    win->draw_circle( pos_x, pos_y, diam );
-
-    // Sector occupation management
-    reset_sectors();
-
-
-    // ---------------
-    //  Draw each CDS
-    // ---------------
-    ae_list_node<ae_protein*>* cds_node  = NULL;
-    ae_protein*   cds       = NULL;
-
-    // NB : As we want OriC to be at the "top" of the circle and the orientation
-    //      to be clockwise, the drawing angle (theta) will be given as
-    //      (90 - alpha), alpha being the "classical" trigonometric angle
-    int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
-    int16_t theta_first, theta_last; // Transposed angles on the trigonometric circle (degrees)
-    int16_t nb_sect;
-    // Same as above with precision = 1/64 degree
-    int16_t alpha_first_64, alpha_last_64;
-    int16_t theta_first_64, theta_last_64;
-    int16_t nb_sect_64;
-
-    // ----------------
-    //  LEADING strand
-    // ----------------
-    cds_node = gen_unit->get_protein_list()[LEADING]->get_first();
-
-    while ( cds_node != NULL )
-    {
-      cds = cds_node->get_obj();
-
-      // Alpha : angles from OriC (in degrees)
-      // Theta : angles on the trigonometric circle (in degrees)
-      // nb_sect : "length" in degrees of the arc to be drawn
-      alpha_first   = (int16_t) round(  360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-      alpha_last    = (int16_t) round(  360 * ((double)cds->get_last_translated_pos()  / (double)genome_length ));
-      theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-      theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-      nb_sect       = ae_utils::mod( alpha_last - alpha_first + 1,  360 );
-
-      // These are the same as above but with a higher precision (1/64 degrees)
-      alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-      alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds->get_last_translated_pos() / (double)genome_length ));
-      theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-      theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-      nb_sect_64       = ae_utils::mod( alpha_last_64 - alpha_first_64 + 1,  64 * 360 );
-
-
-      // Look for the inmost layer that has all the sectors between
-      // theta_first and theta_last free
-      int16_t layer = 0;
-      bool sectors_free = false;
-      while ( ! sectors_free )
-      {
-        sectors_free = true;
-
-        for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-        {
-          if ( _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] )
-          {
-            sectors_free = false;
-            break;
-          }
-        }
-
-        if ( sectors_free )
-        {
-          break; // All the needed sectors are free on the current layer
-        }
-        else
-        {
-          layer++;
-
-          if ( layer >= _outmost_layer )
-          {
-            add_layer();
-            break; // An added layer is necessarily free, no need to look further
-          }
-        }
-      }
-
-      // Mark sectors to be drawn as occupied
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] = true;
-      }
-      // Mark flanking sectors as occupied
-      _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first+1, 360)] = true;
-      _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-nb_sect, 360)] = true;
-
-
-      // Draw
-      const int8_t cds_layer_spacing = 5; // TODO : param?
-      layer++; // index starting at 0 but needed to start at 1
-
-      int16_t diam2 = diam + (layer * 2 * cds_layer_spacing);
-      pos_x         = canvas_width + (int16_t) round( (double)(canvas_width  - diam2 ) / 2.0 );
-      pos_y         = (int16_t) round( (double)(canvas_height - diam2 ) / 2.0 );
-
-      char* color = ae_X11_window::get_color( cds->get_mean() );
-      win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color );
-      delete [] color;
-
-      cds_node = cds_node->get_next();
-    }
-
-    // ----------------
-    //  LAGGING strand
-    // ----------------
-    cds_node = gen_unit->get_protein_list()[LAGGING]->get_first();
-
-    while ( cds_node != NULL )
-    {
-      cds = cds_node->get_obj();
-
-      // Alpha : angles from OriC (in degrees)
-      // Theta : angles on the trigonometric circle (in degrees)
-      // nb_sect : "length" in degrees of the arc to be drawn
-      alpha_first   = (int16_t) round(  360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-      alpha_last    = (int16_t) round(  360 * ((double)cds->get_last_translated_pos()  / (double)genome_length ));
-      theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-      theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-      nb_sect = ae_utils::mod( alpha_first - alpha_last + 1,  360 );
-
-      // These are the same as above but with a higher precision (1/64 degrees)
-      alpha_first_64   = (int16_t) round(64 * 360 * ((double)cds->get_first_translated_pos() / (double)genome_length ));
-      alpha_last_64    = (int16_t) round(64 * 360 * ((double)cds->get_last_translated_pos() / (double)genome_length ));
-      theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-      theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-      nb_sect_64 = ae_utils::mod( alpha_first_64 - alpha_last_64 + 1,  64 * 360 );
-
-
-      // Look for the inmost layer that has all the sectors between
-      // theta_first and theta_last free
-      int16_t layer = 0;
-      bool sectors_free = false;
-      while ( ! sectors_free )
-      {
-        sectors_free = true;
-
-        for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-        {
-          if ( _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] )
-          {
-            sectors_free = false;
-            break;
-          }
-        }
-
-        if ( sectors_free )
-        {
-          break; // All the needed sectors are free on the current layer
-        }
-        else
-        {
-          layer++;
-
-          if ( layer >= _outmost_layer )
-          {
-            add_layer();
-            break; // An added layer is necessarily free, no need to look further
-          }
-        }
-      }
-
-      // Mark sectors to be drawn as occupied
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] = true;
-      }
-      // Mark flanking sectors as occupied
-      _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first-1, 360)] = true;
-      _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+nb_sect, 360)] = true;
-
-
-      // Draw
-      const int8_t cds_layer_spacing = 5; // TODO : param?
-      layer++; // index starting at 0 but needed to start at 1
-
-      int16_t diam2 = diam - (layer * 2 * cds_layer_spacing);
-      pos_x         = canvas_width + (int16_t) round( (double)(canvas_width  - diam2 ) / 2.0 );
-      pos_y         = (int16_t) round( (double)(canvas_height - diam2 ) / 2.0 );
-
-      char* color = ae_X11_window::get_color( cds->get_mean() );
-      win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color );
-      delete [] color;
-
-      cds_node = cds_node->get_next();
-    }
-  }
-}
-
-void ae_individual_X11::display_rnas( ae_X11_window* win )
-{
-  // Retreive the genetic unit corresponding to the main chromosome
-  ae_genetic_unit* gen_unit = _genetic_unit_list->get_first()->get_obj();
-  int32_t genome_length = gen_unit->get_dna()->get_length();
-
-  // Display the number of RNAs
-  char nb_rna[40];
-  sprintf( nb_rna, "Leading : %"PRId32" RNAs", gen_unit->get_rna_list()[LEADING]->get_nb_elts() );
-  win->draw_string( 15, 15, nb_rna );
-  sprintf( nb_rna, "Lagging : %"PRId32" RNAs", gen_unit->get_rna_list()[LAGGING]->get_nb_elts() );
-  win->draw_string( 15, 30, nb_rna );
-
-  // Compute display diameter according to genome length and window size
-  int16_t win_size      = ae_utils::min( win->get_width(), win->get_height() );
-  int16_t diam          = round( win_size * log( (double)genome_length ) / 16 );
-
-  // Prevent diameter from getting greater than 2/3 of the window size
-  if ( diam > 2 * win_size / 3 )
-  {
-    diam = 2 * win_size / 3;
-  }
-
-  // Compute coordinates of the upper-left corner of the containing square
-  int16_t pos_x = (win->get_width() - diam) / 2;
-  int16_t pos_y = (win->get_height() - diam) / 2;
-
-  // Draw main circle
-  win->draw_circle( pos_x, pos_y, diam );
-
-  // Sector occupation management
-  reset_sectors();
-
-
-  // ---------------
-  //  Draw each RNA
-  // ---------------
-  ae_list_node<ae_rna*>* rna_node  = NULL;
-  ae_rna*       rna       = NULL;
-
-  // NB : As we want OriC to be at the "top" of the circle and the orientation
-  //      to be clockwise, the drawing angle (theta) will be given as
-  //      (90 - alpha), alpha being the "classical" trigonometric angle
-  int16_t alpha_first, alpha_last; // Angles of first and last transcribed bases from OriC (degrees)
-  int16_t theta_first, theta_last; // Transposed angles on the trigonometric circle (degrees)
-  int16_t nb_sect;
-  // Same as above with precision = 1/64 degree
-  int16_t alpha_first_64, alpha_last_64;
-  int16_t theta_first_64, theta_last_64;
-  int16_t nb_sect_64;
-
-  // ----------------
-  //  LEADING strand
-  // ----------------
-  rna_node = gen_unit->get_rna_list()[LEADING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-
-    // Alpha : angles from OriC (in degrees)
-    // Theta : angles on the trigonometric circle (in degrees)
-    // nb_sect : "length" in degrees of the arc to be drawn
-    alpha_first   = (int16_t) round(  360 * ((double)rna->get_first_transcribed_pos() / (double)genome_length ));
-    alpha_last    = (int16_t) round(  360 * ((double)rna->get_last_transcribed_pos() / (double)genome_length ));
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    nb_sect       = ae_utils::mod( alpha_last - alpha_first + 1,  360 );
-
-    // These are the same as above but with a higher precision (1/64 degrees)
-    alpha_first_64   = (int16_t) round(64 * 360 * ((double)rna->get_first_transcribed_pos() / (double)genome_length ));
-    alpha_last_64    = (int16_t) round(64 * 360 * ((double)rna->get_last_transcribed_pos() / (double)genome_length ));
-    theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-    theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-    nb_sect_64       = ae_utils::mod( alpha_last_64 - alpha_first_64 + 1,  64 * 360 );
-
-    //~ printf( "    LEADING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->get_first_transcribed_pos(), rna->get_last_transcribed_pos(), theta_first, theta_last );
-
-
-    // Look for the inmost layer that has all the sectors between
-    // theta_first and theta_last free
-    int16_t layer = 0;
-    bool sectors_free = false;
-    while ( ! sectors_free )
-    {
-      sectors_free = true;
-
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        if ( _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] )
-        {
-          sectors_free = false;
-          break;
-        }
-      }
-
-      if ( sectors_free )
-      {
-        break; // All the needed sectors are free on the current layer
-      }
-      else
-      {
-        layer++;
-
-        if ( layer >= _outmost_layer )
-        {
-          add_layer();
-          break; // An added layer is necessarily free, no need to look further
-        }
-      }
-    }
-
-    // Mark sectors to be drawn as occupied
-    for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-    {
-      _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-rho, 360)] = true;
-    }
-    // Mark flanking sectors as occupied
-    _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first+1, 360)] = true;
-    _occupied_sectors[LEADING][layer][ae_utils::mod(theta_first-nb_sect, 360)] = true;
-
-
-    // Determine drawing color
-    char* color;
-    if ( rna->is_coding() )
-    {
-      color = ae_X11_window::get_color( rna->get_basal_level() );
-    }
-    else
-    {
-      color = new char[8];
-      strcpy( color, "#FFFFFF" );
-    }
-
-    // Draw arrow body
-    const int8_t rna_layer_spacing = 5; // TODO : param?
-    layer++; // index starting at 0 but needed to start at 1
-
-    int16_t diam2 = diam + (layer * 2 * rna_layer_spacing);
-    pos_x         = (int16_t) round( (double)(win->get_width()  - diam2 ) / 2.0 );
-    pos_y         = (int16_t) round( (double)(win->get_height() - diam2 ) / 2.0 );
-
-    win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64 - nb_sect_64, nb_sect_64, color );
-
-    // Draw arrow head
-    int8_t arrow_thick = 6; // Must be an even value
-    pos_x = (win->get_width() / 2.0) + (cos((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
-    pos_y = (win->get_height() / 2.0) - (sin((theta_first_64 - nb_sect_64)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
-
-    win->fill_arc( pos_x, pos_y, arrow_thick, ae_utils::mod(180+theta_last, 360), 180, color );
-
-    delete [] color;
-
-    rna_node = rna_node->get_next();
-  }
-
-  // ----------------
-  //  LAGGING strand
-  // ----------------
-  rna_node = gen_unit->get_rna_list()[LAGGING]->get_first();
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-
-    // Alpha : angles from OriC (in degrees)
-    // Theta : angles on the trigonometric circle (in degrees)
-    // nb_sect : "length" in degrees of the arc to be drawn
-    alpha_first   = (int16_t) round(  360 * ((double)rna->get_first_transcribed_pos() / (double)genome_length ));
-    alpha_last    = (int16_t) round(  360 * ((double)rna->get_last_transcribed_pos()  / (double)genome_length ));
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    nb_sect = ae_utils::mod( alpha_first - alpha_last + 1,  360 );
-
-    // These are the same as above but with a higher precision (1/64 degrees)
-    alpha_first_64   = (int16_t) round(64 * 360 * ((double)rna->get_first_transcribed_pos() / (double)genome_length ));
-    alpha_last_64    = (int16_t) round(64 * 360 * ((double)rna->get_last_transcribed_pos()  / (double)genome_length ));
-    theta_first_64   = ae_utils::mod( 64 * 90 - alpha_first_64, 64 * 360 );
-    theta_last_64    = ae_utils::mod( 64 * 90 - alpha_last_64, 64 * 360 );
-    nb_sect_64 = ae_utils::mod( alpha_first_64 - alpha_last_64 + 1,  64 * 360 );
-
-    //~ printf( "    LAGGING RNA %"PRId32" => %"PRId32" :: %"PRId16" %"PRId16"\n", rna->get_first_transcribed_pos(), rna->get_last_transcribed_pos(), theta_first, theta_last );
-
-
-    // Look for the inmost layer that has all the sectors between
-    // theta_first and theta_last free
-    int16_t layer = 0;
-    bool sectors_free = false;
-    while ( ! sectors_free )
-    {
-      sectors_free = true;
-
-      for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-      {
-        if ( _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] )
-        {
-          sectors_free = false;
-          break;
-        }
-      }
-
-      if ( sectors_free )
-      {
-        break; // All the needed sectors are free on the current layer
-      }
-      else
-      {
-        layer++;
-
-        if ( layer >= _outmost_layer )
-        {
-          add_layer();
-          break; // An added layer is necessarily free, no need to look further
-        }
-      }
-    }
-
-    // Mark sectors to be drawn as occupied
-    for ( int16_t rho = 0 ; rho < nb_sect ; rho++ )
-    {
-      _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+rho, 360)] = true;
-    }
-    // Mark flanking sectors as occupied
-    _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first-1, 360)] = true;
-    _occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first+nb_sect, 360)] = true;
-
-
-    // Determine drawing color
-    char* color;
-    if ( rna->is_coding() )
-    {
-      color = ae_X11_window::get_color( rna->get_basal_level() );
-    }
-    else
-    {
-      color = new char[8];
-      strcpy( color, "#FFFFFF" );
-    }
-
-    // Draw arrow body
-    const int8_t rna_layer_spacing = 5; // TODO : param?
-    layer++; // index starting at 0 but needed to start at 1
-
-    int16_t diam2 = diam - (layer * 2 * rna_layer_spacing);
-    pos_x         = (int16_t) round( (double)(win->get_width()  - diam2 ) / 2.0 );
-    pos_y         = (int16_t) round( (double)(win->get_height() - diam2 ) / 2.0 );
-
-    win->draw_arc_64( pos_x, pos_y, diam2, theta_first_64, nb_sect_64, color );
-
-    // Draw arrow head
-    int8_t arrow_thick = 6; // Must be an even value
-    pos_x = (win->get_width() / 2.0) + (cos((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
-    pos_y = (win->get_height() / 2.0) - (sin((theta_last_64+1)/(64*180.0)*M_PI) * diam2 / 2.0) - (arrow_thick / 2.0);
-
-    win->fill_arc( pos_x, pos_y, arrow_thick, theta_last, 180, color );
-
-    delete [] color;
-
-    rna_node = rna_node->get_next();
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_individual_X11::add_layer( void )
-{
-  _occupied_sectors[LEADING][_outmost_layer] = new bool[360];
-  _occupied_sectors[LAGGING][_outmost_layer] = new bool[360];
-
-  for ( int16_t angle = 0 ; angle < 360 ; angle++ )
-  {
-    _occupied_sectors[LEADING][_outmost_layer][angle] = false;
-    _occupied_sectors[LAGGING][_outmost_layer][angle] = false;
-  }
-
-  _outmost_layer++;
-}
-
-void ae_individual_X11::init_occupied_sectors( void )
-{
-  _outmost_layer = 1;
-
-  for ( int16_t layer = 0 ; layer < _outmost_layer ; layer++ )
-  {
-    _occupied_sectors[LEADING][layer] = new bool[360];
-    _occupied_sectors[LAGGING][layer] = new bool[360];
-  }
-}
-
-void ae_individual_X11::reset_sectors( void )
-{
-  for ( int16_t layer = 0 ; layer < _outmost_layer ; layer++ )
-  {
-    for ( int16_t angle = 0 ; angle < 360 ; angle++ )
-    {
-      _occupied_sectors[LEADING][layer][angle] = false;
-      _occupied_sectors[LAGGING][layer][angle] = false;
-    }
-  }
-}
diff --git a/src/libaevol/ae_individual_X11.h b/src/libaevol/ae_individual_X11.h
deleted file mode 100644
index b734343..0000000
--- a/src/libaevol/ae_individual_X11.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// ****************************************************************************
-
-
-#ifndef  __AE_INDIVIDUAL_X11_H__
-#define  __AE_INDIVIDUAL_X11_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_individual.h>
-#include <ae_X11_window.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_individual_X11 : public virtual ae_individual
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_individual_X11(  ae_exp_manager* exp_m,
-                        ae_jumping_mt* mut_prng,
-                        ae_jumping_mt* stoch_prng,
-                        ae_params_mut* param_mut,
-                        double w_max,
-                        int32_t min_genome_length,
-                        int32_t max_genome_length,
-                        bool allow_plasmids,
-                        int32_t id,
-                        char* strain_name,
-                        int32_t age );
-
-    ae_individual_X11( ae_exp_manager* exp_manager, gzFile backup_file );
-    ae_individual_X11( const ae_individual_X11 &model, bool replication_report_copy );
-    ae_individual_X11(  ae_individual_X11* const parent, int32_t id,
-                        ae_jumping_mt* mut_prng, ae_jumping_mt* stoch_prng );
-    //~ ae_individual_X11( char* genome, int32_t genome_size );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_individual_X11( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    virtual void display( void );
-    virtual void display_cdss( ae_X11_window* win );
-    virtual void display_rnas( ae_X11_window* win );
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_individual_X11( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void reset_sectors( void );
-    void add_layer( void );
-    void init_occupied_sectors( void );
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    // These are used to manage overlapping CDS and RNA display
-    int16_t _outmost_layer;
-    bool*   _occupied_sectors[2][100];  // TODO : find a way to manage this table's size properly?
-};
-
-
-// =====================================================================
-//                          Accessors definitions
-// =====================================================================
-
-
-#endif // __AE_INDIVIDUAL_X11_H__
diff --git a/src/libaevol/ae_jump_poly.h b/src/libaevol/ae_jump_poly.h
deleted file mode 100644
index 965ddba..0000000
--- a/src/libaevol/ae_jump_poly.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-/*! \brief Definition of jumping polynomials for various settings of the Mersenne Twister
-*/
-
-
-#ifndef __AE_JUMP_POLYS_H__
-#define __AE_JUMP_POLYS_H__
-
-#if SFMT_MEXP == 607
-const char* jump_poly = "2c375358c852082b88bdf47ffe5ac31b6cd4e255a12f271951f250f805d473248be9e75baee81f0474e793983cdc11c198d269b4bd9c34ca9eec3f91cceb172450d9b6001eaa29d97ba1cdb59c50684e";
-#elif SFMT_MEXP == 1279
-const char* jump_poly = "d9b26ff41ff79250750aa52e7426726d6ade8b9ee66174636bc772ade2aec8f913f573763a809dbeebac14488a5e04da0adc700e064da0ee470935e771d119eb9f08bfa78a3ac74516f4aa8b7885bf212287c03ab64837e8a56c12a0862adfc9a6d054e372b3ae2e11cd2d3c4a3ea924b6beb11f8f96227c61cf8b528b59565b2c040962d5d24d37cf7a0dee5175ca10e0ac797f8f1a3eb99a319ad15d540996";
-#elif SFMT_MEXP == 2281
-const char* jump_poly = "2b1e867bcc6a7adda82c2a26cb38b0ccb7f236848f6c3179e98b5d8b9db21d7df3bfa37941c8fcc0fa42cc4e244503040bad9575e6b0c138d52fe3f83b851495995a561ce64df116fa918b247e3a43817dd77f41115150cf2802c7a511f4e1487798ae3ee0b3cc2e155f82575731dc3bca3a08df85f511179bd7435c9594bd8dc28068d35251820015cd3ef7a23c8d5a1cabb6149a8e36216d4c9838b3ef79d06cb6e2f6e26daef80c2803f11bc03d06f75c2d69f064b72d3abf526961af2510cf688af3f2bfc56e7e4e11286a6302ee21e1109e0f3fbe328d9ad907976fde4aff6e683e3645e275a09 [...]
-#elif SFMT_MEXP == 4253
-const char* jump_poly = "9da17b7f8b81dd8668afea353420300fc56674207f120d8350c6b565d3a04608ebad52f9826d4f0d30b6547ef0ee6be8bfd85d970ee9d7573c72f44a7a90f2eb86d59528a8146b811407f1b08c61d5e349bda9aac6a04a785ba66736e5160858e123a2d06fdfe59eef6e7093b54da08219a3f179cd2776e4595bce3c72307dc555f3d9485d1f82b2a46dded685d2e200d93584a49eae81b541d2e7eb0a1c3cf8d13ba75119a15e606decbb2067e8a760bd024a3dc2b2c703fae28db65a0fbca2466aa2bac285200cfd1702a9b47b29541ae4375b23734d0ff26254e855ad912e9260713a1d205614575 [...]
-#elif SFMT_MEXP == 11213
-const char* jump_poly = "e1fb174eeaec8c048fdd060653c54c0e59746d6bc66ff4cabbbda5f086d06d3796982a80b6467dde91bcd2922b87732361602b2c5610b8146fda7090b5d82aca1c69d40fa235b4f9b44bfc75bf670d089dae22e63f416d009eda5ec00af694026ff7fa0889f830d1ffd0863785190a8c65ff1baa8f5379451d3964766c7e205aa30c66c33f7734a906f8348e008d5d8f1194625711028a77443c986cb71f19b805c9866afdf2f65aed441faa734749dab56e908d1c8edfcba9b0b65752ad5cdafb4efbb18f3bff49974f26cca3a5ac90f97a714fa0b84124f227b4cde80230911be4493a927dc1125bc [...]
-#elif SFMT_MEXP == 19937
-const char* jump_poly = "a23d5563c1fff635b7d3687fe879e3d54f7caddb7371f6174fbd8870d7b7db4aedc6a2c671133f72ab011abf5a98910b1024f2e5c1e89722572831d99320b814b252d58f9433ca547804394c69f4ed2b612068320daad25dc1e0bcef4c59deaa0095329c362103eda909c683e0a9b398efc2b69ac74087f0443842ce5c618d4bb58c66b3046dc752a633f040b2be7b32c7e7de01e17f93a10329d9249bb0a9c25bc41f3831c66a255a61904ce209dee70e7448df9aa741d01da9368ff827915b6f5860cdce17ee9c0e462fdb983709229b4e011796e425d5c0c42079bdae36dcda37603310dbad7b9ec [...]
-#elif SFMT_MEXP == 44497
-const char* jump_poly = "6caad9646010c6e030ad6486ede1d7e2d0d9122a99553188d1972357e0eeeb500586646c540a925f430cbfef2ec953b259bc21128bc82e8e3fdd29310fc07e48578b710f4002a6bc178b59dbbab4e2d999c2ad41844859541c857e4efb86f1b66ffce0d43aa66a041ec2b48ec669cca2fb86abac00cb2e8323bf3977d0bbb2c7c711b4bed35578d7b8bfb6cd0698ca5112785bd5e94604c825e3a268cf5e83d30cf2f587d5267e7938053291e837ddfa99baa243aa39ea065f893854ff28987163ae1aa0b4c1cfa186c8046add5844d345401f8a56e0b4240484551f0431da0620cbbd33bd9cab2c833 [...]
-#elif SFMT_MEXP == 86243
-const char* jump_poly = "933da3fcceeb5ce9c3b6f2eea0dda398900240ba716aef34723cf6d7417c4318858493833a3cbb3d094d1b5b977c7a87105827de0ac72d586ef73bd385022eb28e52f3ac527785bede4fda45a0f320de350efecae3a0553e56f4aab32e02124bf83b07f989d2b37fbc4b45c994ccd03f909a83e08c7458a8bc79dc5eda62b7667ea1acf094b636e81119b9a9ec0ddadb9c3433de8d0516d456b529e9fa08382f030c411dfa02a7adaf9a16ce5193f0a17b673d4c5f32b296b21a3af5bdc6da5f4043d34599b04c55ac6f0d4f4dc28ea46101bfa35219d2b79a33cfeb9612bfbcd761925e2363d39144c [...]
-#elif SFMT_MEXP == 132049
-const char* jump_poly = "ee86f54b0be59c6204771bea03d614ca275a40a9a3ef32f8a14fea7d0a74faef106b8c6406a8dc468b78b5494b3620ac0b895c23685904c1cefb5c80336caa2ef9d5b595733f2a6f4ba6f1acc44cce80ba67f0da127f98de09e07314c32551a9854d09a8d9a64b9f3feaec4551d7192c49c2f02ecc26f5f2fd1da46a77aa0c3f50576c5cb604105abb3af3acfaa7ba2dbe5df35af84dffe4ae0cebaa2fa8ff5c85ffa5dadb5881d02acaf4c7412a8c1b29503150c96fa2dac1dd44d771fd6751bb3b53082a9723e2a80de276229143bdee8e97ff04330b01b18c045eea05eb2dcde96d4aba501139e5a [...]
-#elif SFMT_MEXP == 216091
-const char* jump_poly = "fabdf682938a008933e7f552cdb0c935af57be5a1b9ad2331f52d39f03f0faf355a359cf9953bb56f515d37ec77c1a681737893e649c9552c7d4b275924c17a7395674d620a389468d1735220fc98d9d562a3a04c82b9155ce8b367353578f378cef6e8da22df79d90d2e6caca511b9fd96d3e6bf03e3b2fdb9d7639999fc77a14373f339f30c3c54d575eb043a38fd1fa1a1b1175ed5f31d40e374b2f1ed6ed98dc24a8a8c0d47a208ab0ac2ec865b4f8ba268081d727ff07965bba7a47fe9500ccf12f4d042613bba5a65fbdaa51b05bd28b0a2839d51e887aadb91ca89c0b627539faeb75f774c2e [...]
-#endif
-
-
-#endif // __AE_JUMP_POLYS_H__
diff --git a/src/libaevol/ae_list.h b/src/libaevol/ae_list.h
deleted file mode 100644
index 37f5fe6..0000000
--- a/src/libaevol/ae_list.h
+++ /dev/null
@@ -1,981 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// ****************************************************************************
-
-
-#ifndef AE_LIST_H
-#define AE_LIST_H
-
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-template <typename T>
-class ae_list;
-
-
-
-
-template <typename T>
-class ae_list_node
-{
-  friend class ae_list<T>;
-
-  public :
-    inline ae_list_node( T obj, ae_list_node* prev = NULL, ae_list_node* next = NULL );
-
-    // Make a new node sharing the same object as 'model'
-    // The created node is unlinked
-    inline ae_list_node( const ae_list_node &model );
-
-    virtual inline ~ae_list_node( void );
-
-    inline T&             get_obj( void );
-    inline ae_list_node*  get_prev( void );
-    inline ae_list_node*  get_next( void );
-
-    inline void set_obj( T obj );
-
-  protected :
-    ae_list_node( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    T _obj;
-    ae_list_node* _prev;
-    ae_list_node* _next;
-};
-
-
-
-
-template <typename T>
-class ae_list
-{
-  public :
-    inline ae_list();
-    //~ inline ae_list( ae_list* parent );
-    /*inline ae_list( const ae_list &model );*/
-    inline virtual ~ae_list();
-
-    // Add obj in a newly created node at the end (resp beginning) of the list
-    // => syntaxic sugar for add_after( obj, _last );
-    // (resp add_before( obj, _first );)
-    inline ae_list_node<T>* add( T obj );
-    inline ae_list_node<T>* add_front( T obj );
-
-    // Link a node at the end (resp beginning) of the list. The node must be unlinked
-    // => syntaxic sugar for insert_after( node, _last );
-    // (resp insert_before( obj, _first );)
-    inline void add( ae_list_node<T>* node );
-    inline void add_front( ae_list_node<T>* node );
-
-    // Add obj in a newly created node before (resp after) node n
-    inline ae_list_node<T>* add_before( T obj, ae_list_node<T>* n );
-    inline ae_list_node<T>* add_after(  T obj, ae_list_node<T>* n );
-
-    // Insert node n1 before (resp after) node n2
-    inline void insert_before( ae_list_node<T>* n1, ae_list_node<T>* n2 ); // TODO add au lieu de insert
-    inline void insert_after(  ae_list_node<T>* n1, ae_list_node<T>* n2 );
-
-    // Invert nodes n1 and n2
-    inline void invert( ae_list_node<T>* n1, ae_list_node<T>* n2 );
-
-    // Remove object from list and delete it if delete_obj is true
-    inline void remove( T obj, bool delete_node, bool delete_obj );
-    inline void remove( ae_list_node<T>* node, bool delete_node, bool delete_obj );
-
-    // Remove all the nodes between node_1 and node_2 (included) from the list and return
-    // a new list containing the removed nodes (order is conserved)
-    inline ae_list<T>* extract_sublist(ae_list_node<T>* first_node, ae_list_node<T>* last_node );
-    inline ae_list<T>* extract_sublist(int32_t first, int32_t last );
-    inline ae_list<T>* extract_starting_sublist( ae_list_node<T>* last_node );
-    inline ae_list<T>* extract_starting_sublist( int32_t last );
-    inline ae_list<T>* extract_ending_sublist( ae_list_node<T>* first_node );
-    inline ae_list<T>* extract_ending_sublist( int32_t first );
-
-    // Erase the list (nodes are deleted).
-    // Objects are deleted if delete_obj is true
-    inline void erase( bool delete_obj );
-
-    // Add the elements of 'append' at the end of the list.
-    // 'append' is emptied.
-    inline void merge( ae_list<T> * append );
-
-    // Add the elements of 'to_add' as new nodes at the end of the list.
-    // 'to_add' is untouched.
-    inline void add_list( ae_list<T> * const to_add );
-
-
-    inline int32_t  get_nb_elts( void ) const;
-    inline bool     is_empty( void ) const;
-
-    inline int32_t get_position( T obj ) const;
-    inline ae_list_node<T>* get_node( int32_t pos ) const;
-    inline T get_object( int32_t pos ) const;
-
-    // Accessors
-    inline ae_list_node<T>* get_first( void ) const { return _first; };
-    inline ae_list_node<T>* get_last( void )  const { return _last; };
-
-    // Search for a value WITHIN the object.
-    inline ae_list_node<T>* bsearch( void* needle, int ( * comparator ) ( const void * value, const void * object ) ) const;
-
-
-  protected :
-    ae_list_node<T>* _first;
-    ae_list_node<T>* _last;
-    int32_t       _nb_elts;
-};
-
-
-// Constructor
-template <typename T>
-ae_list<T>::ae_list()
-{
-  _last = _first = NULL;
-  _nb_elts = 0;
-}
-
-
-// Doesn't create new objects
-/*ae_list::ae_list( const ae_list &model )
-{
-  _last = _first = NULL;
-  _nb_elts = 0;
-
-  ae_list_node* node = model._first;
-
-  while ( node != NULL )
-  {
-    add( node->get_obj() );
-
-    node = node->get_next();
-  }
-}*/
-
-
-// Destructor
-template <typename T>
-ae_list<T>::~ae_list()
-{
-  erase( false );
-}
-
-// Add obj in a newly created node at the end of the list
-template <typename T>
-ae_list_node<T>* ae_list<T>::add( T obj )
-{
-  ae_list_node<T>* node = new ae_list_node<T>( obj, _last, NULL );
-  assert( node );
-
-  if ( _last != NULL ) _last->_next = node;
-  _last = node;
-  if ( _first == NULL ) _first = node;
-  _nb_elts++;
-  return node;
-}
-
-// Add obj in a newly created node at the beginning of the list
-template <typename T>
-ae_list_node<T>* ae_list<T>::add_front( T obj )
-{
-  ae_list_node<T>* node = new ae_list_node<T>( obj, NULL, _first );
-  assert( node );
-
-  if ( _first != NULL ) _first->_prev = node;
-  _first = node;
-  if ( _last == NULL ) _last = node;
-  _nb_elts++;
-  return node;
-}
-
-
-// Add a node at the end of the list. The node must be unlinked
-template <typename T>
-void ae_list<T>::add( ae_list_node<T>* node )
-{
-  node->_prev = _last;
-  node->_next = NULL;
-  if( _last != NULL ) _last->_next = node;
-  _last = node;
-  if( _first == NULL ) _first = node;
-  _nb_elts++;
-}
-
-
-// Add a node at the beginning of the list. The node must be unlinked
-template <typename T>
-void ae_list<T>::add_front( ae_list_node<T>* node )
-{
-  node->_prev = NULL;
-  node->_next = _first;
-  if( _first != NULL ) _first->_prev = node;
-  _first = node;
-  if( _last == NULL ) _last = node;
-  _nb_elts++;
-}
-
-
-// Add obj in a newly created node before node n
-template <typename T>
-ae_list_node<T>* ae_list<T>::add_before( T obj, ae_list_node<T>* n )
-{
-  ae_list_node<T>* node = new ae_list_node<T>( obj, NULL, NULL );
-  assert( node );
-
-  insert_before( node, n );
-
-  return node;
-}
-
-
-// Add obj in a newly created node after node n
-template <typename T>
-ae_list_node<T>* ae_list<T>::add_after( T obj, ae_list_node<T>* n )
-{
-  ae_list_node<T>* node = new ae_list_node<T>( obj, NULL, NULL );
-  assert( node );
-
-  insert_after( node, n );
-
-  return node;
-}
-
-
-// Insert node n1 before n2
-template <typename T>
-void ae_list<T>::insert_before( ae_list_node<T> * n1, ae_list_node<T> * n2 )
-{
-  // save node before n2
-  ae_list_node<T> * n2_prev = n2->_prev;
-
-  // link n1 -> n2
-  n1->_next = n2;
-  n2->_prev = n1;
-
-  // link (n2->_prev) -> n1
-  n1->_prev = n2_prev;
-  if (n2_prev == NULL)
-  {
-    // n2 was _first
-    _first = n1;
-  }
-  else
-  {
-    n2_prev->_next = n1;
-  }
-
-  _nb_elts++;
-}
-
-
-// Insert node n1 after n2
-template <typename T>
-void ae_list<T>::insert_after( ae_list_node<T> * n1, ae_list_node<T> * n2 )
-{
-  assert( n1 != NULL && n2 != NULL );
-
-  // save node after n2
-  ae_list_node<T> * n2_next = n2->_next;
-
-  // link n2 -> n1
-  n2->_next = n1;
-  n1->_prev = n2;
-
-  // link n1 -> (n2->_next)
-  n1->_next = n2_next;
-  if (n2_next == NULL)
-  {
-    // n2 was _last
-    _last = n1;
-  }
-  else
-  {
-    n2_next->_prev = n1;
-  }
-
-  _nb_elts++;
-}
-
-
-// Invert nodes n1 and n2
-template <typename T>
-void ae_list<T>::invert( ae_list_node<T> * n1, ae_list_node<T> * n2 )
-{
-  // Optim if nodes are consecutive
-  if ( n2 == n1->_next || n1 == n2->_next )
-  {
-    if ( n1 == n2->_next )
-    {
-      // Exchange n1 and n2
-      ae_list_node<T> * tmp = n1;
-      n1 = n2;
-      n2 = tmp;
-    }
-
-    if ( n1 != _first ) n1->_prev->_next = n2;
-    else _first = n2;
-    if ( n2 != _last ) n2->_next->_prev = n1;
-    else _last = n1;
-    n2->_prev = n1->_prev;
-    n1->_next = n2->_next;
-    n2->_next = n1;
-    n1->_prev = n2;
-  }
-  else
-  {
-     // TODO
-    printf( "NOT IMPLEMENTED!!! %s %d\n", __FILE__, __LINE__ );
-    getchar();
-  }
-}
-
-
-// Remove object from list and delete it if delete_obj is true
-template <typename T>
-void ae_list<T>::remove( T obj, bool delete_node, bool delete_obj )
-{
-  for ( ae_list_node<T> * node = _first ; node != NULL ; node = node->_next )
-  {
-    if ( node->_obj == obj )
-    {
-      // unlink node
-      if ( node == _first )
-      {
-        _first = node->_next;
-      }
-      else if ( node->_prev )
-      {
-        node->_prev->_next = node->_next;
-      }
-
-      if ( node == _last )
-      {
-        _last = node->_prev;
-      }
-      else if ( node->_next )
-      {
-        node->_next->_prev = node->_prev;
-      }
-
-      // delete object (if requested)
-      if ( delete_obj )
-      {
-        if ( node->_obj != NULL )
-        {
-          delete node->_obj;
-          node->_obj = NULL;
-        }
-        else
-        {
-          printf( "%s:%d: Warning: Possible attempt to delete something twice\n", __FILE__, __LINE__ );
-        }
-      }
-
-      // delete node (if requested)
-      if ( delete_node )
-      {
-        if ( node != NULL )
-        {
-          delete node;
-          node = NULL;
-        }
-        else
-        {
-          printf( "%s:%d: Warning: Possible attempt to delete something twice\n", __FILE__, __LINE__ );
-        }
-      }
-
-      _nb_elts--;
-      return;
-    }
-  }
-}
-
-
-// Remove node from list and delete the corrresponding object if delete_obj is true
-// Assumes node is in the list
-template <typename T>
-void ae_list<T>::remove( ae_list_node<T> * node, bool delete_node, bool delete_obj )
-{
-  // Unlink node
-  if( node == _first )
-  {
-    _first = node->_next;
-  }
-  else if(node->_prev != NULL)
-  {
-    node->_prev->_next = node->_next;
-  }
-  if(node == _last)
-  {
-    _last = node->_prev;
-  }
-  else if(node->_next) node->_next->_prev = node->_prev;
-
-  // delete object (if requested)
-  if ( delete_obj )
-  {
-    if ( node->_obj != NULL )
-    {
-      delete node->_obj;
-      node->_obj = NULL;
-    }
-    else
-    {
-      printf( "%s:%d: Warning: Possible attempt to delete something twice\n", __FILE__, __LINE__ );
-    }
-  }
-
-  // delete node (if requested)
-  if ( delete_node )
-  {
-    if ( node != NULL )
-    {
-      delete node;
-      node = NULL;
-    }
-    else
-    {
-      printf( "%s:%d: Warning: Possible attempt to delete something twice\n", __FILE__, __LINE__ );
-    }
-  }
-
-  _nb_elts--;
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove <n> elements from the list starting with that of index <first>
-  (included -- index start at 0) and return a new list containing the removed elements
-  (order is conserved)
-
-  @param first the index of the first element to be extracted
-  @param n the number of elements to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_sublist(int32_t first, int32_t n)
-{
-  assert(first >= 0 && n > 0 && first + n < _nb_elts);
-
-  // Get first node to extract
-  ae_list_node<T>* first_node = _first;
-  for (int32_t i = 0 ; i < first ; i++)
-  {
-    first_node = first_node->_next;
-  }
-
-  // Get last node to extract
-  ae_list_node<T>* last_node = first_node;
-  for (int32_t i = 1 ; i < n ; i++)
-  {
-    last_node = last_node->_next;
-  }
-
-  return extract_sublist(first_node, last_node);
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove the first <n> elements from the list and return a new list containing
-  the removed elements (order is conserved)
-
-  @param n the number of elements to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_starting_sublist(int32_t n)
-{
-  assert(n > 0 && n <= _nb_elts);
-
-  // Get last node to extract
-  ae_list_node<T>* last_node = _first;
-  for ( int32_t i = 1 ; i < n ; i++)
-  {
-    last_node = last_node->_next;
-  }
-
-  return extract_starting_sublist(last_node);
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove the last <n> elements from the list and return a new list containing
-  the removed elements (order is conserved).
-
-  @param n the number of elements to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_ending_sublist(int32_t n)
-{
-  assert(n > 0 && n <= _nb_elts);
-
-  // Get first node to extract
-  ae_list_node<T>* first_node = _last;
-  for (int32_t i = 1 ; i < n ; i++)
-  {
-    first_node = first_node->_prev;
-  }
-
-  return extract_ending_sublist(first_node);
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove all the elements between first_node and last_node (included) from the
-  list and return a new list containing the removed elements
-  (order is conserved)
-
-  @param first_node the first node to be extracted
-  @param last_node the last node to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_sublist(ae_list_node<T>* first_node,
-                                         ae_list_node<T>* last_node)
-{
-  assert(first_node != NULL && last_node != NULL);
-
-  ae_list<T> * new_list = new ae_list<T>();
-
-  new_list->_first  = first_node;
-  new_list->_last   = last_node;
-
-  if ( first_node == _first && last_node == _last )
-  {
-    new_list->_nb_elts  = _nb_elts;
-
-    _first    = NULL;
-    _last     = NULL;
-    _nb_elts  = 0;
-  }
-  else
-  {
-    if ( first_node == _first )
-    {
-      _first = last_node->_next;
-      _first->_prev = NULL;
-      last_node->_next = NULL;
-    }
-    else if ( last_node == _last )
-    {
-      _last = first_node->_prev;
-      _last->_next = NULL;
-      first_node->_prev = NULL;
-    }
-    else
-    {
-      first_node->_prev->_next = last_node->_next;
-      last_node->_next->_prev  = first_node->_prev;
-      first_node->_prev = NULL;
-      last_node->_next = NULL;
-    }
-
-
-    // Update number of elements of both lists
-    ae_list_node<T> * node = first_node;
-    new_list->_nb_elts++;
-    _nb_elts--;
-
-    while ( node != last_node )
-    {
-      new_list->_nb_elts++;
-      _nb_elts--;
-
-      node = node->_next;
-    }
-  }
-
-  return new_list;
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove all the elements before last_node (included) from the list
-  and return a new list containing the removed elements (order is conserved)
-
-  @param last_node the last node to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_starting_sublist(ae_list_node<T> * last_node)
-{
-  ae_list<T> * new_list = new ae_list<T>();
-
-  new_list->_first  = _first;
-  new_list->_last   = last_node;
-
-  if ( last_node == _last )
-  {
-    new_list->_nb_elts  = _nb_elts;
-
-    _first    = NULL;
-    _last     = NULL;
-    _nb_elts  = 0;
-  }
-  else
-  {
-    _first = last_node->_next;
-    _first->_prev = NULL;
-    last_node->_next = NULL;
-
-    // Update number of elements of both lists
-    ae_list_node<T> * node = last_node;
-
-    while ( node != NULL )
-    {
-      new_list->_nb_elts++;
-      _nb_elts--;
-
-      node = node->_prev;
-    }
-  }
-
-  return new_list;
-}
-
-
-/*!
-  @brief Remove elements from the list and returns them in a new list
-
-  Remove all the elements after first_node (included) from the list
-  and return a new list containing the removed elements (order is conserved)
-
-  @param first_node the first node to be extracted
-  @return a new list containing all the extracted elements (in the same order)
- */
-template <typename T>
-ae_list<T> * ae_list<T>::extract_ending_sublist(ae_list_node<T> * first_node)
-{
-  ae_list<T> * new_list = new ae_list<T>();
-
-  new_list->_first  = first_node;
-  new_list->_last   = _last;
-
-  if ( first_node == _first )
-  {
-    new_list->_nb_elts  = _nb_elts;
-
-    _first    = NULL;
-    _last     = NULL;
-    _nb_elts  = 0;
-  }
-  else
-  {
-    _last = first_node->_prev;
-    _last->_next = NULL;
-    first_node->_prev = NULL;
-
-    // Update number of elements of both lists
-    ae_list_node<T> * node = first_node;
-
-    while ( node != NULL )
-    {
-      new_list->_nb_elts++;
-      _nb_elts--;
-
-      node = node->_next;
-    }
-  }
-
-  return new_list;
-}
-
-// Erase the list (nodes are deleted). Objects are deleted if delete_obj is true
-template <typename T>
-void ae_list<T>::erase( bool delete_obj )
-{
-  ae_list_node<T>* node = _first;
-
-  while ( node != NULL )
-  {
-    ae_list_node<T> * next = node->_next;
-
-    if( delete_obj )
-    {
-      assert( node->_obj != NULL );
-      delete node->_obj;
-      node->_obj = NULL;
-    }
-
-    delete node;
-    node = next;
-  }
-
-  _last = _first = NULL;
-  _nb_elts = 0;
-}
-
-
-/*!
-  Adds all the elements of list <append> to the list and empty <append>
-
-  @param append the list of objects to add
- */
-template <typename T>
-void ae_list<T>::merge(ae_list<T>* append)
-{
-  if ( append == NULL || append->is_empty() ) return; // Nothing to do
-
-  if ( this->is_empty() )
-  {
-    // Copy 'append'
-    _first    = append->_first;
-    _last     = append->_last;
-    _nb_elts  = append->_nb_elts;
-
-    // Empty 'append'
-    append->_first    = NULL;
-    append->_last     = NULL;
-    append->_nb_elts  = 0;
-  }
-  else
-  {
-    // Link the lists together
-    _last->_next = append->_first;
-    append->_first->_prev = _last;
-
-    // Update '_last'
-    _last = append->_last;
-
-    // Update number of elements
-    _nb_elts += append->_nb_elts;
-
-    // Empty 'append'
-    append->_first    = NULL;
-    append->_last     = NULL;
-    append->_nb_elts  = 0;
-  }
-}
-
-
-/*!
-  Adds all the elements of list <to_add> to the list
-
-  @param to_add the list of objects to add
- */
-template <typename T>
-inline void ae_list<T>::add_list(ae_list<T>* const to_add)
-{
-  if ( to_add == NULL ) return; // Nothing to do
-
-  ae_list_node<T> * to_add_node = to_add->get_first();
-
-  while ( to_add_node != NULL )
-  {
-    add( new ae_list_node<T>( *to_add_node ) );
-
-    to_add_node = to_add_node->get_next();
-  }
-}
-
-/*!
-  Returns true if the list is empty, false otherwise
-
-  @return true if the list is empty, false otherwise
- */
-template <typename T>
-bool ae_list<T>::is_empty( void ) const
-{
-  return ( _first == NULL );
-}
-
-
-
-/*!
-  Returns the number of elements in the list
-
-  @return the number of elements in the list
- */
-template <typename T>
-int32_t ae_list<T>::get_nb_elts( void ) const
-{
-  return _nb_elts;
-}
-
-
-/*!
-  Returns the position of the object provided or -1 if not found
-
-  @param obj the object to find
-  @return the position (0 for the head) of the object or -1 if not found
- */
-template <typename T>
-int32_t ae_list<T>::get_position( T obj ) const
-{
-  int32_t i = 0;
-
-  ae_list_node<T> * node = _first;
-  while ( node != NULL )
-  {
-    if ( node->_obj == obj ) return i;
-    i++;
-    node = node->_next;
-  }
-
-  return -1;
-}
-
-
-/*!
-  Returns the node at position <pos> or NULL if pos is invalid
-
-  @param pos the position of the node of interest (0 for head)
-  @return the node at position <pos> or NULL if pos is invalid
- */
-template <typename T>
-ae_list_node<T> * ae_list<T>::get_node(int32_t pos) const
-{
-  if ( pos < 0 || pos >= _nb_elts ) return NULL;
-
-  ae_list_node<T> * node = _first;
-  for ( int32_t i = 0 ; i < pos ; i++ )
-  {
-    node = node->_next;
-  }
-  return node;
-}
-
-
-/*!
-  Returns the object at position <pos> or NULL if pos is invalid
-
-  @param pos the position of the node of interest (0 for head)
-  @return the object at position <pos> or NULL if pos is invalid
- */
-template <typename T>
-T ae_list<T>::get_object( int32_t pos ) const
-{
-  if ( pos < 0 || pos >= _nb_elts ) return NULL;
-
-  ae_list_node<T> * node = _first;
-  for ( int32_t i = 0 ; i < pos ; i++ )
-  {
-    node = node->_next;
-  }
-  return node->_obj;
-}
-
-
-/*!
-  Returns a pointer to the first object in the list where needle was found
-  Returns NULL if needle was not found
-  comparator : function that returns true if <value> was found in <object>
- */
-template <typename T>
-ae_list_node<T>* ae_list<T>::bsearch( void* needle, int ( * comparator ) ( const void * value, const void * object ) ) const
-{
-  ae_list_node<T>* node = _first;
-
-  while ( node != NULL )
-  {
-    if ( comparator( needle, (void*)node->get_obj() ) == 0 ) return node;
-
-    node = node->_next;
-  }
-
-  return NULL;
-}
-
-
-
-
-//******************************************************************************
-//                                  ae_list_node
-//******************************************************************************
-template<typename T>
-inline ae_list_node<T>::ae_list_node( T obj, ae_list_node* prev, ae_list_node* next )
-{
-  _obj  = obj;
-  _prev = prev;
-  _next = next;
-};
-
-
-/*!
-  Constructs a new (unlinked) node containing the same object as the model.
-
-  The object is shallow-copied.
-
-  @param model the model to copy the object from
- */
-template<typename T>
-ae_list_node<T>::ae_list_node( const ae_list_node<T> &model )
-{
-  _obj  = model._obj;
-  _prev = NULL;
-  _next = NULL;
-};
-
-template<typename T>
-ae_list_node<T>::~ae_list_node( void )
-{
-}
-
-template<typename T>
-inline T& ae_list_node<T>::get_obj( void )
-{
-  return _obj;
-}
-
-template<typename T>
-inline ae_list_node<T>* ae_list_node<T>::get_prev( void )
-{
-  return _prev;
-}
-
-template<typename T>
-inline ae_list_node<T>* ae_list_node<T>::get_next( void )
-{
-  return _next;
-}
-
-template<typename T>
-inline void ae_list_node<T>::set_obj( T obj )
-{
-  _obj = obj;
-}
-
-#endif // AE_LIST_H
diff --git a/src/libaevol/ae_logger.h b/src/libaevol/ae_logger.h
new file mode 100644
index 0000000..147c338
--- /dev/null
+++ b/src/libaevol/ae_logger.h
@@ -0,0 +1,91 @@
+/*
+ * ae_logger.h
+ *
+ *  Created on: Jan 26, 2015
+ *      Author: arrouan
+ */
+
+#ifndef AE_LOGGER_H_
+#define AE_LOGGER_H_
+
+#include <string>
+#include <iostream>
+#include <unordered_map>
+#include <unordered_set>
+#include <fstream>
+#include <vector>
+#include <sstream>
+#include <mutex>
+
+using namespace std;
+
+enum logger_category {
+	SELECTION = 0,
+	TOTAL = 1
+};
+
+class ae_logger
+{
+  public :
+	static inline void init(string file);
+	static inline void addLog(int category, string msg);
+	static inline void addLog(int category, long int msg);
+	static inline void flush(int generation);
+	static unordered_map<int,unordered_multiset<string>> logMap;
+	static string logFile;
+	static std::mutex loggerMtx;
+};
+
+//int cpt = 0;
+
+void ae_logger::init(string file) {
+	ae_logger::logFile = file;
+}
+
+void ae_logger::addLog(int category, string msg) {
+	loggerMtx.lock();
+	ae_logger::logMap[category].insert(msg);
+	loggerMtx.unlock();
+}
+
+void ae_logger::addLog(int category, long int msg) {
+	std::stringstream ss;
+	ss << msg;
+	string msg_str = ss.str();
+	loggerMtx.lock();
+	ae_logger::logMap[category].insert(msg_str);
+	loggerMtx.unlock();
+}
+
+void ae_logger::flush(int generation) {
+	ofstream loggerFile;
+	loggerFile.open(ae_logger::logFile,ios::out | ios::app );
+
+//	printf("CPT: %d\n",cpt);cpt=0;
+	loggerMtx.lock();
+	for (int i = 0; i <= 28; i++) {
+    switch (i) {
+      case SELECTION:
+        loggerFile << "SELECTION," << generation;
+        for (auto it = logMap[i].begin(); it != logMap[i].end(); ++it) {
+          loggerFile << "," << *it;
+        }
+        loggerFile << endl;
+        logMap[i].clear();
+        break;
+      case TOTAL:
+        if (logMap[i].size() > 0) {
+          loggerFile << "TOTAL," << generation;
+          for (auto it = logMap[i].begin(); it != logMap[i].end(); ++it) {
+            loggerFile << "," << *it;
+          }
+          loggerFile << endl;
+          logMap[i].clear();
+        }
+        break;
+    }
+  }
+  loggerMtx.unlock();
+}
+
+#endif /* AE_LOGGER_H_ */
diff --git a/src/libaevol/ae_logs.cpp b/src/libaevol/ae_logs.cpp
deleted file mode 100644
index d26783d..0000000
--- a/src/libaevol/ae_logs.cpp
+++ /dev/null
@@ -1,427 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_logs.h>
-#include <ae_exp_setup.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_logs                                #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-ae_logs::ae_logs( void )
-{
-  _logs = 0;
-  
-  _transfer_log         = NULL;
-  _rear_log             = NULL;
-  _barrier_log          = NULL;
-  //_param_modification_log = NULL;
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_logs::~ae_logs( void )
-{
-  if ( _logs & LOG_TRANSFER )
-  {
-    fclose( _transfer_log );
-  }
-  if ( _logs & LOG_REAR )
-  {
-    fclose( _rear_log );
-  }
-  if ( _logs & LOG_BARRIER )
-  {
-    fclose( _barrier_log );
-  }
-  /*if ( _logs & LOG_LOADS )
-  {
-    fclose( _param_modification_log );
-  }*/
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-/*void ae_logs::save( gzFile setup_file ) const
-{
-  gzwrite( backup_file, &_logs, sizeof(_logs) );
-}*/
-
-void ae_logs::load( int8_t logs, int32_t num_gener )
-{
-  char* line = new char[500];
-  char* ret;
-  
-  _logs = logs;
-  
-  // Prepare required log files
-  if ( _logs & LOG_TRANSFER )
-  {
-    rename ( "log_transfer.out", "log_transfer.out.old" );
-    FILE* old_transfer_log = fopen( "log_transfer.out.old", "r" );
-    if ( old_transfer_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_transfer.out.old\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    _transfer_log = fopen( "log_transfer.out", "w" );
-    if ( _transfer_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_transfer.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    // Copy file headers
-    ret = fgets( line, 500, old_transfer_log );
-    while ( !feof( old_transfer_log ) && line[0] == '#' )
-    {
-      fputs( line, _transfer_log );
-      ret = fgets( line, 500, old_transfer_log );
-    }
-    // This is the empty line between the header and the values
-    //fputs( line, _transfer_log );
-    
-    // Copy log entries until num_gener (excluded)
-    while ( (int32_t)atol(line) < num_gener && !feof(old_transfer_log) )
-    {
-      fputs( line, _transfer_log );
-      ret = fgets( line, 500, old_transfer_log );
-      while(!feof(old_transfer_log) & (line[0] == '\t' || line[0] == ' '))
-      {
-        fputs( line, _transfer_log );
-        ret = fgets( line, 500, old_transfer_log );
-      }
-    }
-    
-    fclose( old_transfer_log );
-    remove( "log_transfer.out.old" );
-  }
-  if ( _logs & LOG_REAR )
-  {
-    rename ( "log_rear.out", "log_rear.out.old" );
-    FILE* old_rear_log = fopen( "log_rear.out.old", "r" );
-    if ( old_rear_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_rear.out.old\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    _rear_log = fopen( "log_rear.out", "w" );
-    if ( _rear_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_rear.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    // Copy file headers
-    ret = fgets( line, 500, old_rear_log );
-    while ( !feof( old_rear_log ) && line[0] == '#' )
-    {
-      fputs( line, _rear_log );
-      ret = fgets( line, 500, old_rear_log );
-    }
-    // This is the empty line between the header and the values
-    //fputs( line, _rear_log );
-    
-    // Copy log entries until num_gener (excluded)
-    while ( (int32_t)atol(line) < num_gener && !feof(old_rear_log) )
-    {
-      fputs( line, _rear_log );
-      ret = fgets( line, 500, old_rear_log );
-    }
-    
-    fclose( old_rear_log );
-    remove( "log_rear.out.old" );
-  }
-  if ( _logs & LOG_BARRIER )
-  {
-    rename ( "log_barrier.out", "log_barrier.out.old" );
-    FILE* old_barrier_log = fopen( "log_barrier.out.old", "r" );
-    if ( old_barrier_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_barrier.out.old\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    _barrier_log = fopen( "log_barrier.out", "w" );
-    if ( _barrier_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_barrier.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    // Copy file headers
-    ret = fgets( line, 500, old_barrier_log );
-    while ( !feof( old_barrier_log ) && line[0] == '#' )
-    {
-      fputs( line, _barrier_log );
-      ret = fgets( line, 500, old_barrier_log );
-    }
-    // This is the empty line between the header and the values
-    //fputs( line, _barrier_log );
-    
-    // Copy log entries until num_gener (excluded)
-    while ( (int32_t)atol(line) < num_gener && !feof(old_barrier_log) )
-    {
-      fputs( line, _barrier_log );
-      ret = fgets( line, 500, old_barrier_log );
-    }
-    
-    fclose( old_barrier_log );
-    remove( "log_barrier.out.old" );
-  }
-  /*if ( _logs & LOG_LOADS )
-  {
-    rename ( "log_param_modification.out", "log_param_modification.out.old" );
-    FILE* old_param_modification_log = fopen( "log_param_modification.out.old", "r" );
-    if ( old_param_modification_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_param_modification.out.old\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    _param_modification_log = fopen( "log_param_modification.out", "w" );
-    if ( _param_modification_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_param_modification.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-    
-    //Copy file headers
-    ret = fgets( line, 500, old_param_modification_log );
-    while ( !feof( old_param_modification_log ) && line[0] == '#' )
-    {
-      fputs( line, _param_modification_log );
-      ret = fgets( line, 500, old_param_modification_log );
-    }
-    // This is the empty line between the header and the values
-    //fputs( line, _param_modification_log );
-    
-    // Copy log entries until num_gener (excluded)
-    while ( (int32_t)atol(line) < num_gener && !feof(old_param_modification_log) )
-    {
-      fputs( line, _param_modification_log );
-      ret = fgets( line, 500, old_param_modification_log );
-    }
-    
-    fclose( old_param_modification_log );
-    remove( "log_param_modification.out.old" );
-  }*/
-  
-  delete [] line;
-}
-
-void ae_logs::print_to_file( FILE* file ) const
-{
-  fprintf( file, "logs        :                %"PRId8"\n", _logs );
-}
-
-void ae_logs::set_logs( int8_t logs )
-{
-  _logs = logs;
-    
-  // Open required log files
-  if ( _logs & LOG_TRANSFER )
-  {
-    _transfer_log = fopen( "log_transfer.out", "w" );
-    if ( _transfer_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_transfer.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-  }
-  if ( _logs & LOG_REAR )
-  {
-    _rear_log = fopen( "log_rear.out", "w" );
-    if ( _rear_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_rear.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-  }
-  if ( _logs & LOG_BARRIER )
-  {
-    _barrier_log = fopen( "log_barrier.out", "w" );
-    
-    if ( _barrier_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_barrier.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-  }
-  /*if ( _logs & LOG_LOADS )
-  {
-    _param_modification_log = fopen( "log_param_modification.out", "w" );
-    
-    if ( _param_modification_log == NULL )
-    {
-      printf( "Error: Failed to open file \"log_param_modification.out\"\n" );
-      exit( EXIT_FAILURE );
-    }
-  }*/
-  
-  this->write_headers();
-}
-
-void ae_logs::flush( void )
-{
-  if ( _logs & LOG_TRANSFER )
-  {
-    fflush( _transfer_log );
-  }
-  if ( _logs & LOG_REAR )
-  {
-    fflush( _rear_log );
-  }
-  if ( _logs & LOG_BARRIER )
-  {
-    fflush( _barrier_log );
-  }
-  /*if ( _logs & LOG_LOADS )
-  {
-    fflush( _param_modification_log );
-  }*/
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_logs::write_headers( void ) const
-{
-  // ========== TRANSFER LOG ==========
-  if ( _logs & LOG_TRANSFER )
-  {
-    fprintf( _transfer_log, "######################################################################\n" );
-    fprintf( _transfer_log, "#                 Horizontal transfer log\n" );
-    fprintf( _transfer_log, "#\n" );
-    fprintf( _transfer_log, "# Log of every horizontal transfer that occured during the simulation\n" );
-    fprintf( _transfer_log, "#\n" );
-    fprintf( _transfer_log, "# 1.  Generation\n" );
-    fprintf( _transfer_log, "# 2.  Index of the recepient\n" );
-    fprintf( _transfer_log, "# 3.  Index of the donor (generation n-1)\n" );
-    fprintf( _transfer_log, "# 4.  Type of transfer\n" );
-    fprintf( _transfer_log, "# 5.  Length of the transferred segment\n" );
-    fprintf( _transfer_log, "# 6.  Length of the replaced segment (if any)\n" );
-    fprintf( _transfer_log, "# 7.  Size of the genome before the transfer\n" );
-    fprintf( _transfer_log, "# 8.  Size of the genome after the transfer\n" );
-    fprintf( _transfer_log, "# 9.  Alignment 1 point 1\n" );
-    fprintf( _transfer_log, "# 10. Alignment 1 point 2\n" );
-    fprintf( _transfer_log, "# 11. Alignment 1 score\n" );
-    fprintf( _transfer_log, "# 12. Alignment 2 point 1\n" );
-    fprintf( _transfer_log, "# 13. Alignment 2 point 2\n" );
-    fprintf( _transfer_log, "# 14. Alignment 2 score\n" );
-    fprintf( _transfer_log, "#\n" );
-    fprintf( _transfer_log, "######################################################################\n" );
-    fprintf( _transfer_log, "#\n" );
-    fprintf( _transfer_log, "# Header for R\n" );
-    fprintf( _transfer_log, "gener recepient donor t_type seg_len replaced_len size_before size_after align1_pt1 align1_pt2 score1 align2_pt1 align2_pt2 score2\n" );
-    fprintf( _transfer_log, "#\n" );
-  }
-  
-  // ========== REAR LOG ==========
-  if ( _logs & LOG_REAR )
-  {
-    fprintf( _rear_log, "######################################################################\n" );
-    fprintf( _rear_log, "#                 Chromosomal rearrangement log\n" );
-    fprintf( _rear_log, "#\n" );
-    fprintf( _rear_log, "# Log of every rearrangement that occured during the simulation\n" );
-    fprintf( _rear_log, "# (not just one lineage)\n" );
-    fprintf( _rear_log, "#\n" );
-    fprintf( _rear_log, "# 1. Generation\n" );
-    fprintf( _rear_log, "# 2. Index of the individual that has undergone the rearrangement\n" );
-    fprintf( _rear_log, "# 3. Type of rearrangement\n" );
-    fprintf( _rear_log, "# 4. Length of the rearranged segment\n" );
-    fprintf( _rear_log, "# 5. Size of the genome before the rearrangement\n" );
-    fprintf( _rear_log, "# 6. Alignment score that was needed for this rearrangement to occur\n" );
-    fprintf( _rear_log, "# 7. Second alignment score (translocation only)\n" );
-    fprintf( _rear_log, "#\n" );
-    fprintf( _rear_log, "######################################################################\n" );
-    fprintf( _rear_log, "#\n" );
-    fprintf( _rear_log, "# Header for R\n" );
-    fprintf( _rear_log, "gener indiv r_type seg_len genome_size score1 score2\n" );
-    fprintf( _rear_log, "#\n" );
-  }
-  
-  // ========== BARRIER LOG ==========
-  if ( _logs & LOG_BARRIER )
-  {
-    fprintf( _barrier_log, "######################################################################\n" );
-    fprintf( _barrier_log, "#                     Genome size limits log\n" );
-    fprintf( _barrier_log, "#\n" );
-    fprintf( _barrier_log, "# An entry is written whenever a mutation would have produced a\n" );
-    fprintf( _barrier_log, "# genome whose size wouldn't lie in [min, max].\n" );
-    fprintf( _barrier_log, "# The corresponding mutation is \"cancelled\"\n" );
-    fprintf( _barrier_log, "#\n" );
-    fprintf( _barrier_log, "# 1. Generation\n" );
-    fprintf( _barrier_log, "# 2. Index of the individual\n" );
-    fprintf( _barrier_log, "# 3. Type of event\n" );
-    fprintf( _barrier_log, "# 4. Segment length\n" );
-    fprintf( _barrier_log, "# 5. Replaced segment length\n" );
-    fprintf( _barrier_log, "# 6. GU size (before the event)\n" );
-    fprintf( _barrier_log, "# 7. Genome size (before the event)\n" );
-    fprintf( _barrier_log, "#\n" );
-    fprintf( _barrier_log, "######################################################################\n" );
-  
-  }
-  
-  // ========== LOADS LOG ==========     
-  /*if ( _logs & LOG_LOADS )
-  {
-    fprintf( _param_modification_log, "######################################################################\n" );
-    fprintf( _param_modification_log, "#                     Parameter modification log\n" );
-    fprintf( _param_modification_log, "#\n" );
-    fprintf( _param_modification_log, "# An entry is written whenever a parameter is modified by aevol_modify.\n" );
-    fprintf( _param_modification_log, "######################################################################\n" );
-  }*/
-}
diff --git a/src/libaevol/ae_macros.h b/src/libaevol/ae_macros.h
deleted file mode 100644
index 4b68864..0000000
--- a/src/libaevol/ae_macros.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#include <inttypes.h>
-
-#define NB_BASE INT8_C(2) // WARNING :  A lot of stuff has been optimized for binary genomes
-                          //            Changing the value of NB_BASE implies verifying the existing code
-                          //            and make changes where necessary
-
-// Backup directories and file name formats
-// Experimental Setup
-#define EXP_S_DIR                 "exp_setup"
-#define EXP_S_FNAME_BASE          "exp_setup_%06"PRId32
-#define EXP_S_FNAME_FORMAT        EXP_S_DIR"/"EXP_S_FNAME_BASE".ae"
-//~ #define EXP_S_TXT_FNAME_FORMAT    EXP_S_DIR"/"EXP_S_FNAME_BASE".in"
-#define EXP_S_CONST_FNAME_BASE        "exp_setup_const"
-#define EXP_S_CONST_FNAME_FORMAT      EXP_S_DIR"/"EXP_S_CONST_FNAME_BASE".ae"
-#define EXP_S_TXT_CONST_FNAME_FORMAT  EXP_S_DIR"/"EXP_S_CONST_FNAME_BASE".in"
-// Output Profile
-#define OUT_P_DIR                 "output_profile"
-#define OUT_P_FNAME_BASE          "output_profile"
-#define OUT_P_FNAME_FORMAT        OUT_P_DIR"/"OUT_P_FNAME_BASE".ae"
-#define OUT_P_TXT_FNAME_FORMAT    OUT_P_DIR"/"OUT_P_FNAME_BASE".in"
-#define OUT_P_CUR_FNAME           "output_profile.ae"
-#define OUT_P_TXT_CUR_FNAME       "output_profile.in"
-// Environment
-#define ENV_DIR                   "environment"
-#define ENV_FNAME_BASE            "env_%06"PRId32
-#define ENV_FNAME_FORMAT          ENV_DIR"/"ENV_FNAME_BASE".ae"
-// Population
-#define POP_DIR                   "populations"
-#define POP_FNAME_BASE            "pop_%06"PRId32
-#define POP_FNAME_FORMAT          POP_DIR"/"POP_FNAME_BASE".ae"
-// Spatial Structure
-#define SP_STRUCT_DIR             "spatial_structure"
-#define SP_STRUCT_FNAME_BASE      "sp_struct_%06"PRId32
-#define SP_STRUCT_FNAME_FORMAT    SP_STRUCT_DIR"/"SP_STRUCT_FNAME_BASE".ae"
-// Stats
-#define STATS_DIR   "stats"
-// Tree
-#define TREE_DIR    "tree"
-// Last gener file
-#define LAST_GENER_FNAME "last_gener.txt"
-// Best last organism file
-#define BEST_LAST_ORG_FNAME "best_last_org.txt"
-
-
-#define FIXED_POPULATION_SIZE // Some calculation can be spared if we know that the size of the population is fixed
-
-#define PROM_SIZE       INT8_C(22)
-#define PROM_SEQ        "0101011001110010010110"
-
-#define PROM_MAX_DIFF   INT8_C(4)
-#define TERM_STEM_SIZE  INT8_C(4)
-#define TERM_LOOP_SIZE  INT8_C(3)
-#define TERM_SIZE       INT8_C(2 * TERM_STEM_SIZE + TERM_LOOP_SIZE)
-
-#define SHINE_DAL_SIZE      INT8_C(6)
-#define SHINE_DAL_SEQ       "011011"
-#define SHINE_START_SPACER  INT8_C(4)
-
-#define CODON_SIZE    INT8_C(3)
-#define CODON_START   INT8_C(0)   // "000"
-#define CODON_STOP    INT8_C(1)   // "001"
-#define CODON_M0      INT8_C(4)   // "100"
-#define CODON_M1      INT8_C(5)   // "101"
-#define CODON_W0      INT8_C(2)   // "010"
-#define CODON_W1      INT8_C(3)   // "011"
-#define CODON_H0      INT8_C(6)   // "110"
-#define CODON_H1      INT8_C(7)   // "111"
-
-#ifdef __REGUL
-  #define MAX_CODON   INT8_C(1 << CODON_SIZE)
-  #define QUADON_SIZE 4
-  #define MAX_QUADON  INT8_C(1 << QUADON_SIZE)
-#endif
-
-#define X_MIN   0.0
-#define X_MAX   1.0
-#define Y_MIN   0.0
-#define Y_MAX   1.0
-#define H_MIN   -1.0
-#define H_MAX   1.0
-#define W_MIN   0.0
-// W_MAX is defined through a parameter
-
-#define SC_MATCH_BONUS    INT8_C(1)
-#define SC_MISMATCH_COST  INT8_C(2)
-
diff --git a/src/libaevol/ae_mutation.cpp b/src/libaevol/ae_mutation.cpp
deleted file mode 100644
index cca6b3a..0000000
--- a/src/libaevol/ae_mutation.cpp
+++ /dev/null
@@ -1,959 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_mutation.h>
-#include <ae_vis_a_vis.h>
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_mutation                              #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_mutation::ae_mutation( void )
-{
-  _pos = NULL;
-  _length = NULL;
-  _seq = NULL;
-  _align_score = NULL;
-}
-
-
-
-
-ae_mutation::ae_mutation( const ae_mutation &model )
-{
-  _pos = NULL;
-  _length = NULL;
-  _seq = NULL;
-  _align_score = NULL;
-
-  _mut_type = model._mut_type;
-  
-  switch( _mut_type )
-  {
-    case SWITCH :
-    {
-      _pos = new int32_t( *(model._pos) );
-      break;
-    }
-    case S_INS :
-    {
-      _pos = new int32_t( *(model._pos) );
-      _length = new int32_t( *(model._length) );
-      _seq = new char[_length[0] + 1];
-      strncpy(_seq, model._seq, _length[0]);
-      _seq[_length[0]] = '\0';
-      break;
-    }
-    case S_DEL:
-    {
-      _pos = new int32_t( *(model._pos) );
-      _length = new int32_t( *(model._length) );
-      break;
-    }
-    case DUPL:
-    {
-      _pos = new int32_t[3];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _pos[2] = model._pos[2];
-      _length = new int32_t( *(model._length) );
-      _align_score = new int16_t( *(model._align_score) );
-      break;
-    }
-    case DEL:
-    {
-      _pos = new int32_t[2];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _length = new int32_t( *(model._length) );
-      _align_score = new int16_t( *(model._align_score) );
-      break;
-    }
-    case TRANS:
-    {
-      _pos = new int32_t[4];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _pos[2] = model._pos[2];
-      _pos[3] = model._pos[3];
-      _invert = model._invert;
-      _length = new int32_t( *(model._length) );
-      _align_score = new int16_t[2];
-      _align_score[0] = model._align_score[0];
-      _align_score[1] = model._align_score[1];
-      break;
-    }
-    case INV:
-    {
-      _pos = new int32_t[2];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _length = new int32_t( *(model._length) );
-      _align_score = new int16_t( *(model._align_score) );
-      break;
-    }
-    case INSERT:
-    {
-      _pos = new int32_t( *(model._pos) );
-      _length = new int32_t( *(model._length) );
-      _seq = new char[_length[0] + 1];
-      strncpy(_seq, model._seq, _length[0]);
-      _seq[_length[0]] = '\0';
-      break;
-    }
-    case INS_HT:
-    {
-      _pos = new int32_t[4];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _pos[2] = model._pos[2];
-      _pos[3] = model._pos[3];
-      _length = new int32_t( *(model._length) );
-      _seq = new char[_length[0] + 1];
-      strncpy(_seq, model._seq, _length[0]);
-      _seq[_length[0]] = '\0';
-      _align_score = new int16_t[2];
-      _align_score[0] = model._align_score[0];
-      _align_score[1] = model._align_score[1];
-      _donor_id = model._donor_id;
-      _sense = model._sense;
-      break;
-    }
-    case REPL_HT:
-    {
-      _pos = new int32_t[4];
-      _pos[0] = model._pos[0];
-      _pos[1] = model._pos[1];
-      _pos[2] = model._pos[2];
-      _pos[3] = model._pos[3];
-      _length = new int32_t[2];
-      _length[0] = model._length[0];
-      _length[1] = model._length[1];
-      _seq = new char[_length[1] + 1];
-      strncpy(_seq, model._seq, _length[1]);
-      _seq[_length[1]] = '\0';
-      _align_score = new int16_t[2];
-      _align_score[0] = model._align_score[0];
-      _align_score[1] = model._align_score[1];
-      _donor_id = model._donor_id;
-      _sense = model._sense;
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", model._mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-}
-
-
-
-
-ae_mutation::ae_mutation( gzFile backup_file )
-{
-  _pos = NULL;
-  _length = NULL;
-  _seq = NULL;
-  _align_score = NULL;
-
-  int8_t tmp_mut_type;
-  gzread( backup_file, &tmp_mut_type,  sizeof(tmp_mut_type) );
-  _mut_type = (ae_mutation_type) tmp_mut_type;
-  //~ printf("mut type %d\n", _mut_type);
-
-  switch ( _mut_type )
-  {
-    case SWITCH :
-    {
-      _pos = new int32_t;
-      gzread( backup_file, _pos,  sizeof(*_pos) );
-      break;
-    }
-    case S_INS :
-    {
-      _pos = new int32_t;
-      gzread( backup_file, _pos,      sizeof(*_pos) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      
-      _seq = new char[_length[0] + 1];
-      gzread( backup_file, _seq,  _length[0] * sizeof(_seq[0]) );
-      _seq[_length[0]] = '\0';
-      break;
-    }
-    case S_DEL :
-    {
-      _pos = new int32_t;
-      gzread( backup_file, _pos,      sizeof(*_pos) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      break;
-    }
-    case DUPL :
-    {
-      _pos = new int32_t[3];
-      gzread( backup_file, _pos,  3 * sizeof(_pos[0]) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _align_score = new int16_t;
-      gzread( backup_file, _align_score, sizeof(*_align_score) );
-      
-      break;
-    }
-    case DEL :
-    {
-      _pos = new int32_t[2];
-      gzread( backup_file, _pos,  2 * sizeof(_pos[0]) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _align_score = new int16_t;
-      gzread( backup_file, _align_score, sizeof(*_align_score) );
-      
-      break;
-    }
-    case TRANS :
-    {
-      _pos = new int32_t[4];
-      gzread( backup_file, _pos,  4 * sizeof(_pos[0]) );
-      int8_t tmp_invert;
-      gzread( backup_file, &tmp_invert,  sizeof(tmp_invert) );
-      _invert = (tmp_invert != 0);
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _align_score = new int16_t[2];
-      gzread( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      
-      break;
-    }
-    case INV :
-    {
-      _pos = new int32_t[2];
-      gzread( backup_file, _pos,  2 * sizeof(_pos[0]) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _align_score = new int16_t;
-      gzread( backup_file, _align_score, sizeof(*_align_score) );
-      
-      break;
-    }
-    case INSERT:
-    {
-      _pos = new int32_t;
-      gzread( backup_file, _pos,  sizeof(*_pos) );
-     _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _seq = new char[_length[0] + 1];
-      gzread( backup_file, _seq,  _length[0] * sizeof(_seq[0]) );
-      _seq[_length[0]] = '\0';
-    }
-    case INS_HT:
-    {
-      _pos = new int32_t[4];
-      gzread( backup_file, _pos,  4 * sizeof(_pos[0]) );
-      _length = new int32_t;
-      gzread( backup_file, _length,  sizeof(*_length) );
-      _seq = new char[_length[0] + 1];
-      gzread( backup_file, _seq,  _length[0] * sizeof(_seq[0]) );
-      _seq[_length[0]] = '\0';
-      _align_score = new int16_t[2];
-      gzread( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      gzread( backup_file, &_donor_id,  sizeof(_donor_id) );
-      gzread( backup_file, &_sense,  sizeof(_sense) );
-      break;
-    }
-    case REPL_HT:
-    {
-      _pos = new int32_t[4];
-      gzread( backup_file, _pos,  4 * sizeof(_pos[0]) );
-      _length = new int32_t[2];
-      gzread( backup_file, _length, 2 *sizeof(_length[0]) );
-      _seq = new char[_length[1] + 1];
-      gzread( backup_file, _seq,  _length[1] * sizeof(_seq[0]) );
-      _seq[_length[1]] = '\0';
-      _align_score = new int16_t[2];
-      gzread( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      gzread( backup_file, &_donor_id,  sizeof(_donor_id) );
-      gzread( backup_file, &_sense,  sizeof(_sense) );
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-
-
-}
-
-
-
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_mutation::~ae_mutation( void )
-{
-  switch ( _mut_type )
-  {
-    case SWITCH :
-      delete _pos;
-      delete _length;
-      break;
-    case S_INS :
-      delete _pos;
-      delete _length;
-      delete [] _seq;
-      break;
-    case S_DEL :
-      delete _pos;
-      delete _length;
-      break;
-    case DUPL :
-      delete [] _pos;
-      delete _length;
-      delete _align_score;
-      break;
-    case DEL :
-      delete [] _pos;
-      delete _length;
-      delete _align_score;
-      break;
-    case TRANS :
-      delete [] _pos;
-      delete _length;
-      delete [] _align_score;
-      break;
-    case INV :
-      delete [] _pos;
-      delete _length;
-      delete _align_score;
-      break;
-    case INSERT :
-      delete _pos;
-      delete _length;
-      delete [] _seq;
-      break;
-    case INS_HT:
-      delete [] _pos;
-      delete _length;
-      delete [] _align_score;
-      delete [] _seq;
-      break;
-    case REPL_HT:
-      delete [] _pos;
-      delete [] _length;
-      delete [] _align_score;
-      delete [] _seq;
-      break;
-    default :
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-  }
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_mutation::report_point_mutation( int32_t pos )
-{
-  //~ printf( "report point mutation at %ld\n", pos );
-  
-  _mut_type = SWITCH;
-  _pos      = new int32_t( pos );
-  _length = new int32_t(1);
-}
-
-void ae_mutation::report_small_insertion( int32_t pos, int32_t length, const char* seq )
-{
-  //~ printf( "report small insertion of %s (%ld) at %ld\n", seq, length, pos );
-  
-  _mut_type = S_INS;
-  _pos = new int32_t( pos );
-  _length = new int32_t(length);
-  _seq = new char[length + 1];
-  strncpy(_seq, seq, length);
-  _seq[length] = '\0';
-}
-
-void ae_mutation::report_small_deletion( int32_t pos, int32_t length )
-{
-  //~ printf( "report small deletion of %ld at %ld\n", length, pos );
-  
-  _mut_type = S_DEL;
-  _pos = new int32_t( pos );
-  _length = new int32_t(length);
-}
-
-void ae_mutation::report_duplication( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t length, int16_t align_score )
-{
-  //~ printf( "report duplication of [%ld, %ld] to %ld\n", pos_1, pos_2, pos_3 );
-  
-  _mut_type = DUPL;
-  
-  _pos = new int32_t[3];
-  _pos[0] = pos_1;
-  _pos[1] = pos_2;
-  _pos[2] = pos_3;
-  
-  _length = new int32_t(length);
-  
-  _align_score = new int16_t( align_score );
-}
-
-void ae_mutation::report_deletion( int32_t pos_1, int32_t pos_2, int32_t length, int16_t align_score )
-{
-  //~ printf( "report deletion of [%ld, %ld]\n", pos_1, pos_2 );
-  
-  _mut_type = DEL;
-  
-  _pos = new int32_t[2];
-  _pos[0] = pos_1;
-  _pos[1] = pos_2;
-  
-  _length = new int32_t(length);
-  
-  _align_score = new int16_t( align_score );
-}
-
-void ae_mutation::report_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, int32_t length, bool invert, int16_t align_score_1, int16_t align_score_2 )
-{
-  //~ printf( "report translocation of [%ld, %ld] to %ld through %ld (%s)\n", pos_1, pos_2, pos_3, pos_4, invert?"invert":"plain" );
-  
-  _mut_type = TRANS;
-  
-  _pos = new int32_t[4];
-  _pos[0] = pos_1;
-  _pos[1] = pos_2;
-  _pos[2] = pos_3;
-  _pos[3] = pos_4;
-  _invert = invert;
-  
-  _length = new int32_t(length);
-  
-  _align_score = new int16_t[2];
-  _align_score[0] = align_score_1;
-  _align_score[1] = align_score_2;
-}
-
-void ae_mutation::report_inversion( int32_t pos_1, int32_t pos_2, int32_t length, int16_t align_score )
-{
-  //~ printf( "report inversion of [%ld, %ld]\n", pos_1, pos_2 );
-  
-  _mut_type = INV;
-  
-  _pos = new int32_t[2];
-  _pos[0] = pos_1;
-  _pos[1] = pos_2;
-  
-  _length = new int32_t(length);
-  
-  _align_score = new int16_t( align_score );
-}
-
-void ae_mutation::report_insertion( int32_t pos, int32_t length, const char* seq )
-{
-  //~ printf( "report insertion of %s (%ld) at %ld\n", seq, length, pos );
-  
-  _mut_type = INSERT;
-  _pos = new int32_t( pos );
-  _length = new int32_t(length);
-  _seq = new char[length + 1];
-  strncpy(_seq, seq, length);
-  _seq[length] = '\0';
-}
-
-void ae_mutation::report_ins_HT(int32_t alignment_1_donor_pos_1, int32_t alignment_1_donor_pos_2, int32_t alignment_2_ind_pos, int32_t alignment_2_donor_pos, int32_t length, int16_t alignment_1_score, int16_t alignment_2_score, int32_t donor_id, ae_sense sense, const char* donor_seq)
-{
-  _mut_type = INS_HT;
-  _pos = new int32_t[4];
-  _pos[0] = alignment_1_donor_pos_1; //donor
-  _pos[1] = alignment_1_donor_pos_2; //donor
-  _pos[2] = alignment_2_ind_pos; //exogenote   // NOTE: wrong comment? I think it's receiver
-  _pos[3] = alignment_2_donor_pos; //receiver  // NOTE: wrong comment? I think it's exogenote
-  
-  _length = new int32_t( length );
-  _seq = new char[length + 1];
-  strncpy(_seq, donor_seq, length);
-  _seq[length] = '\0';
-  
-  _align_score = new int16_t[2];
-  _align_score[0] = alignment_1_score;
-  _align_score[1] = alignment_2_score;
-  
-  _donor_id = donor_id;
-  _sense = sense;
-}
-
-void ae_mutation::report_repl_HT(int32_t alignment_1_ind_pos, int32_t alignment_1_donor_pos, int32_t alignment_2_ind_pos, int32_t alignment_2_donor_pos, int32_t repl_seq_length, int32_t donor_seq_length, int16_t alignment_1_score, int16_t alignment_2_score, int32_t donor_id, ae_sense sense, const char* donor_seq)
-{
-  _mut_type = REPL_HT;
-  _pos = new int32_t[4];
-  _pos[0] = alignment_1_ind_pos; //receiver
-  _pos[1] = alignment_1_donor_pos; //donor 
-  _pos[2] = alignment_2_ind_pos; //receiver
-  _pos[3] = alignment_2_donor_pos; //donor
-  
-  _length = new int32_t[2];
-  _length[0] = repl_seq_length;
-  _length[1] = donor_seq_length;
-  _seq = new char[donor_seq_length + 1];
-  strncpy(_seq, donor_seq, donor_seq_length);
-  _seq[donor_seq_length] = '\0';
-  
-  _align_score = new int16_t[2];
-  _align_score[0] = alignment_1_score;
-  _align_score[1] = alignment_2_score;
-  
-  _donor_id = donor_id;
-  _sense = sense;
-}
-
-void ae_mutation::save( gzFile backup_file ) // Usually <backup_file> is the tree file (?)
-{
-  int8_t tmp_mut_type = _mut_type;
-  gzwrite( backup_file, &tmp_mut_type,  sizeof(tmp_mut_type) );
-
-  switch ( _mut_type )
-  {
-    case SWITCH :
-    {
-      gzwrite( backup_file, _pos,  sizeof(*_pos) );
-      break;
-    }
-    case S_INS :
-    {
-      gzwrite( backup_file, _pos,     sizeof(*_pos) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      gzwrite( backup_file, _seq,     _length[0] * sizeof(_seq[0]) );
-      break;
-    }
-    case S_DEL :
-    {
-      gzwrite( backup_file, _pos,     sizeof(*_pos) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      break;
-    }
-    case DUPL :
-    {
-      gzwrite( backup_file, _pos,         3 * sizeof(_pos[0]) );
-      gzwrite( backup_file, _length,   sizeof(*_length) );
-      gzwrite( backup_file, _align_score, sizeof(*_align_score) );
-      break;
-    }
-    case DEL :
-    {
-      gzwrite( backup_file, _pos,         2 * sizeof(_pos[0]) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      gzwrite( backup_file, _align_score, sizeof(*_align_score) );
-      break;
-    }
-    case TRANS :
-    {
-      gzwrite( backup_file, _pos,         4 * sizeof(_pos[0]) );
-      int8_t tmp_invert = _invert? 1 : 0;
-      gzwrite( backup_file, &tmp_invert,  sizeof(tmp_invert) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      gzwrite( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      break;
-    }
-    case INV :
-    {
-      gzwrite( backup_file, _pos,         2 * sizeof(_pos[0]) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      gzwrite( backup_file, _align_score, sizeof(*_align_score) );
-      break;
-    }
-    case INS_HT:
-    {
-      gzwrite( backup_file, _pos,  4 * sizeof(_pos[0]) );
-      gzwrite( backup_file, _length,  sizeof(*_length) );
-      gzwrite( backup_file, _seq,     _length[0] * sizeof(_seq[0]) );
-      gzwrite( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      gzwrite( backup_file, &_donor_id,  sizeof(_donor_id) );
-      gzwrite( backup_file, &_sense,  sizeof(_sense) );
-      break;
-    }
-    case REPL_HT:
-    {
-      gzwrite( backup_file, _pos,  4 * sizeof(_pos[0]) );
-      gzwrite( backup_file, _length, 2 *sizeof(_length[0]) );
-      gzwrite( backup_file, _seq,     _length[1] * sizeof(_seq[0]) );
-      gzwrite( backup_file, _align_score, 2 * sizeof(_align_score[0]) );
-      gzwrite( backup_file, &_donor_id,  sizeof(_donor_id) );
-      gzwrite( backup_file, &_sense,  sizeof(_sense) );
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-}
-
-
-
-
-void ae_mutation::get_generic_description_string( char * str )
-{
-  switch ( _mut_type )
-  {
-    case SWITCH :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], -1, -1, -1, (int8_t) -1, (int16_t) -1, (int16_t) -1, (int32_t) -1, (int32_t) -1 );
-      break;
-    }
-    case S_INS :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], -1, -1, -1, (int8_t) -1, (int16_t) -1, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case S_DEL :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-	       (int8_t) _mut_type, _pos[0], -1, -1, -1, (int8_t) -1, (int16_t) -1, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case DUPL :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], _pos[1], _pos[2], -1, (int8_t) -1, *_align_score, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case DEL :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-	       (int8_t) _mut_type, _pos[0], _pos[1], -1, -1, (int8_t) -1, *_align_score, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case TRANS :
-    {
-      int8_t tmp_invert = _invert? 1 : 0;
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], _pos[1], _pos[2], _pos[3], tmp_invert, _align_score[0], _align_score[1], _length[0], (int32_t) -1 );
-      break;
-    }
-    case INV :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-	       (int8_t) _mut_type, _pos[0], _pos[1], -1, -1, (int8_t) -1, *_align_score, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case INSERT :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], (int32_t)-1, (int32_t)-1, (int32_t)-1, (int8_t) -1, (int16_t) -1, (int16_t) -1, _length[0], (int32_t) -1 );
-      break;
-    }
-    case INS_HT :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32"", \
-              (int8_t) _mut_type, _pos[0], _pos[1], _pos[2], _pos[3], (int8_t) _sense, _align_score[0], _align_score[1], _length[0], (int32_t) -1 );
-      break;
-    }
-    case REPL_HT :
-    {
-      sprintf( str, "%"PRId8" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId8" %"PRId16" %"PRId16" %"PRId32" %"PRId32" ", \
-              (int8_t) _mut_type, _pos[0], _pos[1], _pos[2], _pos[3], (int8_t) _sense, _align_score[0], _align_score[1], _length[1], _length[0] );
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-
-}
-
-
-
-/* DEPRECATED, use get_length instead */
-int32_t ae_mutation::segment_length( int32_t gen_unit_len )
-{
-  int32_t res = 0;
-  switch ( _mut_type )
-  {
-    case SWITCH :
-    {
-      res = 1;
-      break;
-    }
-    case S_INS :
-    {
-      res = _length[0];
-      break;
-    }
-    case S_DEL :
-    {
-      res = _length[0];
-      break;
-    }
-    case DUPL :
-    {
-      // pos 0 = begin_seg;
-      // pos 1 = end_seg;
-      // pos 2 = insertion_point;
-
-      if (_pos[0] <= _pos[1]) res = _pos[1] - _pos[0];
-      else res = gen_unit_len - _pos[0] + _pos[1];
-
-      break;
-    }
-    case DEL :
-    {
-      // pos 0 = begin_seg;
-      // pos 1 = end_seg;
-
-      if (_pos[0] <= _pos[1]) res = _pos[1] - _pos[0];
-      else res = gen_unit_len - _pos[0] + _pos[1];
-      
-      break;
-    }
-    case TRANS :
-    {
-      // pos 0 = begin_seg;
-      // pos 1 = end_seg;
-      // pos 2 = cutting_point_in_translocated_segment (1st reinserted bp)
-      // pos 3 = reinsertion_point_in_chromosome;
-
-      if (_pos[0] <= _pos[1]) res = _pos[1] - _pos[0];
-      else res = gen_unit_len - _pos[0] + _pos[1];
-
-      break;
-    }
-    case INV :
-    {
-      // pos 0 = begin_seg;
-      // pos 1 = end_seg;
-
-      if (_pos[0] <= _pos[1]) res = _pos[1] - _pos[0];
-      else res = gen_unit_len - _pos[0] + _pos[1];
-
-      break;
-    }
-    case INS_HT :
-    {
-      break;
-    }
-    case REPL_HT :
-    {
-      break;
-    }
-    default :
-    {
-      fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", _mut_type, __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      break;
-    }
-  }
-
-  return res;
-}
-
-
-
-
-
-void ae_mutation::get_infos_point_mutation( int32_t* pos )
-{
-  assert( _mut_type == SWITCH );
-  *pos = _pos[0];
-}
-
-
-
-void ae_mutation::get_infos_small_insertion( int32_t* pos, int32_t* length )
-{
-  assert( _mut_type == S_INS );
-  *pos    = *_pos;
-  *length = _length[0];
-}
-
-
-// seq must be a char array, large enough to contain _length+1 characters
-void ae_mutation::get_sequence_small_insertion( char* seq )
-{
-  assert( _mut_type == S_INS );
-  strncpy( seq, _seq, _length[0]);
-  seq[_length[0]] = '\0';
-}
-
-void ae_mutation::get_infos_small_deletion( int32_t* pos, int32_t* length )
-{
-  assert( _mut_type == S_DEL );
-  *pos    = _pos[0];
-  *length = _length[0];
-}
-
-
-void ae_mutation::get_infos_duplication( int32_t* pos1, int32_t* pos2, int32_t* pos3, int16_t* align_score )
-{
-  assert( _mut_type == DUPL );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-  *pos3    = _pos[2];
-
-  if ( align_score != NULL )
-  {
-    *align_score = *_align_score;
-  }
-}
-
-
-void ae_mutation::get_infos_deletion( int32_t* pos1, int32_t* pos2, int16_t* align_score )
-{
-  assert( _mut_type == DEL );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-
-  if ( align_score != NULL )
-  {
-    *align_score = *_align_score;
-  }
-}
-
-
-void ae_mutation::get_infos_translocation( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, bool* invert,
-                                           int16_t* align_score_1, int16_t* align_score_2 )
-{
-  assert( _mut_type == TRANS );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-  *pos3    = _pos[2];
-  *pos4    = _pos[3];
-  *invert  = _invert;
-
-  if ( align_score_1 != NULL && align_score_2 != NULL )
-  {
-    *align_score_1 = _align_score[0];
-    *align_score_2 = _align_score[1];
-  }
-}
-
-
-void ae_mutation::get_infos_inversion( int32_t* pos1, int32_t* pos2, int16_t* align_score )
-{
-  assert( _mut_type == INV );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-
-  if ( align_score != NULL )
-  {
-    *align_score = *_align_score;
-  }
-}
-
-void ae_mutation::get_infos_insertion( int32_t* pos, int32_t* length )
-{
-  assert( _mut_type == INSERT );
-  *pos    = _pos[0];
-  *length = _length[0];
-}
-
-void ae_mutation::get_sequence_insertion( char* seq )
-{
-  assert( _mut_type == INSERT );
-  strncpy( seq, _seq, _length[0]);
-  seq[_length[0]] = '\0';
-}
-
-void ae_mutation::get_infos_ins_HT( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, ae_sense* sense, int32_t* length )
-{
-  assert( _mut_type == INS_HT );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-  *pos3    = _pos[2];
-  *pos4    = _pos[3];
-  *sense    = _sense;
-  *length = _length[0];
-}
-
-void ae_mutation::get_sequence_ins_HT( char* seq )
-{
-  assert( _mut_type == INS_HT );
-  strncpy( seq, _seq, _length[0]);
-  seq[_length[0]] = '\0';
-}
-
-void ae_mutation::get_infos_repl_HT( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, ae_sense* sense, int32_t* length )
-{
-  assert( _mut_type == REPL_HT );
-  *pos1    = _pos[0];
-  *pos2    = _pos[1];
-  *pos3    = _pos[2];
-  *pos4    = _pos[3];
-  *sense    = _sense;
-  *length = _length[1];
-}
-
-void ae_mutation::get_sequence_repl_HT( char* seq )
-{
-  assert( _mut_type == REPL_HT );
-  strncpy( seq, _seq, _length[1]);
-  seq[_length[1]] = '\0';
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_mutation.h b/src/libaevol/ae_mutation.h
deleted file mode 100644
index 571dfe2..0000000
--- a/src/libaevol/ae_mutation.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
- 
- 
-#ifndef __AE_MUTATION_H__
-#define __AE_MUTATION_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_enums.h>
-#include <zlib.h>
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-enum ae_mutation_type
-{
-  SWITCH  = 0,
-  S_INS   = 1,
-  S_DEL   = 2,
-  DUPL    = 3,
-  DEL     = 4,
-  TRANS   = 5,
-  INV     = 6,
-  INSERT  = 7,
-  INS_HT  = 8,
-  REPL_HT = 9
-};
-
-
-
-
-
- 
-class ae_mutation : public ae_object
-{  
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_mutation( void );
-    ae_mutation( const ae_mutation &model );
-    ae_mutation( gzFile backup_file );
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_mutation( void );
-  
-    // =================================================================
-    //                        Accessors: Getters
-    // =================================================================
-    inline ae_mutation_type get_mut_type( void );
-    inline int32_t          get_length( void );
-
-    void get_infos_point_mutation( int32_t* pos );
-    void get_infos_small_insertion( int32_t* pos, int32_t* length ); // everything except the sequence
-    void get_sequence_small_insertion( char* seq ); // seq must be a char array, large enough to contain _length+1 characters
-    void get_infos_small_deletion( int32_t* pos, int32_t* length );
-    void get_infos_duplication( int32_t* pos1, int32_t* pos2, int32_t* pos3, int16_t* align_score = NULL );
-    void get_infos_deletion( int32_t* pos1, int32_t* pos2, int16_t* align_score = NULL );
-    void get_infos_translocation( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, bool* invert,
-                                  int16_t* align_score_1 = NULL, int16_t* align_score_2 = NULL );
-    void get_infos_inversion( int32_t* pos1, int32_t* pos2, int16_t* align_score = NULL );
-    void get_infos_insertion( int32_t* pos, int32_t* length );
-    void get_sequence_insertion( char* seq );
-    void get_infos_ins_HT( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, ae_sense* sense, int32_t* length );
-    void get_sequence_ins_HT( char* seq ); 
-    void get_infos_repl_HT( int32_t* pos1, int32_t* pos2, int32_t* pos3, int32_t* pos4, ae_sense* sense, int32_t* length );
-    void get_sequence_repl_HT( char* seq ); 
-    
-    // =================================================================
-    //                        Accessors: Setters
-    // =================================================================
-
-  
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void report_point_mutation( int32_t pos );
-    void report_small_insertion( int32_t pos, int32_t length, const char* seq );
-    void report_small_deletion( int32_t pos, int32_t length );
-    void report_duplication( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t length, int16_t align_score = -1 );
-    void report_deletion( int32_t pos_1, int32_t pos_2, int32_t length, int16_t align_score = -1 );
-    void report_translocation( int32_t pos_1, int32_t pos_2, int32_t pos_3, int32_t pos_4, int32_t length,
-                                bool invert, int16_t align_score_1 = -1, int16_t align_score_2 = -1 );
-    void report_inversion( int32_t pos_1, int32_t pos_2, int32_t length, int16_t align_score = -1 );
-    void report_insertion( int32_t pos, int32_t length, const char* seq );
-    void report_ins_HT(int32_t alignment_1_donor_pos_1, int32_t alignment_1_donor_pos_2, int32_t alignment_2_ind_pos, int32_t alignment_2_donor_pos, int32_t length, int16_t alignment_1_score, int16_t alignment_2_score, int32_t donor_id, ae_sense sense, const char* seq);
-    void report_repl_HT(int32_t alignment_1_donor_pos_1, int32_t alignment_1_donor_pos_2, int32_t alignment_2_ind_pos, int32_t alignment_2_donor_pos, int32_t repl_seq_length, int32_t donor_seq_length, int16_t alignment_1_score, int16_t alignment_2_score, int32_t donor_id, ae_sense sense, const char* seq);
-
-    void get_generic_description_string( char * str );
-    
-    /* DEPRECATED, use get_length instead */
-    int32_t segment_length( int32_t gen_unit_len );
-
-    void save( gzFile backup_file );
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    //~ ae_mutation( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_mutation_type  _mut_type;
-    int32_t*          _pos;
-    int32_t*           _length;
-    char*             _seq;
-    bool              _invert;
-    int16_t*          _align_score;
-    int32_t           _donor_id;   // CK: There should also be another int to indicate which genetic unit in the donor 
-    ae_sense          _sense;
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-ae_mutation_type ae_mutation::get_mut_type( void )
-{
-  return _mut_type;
-}
-
-inline int32_t ae_mutation::get_length( void )
-{
-  return _length[0];
-}
-
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_MUTATION_H__
diff --git a/src/libaevol/ae_output_manager.cpp b/src/libaevol/ae_output_manager.cpp
deleted file mode 100644
index 98a8c65..0000000
--- a/src/libaevol/ae_output_manager.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <err.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_output_manager.h>
-#include <ae_exp_manager.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                           Class ae_output_manager                           #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_output_manager::ae_output_manager( ae_exp_manager* exp_m )
-{
-  _exp_m  = exp_m;
-  _stats  = NULL;
-  _tree   = NULL;
-  _dump   = NULL;
-  _compute_phen_contrib_by_GU = false;
-  _record_tree = false;
-  _make_dumps = false;
-  _dump_step = 0;
-  _logs  = new ae_logs();
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_output_manager::~ae_output_manager( void )
-{
-  delete _stats;
-  delete _tree;
-  delete _dump;
-  delete _logs;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_output_manager::write_setup_file( gzFile setup_file ) const
-{
-  // Write the backup steps
-  gzwrite( setup_file, &_backup_step,      sizeof(_backup_step) );
-  gzwrite( setup_file, &_big_backup_step,  sizeof(_big_backup_step) );
-  
-  // Stats
-  gzwrite( setup_file, &_compute_phen_contrib_by_GU,  sizeof(_compute_phen_contrib_by_GU) );
-  
-  // Tree
-  int8_t record_tree = _record_tree;
-  gzwrite( setup_file, &record_tree, sizeof(record_tree) );
-  if ( _record_tree )
-  {
-    int32_t tmp_tree_step = _tree->get_tree_step();
-    gzwrite( setup_file, &tmp_tree_step, sizeof(tmp_tree_step) );
-    int8_t tmp_tree_mode = (int8_t) _tree->get_tree_mode();
-    gzwrite( setup_file, &tmp_tree_mode, sizeof(tmp_tree_mode) );
-  }
-  
-  // Dumps
-  int8_t make_dumps = _make_dumps;
-  gzwrite( setup_file, &make_dumps,  sizeof(make_dumps) );
-  gzwrite( setup_file, &_dump_step,  sizeof(_dump_step) );
-  
-  // Logs
-  int8_t logs = _logs->get_logs();
-  gzwrite( setup_file, &logs,  sizeof(logs) );
-}
-
-void ae_output_manager::write_setup_file( FILE* setup_file ) const
-{
-  // Write the backup steps
-  fprintf( setup_file, "BACKUP_STEP %"PRId32"\n", _backup_step );
-  fprintf( setup_file, "BIG_BACKUP_STEP %"PRId32"\n", _big_backup_step );
-  
-  // Stats
-  fprintf( setup_file, "COMPUTE_PHENOTYPIC_CONTRIBUTION_BY_GU %"PRId8"\n", (int8_t) _compute_phen_contrib_by_GU );
-  
-  // Tree
-  fprintf( setup_file, "RECORD_TREE %s\n", _record_tree ? "true" : "false" );
-  if ( _record_tree )
-  {
-    fprintf( setup_file, "TREE_STEP %"PRId32"\n", _tree->get_tree_step() );
-    
-    if ( _tree->get_tree_mode() == LIGHT )
-    {
-      fprintf( setup_file, "TREE_MODE LIGHT\n" );
-    }
-    else if ( _tree->get_tree_mode() == NORMAL )
-    {
-      fprintf( setup_file, "TREE_MODE NORMAL\n" );
-    }
-    else
-    {
-      fprintf( setup_file, "TREE_MODE UNKNOWN\n" );
-    }
-  }
-  
-  // Dumps
-  fprintf( setup_file, "MAKE_DUMPS %s\n", _make_dumps ? "true" : "false" );
-  fprintf( setup_file, "DUMP_STEP %"PRId32"\n", _dump_step );
-  
-  // Logs
-  int8_t logs = _logs->get_logs();
-  fprintf( setup_file, "LOGS %"PRId8"\n", logs );
-}
-
-void ae_output_manager::load( gzFile setup_file, bool verbose, bool to_be_run  )
-{
-  // Write the backup steps
-  gzread( setup_file, &_backup_step,      sizeof(_backup_step) );
-  gzread( setup_file, &_big_backup_step,  sizeof(_big_backup_step) );
-  
-  // Stats
-  int32_t num_gener = _exp_m->get_num_gener();
-  if( to_be_run )
-  {
-    if ( num_gener > 0 )
-    {
-      _stats = new ae_stats( _exp_m, num_gener );
-    }
-    else
-    {
-      _stats = new ae_stats( _exp_m );
-    }
-  }
-  gzread( setup_file, &_compute_phen_contrib_by_GU,  sizeof(_compute_phen_contrib_by_GU) );
-  
-  // Tree
-  int8_t record_tree;
-  gzread( setup_file, &record_tree, sizeof(record_tree) );
-  _record_tree = record_tree;
-  if ( _record_tree )
-  {
-    int32_t tmp_tree_step;
-    gzread( setup_file, &tmp_tree_step, sizeof(tmp_tree_step) );
-    int8_t tmp_tree_mode;
-    gzread( setup_file, &tmp_tree_mode, sizeof(tmp_tree_mode) );
-    if ( (ae_tree_mode)tmp_tree_mode != LIGHT && (ae_tree_mode)tmp_tree_mode != NORMAL)
-    {
-      printf( "%s:%d: error: invalid tree mode\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    }
-    
-    _tree = new ae_tree( _exp_m, (ae_tree_mode) tmp_tree_mode, tmp_tree_step );
-  }
-  
-  // Dumps
-  int8_t make_dumps;
-  gzread( setup_file, &make_dumps, sizeof(make_dumps) );
-  _make_dumps = make_dumps;
-  gzread( setup_file, &_dump_step,  sizeof(_dump_step) );
-  if( _make_dumps == true)
-  {
-    _dump = new ae_dump(_exp_m);
-  }
-  
-  // Logs
-  int8_t logs;
-  gzread( setup_file, &logs, sizeof(logs) );
-  if( to_be_run)
-  {
-    _logs->load(logs, num_gener);
-  }
-}
-
-void ae_output_manager::load( FILE* setup_file, bool verbose, bool to_be_run  )
-{
-  // Write the backup steps
-  fscanf( setup_file, "BACKUP_STEP %"PRId32"\n", &_backup_step );
-  fscanf( setup_file, "BIG_BACKUP_STEP %"PRId32"\n", &_big_backup_step );
-  
-  // Stats
-  int32_t num_gener = _exp_m->get_num_gener();
-  if( to_be_run)
-  {
-    if ( num_gener > 0 )
-    {
-      _stats = new ae_stats( _exp_m, num_gener );
-    }
-    else
-    {
-      _stats = new ae_stats( _exp_m );
-    }
-  }
-  fscanf( setup_file, "COMPUTE_PHENOTYPIC_CONTRIBUTION_BY_GU %"PRId8"\n", (int8_t*) &_compute_phen_contrib_by_GU );
-  
-  char tmp[10];
-  
-  // Tree
-  fscanf( setup_file, "RECORD_TREE %s\n", tmp );
-  _record_tree = ! strcmp( tmp, "true" );
-  if ( _record_tree )
-  {
-    int32_t tmp_tree_step;
-    fscanf( setup_file, "TREE_STEP %"PRId32"\n", &tmp_tree_step );
-    int8_t tmp_tree_mode;
-    fscanf( setup_file, "TREE_MODE %"PRId8"\n", &tmp_tree_mode );
-    if ( (ae_tree_mode)tmp_tree_mode != LIGHT && (ae_tree_mode)tmp_tree_mode != NORMAL)
-    {
-        printf( "%s:%d: error: invalid tree mode\n", __FILE__, __LINE__ );
-        assert( false );
-        exit( EXIT_FAILURE );
-    }
-    
-    _tree = new ae_tree( _exp_m, (ae_tree_mode) tmp_tree_mode, tmp_tree_step );
-  }
-  
-  // Dumps
-  fscanf( setup_file, "MAKE_DUMPS %s\n", tmp );
-  _make_dumps = ! strcmp( tmp, "true" );
-  fscanf( setup_file, "DUMP_STEP %"PRId32"\n", &_dump_step );
-  if( _make_dumps == true)
-  {
-    _dump = new ae_dump(_exp_m);
-  }
-  
-  // Logs
-  int8_t logs;
-  fscanf( setup_file, "LOGS %"PRId8"\n", &logs );
-  _logs->load(logs, num_gener);
-}
-
-void ae_output_manager::write_current_generation_outputs( void ) const
-{
-  int32_t num_gener = _exp_m->get_num_gener();
-  
-  _stats->write_current_generation_statistics();
-  
-  if ( _record_tree )
-  {
-    if ( num_gener > 0 )
-    {
-      _tree->fill_tree_with_cur_gener(); 
-    }
-  }
-
-  // Write backup and tree
-  if ( _record_tree && (num_gener != _exp_m->get_first_gener()) && (num_gener % _tree->get_tree_step() == 0) )    
-  {
-    if ( _tree->get_tree_mode() == NORMAL ) 
-    { 
-      write_tree();
-    }
-  }
-  
-  if ( num_gener % _backup_step == 0 )
-  {
-    _stats->flush();
-    _exp_m->save();
-    
-    // Update the LAST_GENER file
-    FILE* last_gener_file = fopen( LAST_GENER_FNAME, "w" );
-    if ( last_gener_file != NULL )
-    {
-      fprintf( last_gener_file, "%"PRId32"\n", num_gener );
-      fclose( last_gener_file );
-    }
-    else
-    {
-      printf( "Error : could not open file "LAST_GENER_FNAME"\n" );
-    }
-    
-    #ifdef __IN2P3
-      if ( num_gener % _big_backup_step == 0 )
-      {
-        system( "./make_big_backup.py" );
-      }
-    #endif
-  }
-
-  if ( _make_dumps ) 
-  {
-    if( num_gener % _dump_step == 0 )
-    {
-      _dump->write_current_generation_dump();
-    }
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_output_manager::write_tree( void ) const
-{
-  // Create the tree directory if it doesn't exist
-  int status;
-  status = mkdir( TREE_DIR, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, "Impossible to create the directory %s", TREE_DIR );
-  }
-  
-  char tree_file_name[50];
-  
-#ifdef __REGUL
-  sprintf( tree_file_name, "tree/tree_%06"PRId32".rae", _exp_m->get_num_gener() );
-#else
-  sprintf( tree_file_name, "tree/tree_%06"PRId32".ae", _exp_m->get_num_gener() );
-#endif
-  
-  gzFile tree_file = gzopen( tree_file_name, "w" );
-  
-  // Write phylogenetic data (tree)
-  _tree->write_to_tree_file( tree_file );
-  
-  gzclose( tree_file );
-}
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
diff --git a/src/libaevol/ae_output_manager.h b/src/libaevol/ae_output_manager.h
deleted file mode 100644
index cd8e299..0000000
--- a/src/libaevol/ae_output_manager.h
+++ /dev/null
@@ -1,277 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef __AE_OUPUT_MANAGER_H__
-#define __AE_OUPUT_MANAGER_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_enums.h>
-#include <ae_stats.h>
-#include <ae_tree.h>
-#include <ae_dump.h>
-#include <ae_logs.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
-
-
-
-
-
-class ae_output_manager
-{
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_output_manager( ae_exp_manager* exp_m );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_output_manager( void );
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-    
-    // Backup
-    inline int32_t	get_backup_step(void) const;
-    inline int32_t	get_big_backup_step(void) const;
-    
-    // Tree
-    inline bool         get_record_tree( void ) const;
-    inline int32_t      get_tree_step( void ) const;
-    inline ae_tree_mode get_tree_mode( void ) const;
-    inline ae_tree*     get_tree( void ) const;
-  
-    // Logs
-    inline FILE* get_log( ae_log_type log_type )   const;
-    inline bool  is_logged( ae_log_type log_type ) const;
-  
-    // Stats
-    inline bool get_compute_phen_contrib_by_GU( void ) const;
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-    inline void set_backup_step( int32_t backup_step );
-    inline void set_big_backup_step( int32_t big_backup_step );
-    inline void init_tree( ae_exp_manager* exp_m, ae_tree_mode _tree_mode, int32_t _tree_step );
-    inline void set_dump_step( int32_t dump_step );
-    inline void set_compute_phen_contrib_by_GU( bool compute_phen_contrib_by_GU );
-    inline void set_logs (int8_t logs);
-  
-    // =================================================================
-    //                              Operators
-    // =================================================================
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void write_setup_file( gzFile setup_file ) const;
-    void write_setup_file( FILE* setup_file ) const;
-    void load( gzFile file, bool verbose, bool to_be_run  );
-    void load( FILE* file, bool verbose, bool to_be_run );
-    void write_current_generation_outputs( void ) const;
-    inline void flush( void );
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_output_manager( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_output_manager( const ae_output_manager &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void write_tree( void ) const;
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-    
-    // Backups
-    int32_t _backup_step;
-    int32_t _big_backup_step;
-    
-    // Stats
-    ae_stats* _stats;
-    bool      _compute_phen_contrib_by_GU;
-  
-    // Tree
-    bool      _record_tree;
-    ae_tree*  _tree;
-    
-    // Dumps
-    bool      _make_dumps;
-    int32_t   _dump_step;
-    ae_dump*  _dump;
-    
-    // Logs
-    ae_logs*  _logs;
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-
-// Backup
-inline int32_t ae_output_manager::get_backup_step(void) const
-{
-  return _backup_step;
-}
-
-inline int32_t ae_output_manager::get_big_backup_step(void) const
-{
-  return _big_backup_step;
-}
-
-// Tree
-inline bool ae_output_manager::get_record_tree( void ) const
-{
-  return _record_tree;
-}
-
-inline int32_t ae_output_manager::get_tree_step( void ) const
-{
-  return _tree->get_tree_step();
-}
-
-inline ae_tree_mode ae_output_manager::get_tree_mode( void ) const
-{
-  return _tree->get_tree_mode();
-}
-
-inline ae_tree* ae_output_manager::get_tree( void ) const
-{
-  return _tree;
-}
-
-// Logs
-inline FILE* ae_output_manager::get_log( ae_log_type log_type )   const
-{
-  return _logs->get_log( log_type );
-}
-
-inline bool  ae_output_manager::is_logged( ae_log_type log_type ) const
-{
-  return _logs->is_logged( log_type );
-}
-
-// Stats
-inline bool ae_output_manager::get_compute_phen_contrib_by_GU( void ) const
-{
-  return _compute_phen_contrib_by_GU;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-inline void ae_output_manager::set_backup_step( int32_t backup_step )
-{
-  _backup_step = backup_step;
-}
-
-inline void ae_output_manager::set_big_backup_step( int32_t big_backup_step )
-{
-  _big_backup_step = big_backup_step;
-}
-
-inline void ae_output_manager::init_tree( ae_exp_manager* exp_m, ae_tree_mode _tree_mode, int32_t _tree_step )
-{
-  _record_tree = true;
-  _tree = new ae_tree( exp_m, _tree_mode, _tree_step );
-}
-
-inline void ae_output_manager::set_dump_step( int32_t dump_step )
-{
-  _make_dumps = true;
-  _dump_step  = dump_step;
-}
-
-inline void ae_output_manager::set_compute_phen_contrib_by_GU( bool compute_phen_contrib_by_GU )
-{
-  _compute_phen_contrib_by_GU = compute_phen_contrib_by_GU;
-}
-
-inline void ae_output_manager::set_logs (int8_t logs)
-{
-  _logs->set_logs(logs);
-}
-
-// =====================================================================
-//                          Operators' definitions
-// =====================================================================
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_output_manager::flush( void )
-{
-  _stats->flush();
-}
-
-#endif // __AE_OUPUT_MANAGER_H__
diff --git a/src/libaevol/ae_params_mut.cpp b/src/libaevol/ae_params_mut.cpp
deleted file mode 100644
index b10e9cd..0000000
--- a/src/libaevol/ae_params_mut.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_params_mut.h>
-#include <ae_align.h>
-
-
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_params_mut                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_params_mut::ae_params_mut( void )
-{
-  // --------------------------------------------------------- Mutation rates
-  _point_mutation_rate  = 0.0;
-  _small_insertion_rate = 0.0;
-  _small_deletion_rate  = 0.0;
-  _max_indel_size       = 0;
-
-  // -------------------------------------------- Rearrangements and Transfer
-  _with_4pts_trans            = false;
-  _with_alignments            = false;
-  _with_HT                    = false;
-  _repl_HT_with_close_points  = false;
-  _HT_ins_rate                = 0.0;
-  _HT_repl_rate               = 0.0;
-  _repl_HT_detach_rate        = 0.0;
-
-  // ------------------------------ Rearrangement rates (without alignements)
-  _duplication_rate   = 0.0;
-  _deletion_rate      = 0.0;
-  _translocation_rate = 0.0;
-  _inversion_rate     = 0.0;
-
-  // --------------------------------- Rearrangement rates (with alignements)
-  _neighbourhood_rate = 0.0;
-  
-  _duplication_proportion   = 0.0;
-  _deletion_proportion      = 0.0;
-  _translocation_proportion = 0.0;
-  _inversion_proportion     = 0.0;
-  
-  // ------------------------------------------------------------ Alignements
-  _align_fun_shape    = SIGMOID;
-  _align_sigm_lambda  = 4;
-  _align_sigm_mean    = 50;
-  _align_lin_min      = 0;
-  _align_lin_max      = 100;
-  
-  _align_max_shift      = 20;
-  _align_w_zone_h_len   = 50;
-  _align_match_bonus    = 1;
-  _align_mismatch_cost  = 2;
-}
-
-ae_params_mut::ae_params_mut( const ae_params_mut& model )
-{
-  // --------------------------------------------------------- Mutation rates
-  _point_mutation_rate  = model._point_mutation_rate;
-  _small_insertion_rate = model._small_insertion_rate;
-  _small_deletion_rate  = model._small_deletion_rate;
-  _max_indel_size       = model._max_indel_size;
-
-  // -------------------------------------------- Rearrangements and Transfer
-  _with_4pts_trans            = model._with_4pts_trans;
-  _with_alignments            = model._with_alignments;
-  _with_HT                    = model._with_HT;
-  _repl_HT_with_close_points  = model._repl_HT_with_close_points;
-  _HT_ins_rate                = model._HT_ins_rate;
-  _HT_repl_rate               = model._HT_repl_rate;
-  _repl_HT_detach_rate        = model._repl_HT_detach_rate;
-
-  // ------------------------------ Rearrangement rates (without alignements)
-  _duplication_rate   = model._duplication_rate;
-  _deletion_rate      = model._deletion_rate;
-  _translocation_rate = model._translocation_rate;
-  _inversion_rate     = model._inversion_rate;
-
-  // --------------------------------- Rearrangement rates (with alignements)
-  _neighbourhood_rate = model._neighbourhood_rate;
-  
-  _duplication_proportion   = model._duplication_proportion;
-  _deletion_proportion      = model._deletion_proportion;
-  _translocation_proportion = model._translocation_proportion;
-  _inversion_proportion     = model._inversion_proportion;
-  
-  // ------------------------------------------------------------ Alignements
-  _align_fun_shape    = model._align_fun_shape;
-  _align_sigm_lambda  = model._align_sigm_lambda;
-  _align_sigm_mean    = model._align_sigm_mean;
-  _align_lin_min      = model._align_lin_min;
-  _align_lin_max      = model._align_lin_max;
-  
-  _align_max_shift      = model._align_max_shift;
-  _align_w_zone_h_len   = model._align_w_zone_h_len;
-  _align_match_bonus    = model._align_match_bonus;
-  _align_mismatch_cost  = model._align_mismatch_cost;
-}
-
-ae_params_mut::ae_params_mut( gzFile backup_file )
-{
-  // --------------------------------------------------------- Mutation rates
-  gzread( backup_file, &_point_mutation_rate,  sizeof(_point_mutation_rate) );
-  gzread( backup_file, &_small_insertion_rate, sizeof(_small_insertion_rate) );
-  gzread( backup_file, &_small_deletion_rate,  sizeof(_small_deletion_rate) );
-  gzread( backup_file, &_max_indel_size,       sizeof(_max_indel_size) );
-
-  // -------------------------------------------- Rearrangements and Transfer
-  int8_t tmp;
-  gzread( backup_file, &tmp, sizeof(tmp) );
-  _with_4pts_trans = (tmp != 0);
-  gzread( backup_file, &tmp, sizeof(tmp) );
-  _with_alignments = (tmp != 0);
-  gzread( backup_file, &tmp, sizeof(tmp) );
-  _with_HT = (tmp != 0);
-  gzread( backup_file, &tmp, sizeof(tmp) );
-  _repl_HT_with_close_points = (tmp != 0);
-  gzread( backup_file, &_HT_ins_rate,  sizeof(_HT_ins_rate) );
-  gzread( backup_file, &_HT_repl_rate, sizeof(_HT_repl_rate) );
-  gzread( backup_file, &_repl_HT_detach_rate, sizeof(_repl_HT_detach_rate) );
-
-  // ------------------------------ Rearrangement rates (without alignements)
-  gzread( backup_file, &_duplication_rate,   sizeof(_duplication_rate) );
-  gzread( backup_file, &_deletion_rate,      sizeof(_deletion_rate) );
-  gzread( backup_file, &_translocation_rate, sizeof(_translocation_rate) );
-  gzread( backup_file, &_inversion_rate,     sizeof(_inversion_rate) );
-
-  // --------------------------------- Rearrangement rates (with alignements)
-  gzread( backup_file, &_neighbourhood_rate,       sizeof(_neighbourhood_rate) );
-  gzread( backup_file, &_duplication_proportion,   sizeof(_duplication_proportion) );
-  gzread( backup_file, &_deletion_proportion,      sizeof(_deletion_proportion) );
-  gzread( backup_file, &_translocation_proportion, sizeof(_translocation_proportion) );
-  gzread( backup_file, &_inversion_proportion,     sizeof(_inversion_proportion) );
-  
-  // ------------------------------------------------------------ Alignements
-  gzread( backup_file, &_align_fun_shape,     sizeof(_align_fun_shape) );
-  gzread( backup_file, &_align_sigm_lambda,   sizeof(_align_sigm_lambda) );
-  gzread( backup_file, &_align_sigm_mean,     sizeof(_align_sigm_mean) );
-  gzread( backup_file, &_align_lin_min,       sizeof(_align_lin_min) );
-  gzread( backup_file, &_align_lin_max,       sizeof(_align_lin_max) );
-  
-  gzread( backup_file, &_align_max_shift,     sizeof(_align_max_shift) );
-  gzread( backup_file, &_align_w_zone_h_len,  sizeof(_align_w_zone_h_len) );
-  gzread( backup_file, &_align_match_bonus,   sizeof(_align_match_bonus) );
-  gzread( backup_file, &_align_mismatch_cost, sizeof(_align_mismatch_cost) );
-  
-  //ae_align::align_fun_shape     = _align_fun_shape;
-  //ae_align::align_sigm_lambda   = _align_sigm_lambda;
-  //ae_align::align_sigm_mean     = _align_sigm_mean;
-  //ae_align::align_lin_min       = _align_lin_min;
-  //ae_align::align_lin_max       = _align_lin_max;
-  
-  //ae_align::align_max_shift     = _align_max_shift;
-  //ae_align::align_w_zone_h_len  = _align_w_zone_h_len;
-  //ae_align::align_match_bonus   = _align_match_bonus;
-  //ae_align::align_mismatch_cost = _align_mismatch_cost;
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_params_mut::~ae_params_mut( void )
-{
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_params_mut::save( gzFile backup_file ) const
-{
-  // --------------------------------------------------------- Mutation rates
-  gzwrite( backup_file, &_point_mutation_rate,  sizeof(_point_mutation_rate) );
-  gzwrite( backup_file, &_small_insertion_rate, sizeof(_small_insertion_rate) );
-  gzwrite( backup_file, &_small_deletion_rate,  sizeof(_small_deletion_rate) );
-  gzwrite( backup_file, &_max_indel_size,       sizeof(_max_indel_size) );
-
-  // -------------------------------------------- Rearrangements and Transfer
-  int8_t tmp = _with_4pts_trans ? 1 : 0;
-  gzwrite( backup_file, &tmp,  sizeof(tmp) );
-  tmp = _with_alignments ? 1 : 0;
-  gzwrite( backup_file, &tmp,  sizeof(tmp) );
-  tmp = _with_HT ? 1 : 0;
-  gzwrite( backup_file, &tmp,  sizeof(tmp) );
-  tmp = _repl_HT_with_close_points ? 1 : 0;
-  gzwrite( backup_file, &tmp,  sizeof(tmp) );
-  gzwrite( backup_file, &_HT_ins_rate,  sizeof(_HT_ins_rate) );
-  gzwrite( backup_file, &_HT_repl_rate, sizeof(_HT_repl_rate) );
-  gzwrite( backup_file, &_repl_HT_detach_rate, sizeof(_repl_HT_detach_rate) );
-
-  // ------------------------------ Rearrangement rates (without alignements)
-  gzwrite( backup_file, &_duplication_rate,   sizeof(_duplication_rate) );
-  gzwrite( backup_file, &_deletion_rate,      sizeof(_deletion_rate) );
-  gzwrite( backup_file, &_translocation_rate, sizeof(_translocation_rate) );
-  gzwrite( backup_file, &_inversion_rate,     sizeof(_inversion_rate) );
-
-  // --------------------------------- Rearrangement rates (with alignements)
-  gzwrite( backup_file, &_neighbourhood_rate,       sizeof(_neighbourhood_rate) );
-  gzwrite( backup_file, &_duplication_proportion,   sizeof(_duplication_proportion) );
-  gzwrite( backup_file, &_deletion_proportion,      sizeof(_deletion_proportion) );
-  gzwrite( backup_file, &_translocation_proportion, sizeof(_translocation_proportion) );
-  gzwrite( backup_file, &_inversion_proportion,     sizeof(_inversion_proportion) );
-  
-  // ------------------------------------------------------------ Alignements
-  gzwrite( backup_file, &_align_fun_shape,     sizeof(_align_fun_shape) );
-  gzwrite( backup_file, &_align_sigm_lambda,   sizeof(_align_sigm_lambda) );
-  gzwrite( backup_file, &_align_sigm_mean,     sizeof(_align_sigm_mean) );
-  gzwrite( backup_file, &_align_lin_min,       sizeof(_align_lin_min) );
-  gzwrite( backup_file, &_align_lin_max,       sizeof(_align_lin_max) );
-  
-  gzwrite( backup_file, &_align_max_shift,     sizeof(_align_max_shift) );
-  gzwrite( backup_file, &_align_w_zone_h_len,  sizeof(_align_w_zone_h_len) );
-  gzwrite( backup_file, &_align_match_bonus,   sizeof(_align_match_bonus) );
-  gzwrite( backup_file, &_align_mismatch_cost, sizeof(_align_mismatch_cost) );
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
diff --git a/src/libaevol/ae_params_mut.h b/src/libaevol/ae_params_mut.h
deleted file mode 100644
index 3810fe5..0000000
--- a/src/libaevol/ae_params_mut.h
+++ /dev/null
@@ -1,567 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// ****************************************************************************
-
-
-#ifndef __AE_PARAMS_MUT_H__
-#define __AE_PARAMS_MUT_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_enums.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_params_mut : public ae_object
-{
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_params_mut( void );
-    ae_params_mut( const ae_params_mut& model );
-    ae_params_mut( gzFile backup_file );
-
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_params_mut( void );
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-
-    // --------------------------------------------------------- Mutation rates
-    inline double   get_point_mutation_rate( void ) const;
-    inline double   get_small_insertion_rate( void ) const;
-    inline double   get_small_deletion_rate( void ) const;
-    inline int16_t  get_max_indel_size( void ) const;
-
-    // -------------------------------------------- Rearrangements and Transfer
-    inline bool   get_with_4pts_trans( void ) const;
-    inline bool   get_with_alignments( void ) const;
-    inline bool   get_with_HT( void ) const;
-    inline bool   get_repl_HT_with_close_points( void ) const;
-    inline double get_HT_ins_rate( void ) const;
-    inline double get_HT_repl_rate( void ) const;
-    inline double get_repl_HT_detach_rate( void ) const;
-
-    // ------------------------------ Rearrangement rates (without alignements)
-    inline double get_duplication_rate( void ) const;
-    inline double get_deletion_rate( void ) const;
-    inline double get_translocation_rate( void ) const;
-    inline double get_inversion_rate( void ) const;
-
-    // --------------------------------- Rearrangement rates (with alignements)
-    inline double get_neighbourhood_rate( void ) const;
-    inline double get_duplication_proportion( void ) const;
-    inline double get_deletion_proportion( void ) const;
-    inline double get_translocation_proportion( void ) const;
-    inline double get_inversion_proportion( void ) const;
-
-    // ------------------------------------------------------------ Alignements
-    inline ae_align_fun_shape get_align_fun_shape( void ) const;
-    inline double  get_align_sigm_lambda( void ) const;
-    inline int16_t get_align_sigm_mean( void ) const;
-    inline int16_t get_align_lin_min( void ) const;
-    inline int16_t get_align_lin_max( void ) const;
-    
-    // Maximum shift of one seq on the other
-    inline int16_t get_align_max_shift( void ) const;
-    // Work zone half length
-    inline int16_t get_align_w_zone_h_len( void ) const;
-    // Corresponding residues match bonus
-    inline int16_t get_align_match_bonus( void ) const;
-    // Corresponding residues mismatch cost
-    inline int16_t get_align_mismatch_cost( void ) const;
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-
-    // --------------------------------------------------------- Mutation rates
-    inline void set_point_mutation_rate( double point_mutation_rate );
-    inline void set_small_insertion_rate( double small_insertion_rate );
-    inline void set_small_deletion_rate( double small_deletion_rate );
-    inline void set_max_indel_size( int16_t max_indel_size );
-
-    // -------------------------------------------- Rearrangements and Transfer
-    inline void set_with_4pts_trans( bool with_4pts_trans );
-    inline void set_with_alignments( bool with_alignments );
-    inline void set_with_HT( bool with_HT );
-    inline void set_repl_HT_with_close_points( bool repl_HT_with_close_points);
-    inline void set_HT_ins_rate( double HT_ins_rate );
-    inline void set_HT_repl_rate( double HT_repl_rate );
-    inline void set_repl_HT_detach_rate( double repl_HT_detach_rate );
-
-    // ------------------------------ Rearrangement rates (without alignements)
-    inline void set_duplication_rate( double duplication_rate );
-    inline void set_deletion_rate( double deletion_rate );
-    inline void set_translocation_rate( double translocation_rate );
-    inline void set_inversion_rate( double inversion_rate );
-
-    // --------------------------------- Rearrangement rates (with alignements)
-    inline void set_neighbourhood_rate( double neighbourhood_rate );
-    inline void set_duplication_proportion( double duplication_proportion );
-    inline void set_deletion_proportion( double deletion_proportion );
-    inline void set_translocation_proportion( double translocation_proportion );
-    inline void set_inversion_proportion( double inversion_proportion );
-
-    // ------------------------------------------------------------ Alignements
-    inline void set_align_fun_shape( ae_align_fun_shape align_fun_shape );
-    inline void set_align_sigm_lambda( double align_sigm_lambda );
-    inline void set_align_sigm_mean( int16_t align_sigm_mean );
-    inline void set_align_lin_min( int16_t align_lin_min );
-    inline void set_align_lin_max( int16_t align_lin_max );
-    
-    inline void set_align_max_shift( int16_t align_max_shift );
-    inline void set_align_w_zone_h_len( int16_t align_w_zone_h_len );
-    inline void set_align_match_bonus( int16_t align_match_bonus );
-    inline void set_align_mismatch_cost( int16_t align_mismatch_cost );
-
-    // =================================================================
-    //                              Operators
-    // =================================================================
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void save( gzFile backup_file ) const;
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    /*ae_params_mut( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_params_mut( const ae_params_mut &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-
-    // --------------------------------------------------------- Mutation rates
-    double  _point_mutation_rate;
-    double  _small_insertion_rate;
-    double  _small_deletion_rate;
-    int16_t _max_indel_size;
-
-    // -------------------------------------------- Rearrangements and Transfer
-    bool    _with_4pts_trans;
-    bool    _with_alignments;
-    bool    _with_HT;
-    bool    _repl_HT_with_close_points;
-    double  _HT_ins_rate;
-    double  _HT_repl_rate;
-    double  _repl_HT_detach_rate;
-
-    // ------------------------------ Rearrangement rates (without alignements)
-    double _duplication_rate;
-    double _deletion_rate;
-    double _translocation_rate;
-    double _inversion_rate;
-
-    // --------------------------------- Rearrangement rates (with alignements)
-    double _neighbourhood_rate;
-    double _duplication_proportion;
-    double _deletion_proportion;
-    double _translocation_proportion;
-    double _inversion_proportion;
-
-    // ------------------------------------------------------------ Alignements
-    ae_align_fun_shape _align_fun_shape;
-    double  _align_sigm_lambda;
-    int16_t _align_sigm_mean;
-    int16_t _align_lin_min;
-    int16_t _align_lin_max;
-    
-    int16_t _align_max_shift;     // Maximum shift of one seq on the other
-    int16_t _align_w_zone_h_len;  // Work zone half length
-    int16_t _align_match_bonus;   // Corresponding residues match bonus
-    int16_t _align_mismatch_cost; // Corresponding residues mismatch cost
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-
-// ------------------------------------------------------------- Mutation rates
-inline double ae_params_mut::get_point_mutation_rate( void ) const
-{
-  return _point_mutation_rate;
-}
-
-inline double ae_params_mut::get_small_insertion_rate( void ) const
-{
-  return _small_insertion_rate;
-}
-
-inline double ae_params_mut::get_small_deletion_rate( void ) const
-{
-  return _small_deletion_rate;
-}
-
-inline int16_t ae_params_mut::get_max_indel_size( void ) const
-{
-  return _max_indel_size;
-}
-
-// ------------------------------------------------ Rearrangements and Transfer
-inline bool ae_params_mut::get_with_4pts_trans( void ) const
-{
-  return _with_4pts_trans;
-}
-
-inline bool ae_params_mut::get_with_alignments( void ) const
-{
-  return _with_alignments;
-}
-
-inline bool ae_params_mut::get_with_HT( void ) const
-{
-  return _with_HT;
-}
-
-inline bool ae_params_mut::get_repl_HT_with_close_points( void ) const
-{
-  return _repl_HT_with_close_points;
-}
-
-inline double ae_params_mut::get_HT_ins_rate( void ) const
-{
-  return _HT_ins_rate;
-}
-
-inline double ae_params_mut::get_HT_repl_rate( void ) const
-{
-  return _HT_repl_rate;
-}
-
-inline double ae_params_mut::get_repl_HT_detach_rate( void ) const
-{
-  return _repl_HT_detach_rate;
-}
-
-// ---------------------------------- Rearrangement rates (without alignements)
-inline double ae_params_mut::get_duplication_rate( void ) const
-{
-  return _duplication_rate;
-}
-
-inline double ae_params_mut::get_deletion_rate( void ) const
-{
-  return _deletion_rate;
-}
-
-inline double ae_params_mut::get_translocation_rate( void ) const
-{
-  return _translocation_rate;
-}
-
-inline double ae_params_mut::get_inversion_rate( void ) const
-{
-  return _inversion_rate;
-}
-
-// ------------------------------------- Rearrangement rates (with alignements)
-inline double ae_params_mut::get_neighbourhood_rate( void ) const
-{
-  return _neighbourhood_rate;
-}
-
-inline double ae_params_mut::get_duplication_proportion( void ) const
-{
-  return _duplication_proportion;
-}
-
-inline double ae_params_mut::get_deletion_proportion( void ) const
-{
-  return _deletion_proportion;
-}
-
-inline double ae_params_mut::get_translocation_proportion( void ) const
-{
-  return _translocation_proportion;
-}
-
-inline double ae_params_mut::get_inversion_proportion( void ) const
-{
-  return _inversion_proportion;
-}
-
-// ---------------------------------------------------------------- Alignements
-inline ae_align_fun_shape ae_params_mut::get_align_fun_shape( void ) const
-{
- return _align_fun_shape;
-}
-
-inline double ae_params_mut::get_align_sigm_lambda( void ) const
-{
- return _align_sigm_lambda;
-}
-
-inline int16_t ae_params_mut::get_align_sigm_mean( void ) const
-{
- return _align_sigm_mean;
-}
-
-inline int16_t ae_params_mut::get_align_lin_min( void ) const
-{
- return _align_lin_min;
-}
-
-inline int16_t ae_params_mut::get_align_lin_max( void ) const
-{
- return _align_lin_max;
-}
-
-inline int16_t ae_params_mut::get_align_max_shift( void ) const
-{
- return _align_max_shift;
-}
-
-inline int16_t ae_params_mut::get_align_w_zone_h_len( void ) const
-{
- return _align_w_zone_h_len;
-}
-
-inline int16_t ae_params_mut::get_align_match_bonus( void ) const
-{
- return _align_match_bonus;
-}
-
-inline int16_t ae_params_mut::get_align_mismatch_cost( void ) const
-{
- return _align_mismatch_cost;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-
-// ------------------------------------------------------------- Mutation rates
-inline void ae_params_mut::set_point_mutation_rate( double point_mutation_rate )
-{
-  _point_mutation_rate = point_mutation_rate;
-}
-
-inline void ae_params_mut::set_small_insertion_rate( double small_insertion_rate )
-{
-  _small_insertion_rate = small_insertion_rate;
-}
-
-inline void ae_params_mut::set_small_deletion_rate( double small_deletion_rate )
-{
-  _small_deletion_rate = small_deletion_rate;
-}
-
-inline void ae_params_mut::set_max_indel_size( int16_t max_indel_size )
-{
-  _max_indel_size = max_indel_size;
-}
-
-// ------------------------------------------------ Rearrangements and Transfer
-inline void ae_params_mut::set_with_4pts_trans( bool with_4pts_trans )
-{
-  _with_4pts_trans = with_4pts_trans;
-}
-
-inline void ae_params_mut::set_with_alignments( bool with_alignments )
-{
-  _with_alignments = with_alignments;
-}
-
-inline void ae_params_mut::set_with_HT( bool with_HT )
-{
-  _with_HT = with_HT;
-}
-
-inline void ae_params_mut::set_repl_HT_with_close_points( bool repl_HT_with_close_points)
-{
-  _repl_HT_with_close_points = repl_HT_with_close_points;
-}
-
-inline void ae_params_mut::set_HT_ins_rate( double HT_ins_rate )
-{
-  _HT_ins_rate = HT_ins_rate;
-}
-
-inline void ae_params_mut::set_HT_repl_rate( double HT_repl_rate )
-{
-  _HT_repl_rate = HT_repl_rate;
-}
-
-inline void ae_params_mut::set_repl_HT_detach_rate( double repl_HT_detach_rate )
-{
-  _repl_HT_detach_rate = repl_HT_detach_rate;
-}
-
-// ---------------------------------- Rearrangement rates (without alignements)
-inline void ae_params_mut::set_duplication_rate( double duplication_rate )
-{
-  _duplication_rate = duplication_rate;
-}
-
-inline void ae_params_mut::set_deletion_rate( double deletion_rate )
-{
-  _deletion_rate = deletion_rate;
-}
-
-inline void ae_params_mut::set_translocation_rate( double translocation_rate )
-{
-  _translocation_rate = translocation_rate;
-}
-
-inline void ae_params_mut::set_inversion_rate( double inversion_rate )
-{
-  _inversion_rate = inversion_rate;
-}
-
-// ------------------------------------- Rearrangement rates (with alignements)
-inline void ae_params_mut::set_neighbourhood_rate( double neighbourhood_rate )
-{
-  _neighbourhood_rate = neighbourhood_rate;
-}
-
-inline void ae_params_mut::set_duplication_proportion( double duplication_proportion )
-{
-  _duplication_proportion = duplication_proportion;
-}
-
-inline void ae_params_mut::set_deletion_proportion( double deletion_proportion )
-{
-  _deletion_proportion = deletion_proportion;
-}
-
-inline void ae_params_mut::set_translocation_proportion( double translocation_proportion )
-{
-  _translocation_proportion = translocation_proportion;
-}
-
-inline void ae_params_mut::set_inversion_proportion( double inversion_proportion )
-{
-  _inversion_proportion = inversion_proportion;
-}
-
-// ---------------------------------------------------------------- Alignements
-inline void ae_params_mut::set_align_fun_shape( ae_align_fun_shape align_fun_shape )
-{
-  _align_fun_shape = align_fun_shape;
-}
-
-inline void ae_params_mut::set_align_sigm_lambda( double align_sigm_lambda )
-{
-  _align_sigm_lambda = align_sigm_lambda;
-}
-
-inline void ae_params_mut::set_align_sigm_mean( int16_t align_sigm_mean )
-{
-  _align_sigm_mean = align_sigm_mean;
-}
-
-inline void ae_params_mut::set_align_lin_min( int16_t align_lin_min )
-{
-  _align_lin_min = align_lin_min;
-}
-
-inline void ae_params_mut::set_align_lin_max( int16_t align_lin_max )
-{
-  _align_lin_max = align_lin_max;
-}
-
-inline void ae_params_mut::set_align_max_shift( int16_t align_max_shift )
-{
-  _align_max_shift = align_max_shift;
-}
-
-inline void ae_params_mut::set_align_w_zone_h_len( int16_t align_w_zone_h_len )
-{
-  _align_w_zone_h_len = align_w_zone_h_len;
-}
-
-inline void ae_params_mut::set_align_match_bonus( int16_t align_match_bonus )
-{
-  _align_match_bonus = align_match_bonus;
-}
-
-inline void ae_params_mut::set_align_mismatch_cost( int16_t align_mismatch_cost )
-{
-  _align_mismatch_cost = align_mismatch_cost;
-}
-
-// =====================================================================
-//                          Operators' definitions
-// =====================================================================
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_PARAMS_MUT_H__
diff --git a/src/libaevol/ae_population.cpp b/src/libaevol/ae_population.cpp
deleted file mode 100644
index 7a132c9..0000000
--- a/src/libaevol/ae_population.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <math.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_population.h>
-
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_individual.h>
-
-#ifdef __NO_X
-  #ifndef __REGUL
-
-  #else
-    #include <ae_individual_R.h>
-  #endif
-#elif defined __X11
-  #ifndef __REGUL
-    #include <ae_individual_X11.h>
-  #else
-    #include <ae_individual_R_X11.h>
-  #endif
-#endif
-
-#include <ae_vis_a_vis.h>
-#include <ae_align.h>
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_population                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_population::ae_population( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-
-  #ifndef DISTRIBUTED_PRNG
-    _mut_prng       = NULL;
-    _stoch_prng     = NULL;
-    _stoch_prng_bak = NULL;
-  #endif
-
-  // Individuals
-  _nb_indivs  = 0;
-  _indivs     = new ae_list<ae_individual*>();
-}
-
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_population::~ae_population( void )
-{
-  #ifndef DISTRIBUTED_PRNG
-    delete _mut_prng;
-    delete _stoch_prng;
-    delete _stoch_prng_bak;
-  #endif
-
-  _indivs->erase( true );
-  delete _indivs;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_population::set_nb_indivs(int32_t nb_indivs)
-{
-  int32_t index_to_duplicate;
-  ae_individual* indiv = NULL;
-  if(nb_indivs > _nb_indivs)
-  {
-    int32_t initial_pop_size = _nb_indivs;
-    for(int32_t i = initial_pop_size; i < nb_indivs; i++)
-    {
-      index_to_duplicate = _exp_m->get_sel()->get_prng()->random( initial_pop_size );
-      indiv = new ae_individual(*get_indiv_by_id(index_to_duplicate), true);
-      indiv->set_id(i);
-      add_indiv(indiv);
-    }
-  }
-  else if(nb_indivs < _nb_indivs)
-  {
-    ae_list<ae_individual*>* new_population = new ae_list<ae_individual*>();
-    for(int32_t i = 0; i < nb_indivs; i++)
-    {
-      index_to_duplicate = _exp_m->get_sel()->get_prng()->random( _nb_indivs );
-      indiv = new ae_individual(*get_indiv_by_id(index_to_duplicate), true);
-      indiv->set_id(i);
-      new_population->add(indiv);
-    }
-    update_population(new_population);
-  }
-  sort_individuals();
-}
-
-void ae_population::replace_population(ae_list<ae_individual*>* new_indivs)
-{
-  // First replace the former indivs by the new ones
-  update_population(new_indivs);
-
-  // Then reconciliate any possible inconsistency...
-
-  // Update pointer to exp_manager in each individual
-  // Replace indivs id by a new one
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual* indiv = NULL;
-  int32_t  id = 0;
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-
-    indiv->set_exp_m(_exp_m);
-    indiv->set_id(id++);
-
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-void ae_population::save( gzFile backup_file ) const
-{
-  // Write population intrinsic data
-  #ifndef DISTRIBUTED_PRNG
-    _mut_prng->save( backup_file );
-    int8_t tmp_with_stoch = _stoch_prng == NULL ? 0 : 1;
-    gzwrite( backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch) );
-    if ( tmp_with_stoch )
-    {
-      _stoch_prng->save( backup_file );
-    }
-  #endif
-  gzwrite( backup_file, &_nb_indivs, sizeof(_nb_indivs) );
-
-  // Write individuals
-  ae_list_node<ae_individual*>*   indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->save( backup_file );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-void ae_population::load( gzFile backup_file, bool verbose )
-{
-  // --------------------------------------- Retreive population intrinsic data
-  #ifndef DISTRIBUTED_PRNG
-    _mut_prng   = new ae_jumping_mt( backup_file );
-    int8_t tmp_with_stoch;
-    gzread( backup_file, &tmp_with_stoch, sizeof(tmp_with_stoch) );
-    if ( tmp_with_stoch )
-    {
-      _stoch_prng = new ae_jumping_mt( backup_file );
-    }
-  #endif
-  gzread( backup_file, &_nb_indivs, sizeof(_nb_indivs) );
-
-  // ----------------------------------------------------- Retreive individuals
-  if ( verbose ) printf( "  Loading individuals " );
-  ae_individual* indiv = NULL;
-  int32_t nb_ind_div_10 = _nb_indivs / 10;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    if ( verbose && i && i % nb_ind_div_10 == 0 )
-    {
-      putchar( '*' );
-      fflush( stdout );
-    }
-
-    #ifdef __NO_X
-      #ifndef __REGUL
-        indiv = new ae_individual( _exp_m, backup_file );
-      #else
-        indiv = new ae_individual_R( _exp_m, backup_file );
-      #endif
-    #elif defined __X11
-      #ifndef __REGUL
-        indiv = new ae_individual_X11( _exp_m, backup_file );
-      #else
-        indiv = new ae_individual_R_X11( _exp_m, backup_file );
-      #endif
-    #endif
-
-    _indivs->add( indiv );
-  }
-}
-
-void ae_population::load(const char* backup_file_name, bool verbose)
-{
-  gzFile backup_file = gzopen(backup_file_name, "r");
-  if ( backup_file == Z_NULL )
-  {
-    printf( "%s:%d: error: could not open pop file %s\n",
-            __FILE__, __LINE__, backup_file_name );
-    exit( EXIT_FAILURE );
-  }
-  this->load(backup_file, verbose);
-}
-
-#ifndef DISTRIBUTED_PRNG
-  void ae_population::backup_stoch_prng( void )
-  {
-    delete _stoch_prng_bak;
-    _stoch_prng_bak = new ae_jumping_mt( *_stoch_prng );
-  }
-#endif
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_population::sort_individuals( void )
-{
-  // Insertion sort
-  ae_list_node<ae_individual*>* last_sorted   = _indivs->get_first();
-  ae_list_node<ae_individual*>* comp          = NULL;
-  ae_list_node<ae_individual*>* item_to_sort  = NULL;
-  double  fit_comp;
-  double  fitness_to_sort;
-  bool    is_sorted;
-
-  // only "pop_size - 1" iterations since the first item is already "sorted"
-  for ( int32_t nb_sorted = 1 ; nb_sorted < _nb_indivs ; nb_sorted++ )
-  {
-    item_to_sort    = last_sorted->get_next();
-    fitness_to_sort = item_to_sort->get_obj()->get_fitness();
-    is_sorted       = false;
-
-    comp = last_sorted;
-
-    // looking for its place among the sorted items
-    while ( !is_sorted )
-    {
-      fit_comp = comp->get_obj()->get_fitness();
-
-      if ( fitness_to_sort >= fit_comp ) // The right place of the item is after comp
-      {
-        if ( item_to_sort->get_prev() == comp )
-        {
-          // item_to_sort is already at the right place
-          is_sorted = true;
-          last_sorted = item_to_sort;
-        }
-
-        // item_to_sort has to be inserted just after comp
-        _indivs->remove( item_to_sort, false, false );
-        _indivs->insert_after( item_to_sort, comp );
-        is_sorted = true;
-      }
-      else
-      {
-        // move on to compare with the next item
-        comp = comp->get_prev();
-      }
-
-      if ( comp == NULL )
-      {
-        // item_to_sort has to be inserted at the beginning of the list
-        _indivs->remove( item_to_sort, false, false );
-        _indivs->add_front( item_to_sort );
-        is_sorted = true;
-      }
-    }
-  }
-
-  // Update the rank of the individuals
-  ae_list_node<ae_individual*>* indiv_node  = _indivs->get_first();
-  ae_individual* indiv       = NULL;
-
-  for ( int32_t rank = 1 ; rank <= _nb_indivs ; rank++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_rank( rank );
-    indiv_node = indiv_node->get_next();
-  }
-
-}
-
-// Find the best individual and put it at the end of the list: this is quicker than sorting the whole list in case we only need the best individual, for example when we have spatial structure.
-void ae_population::update_best( void )
-{
-  ae_list_node<ae_individual*>* current_best  = _indivs->get_first();
-  ae_list_node<ae_individual*>* candidate     = _indivs->get_first();
-
-  while ( candidate != NULL )
-  {
-    if (  candidate->get_obj()->get_fitness() >= current_best->get_obj()->get_fitness() )
-    {
-      current_best = candidate;
-    }
-    candidate = candidate->get_next();
-  }
-
-  _indivs->remove( current_best, false, false );
-  _indivs->add( current_best );
-
-  current_best->get_obj()->set_rank( _nb_indivs );
-}
-
-// The new pop must be consistent and belong to the same experiment as the one
-// it replaces, otherwise use replace_population
-void ae_population::update_population(ae_list<ae_individual*>* new_indivs)
-{
-  // Delete the former indivs
-  _indivs->erase( true );
-  delete _indivs;
-
-  // Replace with new indivs
-  _indivs = new_indivs;
-  _nb_indivs = _indivs->get_nb_elts();
-}
-
-ae_individual* ae_population::create_clone( ae_individual* dolly, int32_t id )
-{
-  ae_individual* indiv;
-
-  #ifdef __NO_X
-    #ifndef __REGUL
-      indiv = new ae_individual( *dolly, false );
-    #else
-      indiv = new ae_individual_R( *(dynamic_cast<ae_individual_R*>(dolly)) , false);
-    #endif
-  #elif defined __X11
-    #ifndef __REGUL
-      indiv = new ae_individual_X11( *(dynamic_cast<ae_individual_X11*>(dolly)), false );
-    #else
-      indiv = new ae_individual_R_X11( *(dynamic_cast<ae_individual_R_X11*>(dolly)), false );
-    #endif
-  #endif
-
-  indiv->set_id( id );
-
-  return indiv;
-}
-
-
-
-
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
-ae_individual* ae_population::get_indiv_by_id( int32_t id ) const
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-
-    if ( indiv->get_id() == id )
-    {
-      return indiv;
-    }
-
-    indiv_node = indiv_node->get_next();
-  }
-
-  return NULL;
-}
diff --git a/src/libaevol/ae_population.h b/src/libaevol/ae_population.h
deleted file mode 100644
index 910d82b..0000000
--- a/src/libaevol/ae_population.h
+++ /dev/null
@@ -1,504 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// ****************************************************************************
-
-
-#ifndef __AE_POPULATION_H__
-#define __AE_POPULATION_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-#include <stdlib.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_list.h>
-#include <ae_individual.h>
-#include <ae_jumping_mt.h>
-#include <ae_tree.h>
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
-
-
-
-
-
-class ae_population : public ae_object
-{
-  friend class ae_selection;
-
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_population( ae_exp_manager* exp_m );
-    //~ ae_population( char* organism_file_name );
-    //~ ae_population( gzFile backup_file );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_population( void );
-
-    // =================================================================
-    //                        Accessors: Getters
-    // =================================================================
-    inline ae_list<ae_individual*>* get_indivs( void ) const;
-    inline int32_t                  get_nb_indivs( void ) const;
-    inline ae_individual*           get_best( void ) const;
-    ae_individual*                  get_indiv_by_id( int32_t id ) const;
-    inline ae_individual*           get_indiv_by_rank( int32_t rank ) const;
-
-    // PRNGs
-    inline ae_jumping_mt* get_mut_prng( void ) const;
-    inline ae_jumping_mt* get_stoch_prng( void ) const;
-
-    // Spatial structure
-    //~ inline double** get_secretion_present( void ) const;
-    //~ inline double** get_secreted_amount( void ) const;
-    //~ inline double** get_fitness_metabolic( void ) const;
-    //~ inline double** get_fitness_total( void ) const;
-
-    // =================================================================
-    //                        Accessors: Setters
-    // =================================================================
-    void set_nb_indivs( int32_t nb_indivs );
-
-    inline void add_indiv( ae_individual* indiv );
-
-    // PRNGs
-    inline void set_mut_prng( ae_jumping_mt* prng );
-    inline void set_stoch_prng( ae_jumping_mt* prng );
-
-    // Mutation rates etc...
-    inline void set_overall_point_mutation_rate( double point_mutation_rate);
-    inline void set_overall_small_insertion_rate( double small_insertion_rate);
-    inline void set_overall_small_deletion_rate( double small_deletion_rate);
-    inline void set_overall_max_indel_size( int16_t max_indel_size);
-
-    inline void set_overall_duplication_rate( double duplication_rate);
-    inline void set_overall_deletion_rate( double deletion_rate);
-    inline void set_overall_translocation_rate( double translocation_rate);
-    inline void set_overall_inversion_rate( double inversion_rate);
-    inline void set_overall_neighbourhood_rate( double neighbourhood_rate);
-    inline void set_overall_duplication_proportion( double duplication_proportion);
-    inline void set_overall_deletion_proportion( double deletion_proportion);
-    inline void set_overall_translocation_proportion( double translocation_proportion);
-    inline void set_overall_inversion_proportion( double inversion_proportion);
-    inline void set_overall_transfer_ins_rate (double transfer_ins_rate);
-    inline void set_overall_transfer_repl_rate (double transfer_repl_rate);
-
-    inline void set_replication_reports( ae_tree* tree, int32_t num_gener);
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void replace_population( ae_list<ae_individual*>* new_indivs );
-    //~ void            step_to_next_generation( void );
-    //~ void            step_to_next_generation_grid( void );
-    //~ ae_individual*  do_replication( ae_individual* parent, int32_t id, int16_t x = -1, int16_t y = -1 );
-    //~ void            secretion_grid_update ( void );
-    //~ ae_individual*  calculate_local_competition ( int16_t x, int16_t y );
-    ae_individual*  calculate_GU_transfer ( int16_t x, int16_t y );
-    void            do_random_migrations ( void );
-    inline void     evaluate_individuals( ae_environment* envir );
-    void            sort_individuals( void );
-    void            update_best( void );
-
-    void save( gzFile backup_file ) const;
-    void load( gzFile backup_file, bool verbose );
-    void load(const char* backup_file_name, bool verbose);
-
-    #ifndef DISTRIBUTED_PRNG
-      void backup_stoch_prng( void );
-    #endif
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_population( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_population( const ae_population &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void update_population(ae_list<ae_individual*>* new_indivs);
-    ae_individual* create_random_individual( int32_t id );
-    ae_individual* create_random_individual_with_good_gene( int32_t id );
-    ae_individual* create_clone( ae_individual* dolly, int32_t id );
-    ae_individual* create_individual_from_file( char* organism_file_name, int32_t id );
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-
-    #ifndef DISTRIBUTED_PRNG
-      ae_jumping_mt* _mut_prng;
-      ae_jumping_mt* _stoch_prng;
-      ae_jumping_mt* _stoch_prng_bak;
-    #endif
-
-    // Individuals
-    int32_t                   _nb_indivs;
-    ae_list<ae_individual*>*  _indivs;
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-inline ae_list<ae_individual*>* ae_population::get_indivs( void ) const
-{
-  return _indivs;
-}
-
-inline int32_t ae_population::get_nb_indivs( void ) const
-{
-  return _nb_indivs;
-}
-
-inline ae_individual* ae_population::get_best( void ) const
-{
-  return _indivs->get_last()->get_obj();
-}
-
-/*!
-  Get the indiv corresponding to the given rank (1 for the worst indiv, POP_SIZE for the best)
-
-  Warning, be sure you call sort_individuals() before using get_indiv_by_rank
-*/
-inline ae_individual* ae_population::get_indiv_by_rank( int32_t rank ) const
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-
-  for ( int32_t i = 1 ; i < rank ; i++ )
-  {
-    indiv_node = indiv_node->get_next();
-  }
-
-  assert( indiv_node->get_obj()->get_rank() == rank );
-
-  return indiv_node->get_obj();
-}
-
-inline ae_jumping_mt* ae_population::get_mut_prng( void ) const
-{
-  return _mut_prng;
-}
-
-inline ae_jumping_mt* ae_population::get_stoch_prng( void ) const
-{
-  return _stoch_prng;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-/*inline void ae_population::set_nb_indivs( int32_t nb_indivs )
-{
-  _nb_indivs = nb_indivs;
-}*/
-
-inline void ae_population::add_indiv( ae_individual* indiv )
-{
-  _indivs->add( indiv );
-  _nb_indivs++;
-}
-
-
-inline void ae_population::set_mut_prng( ae_jumping_mt* prng )
-{
-  if (_mut_prng != NULL) delete _mut_prng;
-  _mut_prng = prng;
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_mut_prng( _mut_prng );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_stoch_prng( ae_jumping_mt* prng )
-{
-  if (_stoch_prng != NULL) delete _stoch_prng;
-  _stoch_prng = prng;
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_stoch_prng( _stoch_prng );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-
-// Mutation rates etc...
-inline void ae_population::set_overall_point_mutation_rate( double point_mutation_rate )
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_point_mutation_rate( point_mutation_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_small_insertion_rate( double small_insertion_rate )
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_small_insertion_rate( small_insertion_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_small_deletion_rate( double small_deletion_rate )
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_small_deletion_rate( small_deletion_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_max_indel_size( int16_t max_indel_size )
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_max_indel_size( max_indel_size );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_duplication_rate( double duplication_rate )
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_duplication_rate( duplication_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_deletion_rate( double deletion_rate)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_deletion_rate( deletion_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_translocation_rate( double translocation_rate)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_translocation_rate( translocation_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_inversion_rate( double inversion_rate)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_inversion_rate( inversion_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_transfer_ins_rate (double transfer_ins_rate)
-{
-	ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_HT_ins_rate( transfer_ins_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_transfer_repl_rate (double transfer_repl_rate)
-{
-	ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_HT_repl_rate( transfer_repl_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_neighbourhood_rate( double neighbourhood_rate)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_neighbourhood_rate( neighbourhood_rate );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_duplication_proportion( double duplication_proportion)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_duplication_proportion( duplication_proportion );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_deletion_proportion( double deletion_proportion)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_deletion_proportion( deletion_proportion );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_translocation_proportion( double translocation_proportion)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_translocation_proportion( translocation_proportion );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_overall_inversion_proportion( double inversion_proportion)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_inversion_proportion( inversion_proportion );
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-inline void ae_population::set_replication_reports( ae_tree* tree, int32_t num_gener)
-{
-  ae_list_node<ae_individual*>* indiv_node = _indivs->get_first();
-  ae_individual*  indiv;
-  for ( int32_t i = 0 ; i < _nb_indivs ; i++ )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->set_replication_report( tree->get_report_by_index( num_gener, indiv->get_id()));
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_population::evaluate_individuals( ae_environment* envir )
-{
-  ae_list_node<ae_individual*>*  indiv_node  = _indivs->get_first();
-  ae_individual * indiv       = NULL;
-
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-    indiv->evaluate( envir );
-    indiv->compute_statistical_data();
-
-    indiv_node = indiv_node->get_next();
-  }
-}
-
-#endif // __AE_POPULATION_H__
diff --git a/src/libaevol/ae_population_X11.cpp b/src/libaevol/ae_population_X11.cpp
deleted file mode 100644
index 0861e8f..0000000
--- a/src/libaevol/ae_population_X11.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdio.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_population_X11.h>
-#include <ae_individual_X11.h>
-#include <ae_exp_manager_X11.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                           Class ae_population_X11                           #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_population_X11::ae_population_X11( ae_exp_manager* exp_m ) : ae_population( exp_m )
-{
-  compute_colormap();
-}
-
-//~ ae_population_X11::ae_population_X11( gzFile backup_file ) : ae_population( backup_file )
-//~ {
-  //~ compute_colormap();
-//~ }
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_population_X11::~ae_population_X11( void )
-{
-  delete [] _col_map;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-// Display unstructured population
-void ae_population_X11::display( ae_X11_window* win )
-{
-  char generation[40];
-  sprintf( generation, "Generation = %"PRId32, _exp_m->get_num_gener() );
-  win->draw_string( 15, 15, generation );
-}
-
-// Display a grid of values
-void ae_population_X11::display_grid( ae_X11_window* win, double** cell_grid )
-{
-  assert( _exp_m->is_spatially_structured() );
-  
-  
-  // printf("display grid\n");
-  char gener[40];
-  int num_colors = 50; 
-  
-  sprintf( gener, "Generation = %"PRId32, _exp_m->get_num_gener() );
-  win->draw_string( 15, 15, gener );
-  
-  
-  const int grid_width  = _exp_m->get_grid_width();
-  const int grid_height = _exp_m->get_grid_height();
-
-  int nb_slots_in_a_row = (int) grid_height;
-  int slot_width = 200/nb_slots_in_a_row;
-  int x1 = 50 + 50 + slot_width/2;
-  int y1 = 75 + 50 + slot_width/2;
-
-  // create the colormap colors to be used for grid plotting
-  int cell_size = 5;
-
-  // draw the color scale for fitness
-  int y_step_size = grid_height*cell_size/num_colors;
-  for ( int i = 0; i  < num_colors; i++ )
-  {
-    win->fill_rectangle( x1 - 30, y1 - 80 + y_step_size * i,
-                         cell_size * 5, y_step_size,
-                         _col_map[num_colors-1-i] );
-  }
-
-  // find min/max of the matrix
-  double grid_max = 0;
-  double grid_min = 1000000;
-  for ( int x = 0 ; x < grid_width ; x++ )
-  {
-    for ( int y = 0 ; y < grid_height ; y++ )
-    {
-       if (cell_grid[x][y] > grid_max) {grid_max = cell_grid[x][y];}
-       if (cell_grid[x][y] < grid_min) {grid_min = cell_grid[x][y];}
-     }
-  }
-  double col_sec_interval = (grid_max - grid_min)/49;
-
-  char scale_txt[40];
-  sprintf(scale_txt,"%.2e", grid_max);
-  win->draw_string(x1-80, y1-80,scale_txt);
-  sprintf(scale_txt,"%.2e", grid_min);
-  win->draw_string(x1-80, y1-80+grid_height*cell_size,scale_txt);
-
-  for (int x = 0; x < grid_width; x++)
-  {
-    for (int y = 0; y < grid_height; y++)
-    {
-      char * col_string;
-      // calculate the color
-      int new_col;
-      if (col_sec_interval==0)
-      {
-        new_col = 0;
-      }
-      else
-      {
-        new_col = (int) floor((cell_grid[x][y] - grid_min) / col_sec_interval);
-      }
-      col_string = _col_map[new_col];
-
-      // draw a colored rectangle for each cell
-      win->fill_rectangle( x1 + 50 + x*cell_size, y1 - 80 + y*cell_size, cell_size, cell_size, col_string );
-    }
-  }
-}
-
-
-void ae_population_X11::compute_colormap( void )
-{
-    _col_map = new char* [50];
-    
-    _col_map[0] = (char*)"RGBi:1.0/0.0/0.0";
-    _col_map[1] = (char*)"RGBi:1.0/0.1/0.0";   
-    _col_map[2] = (char*)"RGBi:1.0/0.2/0.0";
-    _col_map[3] = (char*)"RGBi:1.0/0.3/0.0";
-    _col_map[4] = (char*)"RGBi:1.0/0.4/0.0";
-    _col_map[5] = (char*)"RGBi:1.0/0.5/0.0";
-    _col_map[6] = (char*)"RGBi:1.0/0.6/0.0";
-    _col_map[7] = (char*)"RGBi:1.0/0.7/0.0";
-    _col_map[8] = (char*)"RGBi:1.0/0.8/0.0";
-    _col_map[9] = (char*)"RGBi:1.0/0.9/0.0";
-
-    _col_map[10] = (char*)"RGBi:0.9/1.0/0.0";
-    _col_map[11] = (char*)"RGBi:0.8/1.0/0.0";
-    _col_map[12] = (char*)"RGBi:0.7/1.0/0.0";
-    _col_map[13] = (char*)"RGBi:0.6/1.0/0.0";
-    _col_map[14] = (char*)"RGBi:0.5/1.0/0.0";
-    _col_map[15] = (char*)"RGBi:0.4/1.0/0.0";
-    _col_map[16] = (char*)"RGBi:0.3/1.0/0.0";
-    _col_map[17] = (char*)"RGBi:0.2/1.0/0.0";
-    _col_map[18] = (char*)"RGBi:0.1/1.0/0.0";
-    _col_map[19] = (char*)"RGBi:0.0/1.0/0.0";
-
-    _col_map[20] = (char*)"RGBi:0.0/1.0/0.1";
-    _col_map[21] = (char*)"RGBi:0.0/1.0/0.2";
-    _col_map[22] = (char*)"RGBi:0.0/1.0/0.3";
-    _col_map[23] = (char*)"RGBi:0.0/1.0/0.4";
-    _col_map[24] = (char*)"RGBi:0.0/1.0/0.5";
-    _col_map[25] = (char*)"RGBi:0.0/1.0/0.6";
-    _col_map[26] = (char*)"RGBi:0.0/1.0/0.7";
-    _col_map[27] = (char*)"RGBi:0.0/1.0/0.8";
-    _col_map[28] = (char*)"RGBi:0.0/1.0/0.9";
-    _col_map[29] = (char*)"RGBi:0.0/1.0/1.0";
-
-    _col_map[30] = (char*)"RGBi:0.0/0.9/1.0";
-    _col_map[31] = (char*)"RGBi:0.0/0.8/1.0";
-    _col_map[32] = (char*)"RGBi:0.0/0.7/1.0";
-    _col_map[33] = (char*)"RGBi:0.0/0.6/1.0";
-    _col_map[34] = (char*)"RGBi:0.0/0.5/1.0";
-    _col_map[35] = (char*)"RGBi:0.0/0.4/1.0";
-    _col_map[36] = (char*)"RGBi:0.0/0.3/1.0";
-    _col_map[37] = (char*)"RGBi:0.0/0.2/1.0";
-    _col_map[38] = (char*)"RGBi:0.0/0.1/1.0";
-    _col_map[39] = (char*)"RGBi:0.0/0.0/1.0";
-
-    _col_map[40] = (char*)"RGBi:0.1/0.0/1.0";
-    _col_map[41] = (char*)"RGBi:0.2/0.0/1.0";
-    _col_map[42] = (char*)"RGBi:0.3/0.0/1.0";
-    _col_map[43] = (char*)"RGBi:0.4/0.0/1.0";
-    _col_map[44] = (char*)"RGBi:0.5/0.0/1.0";
-    _col_map[45] = (char*)"RGBi:0.6/0.0/1.0";
-    _col_map[46] = (char*)"RGBi:0.7/0.0/1.0";
-    _col_map[47] = (char*)"RGBi:0.8/0.0/1.0";
-    _col_map[48] = (char*)"RGBi:0.9/0.0/1.0";
-    _col_map[49] = (char*)"RGBi:1.0/0.0/1.0";
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_protein.cpp b/src/libaevol/ae_protein.cpp
deleted file mode 100644
index e8a65b0..0000000
--- a/src/libaevol/ae_protein.cpp
+++ /dev/null
@@ -1,521 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_protein.h>
-
-#include <ae_codon.h>
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_rna.h>
-#include <ae_utils.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_protein                               #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-/**
- * Copy constructor.
- *
- * Copies the protein but does nothing regarding the RNAs transcribing it (creates an empty list).
- */
-ae_protein::ae_protein( ae_genetic_unit* gen_unit, const ae_protein &model )
-{
-  _gen_unit  = gen_unit;
-  
-  _strand                 = model._strand;
-  _shine_dal_pos          = model._shine_dal_pos;
-  _first_translated_pos   = model._first_translated_pos;
-  _last_translated_pos    = model._last_translated_pos;
-  _length                 = model._length;
-  _concentration          = model._concentration;
-  _is_functional          = model._is_functional;
-  
-  _rna_list = new ae_list<ae_rna*>();
-  
-  // Copy the list of amino-acids
-  _AA_list  = new ae_list<ae_codon*>();
-  
-  ae_list_node<ae_codon*>* AA_node = model._AA_list->get_first();
-  ae_codon* AA = NULL;
-
-  
-  while ( AA_node != NULL )
-  {
-    AA = AA_node->get_obj();
-    
-    _AA_list->add( new ae_codon( *AA ) );
-    
-    AA_node = AA_node->get_next();
-  }
-  
-  // Copy triangle parameters
-  _mean   = model._mean;
-  _width  = model._width;
-  _height = model._height;
-}
-
-ae_protein::ae_protein( ae_genetic_unit* gen_unit, ae_list<ae_codon*>* codon_list, ae_strand strand, int32_t shine_dal_pos, ae_rna* rna )
-{
-  assert( shine_dal_pos >= 0 );
-  assert( shine_dal_pos < gen_unit->get_seq_length() );
-
-  _gen_unit       = gen_unit;
-  _strand         = strand;
-  _shine_dal_pos  = shine_dal_pos;
-  _length         = codon_list->get_nb_elts();
-  
-  #ifndef __REGUL
-    // In Aevol the concentration of a new protein is set at the basal level
-    _concentration  = rna->get_basal_level();
-  #else
-    // In Raevol, there is two case, depending on the heredity
-    if ( ae_common::with_heredity )
-    {
-      // With heredity the new protein has a concentration set at 0, because there are inherited proteins which allow the regulation
-      _concentration = 0;
-    }
-    else
-    {
-      // Without heredity, we use the same concentration as in Aevol (No inherited proteins)
-      _concentration = rna->get_basal_level();
-    }
-  #endif
-  
-  // TODO : make this cleaner...
-  _AA_list = codon_list;
-  
-  _rna_list = new ae_list<ae_rna*>();
-  _rna_list->add( rna );
-
-  if ( _strand == LEADING )
-  {
-    _first_translated_pos = ae_utils::mod( _shine_dal_pos + (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE), _gen_unit->get_dna()->get_length() );
-    _last_translated_pos  = ae_utils::mod( _first_translated_pos + (_length * CODON_SIZE - 1), _gen_unit->get_dna()->get_length() );
-  }
-  else
-  {
-    _first_translated_pos = ae_utils::mod( _shine_dal_pos - (SHINE_DAL_SIZE + SHINE_START_SPACER + CODON_SIZE), _gen_unit->get_dna()->get_length() );
-    _last_translated_pos = ae_utils::mod( _first_translated_pos - (_length * CODON_SIZE - 1), _gen_unit->get_dna()->get_length() );
-  }
-
-
-
-  // ============================================================================
-  // Folding process (compute phenotypic contribution parameters from codon list)
-  // ============================================================================
-  //  1) Compute values for M, W and H
-  //  2) Normalize M, W and H values according to number of codons of each kind
-  //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
-
-
-  //  --------------------------------
-  //  1) Compute values for M, W and H
-  //  --------------------------------
-  long double M = 0.0;
-  long double W = 0.0;
-  long double H = 0.0;
-
-  int32_t nb_m = 0;
-  int32_t nb_w = 0;
-  int32_t nb_h = 0;
-
-  bool bin_m = false; // Initializing to false will yield a conservation of the high weight bit
-  bool bin_w = false; // when applying the XOR operator for the Gray to standard conversion
-  bool bin_h = false;
-
-  ae_list_node<ae_codon*>* node = codon_list->get_first();
-  ae_codon* codon = NULL;
-
-
-  while ( node != NULL )
-  {
-    codon = node->get_obj();
-
-    switch ( codon->get_value() )
-    {
-      case CODON_M0 :
-      {
-        // M codon found
-        nb_m++;
-
-        // Convert Gray code to "standard" binary code
-        bin_m ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
-        //~ M <<= 1;
-        M *= 2;
-
-        // Add this nucleotide's contribution to M
-        if ( bin_m ) M += 1;
-
-        break;
-      }
-      case CODON_M1 :
-      {
-        // M codon found
-        nb_m++;
-
-        // Convert Gray code to "standard" binary code
-        bin_m ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest bit was found, make a left bitwise shift
-        //~ M <<= 1;
-        M *= 2;
-
-        // Add this nucleotide's contribution to M
-        if ( bin_m ) M += 1;
-
-        break;
-      }
-      case CODON_W0 :
-      {
-        // W codon found
-        nb_w++;
-
-        // Convert Gray code to "standard" binary code
-        bin_w ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
-        //~ W <<= 1;
-        W *= 2;
-
-        // Add this nucleotide's contribution to W
-        if ( bin_w ) W += 1;
-
-        break;
-      }
-      case CODON_W1 :
-      {
-        // W codon found
-        nb_w++;
-
-        // Convert Gray code to "standard" binary code
-        bin_w ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
-        //~ W <<= 1;
-        W *= 2;
-
-        // Add this nucleotide's contribution to W
-        if ( bin_w ) W += 1;
-
-        break;
-      }
-      case CODON_H0 :
-      case CODON_START : // Start codon codes for the same amino-acid as H0 codon
-      {
-        // H codon found
-        nb_h++;
-
-        // Convert Gray code to "standard" binary code
-        bin_h ^= false; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
-        //~ H <<= 1;
-        H *= 2;
-
-        // Add this nucleotide's contribution to H
-        if ( bin_h ) H += 1;
-
-        break;
-      }
-      case CODON_H1 :
-      {
-        // H codon found
-        nb_h++;
-
-        // Convert Gray code to "standard" binary code
-        bin_h ^= true; // as bin_m was initialized to false, the XOR will have no effect on the high weight bit
-
-        // A lower-than-the-previous-lowest weight bit was found, make a left bitwise shift
-        //~ H <<= 1;
-        H *= 2;
-
-        // Add this nucleotide's contribution to H
-        if ( bin_h ) H += 1;
-
-        break;
-      }
-    }
-
-    node = node->get_next();
-  }
-
-
-
-  //  ----------------------------------------------------------------------------------
-  //  2) Normalize M, W and H values in [0;1] according to number of codons of each kind
-  //  ----------------------------------------------------------------------------------
-  if ( nb_m != 0 )  _mean = M / (pow(2, nb_m) - 1);
-  else              _mean = 0.5;
-  if ( nb_w != 0 )  _width = W / (pow(2, nb_w) - 1);
-  else              _width = 0.0;
-  if ( nb_h != 0 )  _height = H / (pow(2, nb_h) - 1);
-  else              _height = 0.5;
-
-  assert( _mean >= 0.0 && _mean <= 1.0 );
-  assert( _width >= 0.0 && _width <= 1.0 );
-  assert( _height >= 0.0 && _height <= 1.0 );
-
-
-
-  //  ------------------------------------------------------------------------------------
-  //  3) Normalize M, W and H values according to the allowed ranges (defined in macros.h)
-  //  ------------------------------------------------------------------------------------
-  // x_min <= M <= x_max
-  // w_min <= W <= w_max
-  // h_min <= H <= h_max
-  _mean   = (X_MAX - X_MIN) * _mean + X_MIN;
-  _width  = (get_indiv()->get_w_max() - W_MIN) * _width + W_MIN;
-  _height = (H_MAX - H_MIN) * _height + H_MIN;
-  
-  if ( nb_m == 0 || nb_w == 0 || nb_h == 0 || _width == 0.0 || _height == 0.0 )
-  {
-    _is_functional = false;
-  }
-  else
-  {
-    _is_functional = true;
-  }
-
-  assert( _mean >= X_MIN && _mean <= X_MAX );
-  assert( _width >= W_MIN && _width <= get_indiv()->get_w_max() );
-  assert( _height >= H_MIN && _height <= H_MAX );
-}
-
-/*
-ae_protein::ae_protein( ae_protein* parent )
-{
-  _gen_unit             = parent->_gen_unit;
-  _strand               = parent->_strand;
-  _shine_dal_pos        = parent->_shine_dal_pos;
-  _first_translated_pos = parent->_first_translated_pos;
-  _last_translated_pos  = parent->_last_translated_pos;
-  _length               = parent->_length;
-  _concentration        = parent->_concentration;
-  _mean                 = parent->_mean;
-  _width                = parent->_width;
-  _height               = parent->_height;
-}
-*/
-
-ae_protein::ae_protein( gzFile backup_file )
-{
-  _gen_unit = NULL;
-  int8_t tmp_strand;
-  gzread( backup_file, &tmp_strand, sizeof(tmp_strand) );
-  _strand = (ae_strand) tmp_strand;
-  gzread( backup_file, &_shine_dal_pos,			    sizeof(_shine_dal_pos)        );
-  gzread( backup_file, &_first_translated_pos, 	sizeof(_first_translated_pos) );
-  gzread( backup_file, &_last_translated_pos,  	sizeof(_last_translated_pos)  );
-  gzread( backup_file, &_length,     			      sizeof(_length)               );
-  gzread( backup_file, &_concentration,     		sizeof(_concentration)        );
-  gzread( backup_file, &_is_functional,         sizeof(_is_functional)         );
-  gzread( backup_file, &_mean,  			          sizeof(_mean)                 );
-  gzread( backup_file, &_width,    			        sizeof(_width)                );
-  gzread( backup_file, &_height,                sizeof(_height)               );
-  
-  _rna_list = new ae_list<ae_rna*>();
-
-  // Retreive the AA
-  _AA_list = new ae_list<ae_codon*>();
-  int16_t nb_AA = 0;
-  gzread( backup_file, &nb_AA,  sizeof(nb_AA) );
-  
-  for ( int16_t i = 0 ; i < nb_AA ; i++ )
-  {
-    _AA_list->add( new ae_codon( backup_file ) );
-  }
-  
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_protein::~ae_protein( void )
-{
-  _rna_list->erase( false );
-  delete _rna_list;
-  
-  _AA_list->erase( true );
-  delete _AA_list;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-int32_t ae_protein::get_last_STOP_base_pos( void ) const
-{
-  if ( _strand == LEADING )
-  {
-    return ae_utils::mod( _last_translated_pos + 3, _gen_unit->get_dna()->get_length() );
-  }
-  else
-  {
-    return ae_utils::mod( _last_translated_pos - 3, _gen_unit->get_dna()->get_length() );
-  }
-}
-
-void ae_protein::add_RNA( ae_rna* rna )
-{
-  _rna_list->add( rna );
-  _concentration += rna->get_basal_level();
-}
-
-char* ae_protein::get_AA_sequence( void ) const
-{
-  char* seq = new char[3*_length]; // + 1 (for the '\0')  - 1 (_length - 1 spaces)
-  
-  ae_list_node<ae_codon*>* codon_node = _AA_list->get_first();
-  
-  int32_t i = 0;
-  while ( codon_node != NULL )
-  {
-    ae_codon* codon = codon_node->get_obj();
-    
-    if ( i != 0 ) seq[i++] = ' ';
-    
-    switch ( codon->get_value() )
-    {
-      case CODON_START :
-      {
-        seq[i++] = 'S';
-        seq[i++] = 'T';
-        break;
-      }
-      case CODON_M0 :
-      {
-        seq[i++] = 'M';
-        seq[i++] = '0';
-        break;
-      }
-      case CODON_M1 :
-      {
-        seq[i++] = 'M';
-        seq[i++] = '1';
-        break;
-      }
-      case CODON_W0 :
-      {
-        seq[i++] = 'W';
-        seq[i++] = '0';
-        break;
-      }
-      case CODON_W1 :
-      {
-        seq[i++] = 'W';
-        seq[i++] = '1';
-        break;
-      }
-      case CODON_H0 :
-      {
-        seq[i++] = 'H';
-        seq[i++] = '0';
-        break;
-      }
-      case CODON_H1 :
-      {
-        seq[i++] = 'H';
-        seq[i++] = '1';
-        break;
-      }
-    }
-    
-    codon_node = codon_node->get_next();
-  }
-  
-  seq[3*_length-1] = '\0';
-  return seq;
-}
-
-void ae_protein::save( gzFile backup_file )
-{
-  // The rna_list is not write because there is no need to, it is an empty list.
-  int8_t tmp_strand = _strand;
-  gzwrite( backup_file, &tmp_strand,            sizeof(tmp_strand)            );
-  gzwrite( backup_file, &_shine_dal_pos,        sizeof(_shine_dal_pos)        );
-  gzwrite( backup_file, &_first_translated_pos, sizeof(_first_translated_pos) );
-  gzwrite( backup_file, &_last_translated_pos,  sizeof(_last_translated_pos)  );
-  gzwrite( backup_file, &_length,     			    sizeof(_length)               );
-  gzwrite( backup_file, &_concentration,     		sizeof(_concentration)        );
-  gzwrite( backup_file, &_is_functional,        sizeof(_is_functional)         );
-  gzwrite( backup_file, &_mean,  			          sizeof(_mean)                 );
-  gzwrite( backup_file, &_width,    			      sizeof(_width)                );
-  gzwrite( backup_file, &_height,		     	      sizeof(_height)               );
-
-  // Write the Acide Amino in the backup file
-  int16_t nb_AA = _AA_list->get_nb_elts();
-  gzwrite( backup_file, &nb_AA,  sizeof(nb_AA) );
-
-  ae_list_node<ae_codon*>* AA_node = _AA_list->get_first();
-  ae_codon* AA;
-
-  for ( int16_t i = 0 ; i < nb_AA ; i++ )
-  {
-  AA = AA_node->get_obj();
-   
-  AA->save( backup_file );
-    
-  AA_node = AA_node->get_next();
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
-ae_individual* ae_protein::get_indiv( void ) const
-{
-  return _gen_unit->get_indiv();
-}
diff --git a/src/libaevol/ae_replication_report.cpp b/src/libaevol/ae_replication_report.cpp
deleted file mode 100644
index 754f384..0000000
--- a/src/libaevol/ae_replication_report.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-#include <ae_individual.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                         Class ae_replication_report                         #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_replication_report::ae_replication_report( ae_individual * indiv, ae_individual * parent, ae_individual * donor /* = NULL */ )
-{
-  _indiv = indiv;
-  
-  _id   = indiv->get_id();
-  _rank = indiv->get_rank();
-  
-  _parent_id = parent->get_id();
-  // _donor_id is set further down
-    
-  _genome_size        = 0;
-  _metabolic_error    = 0.0;
-  _nb_genes_activ     = 0;
-  _nb_genes_inhib     = 0;
-  _nb_non_fun_genes   = 0;
-  _nb_coding_RNAs     = 0;
-  _nb_non_coding_RNAs = 0;
-  
-  _parent_metabolic_error = parent->get_dist_to_target_by_feature( METABOLISM );
-  _parent_secretion_error = parent->get_dist_to_target_by_feature( SECRETION );
-  _parent_genome_size     = parent->get_total_genome_size();
-  _mean_align_score       = 0.0;
-  
-  if ( donor == NULL )
-  {
-    _donor_id               = -1;
-    _donor_metabolic_error  = 0.0;
-    _donor_secretion_error	= 0.0;
-    _donor_genome_size      = 0;
-  }
-  else
-  {
-    _donor_id              = donor->get_id();
-    _donor_metabolic_error = donor->get_dist_to_target_by_feature( METABOLISM );
-    _donor_secretion_error = donor->get_dist_to_target_by_feature( SECRETION );
-    _donor_genome_size     = donor->get_total_genome_size();
-  }
-    
-  
-  _dna_replic_reports = new ae_list<ae_dna_replic_report*>();
-}
-
-
-// Creates an independent copy of the original report
-ae_replication_report::ae_replication_report( const ae_replication_report &model )
-{
-  _parent_id  = model._parent_id;
-  _donor_id   = model._donor_id;
-  
-  _id   = model._id;
-  _rank = model._rank;
-    
-  _genome_size        = model._genome_size;
-  _metabolic_error    = model._metabolic_error;
-  _nb_genes_activ     = model._nb_genes_activ;
-  _nb_genes_inhib     = model._nb_genes_inhib;
-  _nb_non_fun_genes   = model._nb_non_fun_genes;
-  _nb_coding_RNAs     = model._nb_coding_RNAs;
-  _nb_non_coding_RNAs = model._nb_non_coding_RNAs;
-
-  _parent_metabolic_error = model._parent_metabolic_error;
-  _parent_secretion_error = model._parent_secretion_error;
-  _donor_metabolic_error  = model._donor_metabolic_error;
-  _donor_secretion_error  = model._donor_secretion_error;
-  _parent_genome_size     = model._parent_genome_size;
-  _donor_genome_size      = model._donor_genome_size;
-  _mean_align_score       = model._mean_align_score;
-  
-  _dna_replic_reports = new ae_list<ae_dna_replic_report*>();
-
-  ae_list_node<ae_dna_replic_report*>* node = (model._dna_replic_reports)->get_first();
-  ae_dna_replic_report * dnarep = NULL;
-  while ( node != NULL )
-  {
-    dnarep = node->get_obj();
-    _dna_replic_reports->add( new ae_dna_replic_report(*dnarep) );
-    node = node->get_next();
-  }
-}
-
-
-ae_replication_report::ae_replication_report( gzFile tree_file, ae_individual * indiv )
-{
-  _indiv = indiv;
-    
-  gzread( tree_file, &_id,        sizeof(_id)         );
-  gzread( tree_file, &_rank,      sizeof(_rank)       );
-  gzread( tree_file, &_parent_id, sizeof(_parent_id)  );
-  gzread( tree_file, &_donor_id,  sizeof(_donor_id)   );
-  
-  gzread( tree_file, &_genome_size,         sizeof(_genome_size) );
-  gzread( tree_file, &_metabolic_error,     sizeof(_metabolic_error) );
-  gzread( tree_file, &_nb_genes_activ,      sizeof(_nb_genes_activ) );
-  gzread( tree_file, &_nb_genes_inhib,      sizeof(_nb_genes_inhib) );
-  gzread( tree_file, &_nb_non_fun_genes,    sizeof(_nb_non_fun_genes) );
-  gzread( tree_file, &_nb_coding_RNAs,      sizeof(_nb_coding_RNAs) );
-  gzread( tree_file, &_nb_non_coding_RNAs,  sizeof(_nb_non_coding_RNAs) );
-  
-  int32_t nb_dna_replic_reports;
-  gzread( tree_file, &nb_dna_replic_reports, sizeof(nb_dna_replic_reports) );
-  
-  _dna_replic_reports = new ae_list<ae_dna_replic_report*>();
-
-  int32_t mydnareport, myevent;
-  int32_t nb_rears, nb_muts, nb_HT;
-  ae_dna_replic_report * dnareport = NULL;
-  ae_mutation * event = NULL;
-
-  for ( mydnareport = 0 ; mydnareport < nb_dna_replic_reports ; mydnareport++ )
-  {
-    dnareport = new ae_dna_replic_report();
-    
-    gzread( tree_file, &nb_HT, sizeof(nb_HT) );
-    for ( myevent  = 0 ; myevent < nb_HT ; myevent++ )
-    {
-      event = new ae_mutation( tree_file );
-      dnareport->add_HT( event );
-    }
-    
-    gzread( tree_file, &nb_rears, sizeof(nb_rears) );
-    for ( myevent  = 0 ; myevent < nb_rears ; myevent++ )
-    {
-      event = new ae_mutation( tree_file );
-      dnareport->get_rearrangements()->add( event );
-    }
-    
-    gzread( tree_file, &nb_muts, sizeof(nb_muts) );
-    for(myevent  = 0 ; myevent < nb_muts ; myevent++ )
-    {
-      event = new ae_mutation( tree_file );
-      dnareport->get_mutations()->add( event );
-    }
-
-    dnareport->compute_stats();
-    _dna_replic_reports->add( dnareport );
-  }
-  
-  _parent_metabolic_error = -1;
-  _parent_secretion_error = -1;
-  _donor_metabolic_error  = -1;
-  _parent_genome_size     = -1;
-  _donor_genome_size      = -1;
-  _mean_align_score       = 0.0;
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_replication_report::~ae_replication_report( void )
-{
-  _dna_replic_reports->erase( true );
-  delete _dna_replic_reports;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-/**
- * Method called at the end of the replication. Actions such as finalize the calculation of average values can be done here.
- */
-void ae_replication_report::signal_end_of_replication( void )
-{
-  // Retreive data from the individual
-  _genome_size        = _indiv->get_total_genome_size();
-  _metabolic_error    = _indiv->get_dist_to_target_by_feature( METABOLISM );
-  _nb_genes_activ     = _indiv->get_nb_genes_activ();
-  _nb_genes_inhib     = _indiv->get_nb_genes_inhib();
-  _nb_non_fun_genes   = _indiv->get_nb_functional_genes();
-  _nb_coding_RNAs     = _indiv->get_nb_coding_RNAs();
-  _nb_non_coding_RNAs = _indiv->get_nb_non_coding_RNAs();
-  
-  
-  // Compute the mean alignment score
-  int32_t nb_align = 0;
-  ae_list_node<ae_dna_replic_report*>* dna_rep_node  = _dna_replic_reports->get_first();
-  ae_dna_replic_report* dna_rep = NULL;
-  ae_list_node<ae_mutation*>* rear_node     = NULL;
-  ae_mutation* rear = NULL;
-  ae_mutation_type        mut_type;
-  int32_t*  int32_trash = new int32_t;
-  bool*     bool_trash  = new bool;
-  int16_t*  align_scores = new int16_t[2];
-  while ( dna_rep_node != NULL )
-  {
-    dna_rep = dna_rep_node->get_obj();
-    
-    nb_align += dna_rep->get_nb_duplications();
-    nb_align += dna_rep->get_nb_deletions();
-    nb_align += 2 * dna_rep->get_nb_translocations();
-    nb_align += dna_rep->get_nb_inversions();
-    
-    rear_node = dna_rep->get_rearrangements()->get_first();
-    while ( rear_node != NULL )
-    {
-      rear = rear_node->get_obj();
-      
-      mut_type = rear->get_mut_type();
-      
-      switch( mut_type )
-      {
-        case DUPL:
-        {
-          rear->get_infos_duplication( int32_trash, int32_trash, int32_trash, &align_scores[0] );
-          _mean_align_score += align_scores[0];
-          break;
-        }
-        case DEL:
-        {
-          rear->get_infos_deletion( int32_trash, int32_trash, &align_scores[0] );
-          _mean_align_score += align_scores[0];
-          break;
-        }
-        case TRANS:
-        {
-          rear->get_infos_translocation( int32_trash, int32_trash, int32_trash, int32_trash, bool_trash, &align_scores[0], &align_scores[1] );
-          _mean_align_score += align_scores[0] + align_scores[1];
-          break;
-        }
-        case INV:
-        {
-          rear->get_infos_inversion( int32_trash, int32_trash, &align_scores[0] );
-          _mean_align_score += align_scores[0];
-          break;
-        }
-        default:
-        {
-          fprintf( stderr, "ERROR, invalid mutation type \"%d\" in file %s:%d.\n", mut_type, __FILE__, __LINE__ );
-          exit( EXIT_FAILURE );
-        }
-      }
-      
-      rear_node = rear_node->get_next();
-    }
-    
-    dna_rep_node = dna_rep_node->get_next();
-  }
-  
-  if ( nb_align != 0 )
-  {
-    _mean_align_score /= nb_align;
-  }
-  else
-  {
-    assert( _mean_align_score == 0.0 );
-  }
-  
-  delete int32_trash;
-  delete bool_trash;
-  delete [] align_scores;
-}
-
-void ae_replication_report::write_to_tree_file( gzFile tree_file ) const
-{
-  // Store individual identifiers and rank
-  gzwrite( tree_file, &_id,         sizeof(_id)         );
-  gzwrite( tree_file, &_rank,       sizeof(_rank)       );
-  gzwrite( tree_file, &_parent_id,  sizeof(_parent_id)  );
-  gzwrite( tree_file, &_donor_id,   sizeof(_donor_id)   );
-  
-  gzwrite( tree_file, &_genome_size,         sizeof(_genome_size) );
-  gzwrite( tree_file, &_metabolic_error,     sizeof(_metabolic_error) );
-  gzwrite( tree_file, &_nb_genes_activ,      sizeof(_nb_genes_activ) );
-  gzwrite( tree_file, &_nb_genes_inhib,      sizeof(_nb_genes_inhib) );
-  gzwrite( tree_file, &_nb_non_fun_genes,    sizeof(_nb_non_fun_genes) );
-  gzwrite( tree_file, &_nb_coding_RNAs,      sizeof(_nb_coding_RNAs) );
-  gzwrite( tree_file, &_nb_non_coding_RNAs,  sizeof(_nb_non_coding_RNAs) );  
-  
-  // For each genetic unit, write the mutations and rearrangements undergone during replication
-  int32_t nb_dna_replic_reports = _dna_replic_reports->get_nb_elts();
-  gzwrite( tree_file, &nb_dna_replic_reports, sizeof(nb_dna_replic_reports) );
-  //~ printf( "  nb_dna_replic_reports : %"PRId32"\n", nb_dna_replic_reports );
-
-  ae_list_node<ae_dna_replic_report*>* report_node = _dna_replic_reports->get_first();
-  ae_dna_replic_report* report = NULL;
-  
-  while ( report_node != NULL )
-  {
-    report = report_node->get_obj();
-    
-    // Store HT
-    int32_t nb_HT = report->get_nb_HT();
-    gzwrite( tree_file, &nb_HT, sizeof(nb_HT) );
-    ae_list_node<ae_mutation*>* HT_node = report->get_HT()->get_first();
-    while ( HT_node != NULL )
-    {
-      HT_node->get_obj()->save( tree_file );
-      HT_node = HT_node->get_next();
-    }
-    
-    // Store rearrangements
-    int32_t nb_rears = report->get_nb_rearrangements();
-    gzwrite( tree_file, &nb_rears, sizeof(nb_rears) );
-    //~ printf( "  nb_rears : %"PRId32"\n", nb_rears );
-
-    ae_list_node<ae_mutation*>* rear_node = report->get_rearrangements()->get_first();
-    while ( rear_node != NULL )
-    {
-      rear_node->get_obj()->save( tree_file );
-      rear_node = rear_node->get_next();
-    }
-    
-    // Store mutations
-    int32_t nb_muts = report->get_nb_small_mutations();
-    gzwrite( tree_file, &nb_muts, sizeof(nb_muts) );
-    //~ printf( "  nb_muts : %"PRId32"\n", nb_muts );
-
-    ae_list_node<ae_mutation*>* mut_node = report->get_mutations()->get_first();
-    while ( mut_node != NULL )
-    {
-      mut_node->get_obj()->save( tree_file );
-      mut_node = mut_node->get_next();
-    }
-    
-    report_node = report_node->get_next();
-  }
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-
-
-
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
-
diff --git a/src/libaevol/ae_replication_report.h b/src/libaevol/ae_replication_report.h
deleted file mode 100644
index 0908951..0000000
--- a/src/libaevol/ae_replication_report.h
+++ /dev/null
@@ -1,331 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
- #ifndef __AE_REPLICATION_REPORT_H__
-#define  __AE_REPLICATION_REPORT_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <zlib.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_list.h>
-#include <ae_dna_replic_report.h>
-#include <ae_enums.h>
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_individual;
-
-
-
-
-
-class ae_replication_report : public ae_object
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_replication_report( ae_individual * indiv, ae_individual * parent, ae_individual * donor = NULL );
-
-    // Creates a completely independent copy of the original report
-    ae_replication_report( const ae_replication_report &model );
-
-    ae_replication_report( gzFile tree_file, ae_individual * indiv );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_replication_report( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline ae_individual * get_indiv( void ) const;
-    int32_t         get_id( void ) const;
-    int32_t         get_rank( void ) const;
-    inline int32_t  get_genome_size( void ) const;
-
-    inline int32_t  get_parent_id( void ) const;
-    inline double   get_parent_metabolic_error( void ) const;
-    inline double   get_parent_secretion_error( void ) const;
-    inline int32_t  get_parent_genome_size( void ) const;
-
-    inline double   get_mean_align_score( void ) const;
-    inline int32_t	get_donor_id( void ) const;
-    inline double   get_donor_metabolic_error( void ) const;
-    inline double   get_donor_secretion_error( void ) const;
-    inline int32_t  get_donor_genome_size( void ) const;
-     
-    void            set_indiv( ae_individual * indiv);
-    void            set_id( int32_t id );
-    void            set_rank( int32_t rank );
-    inline void     set_parent_id( int32_t parent_id );
-    inline void     set_parent_metabolic_error( double parent_metabolic_error );
-    inline void     set_parent_secretion_error( double parent_secretion_error );
-    inline void     set_parent_genome_size( int32_t parent_genome_size );
-    inline void     set_donor_id(int32_t donor_id );
-    inline void     set_donor_metabolic_error( double donor_metabolic_error );
-    inline void     set_donor_secretion_error( double donor_secretion_error );
-    inline void     set_donor_genome_size( int32_t donor_genome_size );
-  
-    
-    inline ae_list<ae_dna_replic_report*>* get_dna_replic_reports( void ) const;
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    //~ inline void add_mutation_list( ae_list* mut_list );
-    //~ inline void add_rearrangement_list( ae_list* rear_list );
-    
-    void signal_end_of_replication( void );
-    void write_to_tree_file( gzFile tree_file ) const;
-
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_replication_report( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_individual*  _indiv;
-    
-    int32_t         _id;
-    int32_t         _rank;
-    int32_t         _parent_id;
-    
-    int32_t         _genome_size;
-    double          _metabolic_error;
-    int16_t         _nb_genes_activ;
-    int16_t         _nb_genes_inhib;
-    int16_t         _nb_non_fun_genes;
-    int16_t         _nb_coding_RNAs;
-    int16_t         _nb_non_coding_RNAs;
-    
-    ae_list<ae_dna_replic_report*>*  _dna_replic_reports; // List of each genetic unit's replication report
-    
-    double          _parent_metabolic_error;
-    double          _parent_secretion_error;
-    int32_t         _parent_genome_size;
-    
-    int32_t			    _donor_id;
-    double          _donor_metabolic_error;
-    double          _donor_secretion_error;
-    int32_t         _donor_genome_size;
-    
-    // CK: I think that the attributes below are obsolete 
-    // (HT events are now stored in the ae_dna_replic_reports)
-    
-    double          _mean_align_score;
-    
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline ae_individual * ae_replication_report::get_indiv( void ) const
-{
-  return _indiv;
-}
-
-inline int32_t ae_replication_report::get_id( void ) const
-{
-  return _id;
-}
-
-inline int32_t ae_replication_report::get_rank( void ) const
-{
-  return _rank;
-}
-
-inline int32_t ae_replication_report::get_genome_size( void ) const
-{
-  return _genome_size;
-}
-
-int32_t ae_replication_report::get_parent_id( void ) const
-{
-  return _parent_id;
-}
-
-double ae_replication_report::get_parent_metabolic_error( void ) const
-{
-  return _parent_metabolic_error;
-}
-
-double ae_replication_report::get_parent_secretion_error( void ) const
-{
-  return _parent_secretion_error;
-}
-
-int32_t ae_replication_report::get_parent_genome_size( void ) const
-{
-  return _parent_genome_size;
-}
-
-inline int32_t	ae_replication_report::get_donor_id( void ) const
-{
-  return _donor_id;
-}
-
-inline double   ae_replication_report::get_donor_metabolic_error( void ) const
-{
-  return _donor_metabolic_error;
-}
-
-inline int32_t  ae_replication_report::get_donor_genome_size( void ) const
-{
-  return _donor_genome_size;
-}
-
-
-
-inline double ae_replication_report::get_mean_align_score( void ) const
-{
-  return _mean_align_score;
-}
-
-inline ae_list<ae_dna_replic_report*>* ae_replication_report::get_dna_replic_reports( void ) const
-{
-  return _dna_replic_reports;
-}
-
-
-
-
-
-
-inline void ae_replication_report::set_indiv( ae_individual * indiv )
-{
-  _indiv = indiv;
-}
-
-inline void ae_replication_report::set_id( int32_t id )
-{
-  _id = id;
-}
-
-inline void ae_replication_report::set_rank( int32_t rank )
-{
-  _rank = rank;
-}
-
-void ae_replication_report::set_parent_id( int32_t parent_id )
-{
-  _parent_id = parent_id;
-}
-
-void ae_replication_report::set_parent_metabolic_error( double parent_metabolic_error )
-{
-  _parent_metabolic_error = parent_metabolic_error;
-}
-
-void ae_replication_report::set_parent_secretion_error( double parent_secretion_error )
-{
-  _parent_secretion_error = parent_secretion_error;
-}
-
-void ae_replication_report::set_parent_genome_size( int32_t parent_genome_size )
-{
-  _parent_genome_size = parent_genome_size;
-}
-
-inline void ae_replication_report::set_donor_id(int32_t donor_id )
-{
-  _donor_id = donor_id;
-}
-
-inline void  ae_replication_report::set_donor_metabolic_error( double donor_metabolic_error )
-{
-  _donor_metabolic_error = donor_metabolic_error;
-}
-
-inline void ae_replication_report::set_donor_secretion_error( double donor_secretion_error )
-{
-  _donor_secretion_error = donor_secretion_error;
-}
-
-inline void ae_replication_report::set_donor_genome_size( int32_t donor_genome_size )
-{
-  _donor_genome_size = donor_genome_size;
-}
-
-  
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-//~ void ae_replication_report::add_mutation_list( ae_list* mut_list )
-//~ {
-  //~ _mutations->add( mut_list );
-//~ }
-
-//~ void ae_replication_report::add_rearrangement_list( ae_list* rear_list )
-//~ {
-  //~ _rearrangements->add( rear_list );
-//~ }
-
-
-#endif // __AE_REPLICATION_REPORT_H__
diff --git a/src/libaevol/ae_rna.cpp b/src/libaevol/ae_rna.cpp
deleted file mode 100644
index 89733cf..0000000
--- a/src/libaevol/ae_rna.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_rna.h>
-#include <ae_genetic_unit.h>
-#include <ae_individual.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                 Class ae_rna                                #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_rna::ae_rna( ae_genetic_unit* gen_unit, const ae_rna &model )
-{
-  // Copy "trivial" attributes
-  _gen_unit  = gen_unit;
-  
-  _strand             = model._strand;
-  _pos                = model._pos;
-  _transcript_length  = model._transcript_length;
-  _basal_level        = model._basal_level;
-  
-  // Copy transcribed proteins
-  // WARNING : Since this list do not "own" the proteins (they will not be deleted)
-  //            proteins must NOT be CREATED here.
-  _transcribed_proteins = new ae_list<ae_protein*>();
-  
-  // TODO : Not needed for the moment...
-  //~ ae_list_node<ae_protein*>* prot_node = model._transcribed_proteins->get_first();
-  //~ ae_protein*   prot;
-
-  //~ while ( prot_node != NULL )
-  //~ {
-    //~ prot = prot_node->get_obj();
-
-    //~ _transcribed_proteins->add( prot );
-
-    //~ prot_node = prot_node->get_next();
-  //~ }
-}
-
-ae_rna::ae_rna( ae_genetic_unit* gen_unit )
-{
-  _gen_unit = gen_unit;
-  
-  _transcribed_proteins = new ae_list<ae_protein*>();
-}
-
-ae_rna::ae_rna( ae_genetic_unit* gen_unit, ae_strand strand, int32_t pos, int8_t diff )
-{
-  _gen_unit  = gen_unit;
-  _strand = strand;
-  _pos    = pos;
-
-  _transcript_length  = -1;
-  _basal_level        = 1 - (double)diff / (PROM_MAX_DIFF + 1);
-  
-  _transcribed_proteins = new ae_list<ae_protein*>();
-}
-
-/*
-ae_rna::ae_rna( ae_rna* parent )
-{
-  _gen_unit           = parent->_gen_unit;
-  _strand             = parent->_strand;
-  _pos                = parent->_pos;
-  _transcript_length  = parent->_transcript_length;
-  _basal_level        = parent->_basal_level;
-}
-*/
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_rna::~ae_rna( void )
-{
-  _transcribed_proteins->erase( false );
-  delete _transcribed_proteins;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-int32_t ae_rna::get_first_transcribed_pos( void ) const
-{
-  if ( _strand == LEADING )
-  {
-    return ae_utils::mod( _pos + PROM_SIZE, _gen_unit->get_dna()->get_length() );
-  }
-  else
-  {
-    return ae_utils::mod( _pos - PROM_SIZE, _gen_unit->get_dna()->get_length() );
-  }
-}
-
-int32_t ae_rna::get_last_transcribed_pos( void ) const
-{
-  if ( _strand == LEADING )
-  {
-    return ae_utils::mod( _pos +  PROM_SIZE + _transcript_length - 1, _gen_unit->get_dna()->get_length() );
-  }
-  else
-  {
-    return ae_utils::mod( _pos - (PROM_SIZE + _transcript_length - 1), _gen_unit->get_dna()->get_length() );
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_rna.h b/src/libaevol/ae_rna.h
deleted file mode 100644
index 42b878e..0000000
--- a/src/libaevol/ae_rna.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-#ifndef __AE_RNA_H__
-#define __AE_RNA_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_dna.h>
-#include <ae_utils.h>
-#include <ae_protein.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_individual;
-class ae_genetic_unit;
-
-
-
-
-
-class ae_rna : public ae_object
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_rna( ae_genetic_unit* gen_unit, const ae_rna &model );
-    ae_rna( ae_genetic_unit* gen_unit );
-    ae_rna( ae_genetic_unit* gen_unit, ae_strand strand, int32_t index, int8_t diff );
-    //ae_rna( ae_rna* parent );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_rna( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-
-    // <DEBUG>
-    void check( ae_genetic_unit* gen_unit ) { assert( gen_unit == _gen_unit ); };
-    //~ void* get_indiv( void ) const { return (void*)_indiv; };
-    // </DEBUG>
-
-    inline ae_genetic_unit * get_genetic_unit( void ) const;
-    inline void              set_genetic_unit( ae_genetic_unit*  gen_unit );
-    inline ae_strand  get_strand( void ) const;
-    inline void       set_strand( ae_strand strand );
-    inline int32_t    get_promoter_pos( void ) const;
-    inline void       set_promoter_pos( int32_t pos );
-    inline double     get_basal_level( void ) const;
-    inline int32_t    get_transcript_length( void ) const; // The promoter is NOT transcribed.
-    inline void       set_transcript_length( int32_t length );
-    inline bool       is_coding( void ) const;
-
-    inline ae_list<ae_protein*>* get_transcribed_proteins( void ) const;
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    int32_t get_first_transcribed_pos( void ) const;   // The promoter is NOT transcribed.
-    int32_t get_last_transcribed_pos( void ) const;    // The terminator is transcribed.
-    inline void add_transcribed_protein( ae_protein* prot );
-    inline void shift_position( int32_t delta_pos, int32_t genome_length );
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_rna( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    ae_rna( const ae_rna &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_genetic_unit*  _gen_unit;
-    ae_strand         _strand;
-    int32_t           _pos; // Index of the promoter on the genome.
-                            // The promoter itself is NOT transcribed
-                            // The terminator is transcribed.
-    int32_t           _transcript_length;
-    double            _basal_level;
-
-    ae_list<ae_protein*>* _transcribed_proteins;
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline ae_genetic_unit * ae_rna::get_genetic_unit( void ) const
-{
-  return _gen_unit;
-}
-
-inline void ae_rna::set_genetic_unit( ae_genetic_unit*  gen_unit )
-{
-  _gen_unit = gen_unit;
-}
-
-inline ae_strand ae_rna::get_strand( void ) const
-{
-  return _strand;
-}
-
-inline void ae_rna::set_strand( ae_strand strand )
-{
-  _strand = strand;
-}
-
-inline void ae_rna::set_promoter_pos( int32_t pos )
-{
-  _pos = pos;
-}
-
-inline int32_t ae_rna::get_promoter_pos( void ) const
-{
-  return _pos;
-}
-
-inline double ae_rna::get_basal_level( void ) const
-{
-  return _basal_level;
-}
-
-inline int32_t ae_rna::get_transcript_length( void ) const
-{
-  return _transcript_length;
-}
-
-inline void ae_rna::set_transcript_length( int32_t transcript_length )
-{
-  _transcript_length = transcript_length;
-}
-
-inline ae_list<ae_protein*>* ae_rna::get_transcribed_proteins( void ) const
-{
-  return _transcribed_proteins;
-}
-
-inline bool ae_rna::is_coding( void ) const
-{
-  return ( !get_transcribed_proteins()->is_empty() );
-}
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-void ae_rna::add_transcribed_protein( ae_protein* prot )
-{
-  _transcribed_proteins->add( prot );
-}
-
-void ae_rna::shift_position( int32_t delta_pos, int32_t genome_length )
-{
-  _pos = ae_utils::mod( _pos + delta_pos, genome_length );
-}
-
-
-#endif // __AE_RNA_H__
diff --git a/src/libaevol/ae_selection.cpp b/src/libaevol/ae_selection.cpp
deleted file mode 100644
index 5fc041a..0000000
--- a/src/libaevol/ae_selection.cpp
+++ /dev/null
@@ -1,870 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_selection.h>
-#include <ae_exp_manager.h>
-#include <ae_vis_a_vis.h>
-
-#ifdef __NO_X
-  #ifndef __REGUL
-    #include <ae_individual.h>
-  #else
-    #include <ae_individual_R.h>
-  #endif
-#elif defined __X11
-  #ifndef __REGUL
-    #include <ae_individual_X11.h>
-  #else
-    #include <ae_individual_R_X11.h>
-  #endif
-#endif
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                              Class ae_selection                             #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_selection::ae_selection( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-
-  // ----------------------------------------- Pseudo-random number generator
-  _prng = NULL;
-
-  // -------------------------------------------------------------- Selection
-  _selection_scheme   = RANK_EXPONENTIAL;
-  _selection_pressure = 0.998;
-
-  // --------------------------- Probability of reproduction of each organism
-  _prob_reprod = NULL;
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_selection::~ae_selection( void )
-{
-  delete _prng;
-  if (_prob_reprod!=NULL)
-  {
-    delete [] _prob_reprod;
-  }
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_selection::step_to_next_generation( void )
-{
-  // To create the new generation, we must create nb_indivs new individuals
-  // (offspring) and "kill" the existing ones.
-  // The number of offspring on a given individual will be given by a stochastic
-  // process biased on it's fitness value (the selection process).
-  // There are 3 possible selection schemes :
-  //    * Linear Ranking
-  //    * Exponential Ranking
-  //    * Fitness proportionate
-  //
-  // Whichever method is chosen, we will
-  // 1) Compute the probability of reproduction of each individual in the population
-  // 2) Simulate the stochastic process by a multinomial drawing (based upon the probabilities computed in 1)
-  // 3) Make the selected individuals reproduce, thus creating the new generation
-  // 4) Replace the current generation by the newly created one.
-  // 5) Sort the newly created population*
-
-  if ( _prng == NULL )
-  {
-    printf( "%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-
-  if ( _exp_m->is_spatially_structured() )
-  {
-    step_to_next_generation_grid();
-    return;
-  }
-
-
-  if ( _exp_m->get_pop()->get_indiv_by_id( 0 )->get_with_stochasticity() )
-  {
-    _exp_m->get_pop()->backup_stoch_prng();
-  }
-
-
-  // -------------------------------------------------------------------------------
-  // 1) Compute the probability of reproduction of each individual in the population
-  // -------------------------------------------------------------------------------
-  #ifndef FIXED_POPULATION_SIZE
-    #error this method is not ready for variable population size
-    compute_prob_reprod();
-  #else
-    if ( _selection_scheme == FITNESS_PROPORTIONATE || _prob_reprod == NULL )
-    {
-      compute_prob_reprod();
-    }
-  #endif
-
-  // --------------------------------------------------------------------------------------------------------
-  // 2) Simulate the stochastic process by a multinomial drawing (based upon the probabilities computed in 1)
-  // --------------------------------------------------------------------------------------------------------
-  int32_t  nb_indivs = _exp_m->get_pop()->get_nb_indivs();
-  int32_t* nb_offsprings = new int32_t[nb_indivs];
-  _prng->multinomial_drawing( nb_offsprings, _prob_reprod, nb_indivs, nb_indivs );
-
-  // ------------------------------------------------------------------------------
-  // 3) Make the selected individuals "reproduce", thus creating the new generation
-  // ------------------------------------------------------------------------------
-  ae_list<ae_individual*>*      new_generation  = new ae_list<ae_individual*>();
-  ae_list<ae_individual*>*      old_generation  = _exp_m->get_indivs();
-  ae_list_node<ae_individual*>* indiv_node      = old_generation->get_first();
-  ae_list_node<ae_individual*>* next_indiv_node = NULL;
-  ae_individual*  indiv           = NULL;
-  int32_t         index_new_indiv = 0;
-
-  for ( int32_t i = 0 ; i < nb_indivs ; i++ )
-  {
-    // Make indiv i reproduce (nb_offsprings[i] offsprings)
-    indiv = indiv_node->get_obj();
-
-    next_indiv_node = indiv_node->get_next();
-
-    for ( int32_t j = 0 ; j < nb_offsprings[i] ; j++ )
-    {
-      #ifdef DISTRIBUTED_PRNG
-        #error Not implemented yet !
-        // For all but the first time, Take a jump in the PRNG
-        if ( j > 0 ) indiv->do_prng_jump();
-      #endif
-
-      // Create a new individual (evaluated at the end of do_replication)
-      new_generation->add( do_replication( indiv, index_new_indiv++ ) );
-    }
-
-    // All the offsprings of this individual have been generated, if there is no transfer,
-    // the indiv will not be used any more and can hence be deleted
-    if ( (not _exp_m->get_with_HT()) and (not _exp_m->get_with_plasmids()) )
-    {
-      old_generation->remove( indiv_node, true, true );
-    }
-
-    indiv_node = next_indiv_node;
-  }
-
-  if ( _exp_m->get_with_HT() or _exp_m->get_with_plasmids() )
-  {
-    // The individuals have not yet been deleted, do it now.
-    old_generation->erase( true );
-  }
-
-
-  delete [] nb_offsprings;
-
-
-
-  // -------------------------------------------------------------
-  //  4) Replace the current generation by the newly created one.
-  // -------------------------------------------------------------
-  assert( _exp_m->get_pop()->get_indivs()->is_empty() );
-  _exp_m->get_pop()->update_population( new_generation );
-
-
-  // --------------------------------------
-  //  5) Sort the newly created population
-  // --------------------------------------
-  _exp_m->get_pop()->sort_individuals();
-}
-
-void ae_selection::step_to_next_generation_grid( void )
-{
-  // -------------------------------------------------------------------------------
-  // 1) Compute the probability of reproduction of each individual in the population
-  // -------------------------------------------------------------------------------
-  #ifndef FIXED_POPULATION_SIZE
-    #error this method is not ready for variable population size
-    compute_local_prob_reprod();
-  #else
-    // The function compute_local_prob_reprod creates and fills the array _prob_reprod, which is telling us the probability of being picked for reproduction according to the rank of an individual in its neighboorhood.
-    // It is only usefull when selection is rank based. When selection scheme is FITNESS_PROPORTIONATE, we do not need to call it.
-    // It shoud only be called once in the simulation and not at each generation. So if _prob_reprod already exists we do not need to call it.
-    if ( (_selection_scheme != FITNESS_PROPORTIONATE) && (_prob_reprod == NULL) )
-    {
-      compute_local_prob_reprod();
-    }
-  #endif
-
-  if ( _prng == NULL )
-  {
-    printf( "%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-
-  ae_spatial_structure* sp_struct = _exp_m->get_spatial_structure();
-
-  int16_t grid_width  = _exp_m->get_grid_width();
-  int16_t grid_height = _exp_m->get_grid_height();
-
-  ae_grid_cell*** pop_grid = _exp_m->get_pop_grid();
-
-  // create a temporary grid to store new individuals
-  ae_individual*** new_indiv_grid = new ae_individual** [grid_width];
-  for ( int16_t i = 0 ; i < grid_width ; i++ )
-  {
-    new_indiv_grid[i] = new ae_individual* [grid_height];
-  }
-
-
-  // Do local competitions
-  for ( int16_t x = 0 ; x < grid_width ; x++ )
-  {
-    for ( int16_t y = 0 ; y < grid_height ; y++ )
-    {
-      new_indiv_grid[x][y] = calculate_local_competition( x, y );
-    }
-  }
-
-
-  // Add the compound secreted by the individuals
-  if ( _exp_m->get_with_secretion() )
-  {
-    double tmp_secretion;
-    for ( int16_t x = 0 ; x < grid_width ; x++ )
-    {
-      for ( int16_t y = 0 ; y < grid_height ; y++ )
-      {
-        tmp_secretion = pop_grid[x][y]->get_compound_amount() + pop_grid[x][y]->get_individual()->get_fitness_by_feature(SECRETION);
-        pop_grid[x][y]->set_compound_amount( tmp_secretion );
-      }
-    }
-
-    // Diffusion and degradation of compound in the environment
-    sp_struct->update_secretion_grid();
-  }
-
-
-  // Create the new generation
-  ae_list<ae_individual*>* new_generation = new ae_list<ae_individual*>();
-  int32_t index_new_indiv = 0;
-  for ( int16_t x = 0 ; x < grid_width ; x++ )
-  {
-    for ( int16_t y = 0 ; y < grid_height ; y++ )
-    {
-      pop_grid[x][y]->set_individual( do_replication( new_indiv_grid[x][y], index_new_indiv++, x, y ) );
-      #ifdef DISTRIBUTED_PRNG
-        #error Not implemented yet !
-        new_indiv_grid[x][y]->do_prng_jump();
-      #endif
-      new_generation->add( pop_grid[x][y]->get_individual() );
-    }
-  }
-
-  // Replace the old population by the newly created one
-  _exp_m->get_pop()->replace_population( new_generation );
-
-  // delete the temporary grid
-  for ( int16_t x = 0 ; x < grid_width ; x++ )
-  {
-    delete [] new_indiv_grid[x];
-  }
-  delete [] new_indiv_grid;
-
-  // randomly migrate some organisms, if necessary
-  if ( sp_struct->get_migration_number() > 0 )
-  {
-    sp_struct->do_random_migrations();
-  }
-
-  // Perform plasmid transfer
-  if ( _exp_m->get_with_plasmids() && ( (_exp_m->get_prob_plasmid_HT() != 0.0) || (_exp_m->get_tune_donor_ability() != 0.0) || (_exp_m->get_tune_recipient_ability() != 0.0) ) )
-  {
-    int16_t x_offset, y_offset, new_x, new_y;
-
-
-    // Shuffle the grid:
-    int16_t total_size = ((grid_width)*(grid_height));
-    int16_t** shuffled_table = new int16_t* [total_size];
-    for ( int16_t z = 0 ; z < total_size ; z++ )
-    {
-      shuffled_table[z] = new int16_t[2];
-      int16_t quotient = z / grid_width;
-      int16_t remainder = z % grid_width;
-      shuffled_table[z][0] = (int16_t) remainder;
-      shuffled_table[z][1] = (int16_t) quotient;
-    }
-
-    for ( int16_t z = 0 ;z < total_size - 1 ; z++ )
-    {
-      int16_t rand_nb = _prng->random((int16_t) (total_size-z));
-      int16_t* tmp=shuffled_table[z+rand_nb];
-      shuffled_table[z+rand_nb]=shuffled_table[z];
-      shuffled_table[z]=tmp;
-    }
-
-
-    // First transfer all the plasmids, but just add them at the end of the list of the GUs
-    for ( int16_t z = 0 ; z < total_size ; z++ ) // for each individual x
-    {
-      int16_t x=shuffled_table[z][0];
-      int16_t y=shuffled_table[z][1];
-
-      for ( int16_t n = 0 ; n < 9 ; n++ ) // for each neighbour n of x
-      {
-        x_offset = ( n / 3 ) - 1;
-        y_offset = ( n % 3 ) - 1;
-
-        new_x = (x+x_offset+grid_width) % grid_width;
-        new_y = (y+y_offset+grid_height) % grid_height;
-
-        if ((new_x != x)||(new_y != y))
-        {
-          double ptransfer = _exp_m->get_prob_plasmid_HT() + _exp_m->get_tune_donor_ability()
-                            * sp_struct->get_indiv_at(x, y)->get_fitness_by_feature(DONOR)
-                            + _exp_m->get_tune_recipient_ability() * sp_struct->get_indiv_at(new_x, new_y)->get_fitness_by_feature(RECIPIENT) ;
-          if ( _prng->random() < ptransfer ) // will x give a plasmid to n ?
-          {
-            if ( _exp_m->get_swap_GUs() )
-            {
-              sp_struct->get_indiv_at(new_x, new_y)->inject_2GUs( sp_struct->get_indiv_at(x, y) );
-            }
-            else
-            {
-              sp_struct->get_indiv_at(new_x, new_y)->inject_GU( sp_struct->get_indiv_at(x, y) );
-            }
-          }
-        }
-      }
-    }
-
-    for(int16_t z=0;z <total_size;z++)
-    {
-      delete [] shuffled_table[z];
-    }
-    delete [] shuffled_table;
-
-
-
-    // If an individual has more than 2 GUs, we keep only the first (main chromosome) and the last one
-    // and re-evaluate the individual
-    for ( int16_t x = 0 ; x < grid_width ; x++ )
-    {
-      for ( int16_t y = 0 ; y < grid_height ; y++ )
-      {
-        bool reevaluate = false;
-        while ( sp_struct->get_indiv_at(x, y)->get_genetic_unit_list()->get_nb_elts() > 2 )
-        {
-          reevaluate = true;
-          sp_struct->get_indiv_at(x, y)->get_genetic_unit_list()->remove(
-                  sp_struct->get_indiv_at(x, y)->get_genetic_unit_list()->get_first()->get_next(), true, true);
-        }
-        if (reevaluate)
-        {
-          sp_struct->get_indiv_at(x, y)->reevaluate();
-          //previous code avoided full re-evaluation, just updated the "full" proteins list:
-          //_pop_grid[x][y]->get_individual()->reevaluate_after_GU_transfer(ae_common::sim->get_env());
-        }
-      }
-    }
-  }
-
-  // Update the best individual
-  _exp_m->get_pop()->update_best();
-}
-
-/*!
-*/
-void ae_selection::write_setup_file( gzFile exp_setup_file ) const
-{
-  // ---------------------------------------------------- Selection Parameters
-  int8_t tmp_sel_scheme = _selection_scheme;
-  gzwrite( exp_setup_file, &tmp_sel_scheme,      sizeof(tmp_sel_scheme) );
-  gzwrite( exp_setup_file, &_selection_pressure, sizeof(_selection_pressure) );
-}
-
-/*!
-*/
-void ae_selection::write_setup_file( FILE* exp_setup_file ) const
-{
-  // TODO
-}
-
-
-/*!
-*/
-void ae_selection::save( gzFile& backup_file ) const
-{
-  if ( _prng == NULL )
-  {
-    printf( "%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-
-  // ----------------------------------------- Pseudo-random number generator
-  _prng->save( backup_file );
-}
-
-void ae_selection::load( gzFile& exp_setup_file,
-                         gzFile& backup_file,
-                         bool verbose )
-{
-  // ---------------------------------------------------- Selection parameters
-  int8_t tmp_sel_scheme;
-  gzread( exp_setup_file, &tmp_sel_scheme, sizeof(tmp_sel_scheme) );
-  _selection_scheme = (ae_selection_scheme) tmp_sel_scheme;
-  gzread( exp_setup_file, &_selection_pressure, sizeof(_selection_pressure) );
-
-  // ----------------------------------------- Pseudo-random number generator
-  _prng = new ae_jumping_mt( backup_file );
-}
-
-void ae_selection::load( FILE*& exp_setup_file,
-                         gzFile& backup_file,
-                         bool verbose )
-{
-  // TODO
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-void ae_selection::compute_prob_reprod( void )
-{
-  if ( _prob_reprod != NULL )
-  {
-    delete [] _prob_reprod;
-  }
-
-  int32_t nb_indivs = _exp_m->get_pop()->get_nb_indivs();
-  _prob_reprod = new double[nb_indivs];
-
-  if ( _selection_scheme == RANK_LINEAR )
-  {
-    // The probability of reproduction for an individual is given by
-    // ( 2-SP + 2 * (SP-1) * (R-1)/(N-1) ) / N
-    // With :
-    //      SP : selective pressure. Linear ranking allows values of SP in [1.0, 2.0].
-    //      R  : the rank of the individual in the population (1 for the worst individual)
-    //      N  : the number of individuals in the population
-    //
-    // We can transform this expression into (2-SP)/N + ((2*(SP-1)) / (N*(N-1))) * (R-1)
-    // Furthermore, (R-1) is given directly by <i> (the index of our probability table)
-    //
-    // probs[0] will hence be given by (2-SP)/N
-    // probs[i+1] can then be expressed by probs[i] + (2*(SP-1)) / (N*(N-1))
-
-    double increment  = (2 * (_selection_pressure-1)) / (nb_indivs * (nb_indivs-1));
-    _prob_reprod[0]   = (2 - _selection_pressure) / nb_indivs;
-
-    for ( int32_t i = 1 ; i < nb_indivs ; i++ )
-    {
-      _prob_reprod[i] = _prob_reprod[i-1] + increment;
-    }
-
-    // No need to normalize: The sum is always 1 for linear ranking
-  }
-  else if ( _selection_scheme == RANK_EXPONENTIAL )
-  {
-    // The probability of reproduction for an individual is given by
-    // ( (SP-1) * SP^(N-R) ) / ( SP^N - 1 )
-    // Which is equivalent to
-    // ( (SP-1) * SP^N ) / ( (SP^N - 1) * SP^R )
-    // With :
-    //      SP : selective pressure. Exponential ranking allows values of SP in ]0.0, 1.0[
-    //      R  : the rank of the individual in the population (1 for the worst individual)
-    //      N  : the number of individuals in the population
-    //
-    // NB : The only rank-dependent term is SP^R
-    //
-    // Because we don't allow ex-aequo,
-    // probs[i+1] can hence be expressed as (probs[i] / SP)
-    // We will hence compute probs[0] with the original formula and infer the remaining values
-
-    double SP_N = pow(_selection_pressure, nb_indivs); // SP^N
-    _prob_reprod[0] = ( (_selection_pressure - 1) * SP_N ) /
-                      ( (SP_N - 1) * _selection_pressure );
-
-    for ( int32_t i = 1 ; i < nb_indivs ; i++ )
-    {
-      _prob_reprod[i] = _prob_reprod[i-1] / _selection_pressure;
-    }
-
-    // No need to normalize: We don't allow ex-aequo
-  }
-  else if ( _selection_scheme == FITNESS_PROPORTIONATE ) // Fitness Proportionate
-  {
-    // The probability of reproduction for an individual is given by
-    // exp( -SP * gap ) / sum of this measure on all individuals
-    //    SP : selective pressure. Fitness proportionate allows values of SP in ]0, +inf[
-    //                             The closer SP to 0, the closer the selection to being linear.
-
-    double* fitnesses = new double[nb_indivs];
-    double  sum       = 0;
-
-    ae_list_node<ae_individual*>* indiv_node = _exp_m->get_pop()->get_indivs()->get_first();
-    ae_individual*  indiv       = NULL;
-
-    for ( int32_t i = 0 ; i < nb_indivs ; i++ )
-    {
-      indiv = indiv_node->get_obj();
-      fitnesses[i] = indiv->get_fitness();
-      sum += fitnesses[i];
-      indiv_node = indiv_node->get_next();
-    }
-
-    for ( int32_t i = 0 ; i < nb_indivs ; i++ )
-    {
-      _prob_reprod[i] = fitnesses[i] / sum;
-    }
-
-    delete [] fitnesses;
-  }
-  else if ( _selection_scheme == FITTEST) //  Fittest individual
-  {
-    printf( "ERROR, fittest selection scheme is meant to be used for spatially structured populations %s:%d\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-  else
-  {
-    printf( "ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-}
-
-void ae_selection::compute_local_prob_reprod( void )
-{
-  int16_t neighborhood_size = 9;
-
-  if ( _prob_reprod != NULL )
-  {
-    printf ("Warning, already defined %s:%d\n", __FILE__, __LINE__);
-    delete [] _prob_reprod;
-  }
-
-  _prob_reprod = new double[neighborhood_size];
-
-  if ( _selection_scheme == RANK_LINEAR )
-  {
-    double increment = (2 * (_selection_pressure-1)) / (neighborhood_size * (neighborhood_size-1));
-    double init_prob = (2 - _selection_pressure) / neighborhood_size;
-
-    for ( int16_t i = 0 ; i < neighborhood_size ; i++ )
-    {
-      _prob_reprod[i] = init_prob + increment * i;
-    }
-  }
-  else if ( _selection_scheme == RANK_EXPONENTIAL )
-  {
-    double SP_N = pow(_selection_pressure, neighborhood_size);
-    _prob_reprod[0] = ( (_selection_pressure - 1) * SP_N ) /
-    ( (SP_N - 1) * _selection_pressure );
-
-    for ( int16_t i = 1 ; i < neighborhood_size ; i++ )
-    {
-      _prob_reprod[i] =  _prob_reprod[i-1] /  _selection_pressure;
-    }
-  }
-  else if ( _selection_scheme == FITTEST) //  Fittest individual
-  {
-    for ( int16_t i = 0 ; i < neighborhood_size-1 ; i++ )
-    {
-      _prob_reprod[i] = 0.;
-    }
-    _prob_reprod[neighborhood_size-1] = 1.;
-  }
-  else if ( _selection_scheme == FITNESS_PROPORTIONATE ) // Fitness Proportionate
-  {
-    printf( "ERROR, this function is not intented to be use with this selection scheme %s:%d\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-  else
-  {
-    printf( "ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-}
-
-ae_individual* ae_selection::do_replication( ae_individual* parent, int32_t index, int16_t x /*= -1 */, int16_t y /*= -1 */ )
-{
-  ae_individual* new_indiv = NULL;
-
-  // ===========================================================================
-  //  1) Copy parent
-  // ===========================================================================
-  #ifdef __NO_X
-    #ifndef __REGUL
-      new_indiv = new ae_individual( parent, index, parent->get_mut_prng(), parent->get_stoch_prng() );
-    #else
-      new_indiv = new ae_individual_R( dynamic_cast<ae_individual_R*>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
-    #endif
-  #elif defined __X11
-    #ifndef __REGUL
-      new_indiv = new ae_individual_X11( dynamic_cast<ae_individual_X11*>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
-    #else
-      new_indiv = new ae_individual_R_X11( dynamic_cast<ae_individual_R_X11*>(parent), index, parent->get_mut_prng(), parent->get_stoch_prng() );
-    #endif
-  #endif
-
-
-  // ===========================================================================
-  //  2) Set the new individual's location on the grid
-  //     (needed if the population is structured)
-  // ===========================================================================
-  if ( _exp_m->is_spatially_structured() && (x != -1) )
-  {
-    new_indiv->set_grid_cell( _exp_m->get_spatial_structure()->get_grid_cell( x, y ) );
-  }
-
-  // ===========================================================================
-  //  3) Perform transfer, rearrangements and mutations
-  // ===========================================================================
-  if ( ! new_indiv->get_allow_plasmids() )
-  {
-    ae_genetic_unit* chromosome = new_indiv->get_genetic_unit_list()->get_first()->get_obj();
-
-    chromosome->get_dna()->perform_mutations( parent->get_id());
-
-    if ( new_indiv->get_replic_report() != NULL )
-    {
-      new_indiv->get_replic_report()->get_dna_replic_reports()->add( chromosome->get_dna()->get_replic_report() );
-    }
-  }
-  else
-  {
-    // For each GU, apply mutations
-    ae_list_node<ae_genetic_unit*>* gen_unit_node = NULL;
-    ae_genetic_unit* gen_unit = NULL;
-
-    // Randomly determine the order in which the GUs will undergo mutations
-    bool inverse_order = (_prng->random((int32_t) 2) < 0.5);
-
-    if ( ! inverse_order )
-    // Apply mutations in normal GU order
-    {
-      gen_unit_node = new_indiv->get_genetic_unit_list()->get_first();
-
-      while ( gen_unit_node != NULL )
-      {
-        gen_unit = gen_unit_node->get_obj();
-
-        gen_unit->get_dna()->perform_mutations( parent->get_id() );
-
-        if ( new_indiv->get_replic_report() != NULL )
-        {
-          new_indiv->get_replic_report()->get_dna_replic_reports()->add( gen_unit->get_dna()->get_replic_report() );
-        }
-
-        gen_unit_node = gen_unit_node->get_next();
-      }
-    }
-    else
-    // Apply mutations in inverse GU order
-    {
-      gen_unit_node = new_indiv->get_genetic_unit_list()->get_last();
-
-      while ( gen_unit_node != NULL )
-      {
-        gen_unit = gen_unit_node->get_obj();
-
-        gen_unit->get_dna()->perform_mutations( parent->get_id() );
-
-        if ( new_indiv->get_replic_report() != NULL )
-        {
-          new_indiv->get_replic_report()->get_dna_replic_reports()->add( gen_unit->get_dna()->get_replic_report() );
-        }
-
-        gen_unit_node = gen_unit_node->get_prev();
-      }
-    }
-  }
-
-
-
-  // ===========================================================================
-  //  4) Evaluate new individual
-  // ===========================================================================
-  new_indiv->evaluate();
-
-
-  // ===========================================================================
-  //  5) Compute statistics
-  // ===========================================================================
-  new_indiv->compute_statistical_data();
-
-
-  #ifdef BIG_DEBUG
-  // ae_common::sim->get_logs()->flush();   // ae_common::sim is obsolete in version 4
-  //  new_indiv->assert_promoters();
-  #endif
-
-
-  return new_indiv;
-}
-
-ae_individual* ae_selection::calculate_local_competition ( int16_t x, int16_t y )
-{
-  // This function uses the array _prob_reprod when selection scheme is RANK_LINEAR, RANK_EXPONENTIAL, or FITTEST. For these selection schemes, the function compute_local_prob_reprod (creating the array _prob_reprod) must have been called before.
-  // When selection scheme is FITNESS_PROPORTIONATE, this function only uses the fitness values
-
-  ae_spatial_structure* sp_struct = _exp_m->get_spatial_structure();
-
-  int16_t neighborhood_size = 9;
-  int16_t grid_width  = sp_struct->get_grid_width();
-  int16_t grid_height = sp_struct->get_grid_height();
-  int16_t cur_x;
-  int16_t cur_y;
-
-  // construct a temporarry local array of fitness values
-  double *  local_fit_array   = new double[neighborhood_size];
-  double *  sort_fit_array    = new double[neighborhood_size];
-  int16_t * initial_location  = new int16_t[neighborhood_size];
-  double *  probs             = new double[neighborhood_size];
-  int16_t   count             = 0;
-  double    sum_local_fit     = 0.0;
-
-  for ( int8_t i = -1 ; i < 2 ; i++ )
-  {
-    for ( int8_t j = -1 ; j < 2 ; j++ )
-    {
-      cur_x = ( x + i + grid_width )  % grid_width;
-      cur_y = ( y + j + grid_height ) % grid_height;
-      local_fit_array[count]  = sp_struct->get_indiv_at( cur_x, cur_y )->get_fitness();
-      sort_fit_array[count]   = local_fit_array[count];
-      initial_location[count] = count;
-      sum_local_fit += local_fit_array[count];
-      count++;
-    }
-  }
-
-  // Do the competitions between the individuals, based on one of the 4 methods:
-  // 1. Rank linear
-  // 2. Rank exponential
-  // 3. Fitness proportionate
-  // 4. Fittest individual
-
-  // Any rank based selection
-  switch ( _selection_scheme )
-  {
-    case RANK_LINEAR :
-    case RANK_EXPONENTIAL :
-    case FITTEST :
-    {
-      assert(_prob_reprod);
-      // First we sort the local fitness values using bubble sort :
-      // we sort by increasing order, so the first element will have the worst fitness.
-      bool swaped = true;
-      int16_t loop_length = 8;
-      double  tmp_holder;
-      int16_t tmp_holder2;
-      while ( swaped == true )
-      {
-        swaped = false;
-        for ( int16_t i = 0 ; i < loop_length ; i++ )
-        {
-          //if the first is higher than the second,  exchange them
-          if ( sort_fit_array[i] > sort_fit_array[i+1] )
-          {
-            tmp_holder = sort_fit_array[i];
-            sort_fit_array[i] = sort_fit_array[i+1];
-            sort_fit_array[i+1] = tmp_holder;
-
-            tmp_holder2 = initial_location[i];
-            initial_location[i] = initial_location[i+1];
-            initial_location[i+1] = tmp_holder2;
-
-            swaped = true;
-          }
-        }
-
-        loop_length = loop_length - 1;
-      }
-
-
-      // Then we use the already computed probabilities
-      for ( int16_t i = 0 ; i < neighborhood_size ; i++ )
-      {
-        probs[initial_location[i]] = _prob_reprod[i];
-      }
-
-      break;
-    }
-    // Fitness proportionate selection
-    case FITNESS_PROPORTIONATE :
-    {
-      for( int16_t i = 0 ; i < neighborhood_size ; i++ )
-      {
-        probs[i] = local_fit_array[i]/sum_local_fit;
-      }
-
-      break;
-    }
-    default :
-    {
-      printf( "ERROR, invalid selection scheme in file %s:%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    }
-  }
-
-
-  // pick one organism to reproduce, based on probs[] calculated above, using roulette selection
-  int8_t found_org = _prng->roulette_random( probs, 9 );
-
-  int16_t x_offset = ( found_org / 3 ) - 1;
-  int16_t y_offset = ( found_org % 3 ) - 1;
-
-  delete [] local_fit_array;
-  delete [] sort_fit_array;
-  delete [] initial_location;
-  delete [] probs;
-
-  return sp_struct->get_indiv_at( (x+x_offset+grid_width)  % grid_width,
-                                  (y+y_offset+grid_height) % grid_height );
-}
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
diff --git a/src/libaevol/ae_spatial_structure.cpp b/src/libaevol/ae_spatial_structure.cpp
deleted file mode 100644
index c736f6d..0000000
--- a/src/libaevol/ae_spatial_structure.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_spatial_structure.h>
-#include <ae_population.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                         Class ae_spatial_structure                          #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_spatial_structure::ae_spatial_structure( void )
-{
-  _prng = NULL;
-
-  _grid_width = -1;
-  _grid_height = -1;
-
-  _pop_grid = NULL;
-
-  _migration_number = -1;
-  _secretion_diffusion_prop = -1;
-  _secretion_degradation_prop = -1;
-}
-
-ae_spatial_structure::ae_spatial_structure( gzFile backup_file )
-{
-  _prng = new ae_jumping_mt( backup_file );
-
-  gzread( backup_file, &_grid_width,  sizeof(_grid_width) );
-  gzread( backup_file, &_grid_height, sizeof(_grid_height) );
-
-  _pop_grid = new ae_grid_cell** [_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    _pop_grid[x] = new ae_grid_cell* [_grid_height];
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      _pop_grid[x][y] = new ae_grid_cell( backup_file );
-    }
-  }
-
-  gzread( backup_file, &_migration_number,           sizeof(_migration_number) );
-  gzread( backup_file, &_secretion_diffusion_prop,   sizeof(_secretion_diffusion_prop) );
-  gzread( backup_file, &_secretion_degradation_prop, sizeof(_secretion_degradation_prop) );
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_spatial_structure::~ae_spatial_structure( void )
-{
-  if ( _pop_grid != NULL )
-  {
-    for ( int16_t i = 0 ; i < _grid_width ; i++ )
-    {
-      for ( int16_t j = 0 ; j < _grid_height ; j++ )
-      {
-        delete _pop_grid[i][j];
-      }
-
-      delete [] _pop_grid[i];
-    }
-
-    delete [] _pop_grid;
-  }
-  delete _prng;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_spatial_structure::update_secretion_grid ( void )
-{
-  int16_t cur_x, cur_y;
-
-  double ** new_secretion = new double*[_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    new_secretion[x] = new double[_grid_height];
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      new_secretion[x][y] = _pop_grid[x][y]->get_compound_amount();
-    }
-  }
-
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      // look at the entire neighborhood
-      for ( int8_t i = -1 ; i < 2 ; i++ )
-      {
-        for ( int8_t j = -1 ; j < 2 ; j ++ )
-        {
-          cur_x = (x + i + _grid_width)  % _grid_width;
-          cur_y = (y + j + _grid_height) % _grid_height;
-
-          // add the diffusion from the neighboring cells
-          new_secretion[x][y] += _pop_grid[cur_x][cur_y]->get_compound_amount() * _secretion_diffusion_prop;
-        }
-      }
-    }
-  }
-
-  // substract what has diffused from each cell, and calculate the compound degradation
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      _pop_grid[x][y]->set_compound_amount( new_secretion[x][y] - 9 * _pop_grid[x][y]->get_compound_amount()
-                                                                    * _secretion_diffusion_prop );
-      _pop_grid[x][y]->set_compound_amount(   _pop_grid[x][y]->get_compound_amount()
-                                            * (1 - _secretion_degradation_prop) );
-    }
-  }
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    delete [] new_secretion[x];
-  }
-  delete [] new_secretion;
-}
-
-void ae_spatial_structure::do_random_migrations ( void )
-{
-  ae_individual * tmp_swap;
-
-  int16_t old_x; int16_t old_y; int16_t new_x; int16_t new_y;
-  for ( int16_t i = 0 ; i < _migration_number ; i++ )
-  {
-    old_x = (int16_t) (_prng->random() * _grid_width);
-    old_y = (int16_t) (_prng->random() * _grid_height);
-    new_x = (int16_t) (_prng->random() * _grid_width);
-    new_y = (int16_t) (_prng->random() * _grid_height);
-
-
-    // swap the individuals in these grid cells...
-    tmp_swap = _pop_grid[old_x][old_y]->get_individual();
-    _pop_grid[old_x][old_y]->set_individual( _pop_grid[new_x][new_y]->get_individual() );
-    _pop_grid[new_x][new_y]->set_individual( tmp_swap );
-  }
-}
-
-void ae_spatial_structure::save( gzFile backup_file ) const
-{
-  if ( _prng == NULL )
-  {
-    printf( "%s:%d: error: PRNG not initialized.\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-  if ( _pop_grid == NULL )
-  {
-    printf( "%s:%d: error: grid not initialized.\n", __FILE__, __LINE__ );
-    exit( EXIT_FAILURE );
-  }
-
-  _prng->save( backup_file );
-
-  gzwrite( backup_file, &_grid_width,   sizeof(_grid_width) );
-  gzwrite( backup_file, &_grid_height,  sizeof(_grid_height) );
-
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      _pop_grid[x][y]->save( backup_file );
-    }
-  }
-
-  gzwrite( backup_file, &_migration_number,           sizeof(_migration_number) );
-  gzwrite( backup_file, &_secretion_diffusion_prop,   sizeof(_secretion_diffusion_prop) );
-  gzwrite( backup_file, &_secretion_degradation_prop, sizeof(_secretion_degradation_prop) );
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-// =================================================================
-//                          Non inline accessors
-// =================================================================
diff --git a/src/libaevol/ae_spatial_structure.h b/src/libaevol/ae_spatial_structure.h
deleted file mode 100644
index 92823ef..0000000
--- a/src/libaevol/ae_spatial_structure.h
+++ /dev/null
@@ -1,301 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-#ifndef __AE_SPATIAL_STRUCTURE_H__
-#define __AE_SPATIAL_STRUCTURE_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_grid_cell.h>
-
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-class ae_spatial_structure : public ae_object
-{
-  public :
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_spatial_structure( void );
-    ae_spatial_structure( gzFile backup_file );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_spatial_structure( void );
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-    inline ae_jumping_mt *  get_prng( void ) const;
-    inline int16_t          get_grid_width( void ) const;
-    inline int16_t          get_grid_height( void ) const;
-    inline int32_t          get_migration_number( void ) const;
-    inline ae_grid_cell***  get_pop_grid( void ) const;
-    inline ae_grid_cell*    get_grid_cell( int16_t x, int16_t y ) const;
-    inline ae_individual*   get_indiv_at( int16_t x, int16_t y ) const;
-  
-    inline double** get_secretion_present_grid( void ) const;
-    inline double** get_secreted_amount_grid( void ) const;
-    inline double** get_metabolic_fitness_grid( void ) const;
-    inline double** get_total_fitness_grid( void ) const;
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-    inline void set_grid_size( int16_t grid_x, int16_t grid_y );
-    inline void set_migration_number( int32_t migration_number );
-    inline void set_prng( ae_jumping_mt* prng );
-    inline void set_secretion_degradation_prop( double degradation_prop );
-    inline void set_secretion_diffusion_prop( double diffusion_prop );
-
-    // =================================================================
-    //                              Operators
-    // =================================================================
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void update_secretion_grid( void ); 
-    void do_random_migrations ( void );
-    void save( gzFile backup_file ) const;
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    /*ae_spatial_structure( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_spatial_structure( const ae_spatial_structure &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_jumping_mt* _prng;
-    
-    int16_t _grid_width; 
-    int16_t _grid_height;
-    
-    ae_grid_cell*** _pop_grid;
-    
-    int32_t _migration_number;
-    double  _secretion_diffusion_prop;
-    double  _secretion_degradation_prop;
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-inline ae_jumping_mt * ae_spatial_structure::get_prng( void ) const
-{
-  return _prng;
-}
-
-inline int16_t ae_spatial_structure::get_grid_width( void ) const
-{
-  return _grid_width;
-}
-
-inline int16_t ae_spatial_structure::get_grid_height( void ) const
-{
-  return _grid_height;
-}
-
-inline int32_t ae_spatial_structure::get_migration_number( void ) const
-{
-  return _migration_number;
-}
-
-inline ae_grid_cell*** ae_spatial_structure::get_pop_grid( void ) const
-{
-  return _pop_grid;
-}
-
-inline ae_grid_cell* ae_spatial_structure::get_grid_cell( int16_t x, int16_t y ) const
-{
-  return _pop_grid[x][y];
-}
-
-inline ae_individual* ae_spatial_structure::get_indiv_at( int16_t x, int16_t y ) const
-{
-  return _pop_grid[x][y]->get_individual();
-}
-
-inline double** ae_spatial_structure::get_secretion_present_grid( void ) const
-{
-  double** ret = new double*[_grid_width];
-  
-  for ( int16_t x = 0; x < _grid_width ; x++ )
-  {
-    ret[x] = new double[_grid_height];
-    for ( int16_t y = 0; y < _grid_height ; y++ )
-    { 
-      ret[x][y] = _pop_grid[x][y]->get_compound_amount(); 
-    }
-  }
-  
-  return ret;
-}
-
-inline double** ae_spatial_structure::get_secreted_amount_grid( void ) const
-{
-  double** ret = new double*[_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    ret[x] = new double[_grid_height];
-    for ( int16_t y = 0; y < _grid_height ; y++ )
-    {
-      ret[x][y] = _pop_grid[x][y]->get_secreted_amount();
-    }
-  }
-  
-  return ret;
-}
-
-inline double** ae_spatial_structure::get_metabolic_fitness_grid( void ) const
-{
-  double** ret = new double*[_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    ret[x] = new double[_grid_height];
-    for ( int16_t y = 0; y < _grid_height ; y++ )
-    {
-      ret[x][y] = _pop_grid[x][y]->get_metabolic_fitness();
-    }
-  }
-  
-  return ret;
-}
-
-inline double** ae_spatial_structure::get_total_fitness_grid( void ) const
-{
-  double** ret = new double*[_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    ret[x] = new double[_grid_height];
-    for ( int16_t y = 0; y < _grid_height ; y++ )
-    {
-      ret[x][y] = _pop_grid[x][y]->get_total_fitness();
-    }
-  }
-  
-  return ret;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-inline void ae_spatial_structure::set_prng( ae_jumping_mt* prng )
-{
-  if (_prng != NULL) delete _prng;
-  _prng = prng;
-}
-
-inline void ae_spatial_structure::set_grid_size( int16_t grid_width, int16_t grid_height )
-{
-  _grid_width   = grid_width;
-  _grid_height  = grid_height;
-  
-  _pop_grid = new ae_grid_cell** [_grid_width];
-  for ( int16_t x = 0 ; x < _grid_width ; x++ )
-  {
-    _pop_grid[x] = new ae_grid_cell* [_grid_height];
-    for ( int16_t y = 0 ; y < _grid_height ; y++ )
-    {
-      _pop_grid[x][y] = new ae_grid_cell( x, y, NULL );
-    }
-  }
-}
-
-inline void ae_spatial_structure::set_migration_number( int32_t migration_number )
-{
-  _migration_number = migration_number;
-}
-
-inline void ae_spatial_structure::set_secretion_degradation_prop( double degradation_prop )
-{
-  _secretion_degradation_prop=degradation_prop;
-}
-inline void ae_spatial_structure::set_secretion_diffusion_prop( double diffusion_prop )
-{
-  _secretion_diffusion_prop=diffusion_prop;
-}
-
-
-// =====================================================================
-//                          Operators' definitions
-// =====================================================================
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-
-#endif // __AE_SPATIAL_STRUCTURE_H__
diff --git a/src/libaevol/ae_stat_record.cpp b/src/libaevol/ae_stat_record.cpp
deleted file mode 100644
index 98a4996..0000000
--- a/src/libaevol/ae_stat_record.cpp
+++ /dev/null
@@ -1,1052 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_stat_record.h>
-
-#include <ae_list.h>
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                             Class ae_stat_record                            #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_stat_record::ae_stat_record( ae_exp_manager* exp_m )
-{
-  _exp_m = exp_m;
-  initialize_data();
-}
-
-ae_stat_record::ae_stat_record( const ae_stat_record &model )
-{
-  _exp_m = model._exp_m;
-  
-  _num_gener = model._num_gener;
-  _pop_size  = model._pop_size;
-  
-  _metabolic_error         = model._metabolic_error;
-  _metabolic_fitness       = model._metabolic_fitness;
-  _parent_metabolic_error  = model._parent_metabolic_error;
-  
-  _secretion_error         = model._secretion_error;
-  _secretion_fitness       = model._secretion_fitness;
-  _parent_secretion_error  = model._parent_secretion_error;
-  
-  _compound_amount   = model._compound_amount;
-  
-  _fitness = model._fitness;
-  
-  _amount_of_dna                = model._amount_of_dna;
-  _nb_coding_rnas               = model._nb_coding_rnas;
-  _nb_non_coding_rnas           = model._nb_non_coding_rnas;
-  _av_size_coding_rnas          = model._av_size_coding_rnas;
-  _av_size_non_coding_rnas      = model._av_size_non_coding_rnas;
-  _nb_functional_genes          = model._nb_functional_genes;
-  _nb_non_functional_genes      = model._nb_non_functional_genes;
-  _av_size_functional_gene      = model._av_size_functional_gene;
-  _av_size_non_functional_gene  = model._av_size_non_functional_gene;
-
-  _nb_mut    = model._nb_mut;
-  _nb_rear   = model._nb_rear;
-  _nb_switch = model._nb_switch;
-  _nb_indels = model._nb_indels;
-  _nb_dupl   = model._nb_dupl;
-  _nb_del    = model._nb_del;
-  _nb_trans  = model._nb_trans;
-  _nb_inv    = model._nb_inv;
-  
-  _dupl_rate        = model._dupl_rate;
-  _del_rate         = model._del_rate;
-  _trans_rate       = model._trans_rate;
-  _inv_rate         = model._inv_rate;
-  _mean_align_score = model._mean_align_score;
-  
-  _nb_bases_in_0_CDS                = model._nb_bases_in_0_CDS;
-  _nb_bases_in_0_functional_CDS     = model._nb_bases_in_0_functional_CDS;
-  _nb_bases_in_0_non_functional_CDS = model._nb_bases_in_0_non_functional_CDS;
-  _nb_bases_in_0_RNA                = model._nb_bases_in_0_RNA;
-  _nb_bases_in_0_coding_RNA         = model._nb_bases_in_0_coding_RNA;
-  _nb_bases_in_0_non_coding_RNA     = model._nb_bases_in_0_non_coding_RNA;
-      
-  _nb_bases_non_essential                     = model._nb_bases_non_essential;
-  _nb_bases_non_essential_including_nf_genes  = model._nb_bases_non_essential_including_nf_genes;
-    
-  #ifdef __REGUL
-    _nb_influences                 = model._nb_influences;
-    _nb_enhancing_influences       = model._nb_enhancing_influences;
-    _nb_operating_influences       = model._nb_operating_influences;
-    _av_value_influences           = model._av_value_influences;
-    _av_value_enhancing_influences = model._av_value_enhancing_influences;
-    _av_value_operating_influences = model._av_value_operating_influences;
-  #endif
-}
-
-/* If used for post-treatments, num_gener is mandatory */
-ae_stat_record::ae_stat_record( ae_exp_manager* exp_m, ae_individual const * indiv, chrom_or_gen_unit chrom_or_gu, bool compute_non_coding, int32_t num_gener )
-{
-  _exp_m = exp_m;
-  initialize_data();
-  _record_type = INDIV;
-    
-  // ---------------
-  // Simulation data
-  // ---------------
-  _num_gener = ( num_gener == -1 ) ? _exp_m->get_num_gener() : num_gener;
-  _pop_size = 0; // The pop_size value is irrelevent when dealing with a single individual. It is present for column alignment.
-  
-  #ifdef __REGUL
-    // TODO
-  #endif  
-    
-  ae_list_node<ae_genetic_unit*>* gen_unit_node;
-  ae_genetic_unit*  gen_unit;
-  
-  
-  // TODO : These conditions are not well managed!!!
-  if ( indiv->get_genetic_unit_list()->get_nb_elts() == 1 ) // One single Genetic Unit
-  {
-    // -------------------------------------------------
-    // Compute statistical data for the given individual
-    // -------------------------------------------------
-    ae_replication_report* replic_report = indiv->get_replic_report(); // can be NULL under certain conditions
-    
-    gen_unit = indiv->get_genetic_unit_list()->get_first()->get_obj();
-    
-    // Metabolic error stats
-    _metabolic_error = (double) indiv->get_dist_to_target_by_feature( METABOLISM );
-    _metabolic_fitness = (double) indiv->get_fitness_by_feature( METABOLISM );
-    _parent_metabolic_error = ( replic_report != NULL ) ? replic_report->get_parent_metabolic_error() : 0.0;
-    
-    // Fitness
-    _fitness = indiv->get_fitness();
-  
-    // Secretion stats
-    if ( _exp_m->get_with_secretion() )
-    {
-       _secretion_error   = (double) indiv->get_dist_to_target_by_feature( SECRETION );
-       _secretion_fitness = (double) indiv->get_fitness_by_feature( SECRETION );
-       _compound_amount   = (double) indiv->get_grid_cell()->get_compound_amount();
-       _parent_secretion_error = 0.0;
-  
-      if ( replic_report != NULL )
-      {
-        _parent_secretion_error = replic_report->get_parent_secretion_error();
-      }
-    }
-    else
-    {
-      _secretion_error   = 0.0;
-      _secretion_fitness = 0.0;
-      _compound_amount   = 0.0;
-      _parent_secretion_error = 0.0;
-    }
-    
-
-    
-    // Genes and RNA stats
-    _amount_of_dna               = gen_unit->get_dna()->get_length();
-    _nb_coding_rnas              = gen_unit->get_nb_coding_RNAs();
-    _nb_non_coding_rnas          = gen_unit->get_nb_non_coding_RNAs();
-    _av_size_coding_rnas         = gen_unit->get_av_size_coding_RNAs();
-    _av_size_non_coding_rnas     = gen_unit->get_av_size_non_coding_RNAs();
-    _nb_functional_genes         = gen_unit->get_nb_functional_genes();
-    _nb_non_functional_genes     = gen_unit->get_nb_non_functional_genes();
-    _av_size_functional_gene     = gen_unit->get_av_size_functional_genes();
-    _av_size_non_functional_gene = gen_unit->get_av_size_non_functional_genes();
-
-
-    // Non coding stats
-    if ( compute_non_coding )
-    {
-      _nb_bases_in_0_CDS                = gen_unit->get_nb_bases_in_0_CDS();
-      _nb_bases_in_0_functional_CDS     = gen_unit->get_nb_bases_in_0_functional_CDS();
-      _nb_bases_in_0_non_functional_CDS = gen_unit->get_nb_bases_in_0_non_functional_CDS();
-      _nb_bases_in_0_RNA                = gen_unit->get_nb_bases_in_0_RNA();
-      _nb_bases_in_0_coding_RNA         = gen_unit->get_nb_bases_in_0_coding_RNA();
-      _nb_bases_in_0_non_coding_RNA     = gen_unit->get_nb_bases_in_0_non_coding_RNA();
-      
-      _nb_bases_non_essential                     = gen_unit->get_nb_bases_non_essential();
-      _nb_bases_non_essential_including_nf_genes  = gen_unit->get_nb_bases_non_essential_including_nf_genes();
-    }
-    
-    // Mutation stats
-    if ( replic_report != NULL )
-    {
-      _nb_mut    = gen_unit->get_dna()->get_replic_report()->get_nb_small_mutations();
-      _nb_rear   = gen_unit->get_dna()->get_replic_report()->get_nb_rearrangements();
-      _nb_switch = gen_unit->get_dna()->get_replic_report()->get_nb_switch();
-      _nb_indels = gen_unit->get_dna()->get_replic_report()->get_nb_indels();
-      _nb_dupl   = gen_unit->get_dna()->get_replic_report()->get_nb_duplications();
-      _nb_del    = gen_unit->get_dna()->get_replic_report()->get_nb_deletions();
-      _nb_trans  = gen_unit->get_dna()->get_replic_report()->get_nb_translocations();
-      _nb_inv    = gen_unit->get_dna()->get_replic_report()->get_nb_inversions();
-      
-      // Rearrangement rate stats
-      int32_t parent_genome_size = replic_report->get_parent_genome_size();
-      _dupl_rate  = _nb_dupl  / parent_genome_size;
-      _del_rate   = _nb_del   / parent_genome_size;
-      _trans_rate = _nb_trans / parent_genome_size;
-      _inv_rate   = _nb_inv   / parent_genome_size;
-      
-      //~ // <DEBUG>
-      //~ if ( _nb_dupl + _nb_del + _nb_trans + _nb_inv != 0 )
-      //~ {
-        //~ printf( "_nb_dupl : %"PRId32"\n_nb_del : %"PRId32"\n_nb_trans : %"PRId32"\n_nb_inv : %"PRId32"\n",
-                //~ (int32_t) _nb_dupl, (int32_t) _nb_del, (int32_t) _nb_trans, (int32_t) _nb_inv );
-        //~ printf( "parent genome size : %"PRId32"\n", parent_genome_size );
-        //~ printf( "_dupl_rate : %f\n_del_rate : %f\n_trans_rate : %f\n_inv_rate : %f\n",
-                //~ _dupl_rate, _del_rate, _trans_rate, _inv_rate );
-        //~ getchar();
-      //~ }
-      //~ // </DEBUG>
-      
-      _mean_align_score = replic_report->get_mean_align_score();
-    }
-  }
-  else if ( chrom_or_gu == ALL_GU )
-  {
-    // -------------------------------------------------
-    // Compute statistical data for the given individual
-    // -------------------------------------------------
-    ae_replication_report* replic_report = indiv->get_replic_report(); // can be NULL under certain conditions
-    
-    // Metabolic error stats
-    _metabolic_error = (double) indiv->get_dist_to_target_by_feature( METABOLISM );
-    _metabolic_fitness = (double) indiv->get_fitness_by_feature( METABOLISM );
-    _parent_metabolic_error = ( replic_report != NULL ) ? replic_report->get_parent_metabolic_error() : 0.0;
-    
-    // Fitness
-    _fitness = indiv->get_fitness();
-  
-    // Secretion stats
-    if ( _exp_m->get_with_secretion() )
-    {
-       _secretion_error = (double) indiv->get_dist_to_target_by_feature( SECRETION );
-       _secretion_fitness = (double) indiv->get_fitness_by_feature(SECRETION);
-       _compound_amount   = (double) indiv->get_grid_cell()->get_compound_amount();
-       _parent_secretion_error = 0.0;
-  
-      if ( replic_report != NULL )
-      {
-        _parent_secretion_error = replic_report->get_parent_secretion_error();
-      }
-    }
-    else
-    {
-      _secretion_error   = 0.0;
-      _secretion_fitness = 0.0;
-      _compound_amount   = 0.0;
-      _parent_secretion_error = 0.0;
-    }
-
-    
-    
-    gen_unit_node = indiv->get_genetic_unit_list()->get_first();
-    while ( gen_unit_node != NULL )
-    {
-      gen_unit = gen_unit_node->get_obj();
-
-      // Genes and RNA stats
-      _amount_of_dna               += gen_unit->get_dna()->get_length();
-      _nb_coding_rnas              += gen_unit->get_nb_coding_RNAs();
-      _nb_non_coding_rnas          += gen_unit->get_nb_non_coding_RNAs();
-      _av_size_coding_rnas         += gen_unit->get_av_size_coding_RNAs();
-      _av_size_non_coding_rnas     += gen_unit->get_av_size_non_coding_RNAs();
-      _nb_functional_genes         += gen_unit->get_nb_functional_genes();
-      _nb_non_functional_genes     += gen_unit->get_nb_non_functional_genes();
-      _av_size_functional_gene     += gen_unit->get_av_size_functional_genes();
-      _av_size_non_functional_gene += gen_unit->get_av_size_non_functional_genes();
-
-      // Non coding stats
-      if ( compute_non_coding )
-      {
-        _nb_bases_in_0_CDS                += gen_unit->get_nb_bases_in_0_CDS();
-        _nb_bases_in_0_functional_CDS     += gen_unit->get_nb_bases_in_0_functional_CDS();
-        _nb_bases_in_0_non_functional_CDS += gen_unit->get_nb_bases_in_0_non_functional_CDS();
-        _nb_bases_in_0_RNA                += gen_unit->get_nb_bases_in_0_RNA();
-        _nb_bases_in_0_coding_RNA         += gen_unit->get_nb_bases_in_0_coding_RNA();
-        _nb_bases_in_0_non_coding_RNA     += gen_unit->get_nb_bases_in_0_non_coding_RNA();
-        
-        _nb_bases_non_essential                     += gen_unit->get_nb_bases_non_essential();
-        _nb_bases_non_essential_including_nf_genes  += gen_unit->get_nb_bases_non_essential_including_nf_genes();
-      }
-      
-      // Mutation stats
-      if ( replic_report != NULL )
-      {
-        _nb_mut    += gen_unit->get_dna()->get_replic_report()->get_nb_small_mutations();
-        _nb_rear   += gen_unit->get_dna()->get_replic_report()->get_nb_rearrangements();
-        _nb_switch += gen_unit->get_dna()->get_replic_report()->get_nb_switch();
-        _nb_indels += gen_unit->get_dna()->get_replic_report()->get_nb_indels();
-        _nb_dupl   += gen_unit->get_dna()->get_replic_report()->get_nb_duplications();
-        _nb_del    += gen_unit->get_dna()->get_replic_report()->get_nb_deletions();
-        _nb_trans  += gen_unit->get_dna()->get_replic_report()->get_nb_translocations();
-        _nb_inv    += gen_unit->get_dna()->get_replic_report()->get_nb_inversions();
-      }
-
-     gen_unit_node = gen_unit_node->get_next();
-    }
-    
-    // Rearrangement rate stats
-    if ( replic_report != NULL )
-    {
-      int32_t parent_genome_size = replic_report->get_parent_genome_size();
-      _dupl_rate  = _nb_dupl  / parent_genome_size;
-      _del_rate   = _nb_del   / parent_genome_size;
-      _trans_rate = _nb_trans / parent_genome_size;
-      _inv_rate   = _nb_inv   / parent_genome_size;
-      _mean_align_score = replic_report->get_mean_align_score();
-    }
-  }
-  else // => We have a multi-GU individual and we want only the main chromosome or only the plasmids
-  // WARNING (TODO) As it is coded, this will work only if there is ONE SINGLE PLASMID!
-  {
-    if ( chrom_or_gu == PLASMIDS )
-    {
-      gen_unit_node = indiv->get_genetic_unit_list()->get_first()->get_next();
-    }
-    if ( chrom_or_gu == CHROM ) 
-    {
-      gen_unit_node = indiv->get_genetic_unit_list()->get_first();
-    }
-
-    gen_unit = gen_unit_node->get_obj();
-    
-    // -------------------------------------------------
-    // Compute statistical data for the given individual
-    // -------------------------------------------------
-    ae_replication_report* replic_report = indiv->get_replic_report(); // can be NULL under certain conditions
-    
-    // Metabolic error stats
-    _metabolic_error = (double) gen_unit->get_dist_to_target_by_feature( METABOLISM );
-    _metabolic_fitness = (double) gen_unit->get_fitness_by_feature( METABOLISM );
-    _parent_metabolic_error = ( replic_report != NULL ) ? replic_report->get_parent_metabolic_error() : 0.0;
-    
-    // Fitness
-    _fitness = indiv->get_fitness();
-  
-    // Secretion stats
-    if ( _exp_m->get_with_secretion() )
-    {
-       _secretion_error = (double) gen_unit->get_dist_to_target_by_feature( SECRETION );
-       _secretion_fitness = (double) gen_unit->get_fitness_by_feature( SECRETION );
-       _compound_amount   = (double) indiv->get_grid_cell()->get_compound_amount();
-       _parent_secretion_error = 0.0;
-  
-      if ( replic_report != NULL )
-      {
-        _parent_secretion_error = replic_report->get_parent_secretion_error();
-      }
-    }
-    else
-    {
-      _secretion_error   = 0.0;
-      _secretion_fitness = 0.0;
-      _compound_amount   = 0.0;
-      _parent_secretion_error = 0.0;
-    }
-    
-      // Genes and RNA stats
-    _amount_of_dna               = gen_unit->get_dna()->get_length();
-    _nb_coding_rnas              = gen_unit->get_nb_coding_RNAs();
-    _nb_non_coding_rnas          = gen_unit->get_nb_non_coding_RNAs();
-    _av_size_coding_rnas         = gen_unit->get_av_size_coding_RNAs();
-    _av_size_non_coding_rnas     = gen_unit->get_av_size_non_coding_RNAs();
-    _nb_functional_genes         = gen_unit->get_nb_functional_genes();
-    _nb_non_functional_genes     = gen_unit->get_nb_non_functional_genes();
-    _av_size_functional_gene     = gen_unit->get_av_size_functional_genes();
-    _av_size_non_functional_gene = gen_unit->get_av_size_non_functional_genes();
-    
-      // Non coding stats
-    if ( compute_non_coding )
-    {
-      _nb_bases_in_0_CDS                  = gen_unit->get_nb_bases_in_0_CDS();
-      _nb_bases_in_0_functional_CDS       = gen_unit->get_nb_bases_in_0_functional_CDS();
-      _nb_bases_in_0_non_functional_CDS   = gen_unit->get_nb_bases_in_0_non_functional_CDS();
-      _nb_bases_in_0_RNA                  = gen_unit->get_nb_bases_in_0_RNA();
-      _nb_bases_in_0_coding_RNA           = gen_unit->get_nb_bases_in_0_coding_RNA();
-      _nb_bases_in_0_non_coding_RNA       = gen_unit->get_nb_bases_in_0_non_coding_RNA();
-      
-      _nb_bases_non_essential                     = gen_unit->get_nb_bases_non_essential();
-      _nb_bases_non_essential_including_nf_genes  = gen_unit->get_nb_bases_non_essential_including_nf_genes();
-    }
-    
-    // Mutation stats
-    if ( gen_unit->get_dna()->get_replic_report() != NULL )
-    {
-      _nb_mut    = gen_unit->get_dna()->get_replic_report()->get_nb_small_mutations();
-      _nb_rear   = gen_unit->get_dna()->get_replic_report()->get_nb_rearrangements();
-      _nb_switch = gen_unit->get_dna()->get_replic_report()->get_nb_switch();
-      _nb_indels = gen_unit->get_dna()->get_replic_report()->get_nb_indels();
-      _nb_dupl   = gen_unit->get_dna()->get_replic_report()->get_nb_duplications();
-      _nb_del    = gen_unit->get_dna()->get_replic_report()->get_nb_deletions();
-      _nb_trans  = gen_unit->get_dna()->get_replic_report()->get_nb_translocations();
-      _nb_inv    = gen_unit->get_dna()->get_replic_report()->get_nb_inversions();
-    }
-    
-    // Rearrangement rate stats
-    if ( replic_report != NULL )
-    {
-      int32_t parent_genome_size = replic_report->get_parent_genome_size();
-      _dupl_rate  = _nb_dupl  / parent_genome_size;
-      _del_rate   = _nb_del   / parent_genome_size;
-      _trans_rate = _nb_trans / parent_genome_size;
-      _inv_rate   = _nb_inv   / parent_genome_size;
-      _mean_align_score = replic_report->get_mean_align_score();
-    }
-  }
-
-}
-
-// Calculate average statistics for all the recorded values 
-ae_stat_record::ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, chrom_or_gen_unit chrom_or_gu )
-{
-  _exp_m = exp_m;
-  initialize_data();
-  
-  _record_type = POP;
-  
-  // ---------------
-  // Simulation data
-  // ---------------
-  _num_gener = (double) _exp_m->get_num_gener();
-  _pop_size  = (double) pop->get_nb_indivs();
-
-  // ------------------------------------------------------------------
-  // Compute statistical data for the each individual in the population
-  // ------------------------------------------------------------------
-  ae_list_node<ae_individual*>* indiv_node  = pop->get_indivs()->get_first();
-  ae_individual*  indiv       = NULL;
-  
-  int32_t index;
-
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-    index = indiv->get_id();
-    ae_stat_record* indiv_stat_record = new ae_stat_record( _exp_m, indiv, chrom_or_gu, false );
-    this->add( indiv_stat_record, index  );
-    delete indiv_stat_record;
-    
-    indiv_node = indiv_node->get_next();
-  }
-  
-  
-  // ------------------------------------------------------------------
-  // Divide every accumulator by the number of indivs in the population
-  // ------------------------------------------------------------------
-  this->divide( _pop_size );
-}
-
-// Calculate standard deviation for all the recorded values 
-ae_stat_record::ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, ae_stat_record const * means, chrom_or_gen_unit chrom_or_gu )
-{
-  _exp_m = exp_m;
-  initialize_data();
-  
-  _record_type = STDEVS;
-  
-  // ---------------
-  // Simulation data
-  // ---------------
-  _num_gener = (double) _exp_m->get_num_gener();
-  _pop_size  = (double) pop->get_nb_indivs();
-
-  // ------------------------------------------------------------------
-  // Compute statistical data for the each individual in the population
-  // ------------------------------------------------------------------
-  ae_list_node<ae_individual*>*   indiv_node  = pop->get_indivs()->get_first();
-  ae_individual*  indiv       = NULL;
-
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-    ae_stat_record* indiv_stat_record = new ae_stat_record( _exp_m, indiv, chrom_or_gu, false );
-    this->substract_power( means, indiv_stat_record, 2 );
-    delete indiv_stat_record;
-    
-    indiv_node = indiv_node->get_next();
-  }
-  
-  // ---------------------------------------------------------------------------------
-  // Divide every accumulator by the square root of number of indivs in the population
-  // ---------------------------------------------------------------------------------
-  this->divide( pow((_pop_size-1), 0.5) );
-}
-
- // Calculate skewness for all the recorded values 
-ae_stat_record::ae_stat_record( ae_exp_manager* exp_m, ae_population const * pop, ae_stat_record const * means, ae_stat_record const * stdevs, chrom_or_gen_unit chrom_or_gu )
-{
-  _exp_m = exp_m;
-  initialize_data();
-  
-  _record_type = SKEWNESS;
-  
-  // ---------------
-  // Simulation data
-  // ---------------
-  _num_gener = (double) _exp_m->get_num_gener();
-  _pop_size  = (double) pop->get_nb_indivs();
-
-  // ------------------------------------------------------------------
-  // Compute statistical data for the each individual in the population
-  // ------------------------------------------------------------------
-  ae_list_node<ae_individual*>* indiv_node  = pop->get_indivs()->get_first();
-  ae_individual*  indiv       = NULL;
-
-  while ( indiv_node != NULL )
-  {
-    indiv = indiv_node->get_obj();
-    ae_stat_record* indiv_stat_record = new ae_stat_record( _exp_m, indiv, chrom_or_gu, false );
-    this->substract_power( means, indiv_stat_record, 3 );    
-    delete indiv_stat_record;
-    indiv_node = indiv_node->get_next();
-  }
-
-  this->divide( - _pop_size );
-  
-  this->divide_record( stdevs, 3/2 );
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_stat_record::~ae_stat_record( void )
-{
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_stat_record::initialize_data( void )
-{
-  _num_gener = 0.0;
-  _pop_size  = 0.0;
-  
-  _metabolic_error         = 0.0;
-  _metabolic_fitness       = 0.0;
-  _parent_metabolic_error  = 0.0;
-
-  _secretion_error         = 0.0;
-  _parent_secretion_error  = 0.0;
-  
-  _secretion_fitness = 0.0;
-  _compound_amount   = 0.0;
-  
-  _fitness = 0.0;
-  
-  _amount_of_dna               = 0.0;
-  _nb_coding_rnas              = 0.0;
-  _nb_non_coding_rnas          = 0.0;
-  _av_size_coding_rnas         = 0.0;
-  _av_size_non_coding_rnas     = 0.0;
-  _nb_functional_genes         = 0.0;
-  _nb_non_functional_genes     = 0.0;
-  _av_size_functional_gene     = 0.0;
-  _av_size_non_functional_gene = 0.0;
-
-  _nb_mut    = 0.0;
-  _nb_rear   = 0.0;
-  _nb_switch = 0.0;
-  _nb_indels = 0.0;
-  _nb_dupl   = 0.0;
-  _nb_del    = 0.0;
-  _nb_trans  = 0.0;
-  _nb_inv    = 0.0;
-  
-  _dupl_rate  = 0.0;
-  _del_rate   = 0.0;
-  _trans_rate = 0.0;
-  _inv_rate   = 0.0;
-  _mean_align_score = 0.0;
-  
-  _nb_bases_in_0_CDS                = 0.0;
-  _nb_bases_in_0_functional_CDS     = 0.0;
-  _nb_bases_in_0_non_functional_CDS = 0.0;
-  _nb_bases_in_0_RNA                = 0.0;
-  _nb_bases_in_0_coding_RNA         = 0.0;
-  _nb_bases_in_0_non_coding_RNA     = 0.0;
-    
-  _nb_bases_non_essential                     = 0.0;
-  _nb_bases_non_essential_including_nf_genes  = 0.0;
-    
-  #ifdef __REGUL
-    _nb_influences                 = 0.0;
-    _nb_enhancing_influences       = 0.0;
-    _nb_operating_influences       = 0.0;
-    _av_value_influences           = 0.0;
-    _av_value_enhancing_influences = 0.0;
-    _av_value_operating_influences = 0.0;
-  #endif
-}
-
-void ae_stat_record::write_to_file( FILE* stat_file, stats_type stat_type_to_print) const
-{
-  if ( _record_type == INDIV )
-  {
-    if ( stat_type_to_print == FITNESS_STATS )
-    {
-      fprintf( stat_file, "%"PRId32" %"PRId32" %e %"PRId32" %e %e %e %e %e %e %e",
-              (int32_t) _num_gener,
-              (int32_t) _pop_size,
-              _fitness,              
-              (int32_t) _amount_of_dna,
-              _metabolic_error,
-              _parent_metabolic_error,
-              _metabolic_fitness,
-              _secretion_error,
-              _parent_secretion_error,
-              _secretion_fitness,
-              _compound_amount);
-
-      #ifdef __REGUL
-        fprintf(  stat_file, " %"PRId32" %"PRId32" %"PRId32" %f %f %f",
-              (int32_t) _nb_influences,
-              (int32_t) _nb_enhancing_influences,
-              (int32_t) _nb_operating_influences,
-              _av_value_influences,
-              _av_value_enhancing_influences,
-              _av_value_operating_influences );
-      #endif
-    }
-    if ( stat_type_to_print == MUTATION_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32"", 
-              (int32_t) _num_gener,
-              (int32_t) _nb_mut,
-              (int32_t) _nb_rear,
-              (int32_t) _nb_switch,
-              (int32_t) _nb_indels,
-              (int32_t) _nb_dupl,
-              (int32_t) _nb_del,
-              (int32_t) _nb_trans,
-              (int32_t) _nb_inv );
-
-    }
-    if ( stat_type_to_print == GENES_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %"PRId32" %"PRId32" %f %f %"PRId32" %"PRId32" %f %f ",
-              (int32_t) _num_gener,
-              (int32_t) _nb_coding_rnas,
-              (int32_t) _nb_non_coding_rnas,
-              _av_size_coding_rnas,
-              _av_size_non_coding_rnas,
-              (int32_t) _nb_functional_genes,
-              (int32_t) _nb_non_functional_genes,
-              _av_size_functional_gene,
-              _av_size_non_functional_gene );
-    }
-    if ( stat_type_to_print == BP_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32"",
-              (int32_t) _num_gener,
-              (int32_t) _nb_bases_in_0_CDS,
-              (int32_t) _nb_bases_in_0_functional_CDS,
-              (int32_t) _nb_bases_in_0_non_functional_CDS,
-              (int32_t) _nb_bases_in_0_RNA,
-              (int32_t) _nb_bases_in_0_coding_RNA,
-              (int32_t) _nb_bases_in_0_non_coding_RNA,
-              (int32_t) _nb_bases_non_essential,
-              (int32_t) _nb_bases_non_essential_including_nf_genes );
-    }
-    if ( stat_type_to_print == REAR_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %e %e %e %e %f",
-              (int32_t) _num_gener,
-              _dupl_rate,
-              _del_rate,
-              _trans_rate,
-              _inv_rate,
-              _mean_align_score );
-    }
-  }
-  else // if _record_type == POP
-  {
-   if ( stat_type_to_print == FITNESS_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %"PRId32" %e %f %e %e %e %e %e %e %e", 
-              (int32_t) _num_gener,
-              (int32_t) _pop_size,
-              _fitness,              
-              _amount_of_dna, 
-              _metabolic_error,
-              _parent_metabolic_error,
-              _metabolic_fitness,
-              _secretion_error,
-              _parent_secretion_error,
-              _secretion_fitness,
-              _compound_amount);
-
-      #ifdef __REGUL
-        fprintf(  stat_file, " %"PRId32" %"PRId32" %"PRId32" %f %f %f",
-              (int32_t) _nb_influences,
-              (int32_t) _nb_enhancing_influences,
-              (int32_t) _nb_operating_influences,
-              _av_value_influences,
-              _av_value_enhancing_influences,
-              _av_value_operating_influences );
-      #endif
-    }
-    if ( stat_type_to_print == MUTATION_STATS )
-    {        
-      fprintf(  stat_file, "%"PRId32" %f %f %f %f %f %f %f %f",
-              (int32_t) _num_gener,
-              _nb_mut,
-              _nb_rear,
-              _nb_switch,
-              _nb_indels,
-              _nb_dupl,
-              _nb_del,
-              _nb_trans,
-              _nb_inv );
-
-    }
-    if ( stat_type_to_print == GENES_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %f %f %f %f %f %f %f %f",
-              (int32_t) _num_gener,
-              _nb_coding_rnas,
-              _nb_non_coding_rnas,
-              _av_size_coding_rnas,
-              _av_size_non_coding_rnas,
-              _nb_functional_genes,
-              _nb_non_functional_genes,
-              _av_size_functional_gene,
-              _av_size_non_functional_gene );
-    }
-    if ( stat_type_to_print == BP_STATS )
-    {
-     // TO DO (if needed) : base-pair stats for all individuals, not just for the best one. 
-     //
-     // fprintf(  stat_file, "%"PRId32" %f %f %f %f %f %f %f %f",
-     //         (int32_t)_num_gener,
-     //         _nb_bases_in_0_CDS,
-     //         _nb_bases_in_0_functional_CDS,
-     //         _nb_bases_in_0_non_functional_CDS,
-     //         _nb_bases_in_0_RNA,
-     //         _nb_bases_in_0_coding_RNA,
-     //         _nb_bases_in_0_non_coding_RNA,
-     //         _nb_bases_non_essential,
-     //         _nb_bases_non_essential_including_nf_genes );
-    }
-    if ( stat_type_to_print == REAR_STATS )
-    {
-      fprintf(  stat_file, "%"PRId32" %e %e %e %e %f",
-              (int32_t) _num_gener,
-              _dupl_rate,
-              _del_rate,
-              _trans_rate,
-              _inv_rate,
-              _mean_align_score );
-    }
-  }
-  
-  fprintf( stat_file, "\n" );
-}
-
-void ae_stat_record::divide( double divisor )
-{
-  // NB : _num_gener and pop_size are global values and are not to be divided.
-  
-  _fitness                 /= divisor;
-  
-  _metabolic_error         /= divisor;
-  _parent_metabolic_error  /= divisor;
-  _metabolic_fitness       /= divisor;
-
-  _secretion_error         /= divisor;
-  _parent_secretion_error  /= divisor;
-  
-  _secretion_fitness       /= divisor;
-  _compound_amount         /= divisor;
-  
-  _amount_of_dna               /= divisor;
-  _nb_coding_rnas              /= divisor;
-  _nb_non_coding_rnas          /= divisor;
-  _av_size_coding_rnas         /= divisor;
-  _av_size_non_coding_rnas     /= divisor;
-  _nb_functional_genes          /= divisor;
-  _nb_non_functional_genes      /= divisor;
-  _av_size_functional_gene      /= divisor;
-  _av_size_non_functional_gene  /= divisor;
-
-  _nb_mut    /= divisor;
-  _nb_rear   /= divisor;
-  _nb_switch /= divisor;
-  _nb_indels /= divisor;
-  _nb_dupl   /= divisor;
-  _nb_del    /= divisor;
-  _nb_trans  /= divisor;
-  _nb_inv    /= divisor;
-  
-  //~ printf( "PREFINAL %f %f %f %f\n", _dupl_rate, _del_rate, _trans_rate, _inv_rate );
-  _dupl_rate  /= divisor;
-  _del_rate   /= divisor;
-  _trans_rate /= divisor;
-  _inv_rate   /= divisor;
-  //~ printf( "FINAL %f %f %f %f\n", _dupl_rate, _del_rate, _trans_rate, _inv_rate );
-  //~ getchar();
-  _mean_align_score /= divisor;
-  
-  _nb_bases_in_0_CDS                /= divisor;
-  _nb_bases_in_0_functional_CDS     /= divisor;
-  _nb_bases_in_0_non_functional_CDS /= divisor;
-  _nb_bases_in_0_RNA                /= divisor;
-  _nb_bases_in_0_coding_RNA         /= divisor;
-  _nb_bases_in_0_non_coding_RNA     /= divisor;
-    
-  _nb_bases_non_essential                     /= divisor;
-  _nb_bases_non_essential_including_nf_genes  /= divisor;
-    
-  #ifdef __REGUL
-    _nb_influences                 /= divisor;
-    _nb_enhancing_influences       /= divisor;
-    _nb_operating_influences       /= divisor;
-    _av_value_influences           /= divisor;
-    _av_value_enhancing_influences /= divisor;
-    _av_value_operating_influences /= divisor;
-  #endif
-}
-
-
-void ae_stat_record::divide_record( ae_stat_record const * to_divide, double power )
-{
-  // NB : _num_gener and pop_size are global values and are not to be divided.
-  
-  if (to_divide->_fitness != 0) { _fitness    /= pow(to_divide->_fitness, power); }
-  
-  if (to_divide->_metabolic_error != 0)        { _metabolic_error         /= pow(to_divide->_metabolic_error, power); }
-  if (to_divide->_parent_metabolic_error != 0) { _parent_metabolic_error  /= pow(to_divide->_parent_metabolic_error, power); }
-  if (to_divide->_metabolic_fitness != 0)        { _metabolic_fitness         /= pow(to_divide->_metabolic_fitness, power); }
-  
-  if (to_divide->_secretion_error != 0)        { _secretion_error         /= pow(to_divide->_secretion_error, power); }
-  if (to_divide->_parent_secretion_error != 0) { _parent_secretion_error  /= pow(to_divide->_parent_secretion_error, power); }
-  
-  if (to_divide->_secretion_fitness != 0)       { _secretion_fitness       /= pow(to_divide->_secretion_fitness, power); }
-  if (to_divide->_compound_amount != 0)        { _compound_amount         /= pow(to_divide->_compound_amount, power); }
-  
-  if (to_divide->_amount_of_dna != 0)               { _amount_of_dna               /= pow(to_divide->_amount_of_dna, power); }
-  if (to_divide->_nb_coding_rnas != 0)              { _nb_coding_rnas              /= pow(to_divide->_nb_coding_rnas, power); }
-  if (to_divide->_nb_non_coding_rnas != 0)          { _nb_non_coding_rnas          /= pow(to_divide->_nb_non_coding_rnas, power); }
-  if (to_divide->_av_size_coding_rnas != 0)         { _av_size_coding_rnas         /= pow(to_divide->_av_size_coding_rnas, power); }
-  if (to_divide->_av_size_non_coding_rnas != 0)     { _av_size_non_coding_rnas     /= pow(to_divide->_av_size_non_coding_rnas, power); }
-  if (to_divide->_nb_functional_genes != 0)         { _nb_functional_genes         /= pow(to_divide->_nb_functional_genes, power); }
-  if (to_divide->_nb_non_functional_genes != 0)     { _nb_non_functional_genes     /= pow(to_divide->_nb_non_functional_genes, power); }
-  if (to_divide->_av_size_functional_gene != 0)     { _av_size_functional_gene     /= pow(to_divide->_av_size_functional_gene, power); }
-  if (to_divide->_av_size_non_functional_gene != 0) { _av_size_non_functional_gene /= pow(to_divide->_av_size_non_functional_gene, power); }
-
-  if (to_divide->_nb_mut != 0)     { _nb_mut    /= pow(to_divide->_nb_mut, power); }
-  if (to_divide->_nb_rear != 0)    { _nb_rear   /= pow(to_divide->_nb_rear, power); }
-  if (to_divide->_nb_switch != 0)  { _nb_switch /= pow(to_divide->_nb_switch, power); }
-  if (to_divide->_nb_indels != 0)  { _nb_indels /= pow(to_divide->_nb_indels, power); }
-  if (to_divide->_nb_dupl != 0)    { _nb_dupl   /= pow(to_divide->_nb_dupl, power); }
-  if (to_divide->_nb_del != 0)     { _nb_del    /= pow(to_divide->_nb_del, power); }
-  if (to_divide->_nb_trans != 0)   { _nb_trans  /= pow(to_divide->_nb_trans, power); }
-  if (to_divide->_nb_inv != 0)     { _nb_inv    /= pow(to_divide->_nb_inv, power); }
-  
-  if (to_divide->_dupl_rate != 0)        { _dupl_rate  /= pow(to_divide->_dupl_rate, power); }
-  if (to_divide->_del_rate != 0)         { _del_rate   /= pow(to_divide->_del_rate, power); }
-  if (to_divide->_trans_rate != 0)       { _trans_rate /= pow(to_divide->_trans_rate, power); }
-  if (to_divide->_inv_rate != 0)         { _inv_rate   /= pow(to_divide->_inv_rate, power); }
-  if (to_divide->_mean_align_score != 0) { _mean_align_score /= pow(to_divide->_mean_align_score, power); }
-  
-  if (to_divide->_nb_bases_in_0_CDS != 0)                { _nb_bases_in_0_CDS                /= pow(to_divide->_nb_bases_in_0_CDS, power); }
-  if (to_divide->_nb_bases_in_0_functional_CDS != 0)     { _nb_bases_in_0_functional_CDS     /= pow(to_divide->_nb_bases_in_0_functional_CDS, power); }
-  if (to_divide->_nb_bases_in_0_non_functional_CDS != 0) { _nb_bases_in_0_non_functional_CDS /= pow(to_divide->_nb_bases_in_0_non_functional_CDS, power); }
-  if (to_divide->_nb_bases_in_0_RNA != 0)                { _nb_bases_in_0_RNA                /= pow(to_divide->_nb_bases_in_0_RNA, power); }
-  if (to_divide->_nb_bases_in_0_coding_RNA != 0)         { _nb_bases_in_0_coding_RNA         /= pow(to_divide->_nb_bases_in_0_coding_RNA, power); }
-  if (to_divide->_nb_bases_in_0_non_coding_RNA != 0)     { _nb_bases_in_0_non_coding_RNA     /= pow(to_divide->_nb_bases_in_0_non_coding_RNA, power); }
-    
-  if (to_divide->_nb_bases_non_essential != 0)                    { _nb_bases_non_essential                     /= pow(to_divide->_nb_bases_non_essential, power); }
-  if (to_divide->_nb_bases_non_essential_including_nf_genes != 0) { _nb_bases_non_essential_including_nf_genes  /= pow(to_divide->_nb_bases_non_essential_including_nf_genes, power); }
-    
-  #ifdef __REGUL
-    if (to_divide->_nb_influences != 0)                 { _nb_influences                 /= pow(to_divide->_nb_influences, power); }
-    if (to_divide->_nb_enhancing_influences != 0)       { _nb_enhancing_influences       /= pow(to_divide->_nb_enhancing_influences, power); }
-    if (to_divide->_nb_operating_influences != 0)       { _nb_operating_influences       /= pow(to_divide->_nb_operating_influences, power); }
-    if (to_divide->_av_value_influences != 0)           { _av_value_influences           /= pow(to_divide->_av_value_influences, power); }
-    if (to_divide->_av_value_enhancing_influences != 0) { _av_value_enhancing_influences /= pow(to_divide->_av_value_enhancing_influences, power); }
-    if (to_divide->_av_value_operating_influences != 0) { _av_value_operating_influences /= pow(to_divide->_av_value_operating_influences, power); }
-  #endif
-}
-
-void ae_stat_record::add( ae_stat_record* to_add, int32_t index )
-{
-  // NB : _num_gener and pop_size are global values and are not to be summed.
-  
-  _fitness                 += to_add->_fitness;
-  
-  _metabolic_error         += to_add->_metabolic_error;
-  _parent_metabolic_error  += to_add->_parent_metabolic_error;
-  _metabolic_fitness       += to_add->_metabolic_fitness;
-
-  _secretion_error         += to_add->_secretion_error;
-  _parent_secretion_error  += to_add->_parent_secretion_error;
-  
-  _secretion_fitness       += to_add->_secretion_fitness;
-  _compound_amount         += to_add->_compound_amount;
-  
-  _amount_of_dna               += to_add->_amount_of_dna;
-  _nb_coding_rnas              += to_add->_nb_coding_rnas;
-  _nb_non_coding_rnas          += to_add->_nb_non_coding_rnas;
-  _av_size_coding_rnas         += to_add->_av_size_coding_rnas;
-  _av_size_non_coding_rnas     += to_add->_av_size_non_coding_rnas;
-  _nb_functional_genes         += to_add->_nb_functional_genes;
-  _nb_non_functional_genes     += to_add->_nb_non_functional_genes;
-  _av_size_functional_gene     += to_add->_av_size_functional_gene;
-  _av_size_non_functional_gene += to_add->_av_size_non_functional_gene;
-
-  _nb_mut    += to_add->_nb_mut;
-  _nb_rear   += to_add->_nb_rear;
-  _nb_switch += to_add->_nb_switch;
-  _nb_indels += to_add->_nb_indels;
-  _nb_dupl   += to_add->_nb_dupl;
-  _nb_del    += to_add->_nb_del;
-  _nb_trans  += to_add->_nb_trans;
-  _nb_inv    += to_add->_nb_inv;
-    
-  _dupl_rate  += to_add->_dupl_rate;
-  _del_rate   += to_add->_del_rate;
-  _trans_rate += to_add->_trans_rate;
-  _inv_rate   += to_add->_inv_rate;
-  //~ printf( "%f %f %f %f\n", to_add->_dupl_rate, to_add->_del_rate, to_add->_trans_rate, to_add->_inv_rate );
-  _mean_align_score += to_add->_mean_align_score;
-  
-  _nb_bases_in_0_CDS                += to_add->_nb_bases_in_0_CDS;
-  _nb_bases_in_0_functional_CDS     += to_add->_nb_bases_in_0_functional_CDS;
-  _nb_bases_in_0_non_functional_CDS += to_add->_nb_bases_in_0_non_functional_CDS;
-  _nb_bases_in_0_RNA                += to_add->_nb_bases_in_0_RNA;
-  _nb_bases_in_0_coding_RNA         += to_add->_nb_bases_in_0_coding_RNA;
-  _nb_bases_in_0_non_coding_RNA     += to_add->_nb_bases_in_0_non_coding_RNA;
-    
-  _nb_bases_non_essential                     += to_add->_nb_bases_non_essential;
-  _nb_bases_non_essential_including_nf_genes  += to_add->_nb_bases_non_essential_including_nf_genes;
-    
-  #ifdef __REGUL
-    _nb_influences                 += to_add->_nb_influences;
-    _nb_enhancing_influences       += to_add->_nb_enhancing_influences;
-    _nb_operating_influences       += to_add->_nb_operating_influences;
-    _av_value_influences           += to_add->_av_value_influences;
-    _av_value_enhancing_influences += to_add->_av_value_enhancing_influences;
-    _av_value_operating_influences += to_add->_av_value_operating_influences;
-  #endif
-}
-
-void ae_stat_record::substract_power( ae_stat_record const * means, ae_stat_record const * to_substract, double power )
-{
-  // NB : _num_gener and pop_size are global values and are not to be summed.
-  _fitness                 += pow( means->_fitness - to_substract->_fitness, power );
-  
-  _metabolic_error         += pow( means->_metabolic_error - to_substract->_metabolic_error, power );
-  _parent_metabolic_error  += pow( means->_parent_metabolic_error - to_substract->_parent_metabolic_error, power );
-  _metabolic_fitness         += pow( means->_metabolic_fitness - to_substract->_metabolic_fitness, power );
-  
-  _secretion_error         += pow( means->_secretion_error - to_substract->_secretion_error, power );
-  _parent_secretion_error  += pow( means->_parent_secretion_error - to_substract->_parent_secretion_error, power );
-  
-  _secretion_fitness       += pow( means->_secretion_fitness - to_substract->_secretion_fitness, power );
-  _compound_amount         += pow( means->_compound_amount - to_substract->_compound_amount, power );
-  
-  _amount_of_dna               += pow( means->_amount_of_dna - to_substract->_amount_of_dna, power );
-  _nb_coding_rnas              += pow( means->_nb_coding_rnas - to_substract->_nb_coding_rnas, power );
-  _nb_non_coding_rnas          += pow( means->_nb_non_coding_rnas - to_substract->_nb_non_coding_rnas, power );
-  _av_size_coding_rnas         += pow( means->_av_size_coding_rnas - to_substract->_av_size_coding_rnas, power );
-  _av_size_non_coding_rnas     += pow( means->_av_size_non_coding_rnas - to_substract->_av_size_non_coding_rnas, power );
-  _nb_functional_genes         += pow( means->_nb_functional_genes - to_substract->_nb_functional_genes, power );
-  _nb_non_functional_genes     += pow( means->_nb_non_functional_genes - to_substract->_nb_non_functional_genes, power );
-  _av_size_functional_gene     += pow( means->_av_size_functional_gene - to_substract->_av_size_functional_gene, power );
-  _av_size_non_functional_gene += pow( means->_av_size_non_functional_gene - to_substract->_av_size_non_functional_gene, power );
-
-  _nb_mut    += pow( means->_nb_mut - to_substract->_nb_mut, power );
-  _nb_rear   += pow( means->_nb_rear - to_substract->_nb_rear, power );
-  _nb_switch += pow( means->_nb_switch - to_substract->_nb_switch, power );
-  _nb_indels += pow( means->_nb_indels - to_substract->_nb_indels, power );
-  _nb_dupl   += pow( means->_nb_dupl - to_substract->_nb_dupl, power );
-  _nb_del    += pow( means->_nb_del - to_substract->_nb_del, power );
-  _nb_trans  += pow( means->_nb_trans - to_substract->_nb_trans, power );
-  _nb_inv    += pow( means->_nb_inv - to_substract->_nb_inv, power );
-    
-  _dupl_rate  += pow( means->_dupl_rate - to_substract->_dupl_rate, power );
-  _del_rate   += pow( means->_del_rate - to_substract->_del_rate, power );
-  _trans_rate += pow( means->_trans_rate - to_substract->_trans_rate, power );
-  _inv_rate   += pow( means->_inv_rate - to_substract->_inv_rate, power );
-  
-  _mean_align_score += pow( means->_mean_align_score - to_substract->_mean_align_score, power );
-  
-  _nb_bases_in_0_CDS                += pow( means->_nb_bases_in_0_CDS - to_substract->_nb_bases_in_0_CDS, power );
-  _nb_bases_in_0_functional_CDS     += pow( means->_nb_bases_in_0_functional_CDS - to_substract->_nb_bases_in_0_functional_CDS, power );
-  _nb_bases_in_0_non_functional_CDS += pow( means->_nb_bases_in_0_non_functional_CDS - to_substract->_nb_bases_in_0_non_functional_CDS, power );
-  _nb_bases_in_0_RNA                += pow( means->_nb_bases_in_0_RNA - to_substract->_nb_bases_in_0_RNA, power );
-  _nb_bases_in_0_coding_RNA         += pow( means->_nb_bases_in_0_coding_RNA - to_substract->_nb_bases_in_0_coding_RNA, power );
-  _nb_bases_in_0_non_coding_RNA     += pow( means->_nb_bases_in_0_non_coding_RNA - to_substract->_nb_bases_in_0_non_coding_RNA, power );
-    
-  _nb_bases_non_essential                     += pow( means->_nb_bases_non_essential - to_substract->_nb_bases_non_essential, power );
-  _nb_bases_non_essential_including_nf_genes  += pow( means->_nb_bases_non_essential_including_nf_genes - to_substract->_nb_bases_non_essential_including_nf_genes, power );
-    
-  #ifdef __REGUL
-    _nb_influences                 += pow( means->_nb_influences - to_substract->_nb_influences, power );
-    _nb_enhancing_influences       += pow( means->_nb_enhancing_influences - to_substract->_nb_enhancing_influences, power );
-    _nb_operating_influences       += pow( means->_nb_operating_influences - to_substract->_nb_operating_influences, power );
-    _av_value_influences           += pow( means->_av_value_influences - to_substract->_av_value_influences, power );
-    _av_value_enhancing_influences += pow( means->_av_value_enhancing_influences - to_substract->_av_value_enhancing_influences, power );
-    _av_value_operating_influences += pow( means->_av_value_operating_influences - to_substract->_av_value_operating_influences, power );
-  #endif
-}
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_stats.cpp b/src/libaevol/ae_stats.cpp
deleted file mode 100644
index 3a8ee8f..0000000
--- a/src/libaevol/ae_stats.cpp
+++ /dev/null
@@ -1,729 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <err.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_stats.h>
-#include <ae_stat_record.h>
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#ifdef __REGUL
-  #include <ae_influence_R.h>
-  #include <ae_protein_R.h>
-#endif
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_stats                               #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-/*!
-  Create a NEW stat manager
- */
-ae_stats::ae_stats( ae_exp_manager* exp_m,
-                    bool best_indiv_only,
-                    const char * prefix /* = "stat" */ )
-{
-  _exp_m = exp_m;
-  init_data();
-  set_file_names( prefix, best_indiv_only );
-  open_files();
-  write_headers();
-}
-
-/*!
-  Create a stat manager to append existing stats
- */
-ae_stats::ae_stats( ae_exp_manager* exp_m,
-                    int32_t num_gener,
-                    bool best_indiv_only,
-                    const char * prefix /* = "stat" */,
-                    bool addition_old_stats /* = true */,
-                    bool delete_old_stats /* = true */)
-{
-  _exp_m = exp_m;
-  init_data();
-  set_file_names( prefix, best_indiv_only );
-  
-  // ---------------------------------------------------------------------------
-  //  Make a backup copy (named <original_name>.old) of each file
-  //  and copy its content into the new stat file untill <num_gener> is reached
-  // ---------------------------------------------------------------------------
-  if(addition_old_stats)
-  {
-    char* old_file_name = new char[100];
-    FILE* old_file;
-    char* cur_file_name;  // Syntaxic sugar for _stat_files_names[][][]
-    FILE* cur_file;       // Syntaxic sugar for _stat_files[][][]
-    char  line[500];
-    char* trash;
-    
-    for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-    { 
-      for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-      {
-        for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-        {
-          cur_file_name = _stat_files_names[chrom_or_GU][best_or_glob][stat_type];
-          if ( cur_file_name != NULL )
-          {
-            sprintf( old_file_name, "%s.old", cur_file_name );
-            int8_t exist_file = rename( cur_file_name, old_file_name );
-            if ( exist_file != 0 )
-            {
-              printf( "ERROR : Could not rename %s as %s.\n", cur_file_name, old_file_name );
-              exit( EXIT_FAILURE );
-            }
-            
-            old_file = fopen( old_file_name, "r" );
-            cur_file = fopen( cur_file_name, "w" );
-            
-            // Copy file header
-            trash = fgets( line, 500, old_file );
-            while ( !feof( old_file ) && line[0] == '#' )
-            {
-              fputs( line, cur_file );
-              trash = fgets( line, 500, old_file );
-            }
-            
-            // Copy the empty line between the header and the values
-            fputs( line, cur_file );
-            
-            // Copy stats until num_gener (included)
-            trash = fgets( line, 500, old_file );
-            while ( (int32_t)atol(line) < _exp_m->get_first_gener() && !feof(old_file) )
-            {
-              fputs( line, cur_file );
-              trash = fgets( line, 500, old_file );
-            }
-            
-            fclose( old_file );
-            
-            _stat_files[chrom_or_GU][best_or_glob][stat_type] = cur_file;
-            
-            if ( delete_old_stats )
-            {
-              remove( old_file_name );
-            }
-          }
-        }
-      }
-    }
-    delete [] old_file_name;
-  }
-  else // ancstat case
-  {
-    open_files();
-    write_headers(true);
-  }
-
-  // Flush the new stat files
-  flush();
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_stats::~ae_stats( void )
-{
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        if( _stat_files_names[chrom_or_GU][best_or_glob][stat_type] != NULL )
-        {
-          assert( _stat_files[chrom_or_GU][best_or_glob][stat_type] != NULL );
-          
-          fclose( _stat_files[chrom_or_GU][best_or_glob][stat_type] );
-          _stat_files[chrom_or_GU][best_or_glob][stat_type] = NULL;
-          
-          delete [] _stat_files_names[chrom_or_GU][best_or_glob][stat_type];
-          _stat_files_names[chrom_or_GU][best_or_glob][stat_type] = NULL;
-        }
-      }
-      
-      delete [] _stat_files[chrom_or_GU][best_or_glob];
-      _stat_files[chrom_or_GU][best_or_glob] = NULL;
-      
-      delete [] _stat_files_names[chrom_or_GU][best_or_glob];
-      _stat_files_names[chrom_or_GU][best_or_glob] = NULL;
-    }
-    
-    delete [] _stat_files[chrom_or_GU];
-    _stat_files[chrom_or_GU] = NULL;
-    
-    delete [] _stat_files_names[chrom_or_GU];
-    _stat_files_names[chrom_or_GU] = NULL;
-  }
-  
-  delete [] _stat_files;
-  _stat_files = NULL;
-  
-  delete [] _stat_files_names;
-  _stat_files_names = NULL;
-}   
-
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-inline double sqr( double x )
-{
-  return x*x;
-}
-
-inline double rsqr( double x )
-{
-  return (x < 0.00000001) ? 0. : sqrt(x);
-}
-
-
-void ae_stats::write_headers( bool ancstats_stats /* = false */ )
-{
-  // Column key in the stat files
-  int8_t key;
-  
-  // --------------------------------------
-  //  Write headers in FITNESS_STATS files
-  // --------------------------------------
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    if( ancstats_stats)
-    {
-      write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], " Lineage individuals fitness statistics " );
-      write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "----------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "" );
-    }
-    else
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][FITNESS_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], " Fittest individual fitness statistics " );
-        write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "---------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][FITNESS_STATS], "" );
-      }
-      if ( _stat_files_names[chrom_or_GU][GLOB][FITNESS_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][FITNESS_STATS], " Average fitness statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][GLOB][FITNESS_STATS], "------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][FITNESS_STATS], "" );
-      }
-      
-      if ( _stat_files_names[chrom_or_GU][SDEV][FITNESS_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][SDEV][FITNESS_STATS], " Standard deviation, fitness statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][SDEV][FITNESS_STATS], "------------------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][SDEV][FITNESS_STATS], "" );
-      }
-      
-      if ( _stat_files_names[chrom_or_GU][SKEW][FITNESS_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][SKEW][FITNESS_STATS], " Skewness statistics, fitness over the population " );
-        write_header( _stat_files[chrom_or_GU][SKEW][FITNESS_STATS], "--------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][SKEW][FITNESS_STATS], "" );
-      }
-    }
-    
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][best_or_glob][FITNESS_STATS] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS] != NULL );
-        key = 1;
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Generation", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Population size", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Fitness", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Genome size (amount of DNA)", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic error", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's metabolic error", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Metabolic fitness", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion error", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Parent's secretion error", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Secretion fitness", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Amount of compound present in the grid-cell", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Int probe", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Double probe", key++ );
-
-        #ifdef __REGUL
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of links in the regulation graph", key++ );
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of positive links in the regulation graph", key++ );
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Number of negative links in the regulation graph", key++ );
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of links in the regulation graph", key++ );
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of positive links in the regulation graph", key++ );
-          write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], "Average value of negative links in the regulation graph", key++ );
-        #endif
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][FITNESS_STATS], ""); 
-      }
-    }
-  }
-  
-  // ---------------------------------------
-  //  Write headers in MUTATION_STATS files
-  // ---------------------------------------
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    if( ancstats_stats)
-    {
-      write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], " Lineage individuals mutation statistics " );
-      write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "-----------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "" );
-    }
-    else
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][MUTATION_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], " Fittest individual mutation statistics " );
-        write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "----------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][MUTATION_STATS], "" );
-      }
-      if ( _stat_files_names[chrom_or_GU][GLOB][MUTATION_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][MUTATION_STATS], " Average mutation statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][GLOB][MUTATION_STATS], "-------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][MUTATION_STATS], "" );
-      }
-    }
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][best_or_glob][MUTATION_STATS] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS] != NULL );
-        key = 1;
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Generation", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of local mutations undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of chromosomic rearrangements undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of switch undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of indels undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of duplications undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of deletions undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of translocations undergone", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], "Number of inversions undergone", key++ );
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][MUTATION_STATS], ""); 
-      }
-    }
-  }
-  
-  // ---------------------------------------
-  //  Write headers in GENES_STATS files
-  // ---------------------------------------
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    if( ancstats_stats)
-    {
-      write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], " Lineage individuals gene statistics " );
-      write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "-------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "" );
-    }
-    else
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][GENES_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], " Fittest individual gene statistics " );
-        write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][GENES_STATS], "" );
-      }
-      if ( _stat_files_names[chrom_or_GU][GLOB][GENES_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][GENES_STATS], " Average gene statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][GLOB][GENES_STATS], "---------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][GENES_STATS], "" );
-      }
-    }
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][best_or_glob][GENES_STATS] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS] != NULL );
-        key = 1;
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Generation", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Number of coding RNAs (at least one gene on RNA)", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Number of non-coding RNAs", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of coding RNAs (at least one gene on RNA)", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non-coding RNAs", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Number of functional genes", key++ );
-        // Non functional genes are those with _width == 0 or _height == 0 or those that lack one kind of codons (M, W or H)
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Nb of non functional genes", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of functional genes", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], "Average size of non functional genes (WARNING : bias towards 0)", key++ );
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][GENES_STATS], ""); 
-      }
-    }
-  }
-  
-  // ---------------------------------------
-  //  Write headers in BP_STATS files
-  // ---------------------------------------
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    if( ancstats_stats )
-    {
-      write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], " Lineage individuals non-coding statistics " );
-      write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "-------------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "" );
-    }
-    else
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][BP_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], " Fittest individual non-coding statistics " );
-        write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][BP_STATS], "" );
-      }
-      if ( _stat_files_names[chrom_or_GU][GLOB][BP_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], " Average non-coding statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], "---------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], "" );
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], " This data is not available"); 
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], " Computing bp stats for all individuals is extremely costly computationaly" );
-        write_header( _stat_files[chrom_or_GU][GLOB][BP_STATS], "" );
-        
-        // Mark file as "not to be written into" and close it
-        delete [] _stat_files_names[chrom_or_GU][GLOB][BP_STATS];
-        _stat_files_names[chrom_or_GU][GLOB][BP_STATS] = NULL;
-        fclose( _stat_files[chrom_or_GU][GLOB][BP_STATS] );
-        _stat_files[chrom_or_GU][GLOB][BP_STATS] = NULL;
-      }
-    }
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][best_or_glob][BP_STATS] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][best_or_glob][BP_STATS] != NULL );
-        key = 1;
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Generation", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any CDS", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any functional CDS", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non functional CDS", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any RNA", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any coding RNA", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of bp not included in any non coding RNA", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "Number of non essential bp including non fonctional genes", key++ );
-
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "");
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "NOTE: a bp is considered \"essential\" when it is part of any [functional] CDS");
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "  or any promoter or terminator corresponding to an RNA transcribing a [functional] CDS.");
-        write_header( _stat_files[chrom_or_GU][best_or_glob][BP_STATS], "");
-      }
-    }
-  }
-  
-  // ---------------------------------------
-  //  Write headers in REAR_STATS files
-  // ---------------------------------------
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    if( ancstats_stats)
-    {
-      write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], " Lineage individuals rearrangement statistics " );
-      write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "----------------------------------------------" );
-      write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "" );
-    }
-    else
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][REAR_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], " Fittest individual rearrangement statistics " );
-        write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "---------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][BEST][REAR_STATS], "" );
-      }
-      if ( _stat_files_names[chrom_or_GU][GLOB][REAR_STATS] != NULL )
-      {
-        write_header( _stat_files[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][REAR_STATS], " Average rearrangement statistics over the population " );
-        write_header( _stat_files[chrom_or_GU][GLOB][REAR_STATS], "------------------------------------------------------" );
-        write_header( _stat_files[chrom_or_GU][GLOB][REAR_STATS], "" );
-      }
-    }
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][best_or_glob][REAR_STATS] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS] != NULL );
-        key = 1;
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Generation", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Actual duplication rate", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Actual deletion rate", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Actual translocation rate", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Actual inversion rate", key++ );
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], "Average alignment score (needed score)", key++ );
-        
-        write_header( _stat_files[chrom_or_GU][best_or_glob][REAR_STATS], ""); 
-      }
-    }
-  }
-  
-  flush();
-}
-
-void ae_stats::write_current_generation_statistics( void )
-{
-  ae_stat_record** stat_records;
-  
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    stat_records = new ae_stat_record* [NB_BEST_OR_GLOB];
-    
-    stat_records[BEST] = new ae_stat_record( _exp_m, _exp_m->get_best_indiv(), (chrom_or_gen_unit) chrom_or_GU );
-    stat_records[GLOB] = new ae_stat_record( _exp_m, _exp_m->get_pop(), (chrom_or_gen_unit) chrom_or_GU );
-    stat_records[SDEV] = new ae_stat_record( _exp_m, _exp_m->get_pop(), stat_records[GLOB], (chrom_or_gen_unit) chrom_or_GU );
-    stat_records[SKEW] = new ae_stat_record( _exp_m, _exp_m->get_pop(), stat_records[GLOB], stat_records[SDEV], (chrom_or_gen_unit) chrom_or_GU );
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        if ( _stat_files_names[chrom_or_GU][best_or_glob][stat_type] != NULL )
-        {
-          stat_records[best_or_glob]->write_to_file( _stat_files[chrom_or_GU][best_or_glob][stat_type], (stats_type) stat_type );
-        }
-      }
-      
-      delete stat_records[best_or_glob];
-    }
-    
-    delete [] stat_records;
-  }
-}
-
-void ae_stats::write_statistics_of_this_indiv( ae_individual * indiv, int32_t num_gener )
-{
-  ae_stat_record* stat_record;
-  
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    stat_record = new ae_stat_record( _exp_m, indiv, (chrom_or_gen_unit) chrom_or_GU, true, num_gener );
-    
-    for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-    {
-      if ( _stat_files_names[chrom_or_GU][BEST][stat_type] != NULL )
-      {
-        assert( _stat_files[chrom_or_GU][BEST][stat_type] != NULL );
-        
-        stat_record->write_to_file( _stat_files[chrom_or_GU][BEST][stat_type], (stats_type) stat_type );
-      }
-    }
-    
-    delete stat_record;
-  }
-}
-
-void ae_stats::flush( void )
-{
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        if ( _stat_files_names[chrom_or_GU][best_or_glob][stat_type] != NULL )
-        {
-          assert( _stat_files[chrom_or_GU][best_or_glob][stat_type] != NULL );
-          fflush( _stat_files[chrom_or_GU][best_or_glob][stat_type] );
-        }
-      }
-    }
-  }
-}
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-/**
- * Allocate memory and initialize file handlers and file names to NULL
- */
-void ae_stats::init_data( void )
-{
-  _stat_files       = new FILE***[NB_CHROM_OR_GU];
-  _stat_files_names = new char***[NB_CHROM_OR_GU];
-  
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    _stat_files[chrom_or_GU]        = new FILE**[NB_BEST_OR_GLOB];
-    _stat_files_names[chrom_or_GU]  = new char**[NB_BEST_OR_GLOB];
-    
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      _stat_files[chrom_or_GU][best_or_glob]        = new FILE*[NB_STATS_TYPES];
-      _stat_files_names[chrom_or_GU][best_or_glob]  = new char*[NB_STATS_TYPES];
-      
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        _stat_files[chrom_or_GU][best_or_glob][stat_type]       = NULL;
-        _stat_files_names[chrom_or_GU][best_or_glob][stat_type] = NULL;
-      }
-    }
-  }
-}
-
-/**
- * Construct file names
- * NB: Here is where we "choose" which files we will write.
- *     Files that are not wanted must be left with a NULL name (don't new char[] them)
- *     There is an exception though: for the non-coding file for the population, we will
- *       give it a name temporarily so that we can write the warning headers. Once this
- *       is done, the name will be deleted to mark the file as "not to be written into"
- */
-void ae_stats::set_file_names( const char * prefix, bool one_lambda_indiv_only )
-{
-  // 1) Create stats directory
-  int status;
-  status = mkdir( STATS_DIR, 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, STATS_DIR );
-  }
-  
-  const char* chrom_or_gu_name[NB_CHROM_OR_GU]    = { "", "_chromosome", "_plasmids" };
-  const char* best_or_glob_name[NB_BEST_OR_GLOB]  = { "_best", "_glob", "_sdev", "_skew" };
-  const char* stat_type_name[NB_STATS_TYPES]      = { "_fitness", "_mutation", "_genes", "_bp", "_rear"};
-  
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    // If plasmids are not allowed, don't issue "chromosome" and "plasmids" files
-    if ( not _exp_m->get_with_plasmids() && chrom_or_GU > 0 ) continue;
-
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      if ( one_lambda_indiv_only && best_or_glob != BEST ) continue;
-      
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        //~ // We don't want REAR_STATS when rearrangements are done without alignments
-        //~ if ( stat_type == REAR_STATS && ! _exp_m->get_with_alignments() ) continue;
-        
-        // For now, we only want sdev and skew for fitness data
-        if ( best_or_glob > GLOB && stat_type > FITNESS_STATS) continue; 
-        if ( (chrom_or_GU != ALL_GU || best_or_glob != GLOB) && stat_type > REAR_STATS) continue;
-        
-        _stat_files_names[chrom_or_GU][best_or_glob][stat_type] = new char[255];
-        
-        // Construct the correct name
-        if ( one_lambda_indiv_only )
-        {
-          sprintf(  _stat_files_names[chrom_or_GU][best_or_glob][stat_type],
-                    STATS_DIR"/%s%s%s.out",
-                    prefix,
-                    stat_type_name[stat_type],
-                    chrom_or_gu_name[chrom_or_GU] );
-        }
-        else
-        {
-          sprintf(  _stat_files_names[chrom_or_GU][best_or_glob][stat_type],
-                    STATS_DIR"/%s%s%s%s.out",
-                    prefix,
-                    stat_type_name[stat_type],
-                    chrom_or_gu_name[chrom_or_GU],
-                    best_or_glob_name[best_or_glob] );
-        }
-        
-      }
-    }
-    
-  }
-}
-
-/**
- * Open files that have a non NULL name
- */
-void ae_stats::open_files( void )
-{
-  for ( int8_t chrom_or_GU = 0 ; chrom_or_GU < NB_CHROM_OR_GU ; chrom_or_GU++ )
-  {
-    for ( int8_t best_or_glob = 0 ; best_or_glob < NB_BEST_OR_GLOB ; best_or_glob++ )
-    {
-      for ( int8_t stat_type = 0 ; stat_type < NB_STATS_TYPES ; stat_type++ )
-      {
-        if ( _stat_files_names[chrom_or_GU][best_or_glob][stat_type] != NULL )
-        {
-          _stat_files[chrom_or_GU][best_or_glob][stat_type] = fopen( _stat_files_names[chrom_or_GU][best_or_glob][stat_type], "w" );
-        }
-      }
-    }
-  }
-}
diff --git a/src/libaevol/ae_stats.h b/src/libaevol/ae_stats.h
deleted file mode 100644
index 0e733d4..0000000
--- a/src/libaevol/ae_stats.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-/*! \class ae_stats
-    \brief Manage statistics files
-*/
- 
- 
-#ifndef __AE_STATS_H__
-#define __AE_STATS_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_individual.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
-
-
-
-
- 
-class ae_stats : public ae_object
-{  
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_stats( ae_exp_manager* exp_m,
-              bool best_indiv_only = false,
-              const char * prefix = "stat" );
-    ae_stats( ae_exp_manager* exp_m,
-              int32_t num_gener,
-              bool best_indiv_only = false,
-              const char * prefix = "stat",
-              bool addition_old_stats = true,
-              bool delete_old_stats = true );
-
- 
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_stats( void );
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-    inline void set_exp_m( ae_exp_manager* exp_m);
-    
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-
-    void write_current_generation_statistics( void );
-    void write_statistics_of_this_indiv( ae_individual* indiv, int32_t num_gener );
-    
-    void flush( void );
-
-    void write_headers( bool ancstats_stats = false );
-
-
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_stats( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_stats( const ae_stats &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    void init_data( void );
-    void set_file_names( const char * prefix, bool best_indiv_only );
-    void open_files( void );
-    
-    inline void write_header( FILE* file_name, const char* header );
-    inline void write_header( FILE* file_name, const char* header, int8_t key );
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-    
-    // 3D tables of stat files (FILE*) and their names (char*)
-    // Dimensions are given by:
-    //    * genetic unit (ALL_GU, CHROM or PLASMIDS)
-    //    * BEST or GLOB
-    //    * stat type (FITNESS_STATS, MUTATION_STATS, GENES_STATS, BP_STATS or REAR_STATS)
-    // Files that are not wanted MUST have their name set to NULL.
-    // The files themselves are also NULL because we don't fopen() them.
-    FILE**** _stat_files;
-    char**** _stat_files_names;
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline void ae_stats::set_exp_m( ae_exp_manager* exp_m)
-{
-  _exp_m = exp_m;
-}
-
-inline void ae_stats::write_header( FILE* file_name, const char* header )
-{
-  if ( file_name != NULL) fprintf( file_name, "# %s\n", header );
-}
-
-inline void ae_stats::write_header( FILE* file_name, const char* header, int8_t key )
-{
-  if ( file_name != NULL) fprintf( file_name, "# %2d. %s\n", key, header );
-}
-        
-
-
-#endif // __AE_STATS_H__
diff --git a/src/libaevol/ae_string.cpp b/src/libaevol/ae_string.cpp
index 6f86205..15e86f9 100644
--- a/src/libaevol/ae_string.cpp
+++ b/src/libaevol/ae_string.cpp
@@ -3,26 +3,26 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
@@ -30,19 +30,18 @@
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <assert.h>
-#include <string.h>
+#include <cassert>
+#include <cstring>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_string.h>
-#include <ae_exp_setup.h>
-
-
+#include "ae_string.h"
+#include "ExpSetup.h"
 
+namespace aevol {
 
 //##############################################################################
 //                                                                             #
@@ -57,200 +56,187 @@
 // =================================================================
 //                             Constructors
 // =================================================================
-ae_string::ae_string( void )
-{
-  _nb_blocks = 1;
-  _length = 0;
-  _data = new char[_nb_blocks * BLOCK_SIZE * sizeof(char)];
-  _data[_length] = '\0';
+ae_string::ae_string() {
+  nb_blocks_ = 1;
+  length_ = 0;
+  data_ = new char[nb_blocks_ * BLOCK_SIZE * sizeof(char)];
+  data_[length_] = '\0';
 }
 
-ae_string::ae_string( const ae_string &model )
-{
-  _nb_blocks  = model._nb_blocks;
-  _length     = model._length;
-  _data = new char[_nb_blocks * BLOCK_SIZE * sizeof(char)];
+ae_string::ae_string(const ae_string &model) {
+  nb_blocks_ = model.nb_blocks_;
+  length_ = model.length_;
+  data_ = new char[nb_blocks_ * BLOCK_SIZE * sizeof(char)];
 
-  memcpy( _data, model._data, (_length+1) * sizeof(char) );
+  memcpy(data_, model.data_, (length_ +1) * sizeof(char));
 }
 
 /*!
-  Creates a new ae_string with enough space to store a string of the given length.
+  Creates a new random string with the given length.
 */
-ae_string::ae_string( int32_t length )
-{
-  _nb_blocks = nb_blocks( length );
-  _length = length;
-  _data = new char[_nb_blocks * BLOCK_SIZE];
+ae_string::ae_string(int32_t length, std::shared_ptr<JumpingMT> prng) {
+  nb_blocks_ = nb_blocks(length);
+  length_ = length;
+  data_ = new char[nb_blocks_ * BLOCK_SIZE];
 
   // Generate a random genome
-  /*for ( int32_t i = 0 ; i < _length ; i++ )
-  {
-    _data[i] = '0' + ae_common::sim->alea->random( NB_BASE );
+  for (int32_t i = 0 ; i < length_; i++) {
+    data_[i] = '0' + prng->random(NB_BASE);
   }
-  _data[_length] = '\0';*/
+  data_[length_] = '\0';
 }
 
 /**
  * Creates a new ae_string with sequence <seq> (having length <length>)
  */
-ae_string::ae_string( const char* seq, int32_t length )
-{
-  _length = length;
-  _nb_blocks = nb_blocks( length );
-  _data = new char[_nb_blocks * BLOCK_SIZE];
-  memcpy( _data, seq, (length+1) * sizeof(char) );
+ae_string::ae_string(const char* seq, int32_t length) {
+  length_ = length;
+  nb_blocks_ = nb_blocks(length);
+  data_ = new char[nb_blocks_ * BLOCK_SIZE];
+  memcpy(data_, seq, (length+1) * sizeof(char));
 }
 
 /**
  * Creates a new ae_string with sequence <seq> (having length <length>).
  * WARNING : <seq> is used directly which means the caller must not delete it.
  */
-ae_string::ae_string( char* seq, int32_t length, bool use_seq )
-{
-  assert( use_seq );
-  
-  _length = length;
-  _nb_blocks = nb_blocks( length );
-  _data = seq;
+ae_string::ae_string(char* seq, int32_t length, bool use_seq) {
+  assert(use_seq);
+
+  length_ = length;
+  nb_blocks_ = nb_blocks(length);
+  data_ = seq;
 }
 
-ae_string::ae_string( gzFile backup_file )
-{
-  gzread( backup_file, &_nb_blocks,  sizeof(_nb_blocks) );
-  //~ printf( "read %d bytes (_nb_blocks : %ld)\n", sizeof(_nb_blocks), _nb_blocks );
-  _data = new char[_nb_blocks * BLOCK_SIZE];
-  gzread( backup_file, &_length,     sizeof(_length) );
-  //~ printf( "read %d bytes (_length : %ld)\n", sizeof(_length), _length );
-  gzread( backup_file, _data,        (_length + 1) * sizeof(*_data) );
-  //~ printf( "read %ld bytes (_data : %s)\n", (_length + 1) * sizeof(*_data), _data );
+ae_string::ae_string(gzFile backup_file) {
+  gzread(backup_file, &nb_blocks_,  sizeof(nb_blocks_));
+  data_ = new char[nb_blocks_ * BLOCK_SIZE];
+  gzread(backup_file, &length_, sizeof(length_));
+  gzread(backup_file, data_,
+         static_cast<unsigned int>((length_ + 1) * sizeof(*data_)));
 }
 
-ae_string::ae_string( char* organism_file_name )
-{
-  FILE* org_file = fopen( organism_file_name, "r" );
-  int length; 
-  
-  if (org_file==NULL) printf ("Error opening organism file\n");
-  else
-  {
-    fseek (org_file , 0 , SEEK_END);
-    length = ftell (org_file);
-    rewind (org_file);
-    
-    _nb_blocks = nb_blocks( length );
-    _length = length;
-    _data = new char[_nb_blocks * BLOCK_SIZE];
-    for ( int32_t i = 0 ; i < _length -1 ; i++ )
-    {
-      _data[i] = fgetc (org_file);
+ae_string::ae_string(char* organism_file_name) {
+  FILE* org_file = fopen(organism_file_name, "r");
+  int32_t length;
 
+  if (org_file == NULL) {
+    printf("Error opening organism file\n");
+  }
+  else {
+    fseek(org_file , 0 , SEEK_END);
+    length = ftell(org_file);
+    rewind(org_file);
+
+    nb_blocks_ = nb_blocks(length);
+    length_ = length;
+    data_ = new char[nb_blocks_ * BLOCK_SIZE];
+    for (int32_t i = 0 ; i < length_ -1 ; i++) {
+      data_[i] = static_cast<char>(fgetc(org_file));
     }
-    
-    _data[_length] = '\0';
+
+    data_[length_] = '\0';
   }
-  
-  fclose ( org_file ); 
-  
+
+  fclose(org_file);
 }
+
 // =================================================================
 //                             Destructors
 // =================================================================
-ae_string::~ae_string( void )
-{
-  delete [] _data;
+ae_string::~ae_string() {
+  delete [] data_;
 }
 
 // =================================================================
 //                            Public Methods
 // =================================================================
-void ae_string::remove( int32_t pos_1, int32_t pos_2 )
-// Remove the sequence between positions 'first' and 'last'
-{
-  assert( pos_1 >= 0 && pos_2 >= pos_1 && pos_2 <= _length );
+/**
+ * Remove the sequence between positions 'pos_1' and 'pos_2'
+ *
+ * Character at pos_1 is removed
+ * Character at pos_2 is not removed unless pos_1 == pos_2, in which case the
+ * string will become empty
+ */
+void ae_string::remove(int32_t pos_1, int32_t pos_2) {
+  assert(pos_1 >= 0 && pos_2 >= pos_1 && pos_2 <= length_);
 
   // Compute size of new genome
-  int32_t new_length    = _length - (pos_2 - pos_1);
-  int32_t new_nb_blocks = nb_blocks( new_length );
-  char*   new_genome    = new char[new_nb_blocks * BLOCK_SIZE];
+  int32_t new_length    = length_ - (pos_2 - pos_1);
+  int32_t new_nb_blocks = nb_blocks(new_length);
+  char*   new_genome    = new char[new_nb_blocks * BLOCK_SIZE * sizeof(char)];
 
   // Copy the remaining of the genome in tmp (preceeding and following parts)
-  memcpy( new_genome, _data, pos_1 * sizeof(char) );
-  memcpy( &new_genome[pos_1], &_data[pos_2], (new_length - pos_1) * sizeof(char) );
+  memcpy(new_genome, data_, pos_1 * sizeof(char));
+  memcpy(&new_genome[pos_1], &data_[pos_2],
+         (new_length - pos_1) * sizeof(char));
   new_genome[new_length] = '\0';
 
   // Replace previous genome with the new one
-  //~ printf( "genome before - after delete_block( %ld, %ld ) : \n  %s\n  %s\n\n", pos_1, pos_2, _data, new_genome );
-  //~ getchar();
-  delete [] _data;
-  _data = new_genome;
+  delete [] data_;
+  data_ = new_genome;
 
   // Update length data
-  _length     = new_length ;
-  _nb_blocks  = new_nb_blocks;
+  length_ = new_length;
+  nb_blocks_ = new_nb_blocks;
 }
 
-void ae_string::insert( int32_t pos, const char* seq, int32_t seq_length )
+void ae_string::insert(int32_t pos, const char* seq, int32_t seq_length) {
 // Insert sequence 'seq' at position 'pos'
-{
-  assert( pos >= 0 && pos < _length );
+  assert(pos >= 0 && pos < length_);
 
   // If the sequence's length was not provided, compute it
-  if ( seq_length == -1 )
-  {
-    seq_length = strlen( seq );
+  if (seq_length == -1) {
+    seq_length = strlen(seq);
   }
 
   // Compute size of new genome
-  int32_t new_length    = _length + seq_length;
-  int32_t new_nb_blocks = nb_blocks( new_length );
-  char*   new_genome    = new char[new_nb_blocks * BLOCK_SIZE];
+  int32_t new_length    = length_ + seq_length;
+  int32_t new_nb_blocks = nb_blocks(new_length);
+  char*   new_genome    = new char[new_nb_blocks * BLOCK_SIZE * sizeof(char)];
 
   // Build new genome from previous genome and sequence to insert
-  memcpy( new_genome,                   _data,        pos             * sizeof(char) );
-  memcpy( &new_genome[pos],             seq,          seq_length      * sizeof(char) );
-  memcpy( &new_genome[pos+seq_length],  &_data[pos],  (_length - pos) * sizeof(char) );
+  memcpy(new_genome, data_, pos * sizeof(char));
+  memcpy(&new_genome[pos], seq, seq_length * sizeof(char));
+  memcpy(&new_genome[pos+seq_length], &data_[pos],
+         (length_ - pos) * sizeof(char));
   new_genome[new_length] = '\0';
 
   // Replace the previous genome with the new one
-  delete [] _data;
-  _data = new_genome;
+  delete [] data_;
+  data_ = new_genome;
 
   // Update length-related data
-  _length     = new_length;
-  _nb_blocks  = new_nb_blocks;
+  length_ = new_length;
+  nb_blocks_ = new_nb_blocks;
 }
 
-void ae_string::replace( int32_t pos, char* seq, int32_t seq_length )
+void ae_string::replace(int32_t pos, char* seq, int32_t seq_length) {
 // Invert the sequence between positions 'first' and 'last'
-{
   // Check pos value
-  assert( pos >= 0 && pos < _length );
+  assert(pos >= 0 && pos < length_);
 
   // If the sequence's length was not provided, compute it
-  if ( seq_length == -1 )
-  {
-    seq_length = strlen( seq );
+  if (seq_length == -1) {
+    seq_length = strlen(seq);
   }
-  
+
   // Check that the sequence is contiguous
-  assert( pos + seq_length <= _length );
+  assert(pos + seq_length <= length_);
 
   // Perform the replacement
-  memcpy( &_data[pos], seq, seq_length * sizeof(char) );
+  memcpy(&data_[pos], seq, seq_length * sizeof(char));
 }
 
-void ae_string::save( gzFile backup_file )
-{
-  gzwrite( backup_file, &_nb_blocks,  sizeof(_nb_blocks) );
-  //~ printf( "write %d bytes (_nb_blocks : %ld)\n", sizeof(_nb_blocks), _nb_blocks );
-  gzwrite( backup_file, &_length,     sizeof(_length) );
-  //~ printf( "write %d bytes (_length : %ld)\n", sizeof(_length), _length );
-  gzwrite( backup_file, &_data[0],    (_length + 1) * sizeof(_data[0]) );
-  //~ printf( "write %ld bytes (_data : %s)\n", (_length + 1) * sizeof(*_data), _data );
+void ae_string::save(gzFile backup_file) {
+  gzwrite(backup_file, &nb_blocks_, sizeof(nb_blocks_));
+  gzwrite(backup_file, &length_, sizeof(length_));
+  gzwrite(backup_file, &data_[0],
+          static_cast<unsigned int>((length_ + 1) * sizeof(data_[0])));
 }
 
 
 // =================================================================
 //                           Protected Methods
 // =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_string.h b/src/libaevol/ae_string.h
index 9d212f3..7a8491c 100644
--- a/src/libaevol/ae_string.h
+++ b/src/libaevol/ae_string.h
@@ -3,49 +3,54 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_STRING_H_
+#define AEVOL_STRING_H_
 
 
-#ifndef __AE_STRING_H__
-#define __AE_STRING_H__
- 
- 
 // =================================================================
 //                              Libraries
 // =================================================================
-#include <inttypes.h>
+#include <cinttypes>
+#include <cstring>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
 #include <zlib.h>
-#include <string.h>
+
+#include <memory>
 
 
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-#include <ae_utils.h>
-
-
+#include "Utils.h"
+#include "JumpingMT.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
@@ -58,115 +63,83 @@
 
 
 #define BLOCK_SIZE INT32_C(1024)
- 
-class ae_string : public ae_object
-{  
-  public :
-  
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_string( void );
-    ae_string( const ae_string &model );
-    ae_string( int32_t length );
-    ae_string( const char* seq, int32_t length );
-    ae_string( char* seq, int32_t length, bool use_seq );
-    ae_string( gzFile backup_file );
-    ae_string( char* organism_file_name );
-  
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_string( void );
-  
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline const char*   get_data( void ) const;
-    inline       void    set_data( char* data, int32_t length = -1 );
-    inline       int32_t get_length( void ) const;
-  
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void remove( int32_t first, int32_t last );
-    void insert( int32_t pos, const char* seq, int32_t seq_length = -1 );
-    void replace( int32_t pos, char* seq, int32_t seq_length = -1 );
-    
-    void save( gzFile backup_file );
-  
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-  
-  
-  
-  
-  
-  protected :
-  
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    //~ ae_string( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    /*    ae_string( const ae_string &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      };*/
-
-  
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    static inline int32_t nb_blocks( int32_t length );
-  
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    char*   _data;
-    int32_t _length;
-    int32_t _nb_blocks;
+
+class ae_string {
+ public :
+
+  // =================================================================
+  //                             Constructors
+  // =================================================================
+  ae_string();
+  ae_string(const ae_string &model);
+  ae_string(int32_t length, std::shared_ptr<JumpingMT> prng);
+  ae_string(const char* seq, int32_t length);
+  ae_string(char* seq, int32_t length, bool use_seq);
+  explicit ae_string(gzFile backup_file);
+  explicit ae_string(char* organism_file_name);
+
+  // =================================================================
+  //                             Destructors
+  // =================================================================
+  virtual ~ae_string();
+
+  // =================================================================
+  //                              Accessors
+  // =================================================================
+  const char* data() const {return data_;}
+  int32_t length() const {return length_;}
+  inline void set_data(char* data, int32_t length = -1);
+
+  // =================================================================
+  //                            Public Methods
+  // =================================================================
+  void remove(int32_t first, int32_t last);
+  void insert(int32_t pos, const char* seq, int32_t seq_length = -1);
+  void replace(int32_t pos, char* seq, int32_t seq_length = -1);
+
+  void save(gzFile backup_file);
+
+
+
+
+
+ protected :
+  // =================================================================
+  //                           Protected Methods
+  // =================================================================
+  static inline int32_t nb_blocks(int32_t length);
+
+  // =================================================================
+  //                          Protected Attributes
+  // =================================================================
+
+  char* data_;
+  int32_t length_;
+  int32_t nb_blocks_;
 };
 
 
 // =====================================================================
 //                          Accessors' definitions
 // =====================================================================
-inline const char* ae_string::get_data( void ) const
-{
-  return _data;
-}
-
-inline void ae_string::set_data( char* data, int32_t length /* = -1 */ )
-{
-  if ( _data != NULL )
-  {
-    delete [] _data;
-    _data = NULL;
+void ae_string::set_data(char* data, int32_t length /* = -1 */) {
+  if (data_ != NULL) {
+    delete [] data_;
+    data_ = NULL;
   }
-  
-  _data       = data;
-  _length     = ( length != -1 ) ? length : strlen( _data );
-  _nb_blocks  = nb_blocks( _length );
-}
 
-inline int32_t ae_string::get_length( void ) const
-{
-  return _length;
+  data_ = data;
+  length_ = (length != -1) ? length : strlen(data_);
+  nb_blocks_ = nb_blocks(length_);
 }
 
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
-int32_t ae_string::nb_blocks( int32_t length )
-{
+int32_t ae_string::nb_blocks(int32_t length) {
   return length/BLOCK_SIZE + 1;
 }
 
+} // namespace aevol
 
-#endif // __AE_STRING_H__
+#endif // AEVOL_STRING_H_
diff --git a/src/libaevol/ae_tree.cpp b/src/libaevol/ae_tree.cpp
deleted file mode 100644
index 287a767..0000000
--- a/src/libaevol/ae_tree.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_tree.h>
-
-#include <ae_macros.h>
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_utils.h>
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                                Class ae_tree                                #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-const int32_t ae_tree::NO_PARENT = -1;
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_tree::ae_tree( ae_exp_manager* exp_m, ae_tree_mode tree_mode, int32_t tree_step )
-{
-  _exp_m = exp_m;
-    
-  _tree_mode = tree_mode;
-  _tree_step = tree_step;
-
-  switch ( _tree_mode )
-  {
-    case NORMAL :
-    {
-      _nb_indivs    = new int32_t [_tree_step];
-      _replics      = new ae_replication_report** [_tree_step];
-      
-      // All pointers in the _replics table must be set to NULL, otherwise
-      // the destructor won't work properly if called before the matrix was 
-      // filled 
-      for ( int32_t i = 0 ; i < tree_step ; i++ )
-      {
-        _replics[i] = NULL;
-      }
-      
-      break;
-    }
-    case LIGHT :
-    {
-      // TO DO
-
-      //~ // Creates the big arrays to store number of individuals and child->parent relations
-      //~ _nb_indivs  = new int32_t[ae_common::nb_generations];
-      //~ _parent     = new int32_t*[ae_common::nb_generations];
-      
-      //~ _parent[0]    = new int32_t[ae_common::init_params->get_init_pop_size()];
-      
-      //~ _nb_indivs[0] = ae_common::init_params->get_init_pop_size();
-      
-      //~ // Individuals from the initial population don't have parents
-      //~ for ( int32_t i = 0 ; i < _nb_indivs[0] ; i++ )
-      //~ {
-        //~ _parent[0][i] = NO_PARENT;
-      //~ }
-      
-      break;
-    }
-  }
-}
-
-
-
-ae_tree::ae_tree( ae_exp_manager* exp_m, char* tree_file_name )
-{
-  _exp_m = exp_m;
-
-  _tree_mode = _exp_m->get_tree_mode();
-  _tree_step = _exp_m->get_tree_step();
-  switch ( _tree_mode )
-  {
-    case NORMAL :
-    {
-      gzFile tree_file = gzopen( tree_file_name, "r" );
-      if ( tree_file == Z_NULL )
-      {
-        printf( "ERROR : Could not read tree file %s\n", tree_file_name );
-        exit( EXIT_FAILURE );
-      }
-      
-      ae_replication_report * replic_report = NULL;
-            
-      _nb_indivs    = new int32_t[_tree_step];
-      _replics      = new ae_replication_report**[_tree_step];      
-      
-      gzread( tree_file, _nb_indivs, _tree_step * sizeof(_nb_indivs[0]) );
-
-      for ( int32_t gener_i = 0 ; gener_i < _tree_step ; gener_i++ )
-      {
-        _replics[gener_i] = new ae_replication_report*[_nb_indivs[gener_i]];
-        for ( int32_t indiv_i = 0 ; indiv_i < _nb_indivs[gener_i] ; indiv_i++ )
-        {
-          // Retreive a replication report
-          replic_report = new ae_replication_report( tree_file, NULL );
-          
-          // Put it at its rightful position
-          _replics[gener_i][replic_report->get_id()] = replic_report;
-        }
-      }
-      gzclose( tree_file );
-       
-      break;
-    }
-    case LIGHT :
-    {
-      // TODO
-      break;
-    }
-  }
-}
-
-
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_tree::~ae_tree( void )
-{
-  switch ( _tree_mode )
-  {
-    case NORMAL :
-    {
-      if ( _replics != NULL )
-      {
-        for ( int32_t i = 0 ; i < _tree_step ; i++ )
-        {
-          if ( _replics[i] != NULL )
-          {
-            for ( int32_t j = 0 ; j < _nb_indivs[i] ; j++ )
-            {
-              delete _replics[i][j];
-            }
-            
-            delete [] _replics[i];
-          }
-        }
-        delete [] _replics;
-      }
-
-      break;
-    }
-    case LIGHT :
-    {
-      //~ for( int32_t n = 0 ; n < ae_common::nb_generations ; n++ )
-      //~ {
-        //~ delete _parent[n];
-      //~ }
-      
-      //~ delete [] _parent;
-      
-      break;
-    }
-  }
-
-  delete [] _nb_indivs;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-
-
-int32_t ae_tree::get_nb_indivs( int32_t generation ) const
-{
-  return _nb_indivs[ae_utils::mod(generation - 1, _tree_step)];
-}
-
-
-ae_replication_report * ae_tree::get_report_by_index( int32_t generation, int32_t index ) const
-{
-  assert( _tree_mode == NORMAL );
-  
-  return _replics[ae_utils::mod(generation - 1, _tree_step)][index];
-}
-
-
-ae_replication_report * ae_tree::get_report_by_rank( int32_t generation, int32_t rank ) const
-{
-  assert( _tree_mode == NORMAL );
-  int32_t nb_indivs = get_nb_indivs( generation );
-  assert( rank <= nb_indivs );
-  
-  for ( int32_t i = 0 ; i < nb_indivs ; i++ )
-  {
-    if ( _replics[ae_utils::mod(generation - 1, _tree_step)][i]->get_rank() == rank )
-    {
-      return _replics[ae_utils::mod(generation - 1, _tree_step)][i];
-    }
-  }
-  
-  fprintf( stderr, "ERROR: Couldn't find indiv with rank %"PRId32" in file %s:%d\n", rank, __FILE__, __LINE__ );
-  return NULL;
-}
-
-
-void ae_tree::set_nb_indivs (int32_t nb_indivs, int32_t generation)
-{
-  _nb_indivs[ae_utils::mod(generation - 1, _tree_step)] = nb_indivs;
-}
-
-
-void ae_tree::fill_tree_with_cur_gener( void )
-{
-  assert( _exp_m != NULL && _exp_m->get_num_gener() > 0 );
-  
-  switch ( _tree_mode )
-  {
-    case NORMAL :
-    {
-      //  -1 because the tree's arrays contain information on 
-      // generations n*TREE_STEP+1 --> (n+1)*_tree_step
-      // (for _tree_step == 100, information on generations
-      // 1 to 100, or 101 to 200, or 201 to 300, etc)
-      int32_t gener_i     = ae_utils::mod( _exp_m->get_num_gener() - 1, _tree_step );
-      _nb_indivs[gener_i] = _exp_m->get_pop()->get_nb_indivs();
-      _replics[gener_i]   = new ae_replication_report* [_nb_indivs[gener_i]];
-      
-      
-      ae_list_node<ae_individual*>* indiv_node = _exp_m->get_indivs()->get_first();
-      ae_individual*  indiv       = NULL;
-      int32_t         num_indiv   = 0;
-      
-      while ( indiv_node != NULL )
-      {
-        indiv = indiv_node->get_obj();
-        
-        _replics[gener_i][num_indiv++] = indiv->get_replic_report();
-
-        indiv_node = indiv_node->get_next();
-      }
-      
-      break;
-    }
-    case LIGHT :
-    {
-      // TO DO
-
-      // TO CHECK !!
-      // not sure that gener_i should be used in this block...
-
-      // int32_t gener_i     = ae_utils::mod( _exp_m->get_num_gener() - 1, _tree_step );
-      // _nb_indivs[gener_i] = _exp_m->get_nb_indivs();
-      // _parent[gener_i] = new int32_t [_nb_indivs[gener_i]];
-      
-      // ae_list_node<ae_individual*>* indiv_node = _exp_m->get_indivs()->get_first();
-      // ae_individual*  indiv       = NULL;
-      // int32_t         num_indiv   = 0;
-      
-      // while( indiv_node != NULL )
-      // {
-      //   indiv = indiv_node->get_obj();
-        
-      //   _parent[gener_i][num_indiv++] = indiv->get_replic_report()->get_parent_id();
-        
-      //   indiv_node = indiv_node->get_next();
-      // }
-      
-      break;
-    }
-  }
-}
-
-void ae_tree::write_to_tree_file( gzFile tree_file )
-{
-  switch ( _tree_mode )
-  {
-    case NORMAL :
-    {
-      // Write the tree in the backup
-      gzwrite( tree_file, &_nb_indivs[0], _tree_step * sizeof(_nb_indivs[0]) );
-      
-      for ( int32_t gener_i = 0 ; gener_i < _tree_step ; gener_i++ )
-      {
-        for ( int32_t indiv_i = 0 ; indiv_i < _nb_indivs[gener_i] ; indiv_i++ )
-        {
-          assert(_replics[gener_i][indiv_i] != NULL);
-          _replics[gener_i][indiv_i]->write_to_tree_file( tree_file );
-        }
-      }
-      
-      // Reinitialize the tree
-      for ( int32_t gener_i = 0 ; gener_i < _tree_step ; gener_i++ )
-      {
-        for ( int32_t indiv_i = 0 ; indiv_i < _nb_indivs[gener_i] ; indiv_i++ )
-        {
-          delete _replics[gener_i][indiv_i];
-          _replics[gener_i][indiv_i] = NULL;
-        }
-      
-        delete [] _replics[gener_i];
-        _replics[gener_i] = NULL;
-      }
-      
-      break;
-    }
-    case LIGHT :
-    {
-      // TODO : ?
-      break;
-    }
-  }
-}
-
-
-
-// =================================================================
-//                  Non-inline accessors' definition
-// =================================================================
-void ae_tree::set_replic_report( int32_t id, ae_replication_report* replic_report )
-{
-  assert( _tree_mode == NORMAL );
-  
-  int32_t gener_i = ae_utils::mod(_exp_m->get_num_gener() - 1, _tree_step); // CK: BUGFIX. Previous expression was: _exp_m->get_num_gener() % _tree_step;
-  
-  if ( _replics[gener_i] == NULL )
-  {
-    _replics[gener_i] = new ae_replication_report* [_exp_m->get_nb_indivs()];
-    
-    memset( _replics[gener_i], 0, _exp_m->get_nb_indivs() * sizeof( *_replics ) );  
-  }
-
-  assert( _replics[gener_i][id] == NULL );
-  _replics[gener_i][id] = new ae_replication_report(*replic_report);
-}
-
-
-
-
-// CK: Added for aevol_modify
-void ae_tree::set_replic_report( int32_t generation, int32_t id, ae_replication_report* replic_report )
-{
-  assert( _tree_mode == NORMAL );
-
-  int32_t g = ae_utils::mod(generation - 1, _tree_step);
-
-  if ( _replics[g] == NULL )
-  {
-    _replics[g] = new ae_replication_report* [_exp_m->get_nb_indivs()];
-    memset( _replics[g], 0, _exp_m->get_nb_indivs() * sizeof( *_replics ) );  
-  }
-
-  if ( _replics[g][id] != NULL )
-    {
-      printf("Erased previous replication report for indiv %d of generation %d (%d)\n", id, generation, g);
-      delete _replics[g][id];
-    }
-  _replics[g][id] = new ae_replication_report(*replic_report);
-  _replics[g][id]->set_id(id);
-
-  // debug
-  printf("Added replication report for indiv %d of generation %d (%d) :\n", id, generation, g);
-  printf("  ID            %d \n", _replics[g][id]->get_id() );
-  printf("  Rank          %d \n", _replics[g][id]->get_rank() );
-  printf("  Genome size   %d \n", _replics[g][id]->get_genome_size() );
-  printf("  P. ID         %d \n", _replics[g][id]->get_parent_id() );
-  printf("  P. met.err.   %f \n", _replics[g][id]->get_parent_metabolic_error() );
-  printf("  P. size       %d \n", _replics[g][id]->get_parent_genome_size() );
-}
-
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
diff --git a/src/libaevol/ae_tree.h b/src/libaevol/ae_tree.h
deleted file mode 100644
index b969a5c..0000000
--- a/src/libaevol/ae_tree.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
- 
- 
-#ifndef __AE_TREE_H__
-#define __AE_TREE_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_replication_report.h>
-#include <ae_enums.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-
-
-class ae_tree : public ae_object
-{  
-  public :
-    
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_tree( ae_exp_manager* exp_m, ae_tree_mode tree_mode, int32_t tree_step );
-    // To be used when we want to run a simulation.
-    ae_tree( ae_exp_manager* exp_m, char* tree_file_name ); 
-    // To be used when we want to INSPECT a tree, 
-    // not when we want to run a simulation.
-    
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_tree( void );
-
-    // =================================================================
-    //                        Accessors: getters
-    // =================================================================
-    inline int32_t       get_tree_step( void ) const;
-    inline ae_tree_mode  get_tree_mode( void ) const;
-    
-    // Precondition for the following 3 methods: 
-    // the tree was emptied every TREE_STEP generations ==> it contains
-    // only the last generations since the last emptying ==> do not ask
-    // something about an older generation 
-    int32_t get_nb_indivs( int32_t generation ) const;
-    ae_replication_report * get_report_by_index( int32_t generation, int32_t index ) const;
-    ae_replication_report * get_report_by_rank( int32_t generation, int32_t rank ) const;
-  
-
-    // =================================================================
-    //                        Accessors: setters
-    // =================================================================
-    void set_replic_report( int32_t id, ae_replication_report* replic_report );
-    void set_replic_report( int32_t generation, int32_t id, ae_replication_report* replic_report );
-    void set_nb_indivs (int32_t nb_indivs, int32_t generation);
-    
-    
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void fill_tree_with_cur_gener( void );
-    void write_to_tree_file( gzFile tree_file );
-    
-    inline int32_t get_LCA( int32_t num_gener, int32_t a, int32_t b, int32_t *j );
-    // Returns the generation of the last common ancestor of individuals number a and b
-    // of generation num_gener and stores its index in j if provided (not NULL)
-    
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-    static const int32_t NO_PARENT;
-    
-  
-  
-  
-  
-  protected :
-    
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    ae_tree( void )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_tree( const ae_tree &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    ae_exp_manager* _exp_m;
-    
-    int32_t       _tree_step;
-    ae_tree_mode  _tree_mode;
-    int32_t*      _nb_indivs;
-    
-    ae_replication_report*** _replics;
-    // Two-dimensional table of ae_replication_report*
-    //    dimension 1 (lines)   : generation
-    //    dimension 2 (columns) : individual
-    //
-    // !!!!! WARNING !!!!!
-    // The report at line l, column c is for the
-    // replication that created the indiv with index c of generation l+1
-    
-    // light tree representation
-    int32_t** _parent;
-};
-
-
-// =====================================================================
-//                           Getters' definitions
-// =====================================================================
-inline int32_t ae_tree::get_tree_step( void ) const
-{
-  return _tree_step;
-}
-
-inline ae_tree_mode ae_tree::get_tree_mode( void ) const
-{
-  return _tree_mode;
-}
-
-// =====================================================================
-//                           Setters' definitions
-// =====================================================================
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-
-inline int32_t ae_tree::get_LCA( int32_t num_gener, int32_t a, int32_t b, int32_t* j = NULL )
-// Returns the generation of the last common ancestor of individuals number a and b
-// of generation num_gener and stores its index in j if provided (not NULL)
-{
-  switch( _tree_mode )
-  {
-    case NORMAL :
-    {
-      // TODO
-      break;
-    }
-    case LIGHT :
-    {
-      while ( a != b )
-      {
-        a = _parent[num_gener][a];
-        b = _parent[num_gener][b];
-        num_gener = num_gener - 1;
-      }
-      
-      if ( j != NULL )
-      {
-        *j = a;
-      }
-      
-      break;
-    }
-  }
-  
-  return num_gener;
-}
-
-
-#endif // __AE_TREE_H__
diff --git a/src/libaevol/ae_vis_a_vis.h b/src/libaevol/ae_vis_a_vis.h
deleted file mode 100644
index 07bb5ed..0000000
--- a/src/libaevol/ae_vis_a_vis.h
+++ /dev/null
@@ -1,358 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-#ifndef __AE_VIS_A_VIS_H__
-#define __AE_VIS_A_VIS_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_object.h>
-#include <ae_dna.h>
-#include <ae_utils.h>
-
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-
-
-
-
-
-class ae_vis_a_vis : public ae_object
-{
-  friend class ae_align;
-  
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    ae_vis_a_vis( const ae_dna* chrom_1, const ae_dna* chrom_2, int32_t i_1, int32_t i_2, ae_sense sense = DIRECT );
-    ae_vis_a_vis( const ae_vis_a_vis & orig );
-    //~ ae_vis_a_vis( const ae_vis_a_vis * const orig );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~ae_vis_a_vis( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-    inline const ae_dna*  get_chrom_1( void ) const;
-    inline const ae_dna*  get_chrom_2( void ) const;
-    inline int32_t        get_i_1( void ) const;
-    inline int32_t        get_i_2( void ) const;
-    inline int16_t        get_score( void ) const;
-    inline ae_sense       get_sense( void ) const;
-
-    // =================================================================
-    //                              Operators
-    // =================================================================
-    inline bool operator <  ( ae_vis_a_vis &cmp );
-    inline bool operator <= ( ae_vis_a_vis &cmp );    
-    inline bool operator >  ( ae_vis_a_vis &cmp );
-    inline bool operator >= ( ae_vis_a_vis &cmp );
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    inline bool match( void );
-    inline void step_fwd( void );
-    inline void step_back( void );
-    inline void add( int common_inc );
-    inline void add( int inc_1, int inc_2 );
-    inline void sub( int common_inc );
-    inline void sub( int inc_1, int inc_2 );
-    inline void swap( void );
-    
-    inline void copy( ae_vis_a_vis * source );
-    inline void check_indices( void );
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-  
-    //~ ae_vis_a_vis( void )
-    //~ {
-      //~ _chrom_1 = _chrom_2 = new ae_dna(); // const members must be initialized
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    /*ae_vis_a_vis( const ae_vis_a_vis &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-      };*/
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    const ae_dna *  _chrom_1;
-    const ae_dna *  _chrom_2;
-    int32_t         _i_1; // Index on chrom_1
-    int32_t         _i_2; // Index on chrom_2
-    int16_t         _score;
-    ae_sense        _sense; // Sense (DIRECT or INDIRECT) of the vis_a_vis (alignement)
-    // Say we have the following sequences :
-    //    0 1 2 3 4 5 6 7 8 9             0 1 2 3 4 5 6 7 8 9
-    //    |a|b|c|d|e|f|g|h|i|j|           |a|b|c|d|e|f|g|h|i|j|
-    //
-    // The DIRECT vis_a_vis between _i_1 = 3 and _i_2 = 7 is 'd' with 'h' (caracters at indices 3 and 7 resp.).
-    //   The corresponding alignment would be "defgh" with "hijkl"
-    //
-    // WARNING! The INDIRECT vis_a_vis between the same _i_1 = 3 and i_2 = 7 is 'd' with 'g' (and not 'h'!).
-    // This is because we are reading backwards (towards the left). Directly left to index 7 is 'g' which corresponds to index 6.
-    //   The corresponding alignment would hence be "defgh" with "!g!f!e!d!c" ("!x" means "complementary of x")
-};
-
-
-// =====================================================================
-//                          Accessors' definitions
-// =====================================================================
-inline const ae_dna* ae_vis_a_vis::get_chrom_1( void ) const
-{
-  return _chrom_1;
-}
-
-inline const ae_dna* ae_vis_a_vis::get_chrom_2( void ) const
-{
-  return _chrom_2;
-}
-
-inline int32_t ae_vis_a_vis::get_i_1( void ) const
-{
-  return _i_1;
-}
-
-inline int32_t ae_vis_a_vis::get_i_2( void ) const
-{
-  return _i_2;
-}
-
-inline int16_t ae_vis_a_vis::get_score( void ) const
-{
-  return _score;
-}
-
-inline ae_sense ae_vis_a_vis::get_sense( void ) const
-{
-  return _sense;
-}
-
-
-
-// =====================================================================
-//                          Operators' definitions
-// =====================================================================
-inline bool ae_vis_a_vis::operator < ( ae_vis_a_vis &cmp )
-{
-  return ( _i_1 < cmp._i_1 );
-}
-
-inline bool ae_vis_a_vis::operator <= ( ae_vis_a_vis &cmp )
-{
-  return ( _i_1 <= cmp._i_1 );
-}
-
-inline bool ae_vis_a_vis::operator > ( ae_vis_a_vis &cmp )
-{
-  return ( _i_1 > cmp._i_1 );
-}
-
-inline bool ae_vis_a_vis::operator >= ( ae_vis_a_vis &cmp )
-{
-  return ( _i_1 >= cmp._i_1 );
-}
-
-
-// =====================================================================
-//                       Inline functions' definition
-// =====================================================================
-inline bool ae_vis_a_vis::match( void )
-{
-  if ( _sense == DIRECT )
-  {
-    return ( _chrom_1->get_data()[ae_utils::mod(_i_1, _chrom_1->get_length())] == _chrom_2->get_data()[ae_utils::mod(_i_2, _chrom_2->get_length())] );
-  }
-  else // ( _sense == INDIRECT )
-  {
-    // Note that we are reading the sequence backwards, The nucleotide corresponding to a breakpoint at point <i>
-    // is hence stored at index <i-1>
-    //    a b c d e f g h i j
-    //    |_|_|_|_|_|_|_|_|_|_|
-    //    | | | | | | | | | | |
-    //      9 8 7 6 5 4 3 2 1 0
-    //
-    // The breakpoint F-5 puts into a vis_a_vis the nucleotide at index F on seq1 and that at index 4 (not 5!!!) on seq2
-    return ( _chrom_1->get_data()[ae_utils::mod(_i_1, _chrom_1->get_length())] != _chrom_2->get_data()[ae_utils::mod(_i_2-1, _chrom_2->get_length())] );
-  }
-}
-
-inline void ae_vis_a_vis::step_fwd( void )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1++;
-    _i_2++;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1++;
-    _i_2--;
-  }
-}
-
-inline void ae_vis_a_vis::step_back( void )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1--;
-    _i_2--;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1--;
-    _i_2++;
-  }
-}
-
-inline void ae_vis_a_vis::add( int common_inc )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1 += common_inc;
-    _i_2 += common_inc;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1 += common_inc;
-    _i_2 -= common_inc;
-  }
-}
-
-inline void ae_vis_a_vis::add( int inc_1, int inc_2 )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1 += inc_1;
-    _i_2 += inc_2;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1 += inc_1;
-    _i_2 -= inc_2;
-  }
-}
-
-inline void ae_vis_a_vis::sub( int common_inc )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1 -= common_inc;
-    _i_2 -= common_inc;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1 -= common_inc;
-    _i_2 += common_inc;
-  }
-}
-
-inline void ae_vis_a_vis::sub( int inc_1, int inc_2 )
-{
-  if ( _sense == DIRECT )
-  {
-    _i_1 -= inc_1;
-    _i_2 -= inc_2;
-  }
-  else // ( _sense == INDIRECT )
-  {
-    _i_1 -= inc_1;
-    _i_2 += inc_2;
-  }
-}
-
-inline void ae_vis_a_vis::swap( void )
-{
-  const ae_dna *  tmp_chrom = _chrom_1;
-  int32_t         tmp_i     = _i_1;
-  
-  _chrom_1  = _chrom_2;
-  _i_1      = _i_2;
-  
-  _chrom_2  = tmp_chrom;
-  _i_2      = tmp_i;
-}
-
-inline void ae_vis_a_vis::copy( ae_vis_a_vis * source )
-{
-  _i_1 = source->_i_1;
-  _i_2 = source->_i_2;
-  _chrom_1 = source->_chrom_1;
-  _chrom_2 = source->_chrom_2;
-  _sense = source->_sense;
-  _score = source->_score;
-}
-
-inline void ae_vis_a_vis::check_indices( void )
-{
-  _i_1 = ae_utils::mod( _i_1, _chrom_1->get_length() );
-  _i_2 = ae_utils::mod( _i_2, _chrom_2->get_length() );
-}
-
-
-#endif // __AE_VIS_A_VIS_H__
diff --git a/src/libaevol/aevol.h b/src/libaevol/aevol.h
new file mode 100644
index 0000000..5403440
--- /dev/null
+++ b/src/libaevol/aevol.h
@@ -0,0 +1,89 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+#ifndef AEVOL_AEVOL_H_
+#define AEVOL_AEVOL_H_
+
+#include "ae_enums.h"
+#include "ae_string.h"
+#include "Utils.h"
+#include "Alignment.h"
+#include "Codon.h"
+#include "Dna.h"
+#include "DnaReplicationReport.h"
+#include "Dump.h"
+#include "ExpManager.h"
+#include "ExpSetup.h"
+#include "ParameterLine.h"
+#include "Fuzzy.h"
+#include "HybridFuzzy.h"
+#include "Gaussian.h"
+#include "GeneticUnit.h"
+#include "GridCell.h"
+#include "Habitat.h"
+#include "IndividualFactory.h"
+#include "Individual.h"
+#include "Metrics.h"
+#include "JumpingMT.h"
+#include "JumpPoly.h"
+#include "Logging.h"
+#include "macros.h"
+#include "Mutation.h"
+#include "PointMutation.h"
+#include "SmallInsertion.h"
+#include "SmallDeletion.h"
+#include "Duplication.h"
+#include "Deletion.h"
+#include "Translocation.h"
+#include "Inversion.h"
+#include "MutationParams.h"
+#include "NonCodingMetrics.h"
+#include "OutputManager.h"
+#include "ParamLoader.h"
+#include "Phenotype.h"
+#include "PhenotypicSegment.h"
+#include "PhenotypicTarget.h"
+#include "PhenotypicTargetHandler.h"
+#include "Point.h"
+#include "Protein.h"
+#include "ReplicationReport.h"
+#include "Rna.h"
+#include "Selection.h"
+#include "StatRecord.h"
+#include "Stats.h"
+#include "AeTime.h"
+#include "Tree.h"
+#include "VisAVis.h"
+#include "World.h"
+
+#ifdef __X11
+  #include "ExpManager_X11.h"
+  #include "Individual_X11.h"
+  #include "X11Window.h"
+#endif
+
+#endif // AEVOL_AEVOL_H_
diff --git a/src/libaevol/macros.h b/src/libaevol/macros.h
new file mode 100644
index 0000000..5ba14b7
--- /dev/null
+++ b/src/libaevol/macros.h
@@ -0,0 +1,112 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#include <cinttypes>
+
+#ifndef AEVOL_MACROS_H_
+#define AEVOL_MACROS_H_
+
+constexpr int8_t NB_BASE = 2; // WARNING:
+// A lot of stuff has been optimized for binary genomes
+// Changing the value of NB_BASE implies verifying the existing code
+// and make changes where necessary
+
+// NB The following strings are not easily replaced with `constexpr
+// const char*` because they are meant to be concatenated by the
+// preprocessor.
+
+// Backup directories and file name formats
+#define TIMESTEP_FORMAT "%09" PRId64
+// Experimental Setup
+#define EXP_S_DIR                 "exp_setup"
+#define EXP_S_FNAME_BASE          "exp_setup_" TIMESTEP_FORMAT
+#define EXP_S_FNAME_FORMAT        EXP_S_DIR "/" EXP_S_FNAME_BASE ".ae"
+#define EXP_S_CONST_FNAME_BASE    "exp_setup_const"
+#define EXP_S_CONST_FNAME_FORMAT  EXP_S_DIR "/" EXP_S_CONST_FNAME_BASE ".ae"
+// Output Profile
+#define OUT_P_DIR                 "output_profile"
+#define OUT_P_FNAME_BASE          "output_profile"
+#define OUT_P_FNAME_FORMAT        OUT_P_DIR "/" OUT_P_FNAME_BASE ".ae"
+#define OUT_P_CUR_FNAME           "output_profile.ae"
+// Spatial Structure
+#define WORLD_DIR             "world"
+#define WORLD_FNAME_BASE      "world_" TIMESTEP_FORMAT
+#define WORLD_FNAME_FORMAT    WORLD_DIR "/" WORLD_FNAME_BASE".ae"
+// Stats
+#define STATS_DIR   "stats"
+// Tree
+#define TREE_DIR    "tree"
+// Last gener file
+constexpr auto LAST_GENER_FNAME = "last_gener.txt";
+// Best last organism file
+#define BEST_LAST_ORG_FNAME "best_last_org.txt"
+
+#define FIXED_POPULATION_SIZE // Some calculation can be spared if we know that the size of the population is fixed
+
+constexpr int8_t PROM_SIZE = 22;
+constexpr auto PROM_SEQ = "0101011001110010010110";
+
+constexpr int8_t PROM_MAX_DIFF  = 4;
+constexpr int8_t TERM_STEM_SIZE = 4;
+constexpr int8_t TERM_LOOP_SIZE = 3;
+constexpr int8_t TERM_SIZE      = 2 * TERM_STEM_SIZE + TERM_LOOP_SIZE;
+
+constexpr int8_t SHINE_DAL_SIZE = 6;
+constexpr const char* SHINE_DAL_SEQ = "011011";
+constexpr int8_t SHINE_START_SPACER = 4;
+
+constexpr int8_t CODON_SIZE  = 3;
+constexpr int8_t CODON_START = 0b000;
+constexpr int8_t CODON_STOP  = 0b001;
+constexpr int8_t CODON_M0    = 0b100;
+constexpr int8_t CODON_M1    = 0b101;
+constexpr int8_t CODON_W0    = 0b010;
+constexpr int8_t CODON_W1    = 0b011;
+constexpr int8_t CODON_H0    = 0b110;
+constexpr int8_t CODON_H1    = 0b111;
+
+constexpr int32_t DO_TRANSLATION_LOOP =
+    SHINE_DAL_SIZE + SHINE_START_SPACER + 3 * CODON_SIZE;
+
+#ifdef __REGUL
+constexpr int8_t MAX_CODON   = 1 << CODON_SIZE;
+constexpr int8_t QUADON_SIZE = 4;
+constexpr int8_t MAX_QUADON  = 1 << QUADON_SIZE;
+#endif
+
+constexpr double X_MIN = 0.0;
+constexpr double X_MAX = 1.0;
+constexpr double Y_MIN = 0.0;
+constexpr double Y_MAX = 1.0;
+constexpr double H_MIN = -1.0;
+constexpr double H_MAX = 1.0;
+constexpr double W_MIN = 0.0;
+// W_MAX is defined through a parameter
+
+constexpr int8_t SC_MATCH_BONUS   = 1;
+constexpr int8_t SC_MISMATCH_COST = 2;
+
+#endif // AEVOL_MACROS_H_
diff --git a/src/libaevol/ae_object.h b/src/libaevol/make_unique.h
similarity index 70%
rename from src/libaevol/ae_object.h
rename to src/libaevol/make_unique.h
index 9a0bf94..a17cc95 100644
--- a/src/libaevol/ae_object.h
+++ b/src/libaevol/make_unique.h
@@ -3,50 +3,41 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
 
-#ifndef __AE_OBJECT_H__
-#define __AE_OBJECT_H__
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#ifndef AEVOL_MAKE_UNIQUE_H
+#define AEVOL_MAKE_UNIQUE_H
 
+#if __cplusplus == 201103L
+#include <cstddef>
+#include <memory>
+#include <type_traits>
+#include <utility>
 
-class ae_object
+template<typename T, typename ...Args>
+std::unique_ptr<T> make_unique(Args&& ...args)
 {
-  public :
-    ae_object( void ){};
-    virtual ~ae_object( void ){};
-    
-  protected :
-    ae_object( const ae_object &model )
-    {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      assert( false );
-      exit( EXIT_FAILURE );
-    };
-
-};
+  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+#endif
 
-#endif // __AE_OBJECT_H__
+#endif //AEVOL_MAKE_UNIQUE_H
diff --git a/src/libaevol/param_loader.cpp b/src/libaevol/param_loader.cpp
deleted file mode 100644
index 5400c8c..0000000
--- a/src/libaevol/param_loader.cpp
+++ /dev/null
@@ -1,1971 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <time.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <param_loader.h>
-
-#include <ae_exp_manager.h>
-#include <ae_exp_setup.h>
-#include <ae_output_manager.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-
-#include <ae_jumping_mt.h>
-#include <ae_gaussian.h>
-#include <ae_env_segment.h>
-#include <ae_point_2d.h>
-#include <ae_align.h>
-
-//~ #ifdef __X11
-  //~ #include <ae_individual_X11.h>
-//~ #endif
-
-#ifdef __REGUL
-  #include <ae_array_short.h>
-#endif
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_environment;
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                             Class param_loader                              #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-static const int8_t STRAIN_NAME_DEFAULT_SIZE  = 20;
-static const int8_t STRAIN_NAME_LOGIN_SIZE    = 10;
-#ifndef LOGIN_NAME_MAX
-  #define LOGIN_NAME_MAX 256
-#endif
-// =================================================================
-//                             Constructors
-// =================================================================
-
-
-param_loader::param_loader( const char* file_name )
-{
-  // Give default values to parameters
-
-  // ----------------------------------------- PseudoRandom Number Generators
-  _seed           = 0;
-  _mut_seed       = 0;
-  _stoch_seed     = 0;
-  _env_var_seed   = 0;
-  _env_noise_seed = 0;
-
-  // ------------------------------------------------------------ Constraints
-  _min_genome_length  = 10;
-  _max_genome_length  = 10000000;
-  _w_max              = 0.033333333;
-
-  // ----------------------------------------------------- Initial conditions
-  _chromosome_initial_length  = 5000;
-  _init_method            = ONE_GOOD_GENE | CLONE;
-  _init_pop_size          = 1000;
-  _strain_name = new char[STRAIN_NAME_DEFAULT_SIZE+1];
-
-  char* login_name = new char[LOGIN_NAME_MAX+1];
-  // Try get user login. If fail, replace by default value
-  if(getlogin_r(login_name, LOGIN_NAME_MAX) != 0)
-    strcpy(login_name, "anon");
-
-  // Copy login into strain name with at most STRAIN_NAME_LOGIN_SIZE characters
-  strncpy(_strain_name, login_name, STRAIN_NAME_LOGIN_SIZE);
-  delete [] login_name;
-
-  // Null-terminate the c-string if the max number of characters were copied
-  if (_strain_name[STRAIN_NAME_LOGIN_SIZE] != 0)
-    _strain_name[STRAIN_NAME_LOGIN_SIZE + 1] = 0;
-
-  // Append with a hyphen and a series of random digits
-  int strain_name_len = strlen(_strain_name);
-  _strain_name[strain_name_len++] = '-';
-  srand(time(NULL));
-  while (strain_name_len < STRAIN_NAME_DEFAULT_SIZE)
-  {
-    // Don't care for uniform distrib, using simple and ugly rand() % X
-    _strain_name[strain_name_len++] = '0' + rand() % 10;
-  }
-
-  // ------------------------------------------------------------ Environment
-  _env_gaussians      = NULL;
-  _env_custom_points  = NULL;
-  _env_sampling       = 300;
-
-  // ---------------------------------------- Environment x-axis segmentation
-  _env_axis_nb_segments         = 1;
-  _env_axis_segment_boundaries  = NULL;
-  _env_axis_features            = NULL;
-  _env_axis_separate_segments   = false;
-
-  // -------------------------------------------------- Environment variation
-  _env_var_method = NO_VAR;
-  _env_var_sigma  = 0;
-  _env_var_tau    = 0;
-
-  // ------------------------------------------------------ Environment noise
-  _env_noise_method       = NO_NOISE;
-  _env_noise_alpha        = 0;
-  _env_noise_sigma        = 0;
-  _env_noise_prob         = 0;
-  _env_noise_sampling_log = 0;
-
-  // --------------------------------------------------------- Mutation rates
-  _point_mutation_rate  = 1e-5;
-  _small_insertion_rate = 1e-5;
-  _small_deletion_rate  = 1e-5;
-  _max_indel_size       = 6;
-
-  // -------------------------------------------- Rearrangements and Transfer
-  _with_4pts_trans            = true;
-  _with_alignments            = false;
-  _with_HT                    = false;
-  _repl_HT_with_close_points  = false;
-  _HT_ins_rate                = 0.0;
-  _HT_repl_rate               = 0.0;
-  _repl_HT_detach_rate        = 0.0;
-
-  // ------------------------------ Rearrangement rates (without alignements)
-  _duplication_rate   = 1e-5;
-  _deletion_rate      = 1e-5;
-  _translocation_rate = 1e-5;
-  _inversion_rate     = 1e-5;
-
-  // --------------------------------- Rearrangement rates (with alignements)
-  _neighbourhood_rate       = 5e-5;
-  _duplication_proportion   = 0.3;
-  _deletion_proportion      = 0.3;
-  _translocation_proportion = 0.3;
-  _inversion_proportion     = 0.3;
-
-  // ------------------------------------------------------------ Alignements
-  _align_fun_shape    = SIGMOID;
-  _align_sigm_lambda  = 4;
-  _align_sigm_mean    = 50;
-  _align_lin_min      = 0;
-  _align_lin_max      = 100;
-
-  _align_max_shift      = 20;
-  _align_w_zone_h_len   = 50;
-  _align_match_bonus    = 1;
-  _align_mismatch_cost  = 2;
-
-  // ----------------------------------------------- Phenotypic Stochasticity
-  _with_stochasticity = false;
-
-  // -------------------------------------------------------------- Selection
-  _selection_scheme   = RANK_EXPONENTIAL;
-  _selection_pressure = 0.998;
-
-  // ------------------------------------------------------ Spatial structure
-  _spatially_structured       = false;
-  _grid_width                 = 0;
-  _grid_height                = 0;
-  _migration_number           = 0;
-
-  // -------------------------------------------------------------- Secretion
-  _with_secretion               = false;
-  _secretion_contrib_to_fitness = 0;
-  _secretion_diffusion_prop     = 0;
-  _secretion_degradation_prop   = 0;
-  _secretion_cost               = 0;
-  _secretion_init               = 0;
-
-  // --------------------------------------------------------------- Plasmids
-  _allow_plasmids             = false;
-  _plasmid_initial_length     = -1;
-  _plasmid_initial_gene       = 0;
-  _plasmid_minimal_length     = -1;
-  _plasmid_maximal_length     = -1;
-  _chromosome_minimal_length  = -1;
-  _chromosome_maximal_length  = -1;
-  _prob_plasmid_HT            = 0;
-  _tune_donor_ability         = 0;
-  _tune_recipient_ability     = 0;
-  _donor_cost                 = 0;
-  _recipient_cost             = 0;
-  _compute_phen_contrib_by_GU = false;
-  _swap_GUs         = false;
-
-  // ------------------------------------------------------- Translation cost
-  _translation_cost = 0;
-
-  // ---------------------------------------------------------------- Outputs
-  _stats            = 0;
-  _delete_old_stats = false;
-
-  // Backups
-  _backup_step      = 500;
-  _big_backup_step  = 10000;
-
-  // Tree
-  _record_tree  = false;
-  _tree_step    = 100;
-  _tree_mode    = NORMAL;
-
-  // Dumps
-  _make_dumps = false;
-  _dump_step  = 1000;
-
-  // Logs
-  _logs = 0;
-
-  // Other
-  _more_stats = false;
-
-  #ifdef __REGUL
-    // ------------------------------------------------------- Binding matrix
-    _binding_zeros_percentage = 75;
-  #endif
-
-  // Read parameter file
-  _param_file_name = strdup( file_name );
-  _param_file  = fopen( _param_file_name,  "r" );
-
-  if ( _param_file == NULL )
-  {
-     printf( "ERROR : couldn't open file %s\n", file_name );
-     exit( EXIT_FAILURE );
-  }
-
-  assert( _param_file );
-
-  read_file();
-}
-
-// =================================================================
-//                             Destructors
-// =================================================================
-param_loader::~param_loader( void )
-{
-   free( _param_file_name );
-   fclose( _param_file );
-   if ( _env_axis_segment_boundaries != NULL ) delete [] _env_axis_segment_boundaries;
-   if ( _env_axis_features != NULL ) delete [] _env_axis_features;
-   if ( _prng != NULL) delete _prng;
-   delete [] _strain_name;
-}
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-void param_loader::interpret_line( f_line* line, int32_t cur_line )
-{
-  if ( strcmp( line->words[0], "STRAIN_NAME" ) == 0 )
-  {
-    delete [] _strain_name;
-    _strain_name = new char[strlen(line->words[1])+1];
-    strcpy(_strain_name, line->words[1]);
-  }
-  else if ( strcmp( line->words[0], "MAX_TRIANGLE_WIDTH" ) == 0 )
-  {
-   _w_max = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ENV_AXIS_FEATURES" ) == 0 )
-  {
-    // Set general segmentation data
-    _env_axis_nb_segments = line->nb_words / 2;
-
-    // Set segmentation boundaries
-    _env_axis_segment_boundaries = new double [_env_axis_nb_segments + 1];
-    _env_axis_segment_boundaries[0] = X_MIN;
-    for ( int16_t i = 1 ; i < _env_axis_nb_segments ; i++ )
-    {
-      _env_axis_segment_boundaries[i] = atof( line->words[2*i] );
-    }
-    _env_axis_segment_boundaries[_env_axis_nb_segments] = X_MAX;
-
-    // Set segment features
-    _env_axis_features = new ae_env_axis_feature[_env_axis_nb_segments];
-    for ( int16_t i = 0 ; i < _env_axis_nb_segments ; i++ )
-    {
-      if ( strcmp( line->words[2*i+1], "NEUTRAL" ) == 0 )
-      {
-        _env_axis_features[i] = NEUTRAL;
-      }
-      else if ( strcmp( line->words[2*i+1], "METABOLISM" ) == 0 )
-      {
-        _env_axis_features[i] = METABOLISM;
-      }
-      else if ( strcmp( line->words[2*i+1], "SECRETION" ) == 0 )
-      {
-        _with_secretion = true;
-        _env_axis_features[i] = SECRETION;
-      }
-      else if ( strcmp( line->words[2*i+1], "DONOR" ) == 0 )
-      {
-        _env_axis_features[i] = DONOR;
-      }
-      else if ( strcmp( line->words[2*i+1], "RECIPIENT" ) == 0 )
-      {
-        _env_axis_features[i] = RECIPIENT;
-      }
-      else
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown axis feature \"%s\".\n",
-                _param_file_name, cur_line, line->words[2*i+1] );
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-  else if ( strcmp( line->words[0], "ENV_SEPARATE_SEGMENTS" ) == 0 )
-  {
-    _env_axis_separate_segments = true;
-  }
-  else if ( strcmp( line->words[0], "RECORD_TREE" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _record_tree = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _record_tree = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown tree recording option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "TREE_MODE" ) == 0 )
-  {
-    if ( strcmp( line->words[1], "light" ) == 0 )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : the \"light\" tree recording option is not implemented yet.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-      // _tree_mode = LIGHT;
-    }
-    else if ( strcmp( line->words[1], "normal" ) == 0 )
-    {
-      _tree_mode = NORMAL;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown tree mode option (use normal/light).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "MORE_STATS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _more_stats = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _more_stats = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown more stats option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "DUMP_STEP" ) == 0 )
-  {
-    _dump_step = atol( line->words[1] );
-    if (_dump_step>0) _make_dumps = true;
-  }
-  else if ( strcmp( line->words[0], "BACKUP_STEP" ) == 0 )
-  {
-    _backup_step = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "BIG_BACKUP_STEP" ) == 0 )
-  {
-    _big_backup_step = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TREE_STEP" ) == 0 )
-  {
-    _tree_step = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "CHROMOSOME_INITIAL_LENGTH" ) == 0 )
-  {
-    _chromosome_initial_length = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "MIN_GENOME_LENGTH" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "NONE", 4 ) == 0 )
-    {
-      _min_genome_length = 1; // Must not be 0
-    }
-    else
-    {
-      _min_genome_length = atol( line->words[1] );
-      if (_min_genome_length == 0 )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : MIN_GENOME_LENGTH must be > 0.\n",
-                _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-  else if ( strcmp( line->words[0], "MAX_GENOME_LENGTH" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "NONE", 4 ) == 0 )
-    {
-      _max_genome_length = INT32_MAX;
-    }
-    else
-    {
-      _max_genome_length = atol( line->words[1] );
-    }
-  }
-  else if ( strcmp( line->words[0], "INIT_POP_SIZE" ) == 0 )
-  {
-    _init_pop_size = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "POP_STRUCTURE" ) == 0 )
-  {
-    if ( strcmp( line->words[1], "grid" ) == 0 )
-    {
-      _spatially_structured = true;
-      _grid_width = atol( line->words[2] );
-      _grid_height = atol( line->words[3] );
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown population structure.\n", _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "MIGRATION_NUMBER" ) == 0 )
-  {
-    _migration_number = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "INIT_METHOD" ) == 0 )
-  {
-    for ( int8_t i = 1 ; i < line->nb_words ; i++ )
-    {
-      if ( strcmp( line->words[i], "ONE_GOOD_GENE" ) == 0 )
-      {
-        _init_method |= ONE_GOOD_GENE;
-      }
-      else if ( strcmp( line->words[i], "CLONE" ) == 0 )
-      {
-        _init_method |= CLONE;
-      }
-      else if ( strcmp( line->words[i], "WITH_INS_SEQ" ) == 0 )
-      {
-        _init_method |= WITH_INS_SEQ;
-      }
-      else
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown initialization method %s.\n",
-                _param_file_name, cur_line, line->words[1] );
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-  else if ( strcmp( line->words[0], "POINT_MUTATION_RATE" ) == 0 )
-  {
-    _point_mutation_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "SMALL_INSERTION_RATE" ) == 0 )
-  {
-    _small_insertion_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "SMALL_DELETION_RATE" ) == 0 )
-  {
-    _small_deletion_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "MAX_INDEL_SIZE" ) == 0 )
-  {
-    _max_indel_size = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "DUPLICATION_RATE" ) == 0 )
-  {
-    _duplication_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "DELETION_RATE" ) == 0 )
-  {
-    _deletion_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TRANSLOCATION_RATE" ) == 0 )
-  {
-    _translocation_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "INVERSION_RATE" ) == 0 )
-  {
-    _inversion_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "NEIGHBOURHOOD_RATE" ) == 0 )
-  {
-    _neighbourhood_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "DUPLICATION_PROPORTION" ) == 0 )
-  {
-    _duplication_proportion = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "DELETION_PROPORTION" ) == 0 )
-  {
-    _deletion_proportion = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TRANSLOCATION_PROPORTION" ) == 0 )
-  {
-    _translocation_proportion = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "INVERSION_PROPORTION" ) == 0 )
-  {
-    _inversion_proportion = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ALIGN_FUNCTION" ) == 0 )
-  {
-    if ( line->nb_words != 2 && line->nb_words != 4 )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : incorrect number of parameters for keyword \"%s\".\n",
-              _param_file_name, cur_line, line->words[0] );
-      exit( EXIT_FAILURE );
-    }
-
-    if ( strcmp( line->words[1], "LINEAR" ) == 0 )
-    {
-      _align_fun_shape = LINEAR;
-
-      if ( line->nb_words == 4 )
-      {
-        _align_lin_min = atol( line->words[2] );
-        _align_lin_max = atol( line->words[3] );
-      }
-    }
-    else if ( strcmp( line->words[1], "SIGMOID" ) == 0 )
-    {
-      _align_fun_shape = SIGMOID;
-
-      if ( line->nb_words == 4 )
-      {
-        _align_sigm_lambda = atol( line->words[2] );
-        _align_sigm_mean = atol( line->words[3] );
-      }
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown align function shape \"%s\".\n",
-              _param_file_name, cur_line, line->words[1] );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "ALIGN_MAX_SHIFT" ) == 0 )
-  {
-    _align_max_shift = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ALIGN_W_ZONE_H_LEN" ) == 0 )
-  {
-    _align_w_zone_h_len = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ALIGN_MATCH_BONUS" ) == 0 )
-  {
-    _align_match_bonus = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ALIGN_MISMATCH_COST" ) == 0 )
-  {
-    _align_mismatch_cost = atol( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "STOCHASTICITY" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _with_stochasticity = true;
-    }
-  }
-  else if ( strcmp( line->words[0], "SELECTION_SCHEME" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "lin", 3 ) == 0 )
-    {
-      if ( line->nb_words != 3 )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : selection pressure parameter is missing.\n",
-                _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-
-      _selection_scheme = RANK_LINEAR;
-      _selection_pressure = atof( line->words[2] );
-    }
-    else if ( strncmp( line->words[1], "exp", 3 ) == 0 )
-    {
-      if ( line->nb_words != 3 )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : selection pressure parameter is missing.\n",
-                _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-
-      _selection_scheme = RANK_EXPONENTIAL;
-      _selection_pressure = atof( line->words[2] );
-    }
-    else if ( strncmp( line->words[1], "fitness", 7 ) == 0 )
-    {
-      if ( line->nb_words != 3 )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : selection pressure parameter is missing.\n",
-                _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-
-      _selection_scheme = FITNESS_PROPORTIONATE;
-      _selection_pressure = atof( line->words[2] );
-    }
-    else if ( strcmp( line->words[1], "fittest" ) == 0 )
-    {
-      _selection_scheme = FITTEST;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown selection scheme \"%s\".\n",
-              _param_file_name, cur_line, line->words[1] );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "SEED" ) == 0 )
-  {
-    static bool seed_already_set = false;
-    if ( seed_already_set )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : duplicate entry for SEED.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-    _seed = atol( line->words[1] );
-    seed_already_set = true;
-  }
-  else if ( strcmp( line->words[0], "MUT_SEED" ) == 0 )
-  {
-    static bool mut_seed_already_set = false;
-    if ( mut_seed_already_set )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : duplicate entry for MUT_SEED.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-    _mut_seed = atol( line->words[1] );
-    mut_seed_already_set = true;
-  }
-  else if ( strcmp( line->words[0], "STOCH_SEED" ) == 0 )
-  {
-    static bool stoch_seed_already_set = false;
-    if ( stoch_seed_already_set )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : duplicate entry for STOCH_SEED.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-    _stoch_seed = atol( line->words[1] );
-    stoch_seed_already_set = true;
-  }
-  else if ( strcmp( line->words[0], "WITH_4PTS_TRANS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _with_4pts_trans = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      printf( "ERROR: 3 points translocation hasn't been implemented yet\n" );
-      exit( EXIT_FAILURE );
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown 4pts_trans option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "WITH_ALIGNMENTS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _with_alignments = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _with_alignments = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown alignement option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "WITH_TRANSFER" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _with_HT = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _with_HT = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown transfer option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "REPL_TRANSFER_WITH_CLOSE_POINTS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _repl_HT_with_close_points = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _repl_HT_with_close_points = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown transfer option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "SWAP_GUS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _swap_GUs = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _swap_GUs = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown swap option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "TRANSFER_INS_RATE" ) == 0 )
-  {
-    _HT_ins_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TRANSFER_REPL_RATE" ) == 0 )
-  {
-    _HT_repl_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "REPL_TRANSFER_DETACH_RATE" ) == 0 )
-  {
-    _repl_HT_detach_rate = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TRANSLATION_COST" ) == 0 )
-  {
-    _translation_cost = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ENV_ADD_POINT" ) == 0 )
-  {
-    if ( _env_custom_points == NULL ) _env_custom_points = new ae_list<ae_point_2d*>();
-    _env_custom_points->add( new ae_point_2d(  atof( line->words[1] ), atof( line->words[2] ) ) );
-  }
-  else if ( (strcmp( line->words[0], "ENV_ADD_GAUSSIAN" ) == 0 ) || ( strcmp( line->words[0], "ENV_GAUSSIAN" ) == 0 ))
-  {
-    if ( _env_gaussians == NULL ) _env_gaussians = new ae_list<ae_gaussian*>();
-    _env_gaussians->add( new ae_gaussian( atof( line->words[1] ), atof( line->words[2] ), atof( line->words[3] ) ) );
-  }
-  else if ( strcmp( line->words[0], "ENV_SAMPLING" ) == 0 )
-  {
-    _env_sampling = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ENV_VARIATION" ) == 0 )
-  {
-    static bool env_var_already_set = false;
-    if ( env_var_already_set )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : duplicate entry for %s.\n",
-              _param_file_name, cur_line, line->words[0] );
-      exit( EXIT_FAILURE );
-    }
-    env_var_already_set = true;
-
-    if ( strcmp( line->words[1], "none" ) == 0 )
-    {
-      assert( line->nb_words == 2 );
-      _env_var_method = NO_VAR;
-    }
-    else if ( strcmp( line->words[1], "autoregressive_mean_variation" ) == 0 )
-    {
-      assert( line->nb_words == 5 );
-      _env_var_method = AUTOREGRESSIVE_MEAN_VAR;
-      _env_var_sigma = atof( line->words[2] );
-      _env_var_tau = atol( line->words[3] );
-      _env_var_seed = atoi( line->words[4] );
-    }
-    else if ( strcmp( line->words[1], "autoregressive_height_variation" ) == 0 )
-    {
-      assert( line->nb_words == 5 );
-      _env_var_method = AUTOREGRESSIVE_HEIGHT_VAR;
-      _env_var_sigma = atof( line->words[2] );
-      _env_var_tau = atol( line->words[3] );
-      _env_var_seed = atoi( line->words[4] );
-    }
-    else if ( strcmp( line->words[1], "add_local_gaussians" ) == 0 )
-    {
-      assert( line->nb_words == 3 );
-      _env_var_method = LOCAL_GAUSSIANS_VAR;
-      _env_var_seed = atoi( line->words[2] );
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown environment variation method.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "ENV_NOISE" ) == 0 )
-  {
-    static bool env_noise_already_set = false;
-    if ( env_noise_already_set )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : duplicate entry for %s.\n",
-              _param_file_name, cur_line, line->words[0] );
-      exit( EXIT_FAILURE );
-    }
-    env_noise_already_set = true;
-
-    if ( strcmp( line->words[1], "none" ) == 0 )
-    {
-      assert( line->nb_words == 2 );
-      _env_noise_method = NO_NOISE;
-    }
-    else if ( strcmp( line->words[1], "FRACTAL" ) == 0 )
-    {
-			assert( line->nb_words == 6 );
-      _env_noise_method = FRACTAL;
-      _env_noise_sampling_log = atoi( line->words[2] );
-      _env_noise_sigma = atof( line->words[3] );
-      _env_noise_alpha = atof( line->words[4] );
-      _env_noise_prob = atof( line->words[5] );
-      _env_noise_seed = atoi( line->words[6] );
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown environment noise method.\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "SECRETION_CONTRIB_TO_FITNESS" ) == 0 )
-  {
-    _secretion_contrib_to_fitness = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "SECRETION_DIFFUSION_PROP" ) == 0 )
-  {
-    _secretion_diffusion_prop = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "SECRETION_DEGRADATION_PROP" ) == 0 )
-  {
-    _secretion_degradation_prop = atof( line->words[1] );
-    if ( _secretion_degradation_prop > 1 || _secretion_degradation_prop < 0 )
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : degradation must be in (0,1).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "SECRETION_INITIAL" ) == 0 )
-  {
-    _secretion_init = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "SECRETION_COST" ) == 0 )
-  {
-    _secretion_cost = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "ALLOW_PLASMIDS" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _allow_plasmids = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _allow_plasmids = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown allow_plasmids option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "PLASMID_INITIAL_LENGTH" ) == 0 )
-  {
-    _plasmid_initial_length = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "PLASMID_INITIAL_GENE" ) == 0 )
-  {
-    _plasmid_initial_gene = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "PLASMID_MINIMAL_LENGTH" ) == 0 )
-  {
-    _plasmid_minimal_length = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "PLASMID_MAXIMAL_LENGTH" ) == 0 )
-  {
-    _plasmid_maximal_length = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "CHROMOSOME_MINIMAL_LENGTH" ) == 0 )
-  {
-    _chromosome_minimal_length = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "CHROMOSOME_MAXIMAL_LENGTH" ) == 0 )
-  {
-    _chromosome_maximal_length = atoi( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "PROB_PLASMID_HT" ) == 0 )
-  {
-    _prob_plasmid_HT = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TUNE_DONOR_ABILITY" ) == 0 )
-  {
-    _tune_donor_ability = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "TUNE_RECIPIENT_ABILITY" ) == 0 )
-  {
-    _tune_recipient_ability = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "DONOR_COST" ) == 0 )
-  {
-    _donor_cost = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "RECIPIENT_COST" ) == 0 )
-  {
-    _recipient_cost = atof( line->words[1] );
-  }
-  else if ( strcmp( line->words[0], "COMPUTE_PHEN_CONTRIB_BY_GU" ) == 0 )
-  {
-    if ( strncmp( line->words[1], "true", 4 ) == 0 )
-    {
-      _compute_phen_contrib_by_GU = true;
-    }
-    else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-    {
-      _compute_phen_contrib_by_GU = false;
-    }
-    else
-    {
-      printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown compute_phen_contrib_by_GU option (use true/false).\n",
-              _param_file_name, cur_line );
-      exit( EXIT_FAILURE );
-    }
-  }
-  else if ( strcmp( line->words[0], "LOG" ) == 0 )
-  {
-    for ( int8_t i = 1 ; i < line->nb_words ; i++ )
-    {
-      if ( strcmp( line->words[i], "TRANSFER" ) == 0 )
-      {
-        _logs |= LOG_TRANSFER;
-      }
-      else if ( strcmp( line->words[i], "REAR" ) == 0 )
-      {
-        _logs |= LOG_REAR;
-      }
-      else if ( strcmp( line->words[i], "BARRIER" ) == 0 )
-      {
-        _logs |= LOG_BARRIER;
-      }
-      /*else if ( strcmp( line->words[i], "LOADS" ) == 0 )
-      {
-        tmp_to_be_logged |= LOG_LOADS;
-      }   */
-      else
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown log option %s.\n",
-                _param_file_name, cur_line, line->words[1] );
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-  #ifdef __REGUL
-    else if ( strcmp( line->words[0], "HILL_SHAPE_N" ) == 0 )
-    {
-      _hill_shape_n = atof( line->words[1] );
-    }
-    else if ( strcmp( line->words[0], "HILL_SHAPE_THETA" ) == 0 )
-    {
-      _hill_shape_theta = atof( line->words[1] );
-    }
-    else if ( strcmp( line->words[0], "DEGRADATION_RATE" ) == 0 )
-    {
-      _degradation_rate = atof( line->words[1] );
-    }
-    else if ( strcmp( line->words[0], "DEGRADATION_STEP" ) == 0 )
-    {
-      _degradation_step = atof( line->words[1] );
-      // Check that 1/degradation_step is an integer
-      if( 1/_degradation_step != ((int) 1/_degradation_step) )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : DEGRADATION STEP\n",
-               _param_file_name, cur_line );
-        printf( "This step has to divide 1.\n");
-        exit( EXIT_FAILURE );
-      }
-    }
-    else if ( strcmp( line->words[0], "INDIVIDUAL_EVALUATION_DATES" ) == 0 )
-    {
-      _individual_evaluation_nbr = line->nb_words - 1;
-      if( _individual_evaluation_nbr == 0 )
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : no evaluation dates provided\n",
-               _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-      ae_array_short* individual_evaluation_dates  = new ae_array_short( _individual_evaluation_nbr );
-      for( int16_t i = 0 ; i < _individual_evaluation_nbr ; i++ )
-      {
-        individual_evaluation_dates->set_value( i, atoi( line->words[1 + i] ) );
-      }
-      individual_evaluation_dates->sort();
-      _individual_evaluation_dates = individual_evaluation_dates;
-    }
-    else if ( strcmp( line->words[0], "BINDING_ZEROS_PERCENTAGE" ) == 0 )
-    {
-      _binding_zeros_percentage = atof( line->words[1] );
-    }
-    else if ( strcmp( line->words[0], "WITH_HEREDITY" ) == 0 )
-    {
-      if ( strncmp( line->words[1], "true", 4 ) == 0 )
-      {
-        _with_heredity = true;
-      }
-      else if ( strncmp( line->words[1], "false", 5 ) == 0 )
-      {
-        _with_heredity = false;
-      }
-      else
-      {
-        printf( "ERROR in param file \"%s\" on line %"PRId32" : unknown with_heredity option (use true/false).\n",
-               _param_file_name, cur_line );
-        exit( EXIT_FAILURE );
-      }
-    }
-    else if ( strcmp( line->words[0], "PROTEIN_PRESENCE_LIMIT" ) == 0 )
-    {
-      _protein_presence_limit = atof( line->words[1] );
-    }
-  #endif
-
-  else
-  {
-    printf( "ERROR in param file \"%s\" on line %"PRId32" : undefined key word \"%s\"\n", _param_file_name, cur_line, line->words[0] );
-    exit( EXIT_FAILURE );
-  }
-}
-
-void param_loader::read_file( void )
-{
-  // The rewind is only necessary when using multiple param files
-  rewind( _param_file );
-
-  int32_t cur_line = 0;
-  f_line* line;
-
-
-  while ( ( line = get_line(&cur_line) ) != NULL ) // TODO : write line = new f_line( _param_file ) => f_line::f_line( char* )
-  {
-    interpret_line( line, cur_line );
-    delete line;
-  }
-}
-
-
-void param_loader::load( ae_exp_manager* exp_m, bool verbose, char* chromosome, int32_t lchromosome, char* plasmid, int32_t lplasmid )
-{
-  // Check consistency of min, max and initial length of chromosome and plasmid
-  // Default for by GU minimal or maximal size is -1.
-  // If equal to -1, maximal sizes of each GU will be replaced by total maximal size for the whole genome
-
-  if (_allow_plasmids)
-  {
-    if (_plasmid_initial_gene!=1) // the plasmid will be copied from the chromosome
-    {
-      if (_plasmid_initial_length != -1)
-      {
-        printf("WARNING: PLASMID_INITIAL_LENGTH is not taken into account because PLASMID_INITIAL_GENE is set to 0 (copy from chromosome)\n");
-        _plasmid_initial_length = _chromosome_initial_length;
-      }
-    }
-    if (_plasmid_maximal_length == -1)
-    {
-      _plasmid_maximal_length = _max_genome_length;
-    }
-    if(_plasmid_minimal_length > _plasmid_initial_length)
-    {
-      printf("ERROR: PLASMID_INITIAL_LENGTH is lower than PLASMID_MINIMAL_LENGTH\n");
-      exit( EXIT_FAILURE );
-    }
-    if (_plasmid_maximal_length < _plasmid_initial_length)
-    {
-      printf("ERROR: PLASMID_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n");
-      exit( EXIT_FAILURE );
-    }
-  }
-  if (_chromosome_maximal_length == -1)
-  {
-    _chromosome_maximal_length = _max_genome_length;
-  }
-  if (_chromosome_minimal_length > _chromosome_initial_length)
-  {
-    printf("ERROR: CHROMOSOME_INITIAL_LENGTH is lower than CHROMOSOME_MINIMAL_LENGTH\n");
-    exit( EXIT_FAILURE );
-  }
-  if (_chromosome_maximal_length < _chromosome_initial_length)
-  {
-    printf("ERROR: CHROMOSOME_INITIAL_LENGTH is higher than PLASMID_MAXIMAL_LENGTH\n");
-    exit( EXIT_FAILURE );
-  }
-
-  // Check for incompatible environment options
-  if ( ( _env_custom_points != NULL) && ( _env_gaussians != NULL))
-  {
-    printf( "ERROR in param file \"%s\" : ENV_ADD_POINT is incompatible with ENV_ADD_GAUSSIAN (or ENV_GAUSSIAN).\n",
-           _param_file_name );
-    exit( EXIT_FAILURE );
-
-  }
-
-  if ( ( _env_custom_points != NULL) && ( _env_var_method != NO_VAR))
-  {
-    printf( "ERROR in param file \"%s\" : ENV_ADD_POINT is incompatible with environmental variation.\n",
-           _param_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-
-  // Initialize _prng
-  // This one will be used to create the initial genome(s) and to generate seeds for other prng
-  _prng = new ae_jumping_mt( _seed );
-
-  // Initialize mut_prng, stoch_prng, spatial_struct_prng :
-  // if mut_seed (respectively stoch_seed) not given in param.in, choose it at random
-  int32_t selection_seed = _prng->random( 1000000 );
-  if ( _mut_seed == 0 ) {
-    _mut_seed = _prng->random( 1000000 );
-  }
-  if ( _stoch_seed == 0 ) {
-    _stoch_seed = _prng->random( 1000000 );
-  }
-  ae_jumping_mt * mut_prng    = new ae_jumping_mt( _mut_seed );
-  ae_jumping_mt * stoch_prng  = new ae_jumping_mt( _stoch_seed );
-  ae_jumping_mt * selection_prng = new ae_jumping_mt( selection_seed );
-  ae_jumping_mt * spatial_struct_prng = NULL;
-  if ( _spatially_structured )
-    {
-      int32_t spatial_struct_seed = _prng->random( 1000000 );
-      spatial_struct_prng = new ae_jumping_mt( spatial_struct_seed );
-    }
-
-
-  // Create aliases (syntaxic sugars)
-  ae_exp_setup*       exp_s     = exp_m->get_exp_s();
-  ae_population*      pop       = exp_m->get_pop();
-  ae_environment*     env       = exp_m->get_env();
-  ae_selection*       sel       = exp_m->get_sel();
-  ae_output_manager*  output_m  = exp_m->get_output_m();
-
-  // If the population is spatially structured,
-  // check that the population fits in the spatial structure
-  if ( _spatially_structured )
-  {
-    if ( _init_pop_size != _grid_width * _grid_height )
-    {
-      printf( "ERROR: the number of individuals does not match the size of the grid\n" );
-      exit( EXIT_FAILURE );
-    }
-  }
-
-  // 1) ------------------------------------- Initialize the experimental setup
-  sel->set_prng( selection_prng );
-
-  // ---------------------------------------------------------------- Selection
-  sel->set_selection_scheme( _selection_scheme );
-  sel->set_selection_pressure( _selection_pressure );
-
-  // ----------------------------------------------------------------- Transfer
-  exp_s->set_with_HT( _with_HT );
-  exp_s->set_repl_HT_with_close_points( _repl_HT_with_close_points );
-  exp_s->set_HT_ins_rate( _HT_ins_rate );
-  exp_s->set_HT_repl_rate( _HT_repl_rate );
-  exp_s->set_repl_HT_detach_rate( _repl_HT_detach_rate );
-
-  // ----------------------------------------------------------------- Plasmids
-  exp_s->set_with_plasmids( _allow_plasmids );
-  exp_s->set_prob_plasmid_HT( _prob_plasmid_HT );
-  exp_s->set_tune_donor_ability( _tune_donor_ability );
-  exp_s->set_tune_recipient_ability( _tune_recipient_ability );
-  exp_s->set_donor_cost( _donor_cost );
-  exp_s->set_recipient_cost( _recipient_cost );
-  exp_s->set_swap_GUs( _swap_GUs );
-  output_m->set_compute_phen_contrib_by_GU( _compute_phen_contrib_by_GU );
-
-  // -------------------------------------------------------- Spatial structure
-  if ( _spatially_structured )
-  {
-    exp_m->set_spatial_structure( _grid_width,
-                                  _grid_height,
-                                  spatial_struct_prng );
-    ae_spatial_structure* sp_struct = exp_m->get_spatial_structure();
-    sp_struct->set_secretion_degradation_prop( _secretion_degradation_prop );
-    sp_struct->set_secretion_diffusion_prop( _secretion_diffusion_prop );
-    sp_struct->set_migration_number( _migration_number );
-  }
-
-  // ---------------------------------------------------------------- Secretion
-  exp_s->set_with_secretion( _with_secretion );
-  exp_s->set_secretion_contrib_to_fitness( _secretion_contrib_to_fitness );
-  exp_s->set_secretion_cost( _secretion_cost );
-
-
-  // 2) ------------------------------------------------ Create the environment
-  // Move the gaussian list and the list of custom points from the parameters
-  // to the environment
-  env->set_gaussians( _env_gaussians );
-  _env_gaussians = NULL;
-  env->set_custom_points( _env_custom_points );
-  _env_custom_points = NULL;
-
-  // Copy the sampling
-  env->set_sampling( _env_sampling );
-
-  // Set the environment segmentation
-  if( (_env_axis_features != NULL) && (_env_axis_segment_boundaries != NULL)  )
-    {
-      // if param.in contained a line starting with ENV_AXIS_FEATURES,
-      // we use the values indicated on this line
-      env->set_segmentation( _env_axis_nb_segments,
-                         _env_axis_segment_boundaries,
-                         _env_axis_features,
-                         _env_axis_separate_segments );
-    } // else we leave the ae_environment as it is by default (one "metabolic" segment from X_MIN to XMAX)
-
-
-  // Set environmental variation
-  if ( _env_var_method != NO_VAR )
-  {
-    env->set_var_method( _env_var_method );
-    env->set_var_prng( new ae_jumping_mt( _env_var_seed ) );
-    env->set_var_sigma_tau( _env_var_sigma, _env_var_tau );
-  }
-
-  // Set environmental noise
-  if ( _env_noise_method != NO_NOISE )
-  {
-    env->set_noise_method( _env_noise_method );
-    env->set_noise_sampling_log( _env_noise_sampling_log );
-    env->set_noise_prng( new ae_jumping_mt( _env_noise_seed ) );
-    env->set_noise_alpha( _env_noise_alpha );
-    env->set_noise_sigma( _env_noise_sigma );
-    env->set_noise_prob( _env_noise_prob  );
-  }
-
-  // Build the environment
-  env->build();
-
-  if ( verbose )
-  {
-    printf( "Entire geometric area of the environment : %f\n", env->get_geometric_area() );
-  }
-
-
-  // 3) --------------------------------------------- Create the new population
-  pop->set_mut_prng( mut_prng );
-  pop->set_stoch_prng( stoch_prng );
-
-  // Generate a model ae_mut_param object
-  ae_params_mut* param_mut = new ae_params_mut();
-  param_mut->set_point_mutation_rate( _point_mutation_rate );
-  param_mut->set_small_insertion_rate( _small_insertion_rate );
-  param_mut->set_small_deletion_rate( _small_deletion_rate );
-  param_mut->set_max_indel_size( _max_indel_size );
-  param_mut->set_with_4pts_trans( _with_4pts_trans );
-  param_mut->set_with_alignments( _with_alignments );
-  param_mut->set_with_HT( _with_HT );
-  param_mut->set_repl_HT_with_close_points( _repl_HT_with_close_points );
-  param_mut->set_HT_ins_rate( _HT_ins_rate );
-  param_mut->set_HT_repl_rate( _HT_repl_rate );
-  param_mut->set_repl_HT_detach_rate( _repl_HT_detach_rate );
-  param_mut->set_duplication_rate( _duplication_rate );
-  param_mut->set_deletion_rate( _deletion_rate );
-  param_mut->set_translocation_rate( _translocation_rate );
-  param_mut->set_inversion_rate( _inversion_rate );
-  param_mut->set_neighbourhood_rate( _neighbourhood_rate );
-  param_mut->set_duplication_proportion( _duplication_proportion );
-  param_mut->set_deletion_proportion( _deletion_proportion );
-  param_mut->set_translocation_proportion( _translocation_proportion );
-  param_mut->set_inversion_proportion( _inversion_proportion );
-
-  ae_individual* indiv        = NULL;
-  int32_t        id_new_indiv = 0;
-
-  if (chromosome != NULL)
-  {
-    printf("Option -c is used: chromosome will be loaded from a text file\n");
-    ae_individual* indiv = new ae_individual( exp_m,
-                                              pop->get_mut_prng(),
-                                              pop->get_stoch_prng(),
-                                              param_mut,
-                                              _w_max,
-                                              _min_genome_length,
-                                              _max_genome_length,
-                                              _allow_plasmids,
-                                              id_new_indiv++,
-                                              _strain_name,
-                                              0 );
-
-    indiv->add_GU( chromosome, lchromosome );
-    indiv->get_genetic_unit(0)->set_min_gu_length(_chromosome_minimal_length);
-    indiv->get_genetic_unit(0)->set_max_gu_length(_chromosome_maximal_length);
-
-    if (plasmid != NULL)
-    {
-      printf("Option -p is used: plasmid will be loaded from a text file\n");
-      if (! _allow_plasmids)
-      {
-        printf( "ERROR: option -p requires ALLOW_PLASMIDS set to true\n" );
-        exit( EXIT_FAILURE );
-      }
-      indiv->add_GU( plasmid, lplasmid );
-      indiv->get_genetic_unit(1)->set_min_gu_length(_plasmid_minimal_length);
-      indiv->get_genetic_unit(1)->set_max_gu_length(_plasmid_maximal_length);
-    }
-    else if (_allow_plasmids)
-    {
-      printf( "ERROR: if you use option -c and ALLOW_PLASMIDS is set to true, you must also use option -p. \n For now loading a genetic unit from text file and generating the other is not supported.\n" );
-      exit( EXIT_FAILURE );
-    }
-
-    indiv->set_with_stochasticity( _with_stochasticity );
-    indiv->compute_statistical_data();
-    indiv->evaluate( exp_m->get_env() );
-    printf("Starting with a clonal population of individual with metabolic error %f and secretion error %f \n",indiv->get_dist_to_target_by_feature(METABOLISM),indiv->get_dist_to_target_by_feature(SECRETION));
-    pop->add_indiv( indiv );
-
-    // Make the clones and add them to the list of individuals
-    ae_individual* clone = NULL;
-    for ( int32_t i = 1 ; i < _init_pop_size ; i++ )
-    {
-      clone = create_clone( indiv, id_new_indiv++ );
-      pop->add_indiv( clone );
-    }
-    pop->sort_individuals();
-  }
-  else if (plasmid != NULL)
-  {
-    printf( "ERROR: option -p can only be used in combination with option -c for now\n" );
-    exit( EXIT_FAILURE );
-  }
-  else if ( _init_method & ONE_GOOD_GENE )
-  {
-    if ( _init_method & CLONE )
-    {
-      // Create an individual with a "good" gene (in fact, make an indiv whose
-      // fitness is better than that corresponding to a flat phenotype)
-      // and set its id
-      indiv = create_random_individual_with_good_gene( exp_m, param_mut, id_new_indiv++ );
-      indiv->get_genetic_unit(0)->set_min_gu_length(_chromosome_minimal_length);
-      indiv->get_genetic_unit(0)->set_max_gu_length(_chromosome_maximal_length);
-      if (_allow_plasmids)
-      {
-        indiv->get_genetic_unit(1)->set_min_gu_length(_plasmid_minimal_length);
-        indiv->get_genetic_unit(1)->set_max_gu_length(_plasmid_maximal_length);
-      }
-
-      indiv->set_with_stochasticity( _with_stochasticity );
-
-      // Add it to the list
-      pop->add_indiv( indiv );
-
-      // Make the clones and add them to the list of individuals
-      ae_individual* clone = NULL;
-      for ( int32_t i = 1 ; i < _init_pop_size ; i++ )
-      {
-        // Create a clone, setting its id
-        clone = create_clone( indiv, id_new_indiv++ );
-
-        #ifdef DISTRIBUTED_PRNG
-          #error Not implemented yet !
-          indiv->do_prng_jump();
-        #endif
-
-        // Add it to the list
-        pop->add_indiv( clone );
-      }
-      pop->sort_individuals();
-    }
-    else // if ( ! CLONE )
-    {
-      for ( int32_t i = 0 ; i < _init_pop_size ; i++ )
-      {
-        // Create an individual and set its id
-        indiv = create_random_individual_with_good_gene( exp_m, param_mut, id_new_indiv++ );
-        indiv->get_genetic_unit(0)->set_min_gu_length(_chromosome_minimal_length);
-        indiv->get_genetic_unit(0)->set_max_gu_length(_chromosome_maximal_length);
-        if (_allow_plasmids)
-        {
-          indiv->get_genetic_unit(1)->set_min_gu_length(_plasmid_minimal_length);
-          indiv->get_genetic_unit(1)->set_max_gu_length(_plasmid_maximal_length);
-        }
-
-        // Add it to the list
-        pop->add_indiv( indiv );
-      }
-
-      pop->sort_individuals();
-    }
-  }
-  else // if ( ! ONE_GOOD_GENE )
-  {
-    if ( _init_method & CLONE )
-    {
-      // Create a random individual and set its id
-      indiv = create_random_individual( exp_m, param_mut, id_new_indiv++ );
-      indiv->get_genetic_unit(0)->set_min_gu_length(_chromosome_minimal_length);
-      indiv->get_genetic_unit(0)->set_max_gu_length(_chromosome_maximal_length);
-      if (_allow_plasmids)
-      {
-        indiv->get_genetic_unit(1)->set_min_gu_length(_plasmid_minimal_length);
-        indiv->get_genetic_unit(1)->set_max_gu_length(_plasmid_maximal_length);
-      }
-
-      // Add it to the list
-      pop->add_indiv( indiv );
-
-      // Make the clones and add them to the list of individuals
-      ae_individual* clone = NULL;
-      for ( int32_t i = 1 ; i < _init_pop_size ; i++ )
-      {
-        // Create a clone, setting its id
-        clone = create_clone( indiv, id_new_indiv++ );
-
-        #ifdef DISTRIBUTED_PRNG
-          #error Not implemented yet !
-          indiv->do_prng_jump();
-        #endif
-
-        // Add it to the list
-        pop->add_indiv( clone );
-      }
-      pop->sort_individuals();
-    }
-    else // if ( ! CLONE )
-    {
-      for ( int32_t i = 0 ; i < _init_pop_size ; i++ )
-      {
-        // Create a random individual and set its id
-        indiv = create_random_individual( exp_m, param_mut, id_new_indiv++ );
-        indiv->get_genetic_unit(0)->set_min_gu_length(_chromosome_minimal_length);
-        indiv->get_genetic_unit(0)->set_max_gu_length(_chromosome_maximal_length);
-        if (_allow_plasmids)
-        {
-          indiv->get_genetic_unit(1)->set_min_gu_length(_plasmid_minimal_length);
-          indiv->get_genetic_unit(1)->set_max_gu_length(_plasmid_maximal_length);
-        }
-
-        // Add it to the list
-        pop->add_indiv( indiv );
-      }
-
-      pop->sort_individuals();
-    }
-  }
-
-  // If the population is spatially structured, set each individual's position
-  if ( exp_m->is_spatially_structured() )
-  {
-    int16_t x, y;
-    int16_t x_max = exp_m->get_grid_width();
-    int16_t y_max = exp_m->get_grid_height();
-    ae_grid_cell* grid_cell = NULL;
-
-    ae_list_node<ae_individual*>* indiv_node = pop->get_indivs()->get_first();
-    ae_individual*  indiv = NULL;
-
-    while ( indiv_node != NULL )
-    {
-      indiv = indiv_node->get_obj();
-
-      do
-      {
-        x = exp_m->get_spatial_structure()->get_prng()->random( x_max );
-        y = exp_m->get_spatial_structure()->get_prng()->random( y_max );
-        grid_cell = exp_m->get_grid_cell( x, y );
-      } while ( grid_cell->get_individual() != NULL );
-
-      grid_cell->set_individual( indiv );
-
-      indiv_node = indiv_node->get_next();
-    }
-  }
-
-
-
-  // 4) ------------------------------------------ Set the recording parameters
-  output_m->set_backup_step( _backup_step );
-  output_m->set_big_backup_step( _big_backup_step );
-
-  if ( _record_tree )
-  {
-    output_m->init_tree( exp_m, _tree_mode, _tree_step );
-  }
-
-  if ( _make_dumps )
-  {
-    output_m->set_dump_step( _dump_step );
-  }
-  output_m->set_logs( _logs );
-
-  delete param_mut;
-}
-
-
-
-// =================================================================
-//                           Protected Methods
-// =================================================================
-/*!
-  \brief Format a line by parsing it and the words inside
-
-  \param formated_line the resulted formated line
-  \param line original line in char*
-  \param line_is_interpretable boolean with about the possible intrepretation of the line
-*/
-void param_loader::format_line( f_line* formated_line, char* line, bool* line_is_interpretable )
-{
-  int16_t i = 0;
-  int16_t j;
-
-  // Parse line
-  while ( line[i] != '\n' && line[i] != '\0' && line[i] != '\r' )
-  {
-    j = 0;
-
-    // Flush white spaces and tabs
-    while ( line[i] == ' ' || line[i] == 0x09 ) i++; // 0x09 is the ASCII code for TAB
-
-    // Check comments
-    if ( line[i] == '#' ) break;
-
-    // If we got this far, there is content in the line
-    *line_is_interpretable = true;
-
-    // Parse word
-    while ( line[i] != ' '  && line[i] != '\n' && line[i] != '\0' && line[i] != '\r' )
-    {
-      formated_line->words[formated_line->nb_words][j++] = line[i++];
-    }
-
-    // Add '\0' at end of word if it's not empty (line ending with space or tab)
-    if ( j != 0 )
-    {
-      formated_line->words[formated_line->nb_words++][j] = '\0';
-    }
-  }
-}
-
-/*!
-  \brief Get a line in a file and format it
-
-  \return line (pointer)
-
-  \see format_line(f_line* formated_line, char* line, bool* line_is_interpretable )
-*/
-f_line* param_loader::get_line( int32_t* cur_line_ptr ) // void
-{
-  char line[255];
-  f_line* formated_line = new f_line();
-
-  bool found_interpretable_line = false; // Found line that is neither a comment nor empty
-
-  while ( !feof( _param_file ) && !found_interpretable_line )
-  {
-    if ( !fgets( line, 255, _param_file ) )
-    {
-      delete formated_line;
-      return NULL;
-    }
-    (*cur_line_ptr)++;
-    format_line( formated_line, line, &found_interpretable_line );
-  }
-
-  if ( found_interpretable_line )
-  {
-    return formated_line;
-  }
-  else
-  {
-    delete formated_line;
-    return NULL;
-  }
-}
-
-/*!
-  \brief Create an individual with random sequences
-
-  \param exp_m global exp_manager
-  \param param_mut mutation parameter of the newly created individual
-  \param id index of newly created individual in the population
-  \return clone of dolly
-*/
-ae_individual* param_loader::create_random_individual( ae_exp_manager* exp_m, ae_params_mut* param_mut, int32_t id ) const
-{
-  // Generate a random genome
-  char * random_genome = new char [_chromosome_initial_length + 1];
-  for ( int32_t i = 0 ; i < _chromosome_initial_length ; i++ )
-  {
-    random_genome[i] = '0' + _prng->random( NB_BASE );
-  }
-  random_genome[_chromosome_initial_length] = 0;
-
-
-  // ------------------------------------------------------- Global constraints
-  // Create an individual with this genome and set its id
-  #ifdef DISTRIBUTED_PRNG
-    #error Not implemented yet !
-  #endif
-  ae_individual* indiv = new ae_individual( exp_m,
-                                            exp_m->get_pop()->get_mut_prng(),
-                                            exp_m->get_pop()->get_stoch_prng(),
-                                            param_mut,
-                                            _w_max,
-                                            _min_genome_length,
-                                            _max_genome_length,
-                                            _allow_plasmids,
-                                            id,
-                                            _strain_name,
-                                            0 );
-
-
-  indiv->add_GU( random_genome, _chromosome_initial_length );
-
-  if (_allow_plasmids) // We create a plasmid
-  {
-    char * plasmid_genome;
-    if ( _plasmid_initial_gene == 1 ) // Then the plasmid is generated independently from the chromosome
-    {
-      plasmid_genome = new char [_plasmid_initial_length + 1]; // As ae_dna constructor do not allocate memory but directly use the provided string, we allocate the memory here.
-      for ( int32_t i = 0 ; i < _plasmid_initial_length ; i++ )
-      {
-        plasmid_genome[i] = '0' + _prng->random( NB_BASE );
-      }
-      plasmid_genome[_plasmid_initial_length] = 0;
-      indiv->add_GU( plasmid_genome, _plasmid_initial_length );
-    }
-    else // The plasmid has the same genome than the chromosome
-    {
-      plasmid_genome = new char [_chromosome_initial_length + 1]; // As ae_dna constructor do not allocate memory but directly use the provided string, we allocate the memory here.
-      strncpy(plasmid_genome,random_genome,_chromosome_initial_length+1);
-      indiv->add_GU( plasmid_genome, _chromosome_initial_length );
-    }
-    plasmid_genome = NULL; // should not be deleted since it is now the plasmid dna
-  }
-
-  random_genome = NULL; // should not be deleted since it is now the chromosomal dna
-
-  // Insert a few IS in the sequence
-  /*if ( ae_common::init_params->get_init_method() & WITH_INS_SEQ )
-  {
-    // Create a random sequence
-    int32_t seq_len = 50;
-    char* ins_seq = new char[seq_len+1];
-    int16_t nb_insert = 50;
-    int16_t nb_invert = 50;
-
-    for ( int32_t i = 0 ; i < seq_len ; i++ )
-    {
-      ins_seq[i] = '0' + ae_common::sim->prng->random( NB_BASE );
-    }
-    ins_seq[seq_len] = '\0';
-
-
-    // Insert the sequence at random positions
-    ae_mutation* mut1 = NULL;
-    for ( int16_t i = 0 ; i < nb_insert ; i++ )
-    {
-      mut1 = indiv->get_genetic_unit(0)->get_dna()->do_insertion( ins_seq, seq_len );
-      delete mut1;
-    }
-
-
-    // Invert the sequence and insert it at random positions
-    char* inverted_seq = new char[seq_len+1];
-    for ( int32_t i = 0 ; i < seq_len ; i++ )
-    {
-      inverted_seq[i] = (ins_seq[seq_len-1-i] == '1') ? '0' : '1';
-    }
-    inverted_seq[seq_len] = '\0';
-
-    for ( int16_t i = 0 ; i < nb_invert ; i++ )
-    {
-      mut1 = indiv->get_genetic_unit(0)->get_dna()->do_insertion( inverted_seq, seq_len );
-      delete mut1;
-    }
-
-    delete [] ins_seq;
-    delete [] inverted_seq;
-  }*/
-
-  // Evaluate the newly created individual
-  indiv->evaluate( exp_m->get_env() );
-
-  return indiv;
-}
-
-/*!
-  \brief Create an individual with random sequences. The individual have to have at least one good functional gene
-
-  \param exp_m global exp_manager
-  \param param_mut mutation parameter of the newly created individual
-  \param id index of newly created individual in the population
-  \return clone of dolly
-*/
-ae_individual* param_loader::create_random_individual_with_good_gene( ae_exp_manager* exp_m, ae_params_mut* param_mut, int32_t id ) const
-{
-  // Create a random individual and evaluate it
-  ae_individual* indiv = create_random_individual( exp_m, param_mut, id );
-
-  // While the created individual is not better than the flat individual (indiv whith no metabolic gene),
-  // we delete it and replace it by another random individual
-  double env_metabolic_area;
-
-  env_metabolic_area = exp_m->get_env()->get_area_by_feature( METABOLISM );
-
-  // If there are plasmids, make sure there is at least one metabolic gene on each genetic units
-  if ( _allow_plasmids )
-  {
-    if ( _plasmid_initial_gene == 1 )
-    {
-      while ( indiv->get_genetic_unit(0)->get_dist_to_target_by_feature( METABOLISM ) >= env_metabolic_area  ||
-              indiv->get_genetic_unit(1)->get_dist_to_target_by_feature( METABOLISM ) >= env_metabolic_area  )
-      {
-        delete indiv;
-        indiv = create_random_individual( exp_m, param_mut, id );
-      }
-    }
-    else
-    {
-      // here things work the same as before, but in the constructor of the individual,
-      // a single genetic unit is created and then copied from the chromosome to the plasmid
-      while ( indiv->get_dist_to_target_by_feature( METABOLISM ) >= env_metabolic_area )
-      {
-        delete indiv;
-        indiv = create_random_individual( exp_m, param_mut, id );
-      }
-    }
-  }
-  else
-  {
-    while ( indiv->get_dist_to_target_by_feature( METABOLISM ) >= env_metabolic_area )
-    {
-      delete indiv;
-      indiv = create_random_individual( exp_m, param_mut, id );
-    }
-  }
-
-  // Compute the "good" individual's statistics
-  indiv->compute_statistical_data();
-
-  //~ printf( "metabolic error of the generated individual : %f (%"PRId32" gene(s))\n",
-          //~ indiv->get_dist_to_target_by_feature(METABOLISM), indiv->get_protein_list()->get_nb_elts() );
-
-  return indiv;
-}
-
-/*!
-  \brief Create of clone of an ae_individual
-
-  \param dolly original individual that would be cloned
-  \param id index of the clone in the population
-  \return clone of dolly
-*/
-ae_individual* param_loader::create_clone( ae_individual* dolly, int32_t id ) const
-{
-  ae_individual* indiv;
-
-  indiv = new ae_individual( *dolly, false );
-
-
-  //~ #ifdef __X11
-    //~ indiv = new ae_individual_X11( *(dynamic_cast<ae_individual_X11*>(dolly)), false );
-  //~ #else
-    //~ indiv = new ae_individual( *dolly, false );
-  //~ #endif
-
-  indiv->set_id( id );
-  //~ printf( "metabolic error of the clonal individual : %f (%"PRId32" gene(s))\n",
-          //~ indiv->get_dist_to_target_by_feature(METABOLISM), indiv->get_protein_list()->get_nb_elts());
-  return indiv;
-}
-
-void param_loader::print_to_file( FILE* file )
-{
-  // ------------------------------------------------------------ Constraints
-  fprintf( file, "\nConstraints ---------------------------------------------\n" );
-  fprintf( file, "min_genome_length :          %"PRId32"\n", _min_genome_length       );
-  fprintf( file, "max_genome_length :          %"PRId32"\n", _max_genome_length       );
-  fprintf( file, "W_MAX :                      %f\n",        _w_max                   );
-
-  // --------------------------------------------------------- Mutation rates
-  fprintf( file, "\nMutation rates ------------------------------------------\n" );
-  fprintf( file, "point_mutation_rate :        %e\n",  _point_mutation_rate        );
-  fprintf( file, "small_insertion_rate :       %e\n",  _small_insertion_rate       );
-  fprintf( file, "small_deletion_rate :        %e\n",  _small_deletion_rate        );
-  fprintf( file, "max_indel_size :             %"PRId16"\n", _max_indel_size       );
-
-  // -------------------------------------------- Rearrangements and Transfer
-  fprintf( file, "\nRearrangements and Transfer -----------------------------\n" );
-  fprintf( file, "with_4pts_trans :            %s\n",  _with_4pts_trans? "true" : "false" );
-  fprintf( file, "with_alignments :            %s\n",  _with_alignments? "true" : "false" );
-  fprintf( file, "with_HT :                    %s\n",  _with_HT? "true" : "false"   );
-  fprintf( file, "repl_HT_with_close_points :  %s\n",  _repl_HT_with_close_points? "true" : "false"   );
-  fprintf( file, "HT_ins_rate :                %e\n",  _HT_ins_rate );
-  fprintf( file, "HT_repl_rate :               %e\n",  _HT_repl_rate );
-
-  // ---------------------------------------------------- Rearrangement rates
-  if ( _with_alignments )
-  {
-    fprintf( file, "\nRearrangement rates (with alignements) ------------------\n" );
-    fprintf( file, "neighbourhood_rate :         %e\n",  _neighbourhood_rate         );
-    fprintf( file, "duplication_proportion :     %e\n",  _duplication_proportion     );
-    fprintf( file, "deletion_proportion :        %e\n",  _deletion_proportion        );
-    fprintf( file, "translocation_proportion :   %e\n",  _translocation_proportion   );
-    fprintf( file, "inversion_proportion :       %e\n",  _inversion_proportion       );
-  }
-  else
-  {
-    fprintf( file, "\nRearrangement rates (without alignements) ----------------\n" );
-    fprintf( file, "duplication_rate :           %e\n",  _duplication_rate           );
-    fprintf( file, "deletion_rate :              %e\n",  _deletion_rate              );
-    fprintf( file, "translocation_rate :         %e\n",  _translocation_rate         );
-    fprintf( file, "inversion_rate :             %e\n",  _inversion_rate             );
-  }
-
-  // ------------------------------------------------------------ Alignements
-  fprintf( file, "\nAlignements ---------------------------------------------\n" );
-  fprintf( file, "align_fun_shape :            %"PRId16"\n", (int16_t) _align_fun_shape       );
-  fprintf( file, "align_sigm_lambda :          %f\n",        _align_sigm_lambda     );
-  fprintf( file, "align_sigm_mean :            %"PRId16"\n", _align_sigm_mean       );
-  fprintf( file, "align_lin_min :              %"PRId16"\n", _align_lin_min         );
-  fprintf( file, "align_lin_max :              %"PRId16"\n", _align_lin_max         );
-  fprintf( file, "align_max_shift :            %"PRId16"\n", _align_max_shift       );
-  fprintf( file, "align_w_zone_h_len :         %"PRId16"\n", _align_w_zone_h_len    );
-  fprintf( file, "align_match_bonus :          %"PRId16"\n", _align_match_bonus     );
-  fprintf( file, "align_mismatch_cost :        %"PRId16"\n", _align_mismatch_cost   );
-
-  // -------------------------------------------------------------- Selection
-  fprintf( file, "\nSelection -----------------------------------------------\n" );
-  switch ( _selection_scheme )
-  {
-    case RANK_LINEAR :
-    {
-      fprintf( file, "selection_scheme :           RANK_LINEAR\n" );
-      break;
-    }
-    case RANK_EXPONENTIAL :
-    {
-      fprintf( file, "selection_scheme :           RANK_EXPONENTIAL\n" );
-      break;
-    }
-    case FITNESS_PROPORTIONATE :
-    {
-      fprintf( file, "selection_scheme :           FITNESS_PROPORTIONATE\n" );
-      break;
-    }
-    case FITTEST :
-    {
-      fprintf( file, "selection_scheme :           FITTEST\n" );
-      break;
-    }
-    default :
-    {
-      fprintf( file, "selection_scheme :           UNKNOWN\n" );
-      break;
-    }
-  }
-  fprintf( file, "selection_pressure :         %e\n",  _selection_pressure );
-
-
-  // -------------------------------------------------------------- Secretion
-  fprintf( file, "\nSecretion -----------------------------------------------\n" );
-  fprintf( file, "with_secretion :                %s\n", _with_secretion? "true" : "false" );
-  fprintf( file, "secretion_contrib_to_fitness :  %e\n", _secretion_contrib_to_fitness    );
-  fprintf( file, "secretion_diffusion_prop :      %e\n", _secretion_diffusion_prop        );
-  fprintf( file, "secretion_degradation_prop :    %e\n", _secretion_degradation_prop      );
-  fprintf( file, "secretion_cost :                %e\n", _secretion_cost                  );
-
-  // --------------------------------------------------------------- Plasmids
-  fprintf( file, "\nPlasmids ------------------------------------------------\n" );
-  fprintf( file, "allow_plasmids :             %s\n", _allow_plasmids? "true" : "false"              );
-  fprintf( file, "plasmid_minimal_length :     %"PRId32"\n", _plasmid_minimal_length                 );
-  fprintf( file, "plasmid_maximal_length :     %"PRId32"\n", _plasmid_maximal_length                 );
-  fprintf( file, "chromosome_minimal_length :  %"PRId32"\n", _chromosome_minimal_length              );
-  fprintf( file, "chromosome_maximal_length :  %"PRId32"\n", _chromosome_maximal_length              );
-  fprintf( file, "prob_plasmid_HT :            %e\n", _prob_plasmid_HT                               );
-  fprintf( file, "tune_donor_ability :         %e\n", _tune_donor_ability                            );
-  fprintf( file, "tune_recipient_ability :     %e\n", _tune_recipient_ability                        );
-  fprintf( file, "donor_cost :                 %e\n", _donor_cost                                    );
-  fprintf( file, "recipient_cost :             %e\n", _recipient_cost                                );
-  fprintf( file, "compute_phen_contrib_by_GU : %s\n", _compute_phen_contrib_by_GU? "true" : "false"  );
-  fprintf( file, "swap_GUs :                   %s\n",  _swap_GUs? "true" : "false"   );
-
-  // ------------------------------------------------------- Translation cost
-  fprintf( file, "\nTranslation cost ----------------------------------------\n" );
-  fprintf( file, "translation_cost :           %e\n",  _translation_cost           );
-}
-
diff --git a/src/libaevol/param_loader.h b/src/libaevol/param_loader.h
deleted file mode 100644
index 2bc873e..0000000
--- a/src/libaevol/param_loader.h
+++ /dev/null
@@ -1,308 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-#ifndef __PARAM_LOADER_H__
-#define __PARAM_LOADER_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-
-#include <zlib.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <f_line.h>
-#include <ae_params_mut.h>
-#include <ae_jumping_mt.h>
-
-#include <ae_object.h>
-#include <ae_macros.h>
-#include <ae_enums.h>
-#include <ae_list.h>
-#include <ae_gaussian.h>
-#include <ae_point_2d.h>
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-class ae_exp_manager;
-class ae_environment;
-class ae_individual;
-
-
-class param_loader
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    param_loader( const char* file_name );
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~param_loader( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    void read_file( void );
-    void load( ae_exp_manager* exp_m, bool verbose = false, char* chromosome = NULL, int32_t lchromosome = 0, char* plasmid = NULL, int32_t lplasmid = 0 );
-
-
-    f_line* get_line( int32_t* );
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-    void print_to_file( FILE* file );
-
-
-
-
-  protected :
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-    param_loader( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    param_loader( const param_loader &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    static void format_line( f_line*, char*, bool* );
-    void interpret_line( f_line* line, int32_t cur_line );
-    ae_individual* create_random_individual( ae_exp_manager* exp_m, ae_params_mut* param_mut, int32_t id ) const;
-    ae_individual* create_random_individual_with_good_gene( ae_exp_manager* exp_m, ae_params_mut* param_mut, int32_t id ) const;
-    ae_individual* create_clone( ae_individual* dolly, int32_t id ) const;
-
-
-
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    //~ ae_exp_manager* _exp_m;
-
-    ae_jumping_mt* _prng;
-
-    char*   _param_file_name;
-    FILE*   _param_file;
-
-    // ----------------------------------------- PseudoRandom Number Generators
-    // Seed for the selection random generator
-    int32_t _seed;
-    // Seed for the mutations random generator
-    int32_t _mut_seed;
-    // Seed for the stochasticity random generator
-    int32_t _stoch_seed;
-    // Seed for the environmental variation random generator
-    int32_t _env_var_seed;
-    // Seed for the environmental noise random generator
-    int32_t _env_noise_seed;
-
-    // ------------------------------------------------------------ Constraints
-    int32_t _min_genome_length;
-    int32_t _max_genome_length;
-    double  _w_max;
-
-    // ----------------------------------------------------- Initial conditions
-    int32_t  _chromosome_initial_length;
-    int8_t   _init_method;
-    int32_t  _init_pop_size;
-    char*    _strain_name;
-
-    // ------------------------------------------------------------ Environment
-    ae_list<ae_gaussian*>* _env_gaussians;
-    ae_list<ae_point_2d*>* _env_custom_points;
-    int16_t  _env_sampling;
-
-    // ---------------------------------------- Environment x-axis segmentation
-    // Number of x-axis segments
-    int16_t _env_axis_nb_segments;
-    // x-axis segment boundaries (sorted -- including MIN_X and MAX_X)
-    double* _env_axis_segment_boundaries;
-    // x-axis segment features
-    ae_env_axis_feature* _env_axis_features;
-    // Whether to automatically separate segments
-    bool _env_axis_separate_segments;
-
-    // -------------------------------------------------- Environment variation
-    ae_env_var  _env_var_method;
-    double      _env_var_sigma;
-    int32_t     _env_var_tau;
-
-    // ------------------------------------------------------ Environment noise
-    ae_env_noise _env_noise_method;   // Method... TODO
-    double  _env_noise_alpha;         // Alpha value (variance coefficient)
-    double  _env_noise_sigma;         // Variance of the noise
-    double  _env_noise_prob;          // Probability of variation.
-    int32_t _env_noise_sampling_log;  // Log2 of the number of points in the noise fuzzy_set
-
-    // --------------------------------------------------------- Mutation rates
-    double  _point_mutation_rate;
-    double  _small_insertion_rate;
-    double  _small_deletion_rate;
-    int16_t _max_indel_size;
-
-    // -------------------------------------------- Rearrangements and Transfer
-    bool    _with_4pts_trans;
-    bool    _with_alignments;
-    bool    _with_HT;
-    bool    _repl_HT_with_close_points;
-    double  _HT_ins_rate;
-    double  _HT_repl_rate;
-    double  _repl_HT_detach_rate;
-
-    // ------------------------------ Rearrangement rates (without alignements)
-    double _duplication_rate;
-    double _deletion_rate;
-    double _translocation_rate;
-    double _inversion_rate;
-
-    // --------------------------------- Rearrangement rates (with alignements)
-    double _neighbourhood_rate;
-    double _duplication_proportion;
-    double _deletion_proportion;
-    double _translocation_proportion;
-    double _inversion_proportion;
-
-    // ------------------------------------------------------------ Alignements
-    ae_align_fun_shape _align_fun_shape;
-    double  _align_sigm_lambda;
-    int16_t _align_sigm_mean;
-    int16_t _align_lin_min;
-    int16_t _align_lin_max;
-
-    int16_t _align_max_shift;     // Maximum shift of one seq on the other
-    int16_t _align_w_zone_h_len;  // Work zone half length
-    int16_t _align_match_bonus;   // Corresponding residues match bonus
-    int16_t _align_mismatch_cost; // Corresponding residues mismatch cost
-
-    // ----------------------------------------------- Phenotypic Stochasticity
-    bool _with_stochasticity;
-
-    // -------------------------------------------------------------- Selection
-    ae_selection_scheme  _selection_scheme;
-    double               _selection_pressure;
-
-    // ------------------------------------------------------ Spatial structure
-    bool     _spatially_structured;
-    int16_t  _grid_width;
-    int16_t  _grid_height;
-    int32_t  _migration_number; // TODO : explain
-
-    // -------------------------------------------------------------- Secretion
-    bool   _with_secretion;
-    // Proportion of the fitness contributed by secretion
-    double _secretion_contrib_to_fitness;      // (0,1)
-    // Proportion that diffuses into each cell, every generation
-    // (0 for no diffusion)
-    double _secretion_diffusion_prop;
-    // Proportion of secreted substance that degrades every generation
-    double _secretion_degradation_prop;
-    // Cost of secreting the compound, as a proportion of the amount secreted
-    double _secretion_cost;
-    // Starting configuration of secretion grid
-    // 0, all are 0; 1, point source of secreted compund
-    double _secretion_init;
-
-    // --------------------------------------------------------------- Plasmids
-    bool      _allow_plasmids;
-    int32_t   _plasmid_initial_length;
-    int32_t   _plasmid_initial_gene;
-    int32_t   _plasmid_minimal_length;
-    int32_t   _plasmid_maximal_length;
-    int32_t   _chromosome_minimal_length;
-    int32_t   _chromosome_maximal_length;
-    double    _prob_plasmid_HT;
-    double    _tune_donor_ability;
-    double    _tune_recipient_ability;
-    double    _donor_cost;
-    double    _recipient_cost;
-    bool      _compute_phen_contrib_by_GU;
-    bool      _swap_GUs;
-
-    // ------------------------------------------------------- Translation cost
-    double _translation_cost;
-
-    // ---------------------------------------------------------------- Outputs
-    // Stats
-    int8_t _stats;
-    // Whether to delete the existing statistics file
-    // (otherwise kept with the suffix ".old")
-    bool _delete_old_stats;
-
-    // Backups
-    int32_t _backup_step;
-    int32_t _big_backup_step;
-
-    // Tree
-    bool         _record_tree;
-    int32_t      _tree_step;
-    ae_tree_mode _tree_mode;
-
-    // Dumps // TODO : explain
-    bool    _make_dumps;
-    int32_t _dump_step;
-
-    // Logs
-    int8_t _logs;
-
-    // Other
-    bool _more_stats;  // TODO : explain
-
-  #ifdef __REGUL
-    // ------------------------------------------------------- Binding matrix
-    double _binding_zeros_percentage;
-  #endif
-
-
-};
-
-
-#endif // __param_loader_H__
diff --git a/src/libaevol/ae_codon.cpp b/src/libaevol/raevol/Habitat_R.cpp
similarity index 50%
rename from src/libaevol/ae_codon.cpp
rename to src/libaevol/raevol/Habitat_R.cpp
index ea2dbf9..0b589fe 100644
--- a/src/libaevol/ae_codon.cpp
+++ b/src/libaevol/raevol/Habitat_R.cpp
@@ -3,124 +3,111 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
+//
+// ****************************************************************************
 
 
 
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <math.h>
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Habitat_R.h"
+#include "PhenotypicTargetHandler_R.h"
 
+#include <iostream>
 
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_codon.h>
-#include <ae_utils.h>
+using std::cout;
+using std::endl;
 
 
+namespace aevol {
 
 
 //##############################################################################
 //                                                                             #
-//                                Class ae_codon                               #
+//                                Class Habitat                                #
 //                                                                             #
 //##############################################################################
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_codon::ae_codon( void )
-{
-  _value = -1;
+// ============================================================================
+//                                Constructors
+// ============================================================================
+Habitat_R::Habitat_R(void) {
+  compound_amount_ = 0.0;
+  phenotypic_target_handler_ = new PhenotypicTargetHandler_R();
 }
 
-ae_codon::ae_codon( const ae_codon &model )
-{
-  _value = model._value;
+Habitat_R::Habitat_R(const Habitat_R& rhs, bool share_phenotypic_target) {
+  assert(share_phenotypic_target);
+  compound_amount_ = rhs.compound_amount_;
+  phenotypic_target_handler_ = rhs.phenotypic_target_handler_;
 }
 
-ae_codon::ae_codon( int8_t value )
-{
-  _value = value;
+Habitat_R::Habitat_R(gzFile backup_file,
+                 PhenotypicTargetHandler_R*
+                    phenotypic_target_handler) {
+  load(backup_file, phenotypic_target_handler);
 }
 
-ae_codon::ae_codon( ae_dna* dna, ae_strand strand, int32_t index )
-{
-  const char* gen = dna->get_data();
-  int32_t     len = dna->get_length();
-
-  _value = 0;
-
-  if ( strand == LEADING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index+i),len)] == '1' )
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
-  else // ( strand == LAGGING )
-  {
-    for ( int8_t i = 0 ; i < CODON_SIZE ; i++ )
-    {
-      if ( gen[ae_utils::mod((index-i),len)] != '1' ) // == and not != because we are on the complementary strand...
-      {
-        //_value += pow( 2, CODON_SIZE - i - 1 );
-        _value += 1 << ( CODON_SIZE - i - 1 );
-      }
-    }
-  }
-}
+// ============================================================================
+//                                 Destructor
+// ============================================================================
 
-ae_codon::ae_codon( gzFile backup_file )
-{
-  gzread( backup_file, &_value,   			sizeof(_value) );
-}
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_codon::~ae_codon( void )
-{
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void Habitat_R::ApplyVariation() {
+  //printf("Appel au apply_variation de habitat_R\n");
+  dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler_)->ApplyVariation();
+}
+void Habitat_R::save(gzFile backup_file,
+                     bool skip_phenotypic_target /*= false*/) const {
+  //printf("Appel a la sauvegarde de Habitat_R\n");
+  gzwrite(backup_file, &compound_amount_, sizeof(compound_amount_));
+  if (not skip_phenotypic_target) {
+    phenotypic_target_handler_->save(backup_file);
+  }
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-void ae_codon::save( gzFile backup_file )
-{
-  gzwrite( backup_file, &_value,   			sizeof(_value) );
+void Habitat_R::load(gzFile backup_file, 
+                     PhenotypicTargetHandler_R* phenotypic_target_handler) {
+  //printf("Appel au chargement de Habitat_R\n");
+  gzread(backup_file, &compound_amount_, sizeof(compound_amount_));
+  if (phenotypic_target_handler == NULL)
+    phenotypic_target_handler_ = new PhenotypicTargetHandler_R(backup_file);
+  else
+    phenotypic_target_handler_ = phenotypic_target_handler;
 }
-// =================================================================
-//                           Protected Methods
-// =================================================================
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/raevol/Habitat_R.h b/src/libaevol/raevol/Habitat_R.h
new file mode 100644
index 0000000..e2c8646
--- /dev/null
+++ b/src/libaevol/raevol/Habitat_R.h
@@ -0,0 +1,149 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+#ifndef AEVOL_HABITAT_R_H__
+#define AEVOL_HABITAT_R_H__
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
+
+#include <zlib.h>
+
+#include "PhenotypicTargetHandler_R.h"
+#include "Habitat.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+
+
+
+
+
+
+class Habitat_R : public virtual Habitat
+{
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  Habitat_R(void); //< Default ctor
+  Habitat_R(const Habitat_R&) = delete; //< Copy ctor
+  Habitat_R(Habitat_R&&) = delete; //< Move ctor
+  Habitat_R(const Habitat_R&, bool share_phenotypic_target);
+  Habitat_R(gzFile backup_file,
+            PhenotypicTargetHandler_R* phenotypic_target_handler_);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~Habitat_R(void) = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void ApplyVariation();
+  virtual void save(gzFile backup_file,
+                    bool skip_phenotypic_target = false) const;
+  virtual void load(gzFile backup_file,
+                    PhenotypicTargetHandler_R* phenotypic_target_handler);
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  virtual const PhenotypicTarget& phenotypic_target() const {
+    Utils::ExitWithDevMsg("You should not call a phenotypic target without age id in RAevol", __FILE__, __LINE__);
+    return *(new PhenotypicTarget()); // suppress warning
+  }
+
+  const PhenotypicTarget_R& phenotypic_target(  int8_t age ) const {
+    return (dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler_))->phenotypic_target( age );
+  }
+
+  int8_t number_of_phenotypic_targets() const {
+    return (dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler_))->number_of_phenotypic_targets();
+  }
+
+  virtual const PhenotypicTargetHandler_R& phenotypic_target_handler() const {
+    return *(dynamic_cast<PhenotypicTargetHandler_R*> (phenotypic_target_handler_));
+  }
+  virtual PhenotypicTargetHandler_R& phenotypic_target_handler_nonconst() const {
+    return *(dynamic_cast<PhenotypicTargetHandler_R*> (phenotypic_target_handler_));;
+  }
+  const std::list<Protein_R*> signals() const {
+    return (dynamic_cast<PhenotypicTargetHandler_R*>(phenotypic_target_handler_))->signals();
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_HABITAT_R_H__
diff --git a/src/libaevol/raevol/Individual_R.cpp b/src/libaevol/raevol/Individual_R.cpp
new file mode 100644
index 0000000..a120a9f
--- /dev/null
+++ b/src/libaevol/raevol/Individual_R.cpp
@@ -0,0 +1,492 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Individual_R.h"
+#include "../ExpManager.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                           Class ae_individual_R                             #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+
+/*
+ * Used at initialization
+*/
+Individual_R::Individual_R(ExpManager* exp_m,
+                       std::shared_ptr<JumpingMT> mut_prng,
+                       std::shared_ptr<JumpingMT> stoch_prng,
+                       std::shared_ptr<MutationParams> param_mut,
+                       double w_max,
+                       int32_t min_genome_length,
+                       int32_t max_genome_length,
+                       bool allow_plasmids,
+                       int32_t id,
+                       const char* strain_name,
+                       int32_t age) : Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length,
+                                                 max_genome_length,allow_plasmids,id,strain_name,age) {
+
+  _indiv_age = 0;
+  _networked = false;
+  _dist_sum = 0;
+}
+
+Individual_R::Individual_R(const Individual_R& other)
+    : Individual( other )
+{
+  _indiv_age = 0;
+  _networked = false;
+  _dist_sum = 0;
+
+  if (exp_m_->exp_s()->get_with_heredity()) {
+    _inherited_protein_list = std::vector<Protein_R*>(
+        other._inherited_protein_list);
+  }
+}
+
+Individual_R::Individual_R( Individual_R* parent, int32_t id,
+                            std::shared_ptr<JumpingMT> mut_prng,
+                            std::shared_ptr<JumpingMT> stoch_prng)
+        : Individual( parent, id, mut_prng, stoch_prng )
+{
+  //~ printf( "ae_individual_R( parent ) : I have %d inherited proteins\n", parent->get_protein_list()->get_nb_elts() );
+    _indiv_age = 0;
+    _networked = false;
+    _dist_sum = 0;
+
+  if (exp_m_->exp_s()->get_with_heredity()) {
+    for (const auto& prot : parent->protein_list_) {
+      if (prot->concentration() >
+          parent->exp_m_->exp_s()->get_protein_presence_limit()) {
+        Protein_R* inherited_prot = new Protein_R(prot->get_gen_unit(),
+                                                  (Protein_R&) *prot);
+        inherited_prot->set_inherited(true);
+        _inherited_protein_list.push_back(inherited_prot);
+      }
+    }
+  }
+}
+
+Individual_R::Individual_R(ExpManager* exp_m, gzFile backup_file) : Individual( exp_m, backup_file )
+{
+    _indiv_age = 0;
+  _networked = false;
+
+  if( exp_m_->exp_s()->get_with_heredity() )
+  {
+    // Retreive inherited proteins
+    // _inherited_protein_list = new ae_list();
+    int16_t nb_inherited_proteins = 0;
+    gzread( backup_file, &nb_inherited_proteins,  sizeof(nb_inherited_proteins) );
+  
+    for ( int16_t i = 0 ; i < nb_inherited_proteins ; i++ )
+    {
+	  _inherited_protein_list.push_back( new Protein_R( backup_file ) );
+    }
+  }  
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Individual_R::~Individual_R( void ) noexcept
+{
+//  assert( !exp_m_->exp_s()->get_with_heredity()  );
+
+  /*
+  for (const auto& prot : parent->_protein_list)
+	  Protein_R* dp = _inherited_protein_list[i];
+	  delete dp;
+  }*/
+
+  if (exp_m_->exp_s()->get_with_heredity()) {
+    for (unsigned int i = 0; i < _inherited_protein_list.size(); i++)
+      delete _inherited_protein_list[i];
+
+    _inherited_protein_list.clear();
+  }
+
+  for (unsigned int i = 0; i < _rna_list_coding.size(); i++) {
+    _rna_list_coding[i] = NULL;
+  }
+
+  _rna_list_coding.clear();
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+Individual_R* Individual_R::CreateClone(const Individual_R* dolly, int32_t id) {
+  Individual_R* indiv = new Individual_R(*dolly);
+  indiv->set_id(id);
+  return indiv;
+}
+
+void Individual_R::Evaluate() {
+		EvaluateInContext(grid_cell_->habitat());
+}
+
+void Individual_R::EvaluateInContext(const Habitat_R& habitat) {
+	if (evaluated_ == true) return; // Individual has already been evaluated, nothing to do.
+
+  if (!_networked) {
+    init_indiv(habitat);
+  }
+
+  std::set<int>* eval = exp_m_->exp_s()->get_list_eval_step();
+
+  // i is thus the age of the individual
+  for (int8_t i = 1; i <= exp_m_->exp_s()->get_nb_indiv_age(); i++) {
+    //Set the concentration of signals for this age
+    for(Protein_R* prot1 : habitat.signals()) {
+      prot1->set_concentration(0.0);
+    }
+    for(Protein_R* prot2 : habitat.phenotypic_target(i).signals()) {
+      prot2->set_concentration(0.9);
+    }
+
+
+    for (int j = 0; j < exp_m_->exp_s()->get_nb_degradation_step(); j++) {
+      one_step();
+    }
+
+    // If we have to evaluate the individual at this age
+    if (eval->find(i) != eval->end())
+    {
+      eval_step(habitat, i); 
+    }
+  }
+
+  final_step(habitat, exp_m_->exp_s()->get_nb_indiv_age());
+  protein_list_.clear();
+  protein_list_ = _initial_protein_list;
+}
+
+void Individual_R::EvaluateInContext(const Habitat& habitat) {
+  EvaluateInContext(dynamic_cast<const Habitat_R&> (habitat));
+}
+
+void Individual_R::init_indiv(const Habitat_R& habitat)
+{
+  // ---------------------------------------------------------------------------
+  // 1) Transcription - Translation - Folding - make_protein_list
+  // ---------------------------------------------------------------------------
+  transcribed_ = false;
+  translated_ = false;
+  folded_ = false;
+
+  do_transcription_translation_folding();
+
+  if (phenotype_ != NULL) {
+    delete phenotype_;
+    delete phenotype_activ_;
+    delete phenotype_inhib_;
+
+    phenotype_ = NULL;
+    phenotype_activ_ = NULL;
+    phenotype_inhib_ = NULL;
+  }
+  phenotype_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotype_activ_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+  phenotype_inhib_ = FuzzyFactory::fuzzyFactory->create_fuzzy();
+
+  //----------------------------------------------------------------------------
+  // 2) Make a list of all the rna present in the individual
+  //    and initialise the concentrations of the proteins
+  //----------------------------------------------------------------------------
+  make_rna_list();
+
+  _initial_protein_list = protein_list_;
+
+  //_protein_list.insert(_protein_list.end(), habitat.signals().begin(), habitat.signals().end());
+  for(Protein_R* prot : habitat.signals()) {
+    protein_list_.push_back(prot);
+  }
+
+
+
+  //----------------------------------------------------------------------------
+  // 3) Create influence graph (including the signals)
+  //----------------------------------------------------------------------------
+  //printf("Protein %ld RNA %ld\n",protein_list_.size(),rna_list_.size());
+  set_influences();
+
+  _networked = true;
+}
+
+void Individual_R::one_step( void )
+{
+  //----------------------------------------------------------------------------
+  // 4) Make the individual "live its life" and compute partial phenotypes and
+  //    fitnesses
+  //----------------------------------------------------------------------------
+
+  if (exp_m_->regul_or_not()) update_concentrations();
+}
+
+void Individual_R::eval_step( const Habitat_R& habitat, int8_t age ) {
+  update_phenotype();
+  distance_to_target_computed_ = false;
+  phenotype_computed_ = true;
+
+  for (int i=0; i<NB_FEATURES; i++) {
+    dist_to_target_by_feature_[i] = 0;
+  }
+
+  compute_distance_to_target( habitat.phenotypic_target( age ) );
+  //printf("Dist to target à l'age %d du nouveau clone : %f\n", age, _dist_to_target_by_feature[METABOLISM]);
+  _dist_sum += dist_to_target_by_feature_[METABOLISM];
+}
+
+
+void Individual_R::final_step( const Habitat_R& habitat, int8_t age ) {
+  //printf("Nombre final d'évaluations : %d\n", exp_m_->exp_s()->get_list_eval_step()->size());
+  dist_to_target_by_feature_[METABOLISM] = _dist_sum / (double) (exp_m_->exp_s()->get_list_eval_step()->size());
+
+
+  fitness_computed_=false;
+  // yoram attention il peut y avoir des soucis si on utilise des environnements segmentés ici
+  compute_fitness(habitat.phenotypic_target( age ));
+
+  phenotype_computed_ = true;
+}
+
+void Individual_R::set_influences()
+// Compute the influence of each protein over each coding RNA
+// As non-coding RNAs are completely inert, we don't care about their concentration
+// so we don't care if proteins activate or inhibit their transcription.
+{
+	  for(auto& rna : _rna_list_coding) {
+		  rna->set_influences( protein_list_ );
+	  }
+}
+
+void Individual_R::update_concentrations( void )
+{
+	// Compute all the changes that will be applied to the concentrations
+	// Concentrations must not be changed at this stage
+  for (auto& prot : protein_list_) {
+    if (!((Protein_R*)prot)->is_signal()) ((Protein_R*)prot)->compute_delta_concentration();
+	}
+
+	// Apply the changes in concentrations we have just computed
+  for (auto& prot : protein_list_) {
+		if (!((Protein_R*)prot)->is_signal()) ((Protein_R*)prot)->update_concentration();
+	}
+}
+
+// Multiply the concentration of each protein by <factor>
+void Individual_R::multiply_concentrations( double factor )
+{
+  for (auto& prot : protein_list_) {
+	 	  ((Protein_R*)prot)->multiply_concentration( factor );
+	}
+}
+
+int8_t Individual_R::get_quadon( const GeneticUnit* gen_unit, Strand strand, int32_t pos )
+{
+  const char* dna = gen_unit->dna()->data();
+  int32_t  len    = gen_unit->dna()->length();
+  //int8_t quadon_1 = 0,quadon_2 = 0,quadon_3 = 0,quadon_4   = 0;
+  int8_t quadon[4];
+
+//  printf("Length %d : %s\n\n",len,dna);
+
+  if ( strand == LEADING )
+  {
+    #pragma omp simd
+    for ( int8_t i = 0 ; i < QUADON_SIZE ; i++ )
+    {
+      quadon[i] = (dna[(pos+i) % len] == '1') ? 1 << (QUADON_SIZE - i - 1) : 0;
+    }
+    /*quadon_1 += (dna[(pos+0) % len] == '1') ? 1 << (QUADON_SIZE - 0 - 1) : 0;
+    quadon_2 += (dna[(pos+1) % len] == '1') ? 1 << (QUADON_SIZE - 1 - 1) : 0;
+    quadon_3 += (dna[(pos+2) % len] == '1') ? 1 << (QUADON_SIZE - 2 - 1) : 0;
+    quadon_4 += (dna[(pos+3) % len] == '1') ? 1 << (QUADON_SIZE - 3 - 1) : 0;*/
+      //if ( dna[(pos+i) % len] == '1' )
+      //{
+      //  quadon += 1 << (QUADON_SIZE - i - 1);  //pow( 2, QUADON_SIZE - i - 1 );
+      //}
+    //}
+  }
+  else  // ( strand == LAGGING )
+  {
+    #pragma omp simd
+    for ( int8_t i = 0 ; i < QUADON_SIZE ; i++ )
+    {
+      quadon[i] = (dna[(pos-i) % len] != '1') ? 1 << (QUADON_SIZE - i - 1) : 0;
+      /*if ( dna[(pos-i) % len] != '1' ) // == and not != because we are on the complementary strand...
+      {
+        quadon += 1 << (QUADON_SIZE - i - 1);  //pow( 2, QUADON_SIZE - i - 1 );
+      }*/
+    }
+    /*quadon_1 += (dna[(pos-0) % len] != '1') ? 1 << (QUADON_SIZE - 0 - 1) : 0;
+    quadon_2 += (dna[(pos-1) % len] != '1') ? 1 << (QUADON_SIZE - 1 - 1) : 0;
+    quadon_3 += (dna[(pos-2) % len] != '1') ? 1 << (QUADON_SIZE - 2 - 1) : 0;
+    quadon_4 += (dna[(pos-3) % len] != '1') ? 1 << (QUADON_SIZE - 3 - 1) : 0;*/
+  }
+
+  return quadon[0]+quadon[1]+quadon[2]+quadon[3];
+}
+
+void Individual_R::save( gzFile backup_file )
+{
+  //printf("Appel à la sauvegarde de Individual_R\n");
+  Individual::save( backup_file );
+  // Test if there is heredity, and if the generation is the first one (no inherited protein list).
+  if (this->exp_m_->exp_s()->get_with_heredity() && !_inherited_protein_list.empty() )
+  {
+    // Write inherited proteins
+    int16_t nb_inherited_proteins = _inherited_protein_list.size();
+    gzwrite( backup_file, &nb_inherited_proteins,  sizeof(nb_inherited_proteins) );
+
+    for (auto& prot : _inherited_protein_list) {
+    	prot->save( backup_file );
+    }
+  }
+}
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void Individual_R::make_protein_list( void )
+{
+	  Individual::make_protein_list();
+
+    if (this->exp_m_->exp_s()->get_with_heredity()) {
+      for (auto& prot : _inherited_protein_list)
+        protein_list_.push_back(prot);
+    }
+}
+
+void Individual_R::make_rna_list( void )
+{
+  Individual::make_rna_list();
+  _rna_list_coding = {};
+
+  // Parse the newly created RNA list and copy the coding RNAs in _rna_list_coding.
+  for (const auto& gen_unit: genetic_unit_list_) {
+    GeneticUnit* genu = const_cast<GeneticUnit*>(&gen_unit);
+    // Create proxies
+    const auto& rna_list = gen_unit.rna_list();
+    const auto& lead = rna_list[LEADING];
+    const auto& lagg = rna_list[LAGGING];
+
+    // append pointers to rna material to local _rna_list
+    for (auto& strand: {LEADING, LAGGING})
+      for (auto& rna: rna_list[strand]) {
+        //TODO Ugly fix, change it to avoid memory usage double
+        if (rna.is_coding()) {
+          Rna_R* prna =  const_cast<Rna_R*>(&rna);
+          //printf("COPY OR NOT : %ld == %ld",prna->get_id(),((Rna_R)rna).get_id());
+          _rna_list_coding.push_back(
+             prna);//new Rna_R(genu, rna));
+        }
+    }
+
+  }
+}
+
+void Individual_R::update_phenotype( void )
+{
+  // We will use two fuzzy sets :
+  //   * _phenotype_activ for the proteins realising a set of functions
+  //   * _phenotype_inhib for the proteins inhibitting a set of functions
+  // The phenotype will then be given by the sum of these 2 fuzzy sets
+
+  phenotype_activ_->reset();
+  phenotype_inhib_->reset();
+  phenotype_->reset();
+
+  for (auto& prot : protein_list_) {
+    if ( ((Protein_R*)prot)->is_functional() )
+    {
+      if ( ((Protein_R*)prot)->height() > 0 )
+      {
+//    	  added=true;
+        phenotype_activ_->add_triangle(  ((Protein_R*)prot)->mean(),
+                                         ((Protein_R*)prot)->width(),
+                                         ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration() );
+
+/*        printf("Add triangle ACTIV %f %f %f (%f %f)\n",((Protein_R*)prot)->mean(),
+               ((Protein_R*)prot)->width(),
+               ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration(),
+               ((Protein_R*)prot)->height(), ((Protein_R*)prot)->concentration() );*/
+      }
+      else
+      {
+        phenotype_inhib_->add_triangle(  ((Protein_R*)prot)->mean(),
+                                         ((Protein_R*)prot)->width(),
+                                         ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration() );
+
+  /*      printf("Add triangle INHIB %f %f %f (%f %f)\n",((Protein_R*)prot)->mean(),
+               ((Protein_R*)prot)->width(),
+               ((Protein_R*)prot)->height() * ((Protein_R*)prot)->concentration(),
+               ((Protein_R*)prot)->height(), ((Protein_R*)prot)->concentration() );*/
+      }
+    }
+  }
+
+
+    phenotype_activ_->clip(AbstractFuzzy::max,   Y_MAX);
+    phenotype_inhib_->clip(AbstractFuzzy::min, - Y_MAX);
+
+    phenotype_->add(*phenotype_activ_);
+    phenotype_->add(*phenotype_inhib_);
+    phenotype_->clip(AbstractFuzzy::min, Y_MIN);
+    phenotype_->simplify();
+
+//  _phenotype->simplify();
+}
+
+void    Individual_R::clear_everything_except_dna_and_promoters() {
+    _networked = false;
+    _rna_list_coding.clear();
+    _dist_sum = 0.0;
+
+    Individual::clear_everything_except_dna_and_promoters();
+}
+
+} // namespace aevol
diff --git a/src/libaevol/ae_point_2d.h b/src/libaevol/raevol/Individual_R.h
similarity index 51%
rename from src/libaevol/ae_point_2d.h
rename to src/libaevol/raevol/Individual_R.h
index 680b43f..89f640a 100644
--- a/src/libaevol/ae_point_2d.h
+++ b/src/libaevol/raevol/Individual_R.h
@@ -3,183 +3,179 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_POINT_2D_H__
-#define __AE_POINT_2D_H__
- 
- 
+
+
+#ifndef AEVOL_INDIVIDUAL_R_H_
+#define  AEVOL_INDIVIDUAL_R_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
 #include <inttypes.h>
-#include <zlib.h>
-
-
-
+#include <vector>
+#include <set>
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_object.h>
-
-
+#include "Individual.h"
+#include "Rna_R.h"
+#include "Protein_R.h"
+#include "Habitat_R.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-
-
-
-
-
- 
-class ae_point_2d : public ae_object
-{  
+class Individual_R : public virtual Individual
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    inline ae_point_2d( void );
-    inline ae_point_2d( double x, double y );
-    inline ae_point_2d( const ae_point_2d& source );
-    inline ae_point_2d( gzFile backup_file );
-  
+	Individual_R() = delete;
+  Individual_R(const Individual_R& other);
+  Individual_R(ExpManager * exp_m,
+              std::shared_ptr<JumpingMT> mut_prng,
+              std::shared_ptr<JumpingMT> stoch_prng,
+              std::shared_ptr<MutationParams> param_mut,
+              double w_max,
+              int32_t min_genome_length,
+              int32_t max_genome_length,
+              bool allow_plasmids,
+              int32_t id,
+              const char* strain_name,
+              int32_t age);
+	Individual_R(  Individual_R* parent, int32_t id,
+                 std::shared_ptr<JumpingMT> mut_prng,
+                 std::shared_ptr<JumpingMT> stoch_prng);
+  Individual_R(ExpManager* exp_m, gzFile backup_file);
+
+  static Individual_R* CreateClone(const Individual_R* dolly, int32_t id);
     // =================================================================
     //                             Destructors
     // =================================================================
-    inline virtual ~ae_point_2d( void );
-  
+    virtual ~Individual_R( void ) noexcept;
+
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+    inline std::vector<Rna_R *> get_rna_list_coding( void ) const;
+
     // =================================================================
     //                            Public Methods
     // =================================================================
-    inline void save( gzFile backup_file );
-  
+    /**
+      * Main evaluation method
+      */
+     virtual void Evaluate();
+     /**
+      * Evaluate within the provided context
+      */
+     virtual void EvaluateInContext(const Habitat_R& habitat);
+     virtual void EvaluateInContext(const Habitat& habitat);
+
+     virtual void init_indiv(const Habitat_R& habitat);
+     virtual void one_step( void );
+     virtual void eval_step(const Habitat_R& habitat, int8_t age);
+     virtual void final_step(const Habitat_R& habitat, int8_t age);
+     //virtual void reevaluate();
+     //virtual void clear_everything_except_dna_and_promoters();
+     //void do_transcription_translation_folding();
+    // void do_transcription();
+     //void do_translation();
+     //void do_folding();
+     //void compute_phenotype();
+     //void compute_distance_to_target(const PhenotypicTarget& target);
+    //void update_phenotype();
+
+    void    set_influences( void );
+    void    update_concentrations( void );
+    void    multiply_concentrations( double factor );
+    int8_t  get_quadon( const GeneticUnit* gen_unit, Strand strand, int32_t pos );
+    virtual void    save( gzFile backup_file );
+    void    clear_everything_except_dna_and_promoters();
+
+    inline std::vector<Protein_R*> get_inherited_protein_list( void) const;
+    inline void set_networked( bool networked );
+    std::vector<Rna_R *> _rna_list_coding;   // Please note that these RNAs are
+    // actually managed via genetic units.
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-    double x;
-    double y;
-  
-  
-  
-  
-  
+
   protected :
-  
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    //~ ae_point_2d( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    /*    ae_point_2d( const ae_point_2d &model )
+    /*    ae_individual_R(const ae_individual &model)
     {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
       };*/
 
-  
     // =================================================================
     //                           Protected Methods
     // =================================================================
-  
+    virtual void make_protein_list( void );
+    virtual void make_rna_list( void );
+    void update_phenotype( void );
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-};
-
-
+    std::vector<Protein_R*> _inherited_protein_list;
 
+    std::list<Protein*> _initial_protein_list;
 
-//##############################################################################
-//                                                                             #
-//                              Class ae_point_2d                              #
-//                                                                             #
-//##############################################################################
+    int _indiv_age;
+    bool _networked;
+    double _dist_sum;
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-inline ae_point_2d::ae_point_2d( void )
-{
-  x = -1;
-  y = -1;
-}
-
-inline ae_point_2d::ae_point_2d( double x, double y )
-{
-  this->x = x;
-  this->y = y;
-}
-
-inline ae_point_2d::ae_point_2d( const ae_point_2d& source )
-{
-  this->x = source.x;
-  this->y = source.y;
-}
+};
 
-inline ae_point_2d::ae_point_2d( gzFile backup_file )
+// =====================================================================
+//                          Accessors definitions
+// =====================================================================
+inline std::vector<Protein_R*> Individual_R::get_inherited_protein_list( void ) const
 {
-  gzread( backup_file, &x, sizeof(x) );
-  gzread( backup_file, &y, sizeof(y) );
+  return _inherited_protein_list;
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-inline ae_point_2d::~ae_point_2d( void )
+inline std::vector<Rna_R *> Individual_R::get_rna_list_coding( void ) const
 {
+  return _rna_list_coding;
 }
 
-// =====================================================================
-//                          Accessors definitions
-// =====================================================================
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-inline void ae_point_2d::save( gzFile backup_file )
+inline void Individual_R::set_networked( bool networked )
 {
-  gzwrite( backup_file, &x, sizeof(x) );
-  gzwrite( backup_file, &y, sizeof(y) );
+  _networked = networked;
 }
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
-
-
+} // namespace aevol
 
-#endif // __AE_POINT_2D_H__
+#endif // AEVOL_INDIVIDUAL_R_H_
diff --git a/src/libaevol/raevol/Individual_R_X11.cpp b/src/libaevol/raevol/Individual_R_X11.cpp
new file mode 100644
index 0000000..0b22d32
--- /dev/null
+++ b/src/libaevol/raevol/Individual_R_X11.cpp
@@ -0,0 +1,601 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Individual_R_X11.h"
+#include "../ExpManager.h"
+#include "../ExpManager_X11.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                           Class ae_individual_R_X11                         #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Individual_R_X11::Individual_R_X11( const Individual_R_X11 &model  ) :
+  Individual( model  ), Individual_R( model  ), Individual_X11( model  )
+{
+  //printf("ae_individual_R_X11( model )");
+}
+
+Individual_R_X11::Individual_R_X11(ExpManager* exp_m,
+                           std::shared_ptr<JumpingMT> mut_prng,
+                           std::shared_ptr<JumpingMT> stoch_prng,
+                           std::shared_ptr<MutationParams> param_mut,
+                           double w_max,
+                           int32_t min_genome_length,
+                           int32_t max_genome_length,
+                           bool allow_plasmids,
+                           int32_t id,
+                           const char* strain_name,
+                           int32_t age) :
+                           Individual(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length,
+                            max_genome_length,allow_plasmids,id,strain_name,age),
+                           Individual_R(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length,
+                            max_genome_length,allow_plasmids,id,strain_name,age),
+                           Individual_X11(exp_m,mut_prng,stoch_prng,param_mut,w_max,min_genome_length,
+                            max_genome_length,allow_plasmids,id,strain_name,age)
+{
+
+}
+
+
+Individual_R_X11::Individual_R_X11( Individual_R_X11* parent, int32_t id,
+                                    std::shared_ptr<JumpingMT> mut_prng, std::shared_ptr<JumpingMT> stoch_prng ) :
+        Individual( parent, id, mut_prng, stoch_prng ),
+        Individual_R( parent, id, mut_prng, stoch_prng  ),
+        Individual_X11( parent, id, mut_prng, stoch_prng  )
+{
+  //printf("ae_individual_R_X11( parent )");
+}
+
+Individual_R_X11::Individual_R_X11( ExpManager* exp_m, gzFile backup_file ) :
+Individual( exp_m, backup_file ), Individual_R( exp_m, backup_file ), Individual_X11( exp_m, backup_file )
+{
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Individual_R_X11::~Individual_R_X11( void ) noexcept
+{
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+
+void Individual_R_X11::display_concentrations( X11Window* win )
+{
+  char* color = new char[8];
+  char* color2 = NULL;
+  strcpy( color, "#FFFFFF" );
+
+  //variable qui sert à stocker du texte à afficher
+  char display_string[40];
+  int16_t nb_prot = 0;
+  int16_t life_time =  exp_m_->exp_s()->get_nb_indiv_age();
+
+  //deux pointeurs utilisés pour défiler dans la liste de protéines
+  //  ae_list_node* prot_node  = NULL;
+  //  ae_protein_R* prot       = NULL;
+
+  //Draw the number of proteins
+  if ( exp_m_->exp_s()->get_with_heredity())
+  {
+    nb_prot = protein_list_.size();
+    sprintf( display_string, "Nb proteins: %" PRId32 " (inherited: %ld)",nb_prot,_inherited_protein_list.size());
+  }
+  else
+  {
+    nb_prot = protein_list_.size();
+    sprintf( display_string, "Nb proteins: %" PRId32 " (without heredity)",nb_prot);
+  }
+  win->draw_string( 15, 15, display_string );
+
+  //Draw the life time
+  sprintf( display_string, "Life duration: %" PRId32 "",life_time);
+  win->draw_string( 15, 30, display_string );
+
+  //Draw the box
+  win->draw_line( win->width() / 10 , 2* win->height() / 10 , 9 * win->width() / 10 , 2 * win->height() / 10 ,color);
+  win->draw_line( win->width() / 10 , 9 * win->height() / 10 , 9 * win->width() / 10 , 9 * win->height() / 10 ,color);
+  win->draw_line( win->width() / 10 , 2* win->height() / 10 ,  win->width() / 10 , 9 * win->height() / 10 ,color);
+  win->draw_line( 9 * win->width() / 10 , 2 * win->height() / 10 , 9 * win->width() / 10 , 9 * win->height() / 10 ,color);
+
+  // save the initial list of proteins
+  //std::list<Protein*> init_prot_list = protein_list_;
+  _initial_protein_list = protein_list_;
+
+  //_protein_list.insert(_protein_list.end(), habitat.signals().begin(), habitat.signals().end());
+  for(Protein_R* prot :dynamic_cast<const Habitat_R&>(this->habitat()).signals()) {
+    protein_list_.push_back(prot);
+  }
+
+  //set the concentrations of proteins to their initial value
+  double* concentrations = new double[protein_list_.size()]; // initialise le tableau de concentrations.
+  //  int16_t prot_index = 0;
+  int i = 0;
+  for (const auto& prot : protein_list_) {
+    ((Protein_R*)prot)->reset_concentration();
+    concentrations[i] = ((Protein_R*)prot)->concentration();
+    i++;
+  }
+
+  set_influences();
+
+  // compute steps
+  double x_step = 0.8 * win->width() / (double)(exp_m()->exp_s()->get_nb_indiv_age());
+  double y_step = 0.7 * win->height();
+
+  //printf("START IN HERE .......\n \n");
+  for (int8_t i = 1; i <= exp_m_->exp_s()->get_nb_indiv_age(); i++) {
+    //Set the concentration of signals for this age
+    for(Protein_R* prot1 : dynamic_cast<const Habitat_R&>(this->habitat()).signals()) {
+      prot1->set_concentration(0.0);
+    }
+    for(Protein_R* prot2 : dynamic_cast<const Habitat_R&>(this->habitat()).phenotypic_target(i).signals()) {
+      prot2->set_concentration(0.9);
+    }
+
+    for (int j = 0; j < exp_m()->exp_s()->get_nb_degradation_step(); j++)
+      update_concentrations();
+
+    //affichage des points n+1 dans la concentration
+    //prot_index = 0;
+    int proti = 0;
+    //printf("Age[%d] : ",i);
+    for (const auto& prot : protein_list_) {
+
+      // morceau ajouté pour colorer les protéines en fonctions de leur paramètres
+      if ( ((Protein_R*)prot)->is_functional() )
+      {
+        color2 = X11Window::color( ((Protein_R*)prot)->mean() );
+      }
+      else
+      {
+        color2 = new char[8];
+        strcpy( color2, "#FFFFFF" );
+      }
+
+      win->draw_line( (int16_t)((win->width() / 10) + ((i-1)*x_step)),
+                      (int16_t)(( 9 * win->height() / 10)-(concentrations[proti]*y_step)),
+                      (int16_t)((win->width() / 10) + (( i)  * x_step)),
+                      (int16_t)((9 * win->height() / 10)-(((Protein_R*)prot)->concentration()*y_step)) ,color2);
+      concentrations[proti]=((Protein_R*)prot)->concentration();
+
+      //if (((Protein_R*)prot)->get_id() == 34483) {
+
+        //printf("p[%ld]=%f ",((Protein_R*)prot)->get_id(),((Protein_R*)prot)->concentration());
+      //}
+
+      //printf("%d -- %f (%f) | ",proti,((Protein_R*)prot)->concentration(),((Protein_R*)prot)->mean());
+
+      delete[] color2;
+      proti++;
+    }
+    //printf("\n");
+  }
+
+  protein_list_.clear();
+  protein_list_ = _initial_protein_list;
+  //init_prot_list.clear();
+
+  delete[] concentrations;
+  delete[] color;
+}
+
+void Individual_R_X11::display_regulation( X11Window* win )
+{
+  int16_t nb_activators = 0;
+  int16_t nb_operators = 0;
+
+  double min_merged_activator_activity = 10;
+  double min_merged_operator_activity = 10;
+  double max_merged_activator_activity = 0;
+  double max_merged_operator_activity = 0;
+  double min_activator_activity = 10;
+  double min_operator_activity = 10;
+  double max_activator_activity = 0;
+  double max_operator_activity = 0;
+  double mean_activator_activity = 0;
+  double mean_operator_activity = 0;
+  // Retreive the genetic unit corresponding to the main chromosome
+  GeneticUnit* gen_unit = &genetic_unit_list_.front();
+  int32_t genome_length = gen_unit->dna()->length();
+
+  // draw color scale
+  char *color_bar = new char[8];
+  for ( int16_t i = 0 ; i < (win->width()/2) ; i++ )
+  {
+    sprintf( color_bar, "#%02x%02x%02x", 255 - (i * 255 * 2) / win->width(),0,0 );
+    win->draw_line( i, win->height() * 19 / 20, i, win->height(), color_bar );
+  }
+
+  for ( int16_t i = (win->width()/2) ; i < (win->width()) ; i++ )
+  {
+    sprintf( color_bar, "#%02x%02x%02x",0, ((i - (win->width() / 2)) * 255 * 2 ) / win->width(), 0 );
+    win->draw_line( i, win->height() * 19 / 20, i, win->height(), color_bar );
+  }
+  delete [] color_bar;
+
+
+  char display_string[80];
+  sprintf( display_string, "-");
+  win->draw_string( 15, (win->height() * 19 / 20) - 5, display_string );
+  sprintf( display_string, "0");
+  win->draw_string( win->width()/2,  (win->height() * 19 / 20) - 5, display_string );
+  sprintf( display_string, "+");
+  win->draw_string( win->width()-15,  (win->height() * 19 / 20) - 5, display_string );
+
+
+  // Compute display diameter according to genome length and window size
+  int16_t win_size      = std::min( win->width(), win->height() );
+  int16_t diam          = round( win_size * log( (double)genome_length ) / 16 );
+
+  // Prevent diameter from getting greater than 2/3 of the window size
+  if ( diam > 2 * win_size / 3 )
+  {
+    diam = 2 * win_size / 3;
+  }
+
+  // Compute coordinates of the upper-left corner of the containing square
+  int16_t pos_x = (win->width() - diam) / 2;
+  int16_t pos_y = (win->height() - diam) / 2;
+  double len_link;
+
+  char* color = new char[8];
+  strcpy( color, "#FFFFFF" );
+
+  // Draw main circle
+  win->draw_circle( pos_x, pos_y, diam );
+
+
+  // ---------------
+  //  Draw each RNA
+  // ---------------
+
+  // NB : As we want OriC to be at the "top" of the circle and the orientation
+  //      to be clockwise, the drawing angle (theta) will be given as
+  //      (90 - alpha), alpha being the "classical" trigonometric angle
+  int16_t alpha_rna_first,alpha_prot_first; // Angles of first and last transcribed bases from OriC (degrees)
+  int16_t theta_rna_first, theta_prot_first; // Transposed angles on the trigonometric circle (degrees)
+  // Same as above with precision = 1/64 degree
+  int16_t alpha_rna_first_64,alpha_prot_first_64;
+  int16_t theta_rna_first_64,theta_prot_first_64;
+  int16_t pos_rna_x,pos_rna_y,pos_prot_x,pos_prot_y;
+  int8_t nb_signals = 0;
+
+  // search for max and min regulation values (in order to scale colors)
+
+  for (const auto& rna: _rna_list_coding) {
+    // ---------------
+    //  Draw each regulation link
+    // ---------------
+
+    for (unsigned int i = 0; i < rna->nb_influences(); i++) {
+      //if (rna->_protein_list[i] != nullptr) {
+        //compute the activity
+        if (rna->_enhancing_coef_list[i] > 0) {
+          nb_activators++;
+          mean_activator_activity += rna->_enhancing_coef_list[i];
+          //printf("RNA %ld is activated by %ld at %f (mean %f)\n",
+          //        rna->get_id(),rna->_protein_list[i]->get_id(),rna->_enhancing_coef_list[i],mean_activator_activity);
+
+          if (rna->_enhancing_coef_list[i] >
+              max_activator_activity)
+            max_activator_activity = rna->_enhancing_coef_list[i];
+          if (rna->_enhancing_coef_list[i] <
+              min_activator_activity)
+            min_activator_activity = rna->_enhancing_coef_list[i];
+        }
+
+        if (rna->_operating_coef_list[i] > 0) {
+          nb_operators++;
+          mean_operator_activity += rna->_operating_coef_list[i];
+
+          //printf("RNA %ld is operated by %ld at %f (mean %f %f)\n",
+          //       rna->get_id(),rna->_protein_list[i]->get_id(),rna->_operating_coef_list[i],mean_activator_activity,
+          //       mean_operator_activity);
+
+          if (rna->_operating_coef_list[i] >
+              max_operator_activity)
+            max_operator_activity = rna->_operating_coef_list[i];
+          if (rna->_operating_coef_list[i] <
+              min_operator_activity)
+            min_operator_activity = rna->_operating_coef_list[i];
+        }
+        double merged_activity =
+            rna->_enhancing_coef_list[i] - rna->_operating_coef_list[i];
+        //if (merged_activity !=0) printf("RNA %ld is merge active by %ld at %f \n",rna->get_id(),rna->_protein_list[i]->get_id(),rna->_enhancing_coef_list[i],
+        //       merged_activity);
+
+        if (merged_activity > 0) {
+          if (merged_activity >
+              max_merged_activator_activity)
+            max_merged_activator_activity = merged_activity;
+          if (merged_activity <
+              min_activator_activity)
+            min_merged_activator_activity = merged_activity;
+        }
+        if (merged_activity < 0) {
+          if (merged_activity <
+              max_merged_operator_activity)
+            max_merged_operator_activity = merged_activity;
+          if (merged_activity >
+              min_merged_operator_activity)
+            min_merged_operator_activity = merged_activity;
+        }
+     // }
+    }
+  }
+
+  sprintf( display_string, "Activation links: %" PRId32 ", mean: %lf (max: %lf min:%lf)", nb_activators,mean_activator_activity/(double)nb_activators,max_activator_activity,min_activator_activity);
+  win->draw_string( 15, 15, display_string );
+  sprintf( display_string, "Inhibition links: %" PRId32 ", mean: %lf (max: %lf min: %lf)", nb_operators,mean_operator_activity/(double)nb_operators,max_operator_activity,min_operator_activity);
+  win->draw_string( 15, 30, display_string );
+
+  // end search for max
+
+  // begin links drawing procedure
+  for (const auto& rna: _rna_list_coding) {
+
+    // Alpha : angles from OriC (in degrees)
+    // Theta : angles on the trigonometric circle (in degrees)
+    // nb_sect : "length" in degrees of the arc to be drawn
+    alpha_rna_first = (int16_t) round(
+        360 * ((double) rna->first_transcribed_pos() / (double) genome_length));
+    theta_rna_first = std::fmod(90 - alpha_rna_first, 360);
+
+    // These are the same as above but with a higher precision (1/64 degrees)
+    alpha_rna_first_64 = (int16_t) round(64 * 360 *
+                                         ((double) rna->first_transcribed_pos() /
+                                          (double) genome_length));
+    theta_rna_first_64 = std::fmod(64 * 90 - alpha_rna_first_64, 64 * 360);
+
+    pos_rna_x = (win->width() / 2.0) +
+                (cos((theta_rna_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0);
+    pos_rna_y = (win->height() / 2.0) -
+                (sin((theta_rna_first_64 / (64 * 180.0) * M_PI)) * diam / 2.0);
+
+    // ---------------
+    //  Draw each regulation link
+    // ---------------
+    nb_signals = 0;
+    for (unsigned int i = 0; i < rna->_nb_influences; i++) {
+      Protein_R* prot = rna->_protein_list[i];
+
+      if (!(prot->is_signal())) {
+        alpha_prot_first = (int16_t) round(360 *
+                                           ((double) prot->first_translated_pos() /
+                                            (double) genome_length));
+        theta_prot_first = std::fmod(90 - alpha_prot_first, 360);
+
+        alpha_prot_first_64 = (int16_t) round(64 * 360 *
+                                              ((double) prot->first_translated_pos() /
+                                               (double) genome_length));
+        theta_prot_first_64 = std::fmod(64 * 90 - alpha_prot_first_64,
+                                        64 * 360);
+
+        pos_prot_x = (win->width() / 2.0) +
+                     (cos((theta_prot_first_64 / (64 * 180.0) * M_PI)) *
+                      diam /
+                      2.0);
+        pos_prot_y = (win->height() / 2.0) -
+                     (sin((theta_prot_first_64 / (64 * 180.0) * M_PI)) *
+                      diam /
+                      2.0);
+      }
+      else {
+        nb_signals += 1;
+        pos_prot_x = (win->width() / 10.0) * nb_signals;
+        pos_prot_y = (win->height() * 0.9);
+      }
+
+      // compute the color of the link
+      double merged_influence =
+          rna->_enhancing_coef_list[i] - rna->_operating_coef_list[i];
+
+      //printf("Merged influence of RNA %ld with prot %ld is %f (%f %f)\n",rna->get_id(),rna->_protein_list[i]->get_id(),
+      //       merged_influence,rna->_enhancing_coef_list[i],rna->_operating_coef_list[i]);
+      if (merged_influence > 0) {
+            //printf("ONE %lf %lf %d\n", merged_influence, max_merged_activator_activity,(int)((255 * merged_influence) / max_merged_activator_activity));
+            //printf("COLOR : #%02x%02x%02x\n", 0,(int)((255 * merged_influence) / max_merged_activator_activity),0);
+            sprintf(color, "#%02x%02x%02x", 0,
+                    (int) ((255 * merged_influence) /
+                           max_merged_activator_activity), 0);
+
+        }
+        else {
+            //printf("TWO %lf %lf %d\n", merged_influence, max_merged_activator_activity,(int)((255 * merged_influence) / max_merged_activator_activity));
+            //printf("COLOR : #%02x%02x%02x\n", (int)((255 * merged_influence) / max_merged_operator_activity),0,0);
+            sprintf(color, "#%02x%02x%02x", (int) ((255 * merged_influence) /
+                                                   max_merged_operator_activity),
+                    0, 0);
+
+        }
+
+
+        if (merged_influence != 0.0) {
+          //compute the lenght of the line
+          len_link = sqrt(
+              ((pos_rna_x - pos_prot_x) * (pos_rna_x - pos_prot_x)) +
+              ((pos_rna_y - pos_prot_y) * (pos_rna_y - pos_prot_y)));
+
+          //draw the link
+          win->draw_line(pos_rna_x, pos_rna_y, pos_prot_x, pos_prot_y, color);
+          //printf("Draw link from %d %d to %d %f with color\n",pos_rna_x, pos_rna_y, pos_prot_x, pos_prot_y);
+
+          //draw the arrow going to the protein to the rna regulated the arrow is well centered
+          win->draw_line(
+              (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) +
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link)),
+              (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) +
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link)),
+              (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) +
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link) -
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link)),
+              (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) -
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link) -
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link)),
+              color);
+
+          win->draw_line(
+              (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) +
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link)),
+              (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) +
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link)),
+              (int16_t) (((pos_rna_x + pos_prot_x) / 2.0) -
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link) -
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link)),
+              (int16_t) (((pos_rna_y + pos_prot_y) / 2.0) +
+                         (5.0 * (pos_rna_x - pos_prot_x) / len_link) -
+                         (5.0 * (pos_rna_y - pos_prot_y) / len_link)),
+              color);
+        }
+      }
+
+
+  }
+  delete[] color;
+}
+
+void Individual_R_X11::display_phenotype( X11Window* win, const Habitat_R& habitat )
+{
+  init_indiv(habitat);
+
+  double dist_temp = 0;
+  char* color = new char[8];
+  char* color2 = NULL;
+  int nb_eval = 0;
+  strcpy( color, "#FFFFFF" );
+
+  //variable qui sert à stocker du texte à afficher
+  char display_string[40];
+  int16_t nb_prot = 0;
+  int16_t life_time = exp_m()->exp_s()->get_nb_indiv_age();
+
+  //set the concentrations of proteins to their initial value
+  double* concentrations = new double[protein_list_.size()]; // initialise le tableau de concentrations.
+  int16_t prot_index = 0;
+  for (auto& prot : protein_list_) {
+    concentrations[prot_index++] = ((Protein_R*)prot)->concentration();
+  }
+
+  // compute steps
+  double x_step = 0.8 * win->width() / (double)(life_time * exp_m()->exp_s()->get_nb_degradation_step());
+  double y_step = 0.7 * win->height();
+
+  // Go from an evaluation date to the next
+  //int8_t compteur_env   = 0;
+  //envir = env_list[compteur_env];
+  //int16_t nb_signals = 0;
+
+  //Add the signals protein to the individual
+  //  _signals = envir->get_signals();
+  //for ( int8_t i = 0; i < _cloned_signals[compteur_env].size(); i++)
+  //{
+  //  ((ae_protein_R*) _cloned_signals[compteur_env][i])->set_concentration(0.9);
+  //}
+
+  std::set<int>* eval = exp_m()->exp_s()->get_list_eval_step();
+
+  std::list<Protein*> initial_protein_list = protein_list_;
+
+  for (int i = 1; i <= exp_m()->exp_s()->get_nb_indiv_age(); i++) {
+    //Set the concentration of signals for this age
+    for(Protein_R* prot1 : habitat.signals()) {
+      prot1->set_concentration(0.0);
+    }
+    for(Protein_R* prot2 : habitat.phenotypic_target(i).signals()) {
+      prot2->set_concentration(0.9);
+    }
+
+    for (int j = 0; j < exp_m()->exp_s()->get_nb_degradation_step(); j++) {
+      update_concentrations();
+    }
+
+    update_phenotype();
+
+    dynamic_cast<ExpManager_X11*>(exp_m())->display_3D(win, *(phenotype()),
+                                                           WHITE, (life_time * 5) - (5 * i), (life_time * -3) + (3 * i),true);
+
+    dynamic_cast<ExpManager_X11*>(exp_m())->display_3D(win, *(habitat.phenotypic_target(i ).fuzzy()),
+                                                           RED, (life_time * 5) - (5 * i), (life_time * -3) + (3 * i), false);
+
+
+    // if its an evaluation date
+    if (eval->find(i) != eval->end()) {
+      for (int i=0; i<NB_FEATURES; i++) {
+        dist_to_target_by_feature_[i] = 0;
+      }
+
+      distance_to_target_computed_ = false;
+      phenotype_computed_ = true;
+
+      compute_distance_to_target( habitat.phenotypic_target( i ) );
+
+      dist_temp += dist_to_target_by_feature_[METABOLISM];
+      nb_eval++;
+
+      //Draw the intermediate evaluation result
+      sprintf( display_string, " t = %" PRId32 ", dist_to_target =  %lf",i,dist_to_target_by_feature_[METABOLISM]);
+      win->draw_string( 15, 15*nb_eval, display_string );
+    }
+  }
+
+  //Draw the evaluation result
+  sprintf( display_string, "Mean dist_to_target =  %lf",dist_temp/(double)nb_eval);
+  win->draw_string( 15, 15*(nb_eval + 1), display_string );
+  protein_list_.clear();
+  protein_list_ = initial_protein_list;
+  delete[] concentrations;
+  delete[] color;
+}
+
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+} // namespace aevol
diff --git a/src/libaevol/ae_population_X11.h b/src/libaevol/raevol/Individual_R_X11.h
similarity index 70%
rename from src/libaevol/ae_population_X11.h
rename to src/libaevol/raevol/Individual_R_X11.h
index 1fb521c..8f50e89 100644
--- a/src/libaevol/ae_population_X11.h
+++ b/src/libaevol/raevol/Individual_R_X11.h
@@ -3,124 +3,113 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_POPULATION_X11_H__
-#define __AE_POPULATION_X11_H__
- 
- 
+
+
+ #ifndef AEVOL_INDIVIDUAL_R_X11_H_
+#define  AEVOL_INDIVIDUAL_R_X11_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
 #include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <zlib.h>
-
-
 
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_population.h>
-#include <ae_X11_window.h>
-
-
+#include "Individual_R.h"
+#include "Individual_X11.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-
-
-
-
-
- 
-class ae_population_X11 : public ae_population
-{  
+class Individual_R_X11 : public Individual_R, Individual_X11
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_population_X11( ae_exp_manager* exp_m );
-    //~ ae_population_X11( gzFile backup_file );
-  
+	Individual_R_X11( const Individual_R_X11 &model  );
+  Individual_R_X11(ExpManager * exp_m,
+                   std::shared_ptr<JumpingMT> mut_prng,
+                   std::shared_ptr<JumpingMT> stoch_prng,
+                   std::shared_ptr<MutationParams> param_mut,
+                   double w_max,
+                   int32_t min_genome_length,
+                   int32_t max_genome_length,
+                   bool allow_plasmids,
+                   int32_t id,
+                   const char* strain_name,
+                   int32_t age);
+	Individual_R_X11(  Individual_R_X11* parent, int32_t id,
+                     std::shared_ptr<JumpingMT> mut_prng,
+                     std::shared_ptr<JumpingMT> stoch_prng);
+	Individual_R_X11( ExpManager* exp_m, gzFile backup_file );
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_population_X11( void );
-  
+    virtual ~Individual_R_X11( void ) noexcept;
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+
     // =================================================================
     //                            Public Methods
     // =================================================================
-    virtual void display( ae_X11_window* win );
-    virtual void display_grid( ae_X11_window* win, double** cell_grid );
-
+    virtual void display_regulation( X11Window* win );
+    virtual void display_concentrations( X11Window* win );
+    virtual void display_phenotype( X11Window* win, const Habitat_R& habitat );
     // =================================================================
     //                           Public Attributes
     // =================================================================
-  
-  
-  
-  
-  
+
   protected :
-  
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    ae_population_X11( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    ae_population_X11( const ae_population &model )
+    /*    ae_individual_R_X11(const ae_individual &model)
     {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-  
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+      };*/
+
     // =================================================================
     //                           Protected Methods
     // =================================================================
-    void compute_colormap(void);  
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
-    char ** _col_map;
 
 };
 
-
 // =====================================================================
 //                          Accessors definitions
 // =====================================================================
-
-
-#endif // __AE_POPULATION_X11_H__
+} // namespace aevol
+#endif // AEVOL_INDIVIDUAL_R_X11_H_
diff --git a/src/libaevol/raevol/PhenotypicTargetHandler_R.cpp b/src/libaevol/raevol/PhenotypicTargetHandler_R.cpp
new file mode 100644
index 0000000..9b0978f
--- /dev/null
+++ b/src/libaevol/raevol/PhenotypicTargetHandler_R.cpp
@@ -0,0 +1,442 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#if __cplusplus == 201103L
+#include "make_unique.h"
+#endif
+
+#include "PhenotypicTargetHandler_R.h"
+#include "Habitat_R.h"
+#include "ExpSetup.h"
+#include "HybridFuzzy.h"
+#include "Utils.h"
+
+#include <iostream>
+
+
+using std::cout;
+using std::endl;
+
+
+namespace aevol {
+
+
+//##############################################################################
+//                                                                             #
+//                        Class PhenotypicTargetHandler                        #
+//                                                                             #
+//##############################################################################
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+PhenotypicTargetHandler_R::PhenotypicTargetHandler_R() : 
+PhenotypicTargetHandler(), phenotypic_target_models_(0), phenotypic_targets_(0) {
+  env_switch_probability_ = 0.1;
+}
+
+PhenotypicTargetHandler_R::PhenotypicTargetHandler_R(
+    const PhenotypicTargetHandler_R& rhs) : PhenotypicTargetHandler(rhs) {
+  phenotypic_target_models_ = rhs.phenotypic_target_models_;
+  phenotypic_targets_       = rhs.phenotypic_targets_;
+  env_gaussians_list_       = rhs.env_gaussians_list_;
+  env_signals_list_         = rhs.env_signals_list_;
+  signals_models_           = rhs.signals_models_;
+  env_switch_probability_   = rhs.env_switch_probability_;
+}
+
+PhenotypicTargetHandler_R::PhenotypicTargetHandler_R(gzFile backup_file) {
+  load(backup_file);
+}
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+PhenotypicTargetHandler_R::~PhenotypicTargetHandler_R() {
+  for(Protein_R* prot : signals_models_) {
+    delete prot;
+  }
+  signals_models_.clear();
+}
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+void PhenotypicTargetHandler_R::ApplyVariation() {
+  switch (var_method_) {
+    case NO_VAR :
+      return;
+    case AUTOREGRESSIVE_MEAN_VAR :
+      Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
+      //ApplyAutoregressiveMeanVariation();
+      break;
+    case AUTOREGRESSIVE_HEIGHT_VAR :
+      Utils::ExitWithDevMsg("Not implemented yet", __FILE__, __LINE__);
+      //ApplyAutoregressiveHeightVariation();
+      break;
+    case SWITCH_IN_A_LIST : {
+      //printf("ApplyVariation SWITCH_IN_A_LIST\n");
+
+      // A security in order to preserve the program from an infinite loop : while( id_new_env == id_old_env )
+      int8_t nb_env_in_list = phenotypic_target_models_.size();
+      int8_t last_age = phenotypic_targets_.size();
+      //printf("last_age = %d\n", last_age);
+      if ( nb_env_in_list <= 1 ) {
+        break;
+      }
+
+      //reset the vector of phenotypic targets keeping only the last environment
+      ResetPhenotypicTargets();
+
+      // Shortcuts used :
+      int8_t id_old_env = phenotypic_targets_.at(0)->get_id();
+      int8_t id_new_env = 0;
+
+      //Special case for the first env that may change also :
+      if ( var_prng_->random() < env_switch_probability_) {         
+        //we have to change to a new env that have an id different from the old one
+        while( id_new_env == id_old_env ) {
+          id_new_env = var_prng_->random(nb_env_in_list);
+        }
+        //The environment has changed
+        id_old_env = id_new_env;
+        changeEnv(0,id_new_env);
+      }
+
+      // At each age we have to add the environment of this age
+      for (int8_t i = 1; i < last_age ; i++) {
+        id_new_env = id_old_env;
+
+        // if we have to change of environment :
+        if ( var_prng_->random() < env_switch_probability_) {         
+          //we have to change to a new env that have an id different from the old one
+          while( id_new_env == id_old_env ) {
+            id_new_env = var_prng_->random(nb_env_in_list);
+          }
+          //The environment has changed
+          id_old_env = id_new_env;
+        }
+        addEnv(id_new_env);
+      }
+
+      break; }
+    default :
+      Utils::ExitWithDevMsg("Unknown variation method", __FILE__, __LINE__);
+      break;
+  }
+}
+
+void PhenotypicTargetHandler_R::InitPhenotypicTargetsAndModels( int8_t nb_indiv_age ) {
+  InitPhenotypicTargetsModels();
+  BuildPhenotypicTargetsModels();
+  InitPhenotypicTargets(nb_indiv_age);
+}
+
+void PhenotypicTargetHandler_R::print_geometric_areas() {
+  double area = 0.0;
+  for (int8_t i = 0; i < phenotypic_target_models_.size() ; i++) {
+    area = phenotypic_target_models_.at(i)->fuzzy()->get_geometric_area();
+    printf("Entire geometric area of the phenotypic target %d: %f\n", i, area);
+  }
+}
+
+void PhenotypicTargetHandler_R::save(gzFile backup_file) const {
+  //printf("Appel a la sauvegarde de PhenotypicTargetHandler_R\n");
+  PhenotypicTargetHandler::save(backup_file);
+  
+  // Sauvegarde en plus
+  gzwrite(backup_file, &env_switch_probability_, sizeof(env_switch_probability_));
+
+  // Save gaussians :
+  int8_t nb_gaussian_list = env_gaussians_list_.size();
+  int8_t nb_gaussians = 0;
+  gzwrite(backup_file, &nb_gaussian_list, sizeof(nb_gaussian_list));
+  for (const std::list<Gaussian>& gaussian_list: env_gaussians_list_) {
+    nb_gaussians = gaussian_list.size();
+    gzwrite(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+    for (const Gaussian & g: gaussian_list) {
+      g.save(backup_file);
+    }
+  }
+
+  // Save signals_models :
+  int8_t nb_signals_models = signals_models_.size();
+  gzwrite(backup_file, &nb_signals_models, sizeof(nb_signals_models)); 
+  for (Protein_R* p: signals_models_) {
+    p->save(backup_file);
+  }
+
+  // We do not need to save signals_models_list as its just a copy
+
+  // Save env_signals_list :
+  int8_t nb_signal_list = env_signals_list_.size();
+  int8_t nb_signals = 0;
+  gzwrite(backup_file, &nb_signal_list, sizeof(nb_signal_list));
+  for (const std::list<int8_t>& signals_list: env_signals_list_) {
+    nb_signals = signals_list.size();
+    gzwrite(backup_file, &nb_signals, sizeof(nb_signals));
+    for (const int8_t & id: signals_list) {
+      gzwrite(backup_file, &id, sizeof(id));
+    }
+  }
+
+  // Save segmentation :
+  int8_t nb_models = phenotypic_target_models_.size();
+  gzwrite(backup_file, &nb_models, sizeof(nb_models));
+  for (PhenotypicTarget_R* model: phenotypic_target_models_) {
+    model->save( backup_file);
+  }
+
+  // We have to save phenotypic_targets_ but we cannot since its a vector of pointer
+  // Thus we save the ids
+  int8_t nb_env = phenotypic_targets_.size();
+  gzwrite(backup_file, &nb_env, sizeof(nb_env));
+  int8_t id = 0;
+  for (PhenotypicTarget_R* env: phenotypic_targets_) {
+    id = env->get_id();
+    gzwrite(backup_file, &id, sizeof(id));
+  }
+}
+
+void PhenotypicTargetHandler_R::load(gzFile backup_file) {
+  //printf("Appel au chargement de PhenotypicTargetHandler_R\n");
+  PhenotypicTargetHandler::load(backup_file);
+  // Chargement en plus
+  gzread(backup_file, &env_switch_probability_, sizeof(env_switch_probability_));
+
+  //Load gaussians :
+  int8_t nb_gaussian_list = 0;
+  int8_t nb_gaussians = 0;
+  gzread(backup_file, &nb_gaussian_list, sizeof(nb_gaussian_list));
+  //printf("Loading %d gaussians list\n", nb_gaussian_list);
+  for( int8_t i = 0; i<nb_gaussian_list; i++) {
+    env_gaussians_list_.push_back( std::list<Gaussian>());
+    gzread(backup_file, &nb_gaussians, sizeof(nb_gaussians));
+    //printf("There are %d gaussian in gaussians list %d\n", nb_gaussians, i);
+    for (int8_t j = 0 ; j < nb_gaussians ; j++) {
+      env_gaussians_list_.back().push_back(Gaussian(backup_file));
+      //printf("Nb gaussians in current_gaussians : %d\n", env_gaussians_list_.back().size());
+      /*printf("Gaussian %d. Height = %f, Mean = %f, width = %f\n",j, 
+       env_gaussians_list_.back().back().get_height(),
+       env_gaussians_list_.back().back().get_mean(),
+       env_gaussians_list_.back().back().get_width()
+        );*/
+    }
+  }
+
+  // Load signals_models
+  int8_t nb_signals_models = 0;
+  gzread(backup_file, &nb_signals_models, sizeof(nb_signals_models)); 
+  for (int8_t i = 0; i< nb_signals_models; i++) {
+    signals_models_.push_back(new Protein_R(backup_file));
+  }
+
+  // Rebuild signals_models_list
+  for(Protein_R* prot : signals_models_) {
+    signals_models_list_.push_back(prot);
+  }
+
+  // Load env_signals_list
+  int8_t nb_signal_list = 0;
+  int8_t nb_signals = 0;
+  int8_t id = 0;
+  gzread(backup_file, &nb_signal_list, sizeof(nb_signal_list));
+  for( int8_t i = 0; i<nb_signal_list; i++) {
+    env_signals_list_.push_back( std::list<int8_t>());
+    gzread(backup_file, &nb_signals, sizeof(nb_signals));
+    for (int8_t j = 0 ; j < nb_signals ; j++) {
+      gzread(backup_file, &id, sizeof(id));
+      env_signals_list_.back().push_back(id);
+    }
+  }
+
+  // Now that gaussians are loaded we can build our PhenotypicTargetsModels
+  InitPhenotypicTargetsModels();
+
+  //load segmentation :
+  int8_t nb_models = 0;
+  gzread(backup_file, &nb_models, sizeof(nb_models));
+  for (int8_t i = 0 ; i < nb_models ; i++) {
+    phenotypic_target_models_.at(i)->load( backup_file );
+  }
+
+  BuildPhenotypicTargetsModels();
+  //Debug
+  //print_geometric_areas();
+
+  // We load the phenotypic targets after having built the models
+  int8_t nb_env = 0;
+  gzread(backup_file, &nb_env, sizeof(nb_env));
+  id = 0;
+  PhenotypicTarget_R* env_to_add = NULL;
+  for (int8_t i = 0 ; i < nb_env ; i++) {
+    gzread(backup_file, &id, sizeof(id));
+    addEnv(id);
+  }
+}
+
+// ============================================================================
+//                              Protected Methods
+// ============================================================================
+void PhenotypicTargetHandler_R::InitPhenotypicTargetsModels() {
+  // First of all we have to know how many models do we have :
+  int8_t nb_models = env_gaussians_list_.size();
+  //debug
+  //printf("PhenotypicTargetHandler_R::InitPhenotypicTargets : we have %d env\n", nb_models);
+  for (int8_t i = 0; i < nb_models ; i++) {
+    phenotypic_target_models_.push_back(new PhenotypicTarget_R( i ));
+  }
+}
+
+void PhenotypicTargetHandler_R::BuildPhenotypicTargetsModels() {
+  // First of all we have to know how many models do we have :
+  int8_t nb_models = env_gaussians_list_.size();
+  //debug
+  //printf("PhenotypicTargetHandler_R::BuildPhenotypicTargets : we have %d env\n", nb_models);
+  for (int8_t i = 0; i < nb_models ; i++) {
+    BuildPhenotypicTargetModel(i);
+  }
+}
+
+void PhenotypicTargetHandler_R::BuildPhenotypicTargetModel( int8_t id) {
+  //printf("Appel a BuildPhenotypicTargetModel avec id = %d\n", id);
+  // NB : Extreme points (at abscissa X_MIN and X_MAX) will be generated, we need to erase the list first
+  PhenotypicTarget_R* phenotypic_target = phenotypic_target_models_.at(id);
+  phenotypic_target->fuzzy()->reset();
+
+  //printf("On a %d gaussiennes\n", env_gaussians_list_.at(id).size());
+
+  // Generate sample points from gaussians
+  if (not env_gaussians_list_.at(id).empty()) {
+    for (int16_t i = 0; i <= sampling_; i++) {
+      Point new_point = Point(
+          X_MIN + (double) i * (X_MAX - X_MIN) / (double) sampling_, 0.0);
+      int gi = 0;
+      for (const Gaussian& g: env_gaussians_list_.at(id)) {
+        gi++;
+        new_point.y += g.compute_y(new_point.x);
+      }
+      phenotypic_target->fuzzy()->add_point(new_point.x, new_point.y);
+    }
+
+    if (FuzzyFactory::fuzzyFactory->get_fuzzy_flavor() == 1) {
+      HybridFuzzy* fuz = (HybridFuzzy*) phenotypic_target->fuzzy();
+
+      for (int i = 1; i < fuz->get_pheno_size(); i++) {
+        if (fuz->points()[i] == 0.0) {
+          int minL = i - 1;
+          int maxL = i + 1;
+          int dist = 1;
+
+          while (fuz->points()[maxL] == 0.0) {
+            maxL++;
+            dist++;
+          }
+          double inc = 0.0;
+          if (fuz->points()[maxL] > fuz->points()[minL]) {
+            inc = (fuz->points()[maxL] - fuz->points()[minL]) / dist;
+          } else {
+            inc = (fuz->points()[minL] - fuz->points()[maxL]) / dist;
+            minL = maxL;
+          }
+
+          for (int j = i; j < maxL; j++) {
+            fuz->points()[j] = fuz->points()[minL] + inc;
+            inc += inc;
+          }
+
+        }
+      }
+    }
+  }
+  // Add lower and upper bounds
+  phenotypic_target->fuzzy()->clip(AbstractFuzzy::min, Y_MIN);
+  phenotypic_target->fuzzy()->clip(AbstractFuzzy::max, Y_MAX);
+
+  // Simplify (get rid of useless points)
+  phenotypic_target->fuzzy()->simplify();
+
+  // Compute areas (total and by feature)
+  phenotypic_target->ComputeArea();
+  double area = phenotypic_target->fuzzy()->get_geometric_area();
+    //printf("Entire geometric area of the phenotypic target %d: %f\n", id, area);
+
+  //Add its signals to the env
+  // build a temporary real signals list (not a id list)
+  std::list<Protein_R*> signals_list;
+  for(int8_t & signal_id : env_signals_list_.at(id))
+  {
+    signals_list.push_back(signals_models_.at(signal_id));
+  }
+  phenotypic_target->set_signals(signals_list);
+}
+
+void PhenotypicTargetHandler_R::ResetPhenotypicTargets() {
+  PhenotypicTarget_R* last_env = phenotypic_targets_.back();
+  int8_t size = phenotypic_targets_.size();
+  phenotypic_targets_.clear();
+  phenotypic_targets_.resize(1);
+  phenotypic_targets_.at(0) = last_env;
+  phenotypic_targets_.reserve(size);
+  //printf("Taille de l'habitat après reset : %d\n", phenotypic_targets_.size());
+}
+
+void PhenotypicTargetHandler_R::InitPhenotypicTargets(int8_t nb_indiv_age) {
+  phenotypic_targets_.clear();
+  //printf("Taille de l'habitat après le clear dans initialize... : %d\n", phenotypic_targets_.size());
+  phenotypic_targets_.reserve(nb_indiv_age);
+  PhenotypicTarget_R* env_to_add;
+  for (int i = 0; i < nb_indiv_age; ++i) {
+    addEnv(0);
+  }
+  //printf("Taille de l'habitat avant applyvariation : %d\n", phenotypic_targets_.size());
+  ApplyVariation();  
+}
+
+void PhenotypicTargetHandler_R::addEnv( int8_t env_id ) {
+  assert(env_id >= 0 && env_id <= phenotypic_target_models_.size());
+  phenotypic_targets_.push_back( phenotypic_target_models_.at(env_id) );
+}
+
+void PhenotypicTargetHandler_R::changeEnv( int8_t ind, int8_t env_id ) {
+  assert(env_id >= 0 && env_id <= phenotypic_target_models_.size());
+  phenotypic_targets_.at(ind) = phenotypic_target_models_.at(env_id);
+}
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/libaevol/raevol/PhenotypicTargetHandler_R.h b/src/libaevol/raevol/PhenotypicTargetHandler_R.h
new file mode 100644
index 0000000..292f079
--- /dev/null
+++ b/src/libaevol/raevol/PhenotypicTargetHandler_R.h
@@ -0,0 +1,198 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+#ifndef AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__
+#define AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include <memory>
+//#include <list>
+#include <vector>
+
+#include "PhenotypicTargetHandler.h"
+#include "PhenotypicTarget_R.h"
+#include "../Utils.h"
+//#include "Habitat_R.h"
+
+//using std::list;
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+class Habitat_R;
+
+
+
+/**
+ * Manages a phenotypic target and its "evolution" over time
+ *
+ * Handles a phenotypic target, the variation and/or noise that may be applied
+ * to it as well as the set of possible phenotypic targets and the rules that
+ * define how and when we switch from one to another
+ */
+class PhenotypicTargetHandler_R : public virtual PhenotypicTargetHandler
+{
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  PhenotypicTargetHandler_R(void); //< Default ctor
+  PhenotypicTargetHandler_R(const PhenotypicTargetHandler_R&); //< Copy ctor
+  PhenotypicTargetHandler_R(PhenotypicTargetHandler_R&&) = delete; //< Move ctor
+  PhenotypicTargetHandler_R(gzFile backup_file);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~PhenotypicTargetHandler_R(void); //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  virtual void ApplyVariation();
+  void InitPhenotypicTargetsAndModels(int8_t nb_indiv_age);
+  void print_geometric_areas();
+  virtual void save(gzFile backup_file) const;
+  virtual void load(gzFile backup_file);
+
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  const std::vector<PhenotypicTarget_R*>& phenotypic_targets() const {
+    return phenotypic_targets_;
+  }
+
+  const PhenotypicTarget_R& phenotypic_target_model(int8_t env_id) const {
+    assert(env_id >= 0 && env_id <= (int8_t) phenotypic_target_models_.size());
+    return *(phenotypic_target_models_.at(env_id));
+  }
+
+  const PhenotypicTarget_R& phenotypic_target(int8_t age) const {
+    assert(age >= 0 && age <= (int8_t) phenotypic_targets_.size());
+    return *(phenotypic_targets_.at(age-1));
+  }
+
+  int8_t number_of_phenotypic_targets() const {
+    return phenotypic_targets_.size();
+  }
+
+  virtual double mean_environmental_area() const {
+    double total_dist = 0.0;
+    for(int8_t i = 0; i< (int8_t) phenotypic_targets_.size(); i++) {
+      total_dist += phenotypic_targets_.at(i)->area_by_feature(METABOLISM);
+    }
+
+    return total_dist/(double) phenotypic_targets_.size();
+  }
+
+  const std::list<Protein_R*> signals() const {
+    return signals_models_list_;
+  }
+
+  // ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+  void set_gaussians(const std::vector<std::list<Gaussian>>& gaussians_list) {
+    env_gaussians_list_ = gaussians_list;
+  }
+
+  void set_signals(const std::vector<std::list<int8_t>>& signals_list) {
+    env_signals_list_ = signals_list;
+  }
+
+  void set_signals_models(const std::vector<Protein_R*>& signals_list) {
+    signals_models_ = signals_list;
+    std::list<Protein_R*> temp_list;
+    for(Protein_R* prot : signals_list) {
+      temp_list.push_back(prot);
+    }
+    signals_models_list_ = temp_list;
+  }
+
+  void set_switch_probability(double p) {
+    env_switch_probability_ = p;
+  }
+
+  virtual void set_segmentation(int8_t nb_segments,
+                        double* boundaries,
+                        PhenotypicFeature * features,
+                        bool separate_segments = false) {
+    for(PhenotypicTarget_R* phenotypic_target : phenotypic_target_models_) {
+      phenotypic_target->set_segmentation(nb_segments,
+                                         boundaries,
+                                         features,
+                                         separate_segments);
+    }
+  }
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+  void InitPhenotypicTargetsModels();
+  void BuildPhenotypicTargetsModels();
+  void BuildPhenotypicTargetModel( int8_t id);
+  // This function keep only the last element of the vector
+  void ResetPhenotypicTargets();
+  void InitPhenotypicTargets(int8_t nb_indiv_age);
+  void addEnv( int8_t env_id );
+  void changeEnv( int8_t ind, int8_t env_id );
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  std::vector<PhenotypicTarget_R*> phenotypic_target_models_;
+  std::vector<PhenotypicTarget_R*> phenotypic_targets_;
+  std::vector<std::list<Gaussian>> env_gaussians_list_;
+  std::vector<std::list<int8_t>> env_signals_list_;
+  std::vector<Protein_R*> signals_models_;
+  std::list<Protein_R*> signals_models_list_;
+  double env_switch_probability_;
+};
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_PHENOTYPIC_TARGET_HANDLER_R_H__
diff --git a/src/libaevol/ae_phenotype.cpp b/src/libaevol/raevol/PhenotypicTarget_R.cpp
similarity index 58%
rename from src/libaevol/ae_phenotype.cpp
rename to src/libaevol/raevol/PhenotypicTarget_R.cpp
index 958b8ff..92b6f87 100644
--- a/src/libaevol/ae_phenotype.cpp
+++ b/src/libaevol/raevol/PhenotypicTarget_R.cpp
@@ -3,105 +3,95 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
+//
+// ****************************************************************************
 
 
-// =================================================================
-//                              Libraries
-// =================================================================
 
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "PhenotypicTarget_R.h"
+#include "FuzzyFactory.h"
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_phenotype.h>
-#include <ae_individual.h>
+#include <cstring>
 
 
+namespace aevol {
 
 
 //##############################################################################
 //                                                                             #
-//                              Class ae_phenotype                             #
+//                           Class PhenotypicTarget                            #
 //                                                                             #
 //##############################################################################
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-ae_phenotype::ae_phenotype( void ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = NULL;
-}
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
 
-ae_phenotype::ae_phenotype( ae_individual* indiv, const ae_phenotype &model ) :
-#ifdef __NO_X
-  ae_fuzzy_set( model )
-#elif defined __X11
-  ae_fuzzy_set_X11( model )
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+// ============================================================================
+//                                Constructors
+// ============================================================================
+PhenotypicTarget_R::PhenotypicTarget_R() : PhenotypicTarget() {
+  id_ = 0;
+  //signals_ = NULL;
 }
 
-ae_phenotype::ae_phenotype( ae_individual* indiv ) :
-#ifdef __NO_X
-  ae_fuzzy_set()
-#elif defined __X11
-  ae_fuzzy_set_X11()
-#else
-#error You must specify a graphic option
-#endif
-{
-  _indiv = indiv;
+PhenotypicTarget_R::PhenotypicTarget_R( int8_t id) : PhenotypicTarget() {
+  id_ = id;
+  //signals_ = NULL;
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-ae_phenotype::~ae_phenotype( void )
-{
+PhenotypicTarget_R::PhenotypicTarget_R(const PhenotypicTarget_R& rhs) : PhenotypicTarget(rhs) {
+  id_ = rhs.id_;
+  signals_ = rhs.signals_;
 }
 
-// =================================================================
-//                            Public Methods
-// =================================================================
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+PhenotypicTarget_R::~PhenotypicTarget_R() {
+
+}
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+// ============================================================================
+//                                   Methods
+// ============================================================================
+  void PhenotypicTarget_R::save(gzFile backup_file) const {
+    //printf("Appel a la sauvegarde de PhenotypicTarget_R\n");
+    SaveSegmentation(backup_file);
+    // Backup id
+    gzwrite(backup_file, &id_, sizeof(id_));
+  }
+
+  void PhenotypicTarget_R::load(gzFile backup_file) {
+    //printf("Appel au chargement de PhenotypicTarget_R\n");
+    LoadSegmentation(backup_file);
+    //  Retrieve id
+    gzread(backup_file, &id_, sizeof(id_));
+  }
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+} // namespace aevol
diff --git a/src/libaevol/raevol/PhenotypicTarget_R.h b/src/libaevol/raevol/PhenotypicTarget_R.h
new file mode 100644
index 0000000..22388a4
--- /dev/null
+++ b/src/libaevol/raevol/PhenotypicTarget_R.h
@@ -0,0 +1,132 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+#ifndef AEVOL_PHENOTYPIC_TARGET_R_H__
+#define AEVOL_PHENOTYPIC_TARGET_R_H__
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+
+#include "PhenotypicTarget.h"
+#include "Protein_R.h"
+
+
+namespace aevol {
+
+// ============================================================================
+//                          Class declarations
+// ============================================================================
+//class Protein_R;
+
+
+
+
+
+class PhenotypicTarget_R : public PhenotypicTarget
+{
+  // Faut il le laisser ?
+  //friend class PhenotypicTargetHandler;
+
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  PhenotypicTarget_R(void); //< Default ctor
+  PhenotypicTarget_R(int8_t id);
+  PhenotypicTarget_R(const PhenotypicTarget_R&); //< Copy ctor
+  PhenotypicTarget_R(PhenotypicTarget_R&&) = delete; //< Move ctor
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~PhenotypicTarget_R(void); //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  void save(gzFile backup_file) const;
+  void load(gzFile backup_file);
+  // ==========================================================================
+  //                                 Getters
+  // ==========================================================================
+  int8_t get_id() const {
+    return id_;
+  }
+  std::list<Protein_R*> signals() const {
+    return signals_;
+  }
+
+// ==========================================================================
+  //                                 Setters
+  // ==========================================================================
+  void set_signals(const std::list<Protein_R*>& signals_list) {
+    signals_ = signals_list;
+  }
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+  // An identifier used to know the position of this Phenotypic target in PhenotypicTargetHandler
+  int8_t id_;
+  std::list<Protein_R*> signals_;
+};
+
+
+// ============================================================================
+//                           Getters' definitions
+// ============================================================================
+
+// ============================================================================
+//                           Setters' definitions
+// ============================================================================
+
+// ============================================================================
+//                          Operators' definitions
+// ============================================================================
+
+// ============================================================================
+//                       Inline functions' definition
+// ============================================================================
+
+} // namespace aevol
+
+#endif // AEVOL_PHENOTYPIC_TARGET_R_H__
diff --git a/src/libaevol/raevol/Protein_R.cpp b/src/libaevol/raevol/Protein_R.cpp
new file mode 100644
index 0000000..3c9f148
--- /dev/null
+++ b/src/libaevol/raevol/Protein_R.cpp
@@ -0,0 +1,218 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Protein_R.h"
+#include "Codon.h"
+#include "GeneticUnit.h"
+#include "ExpManager.h"
+
+#include <algorithm>
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                           Class Protein_R                                #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+long Protein_R::id = 0;
+
+// =================================================================
+//                             Constructors
+// =================================================================
+Protein_R::Protein_R( GeneticUnit* gen_unit, const Protein_R &model ) : Protein::Protein( gen_unit, model ) {
+  concentration_ = model.concentration_;
+  _initial_concentration = model.concentration_;
+  _delta_concentration = model._delta_concentration;
+  _signal = model._signal;
+  _inherited = model._inherited;
+  is_TF_ = model.is_TF_;
+  _id = id++;
+
+  if (!AA_list_.empty()) {
+    _cod_tab = new int8_t[AA_list_.size()];
+    int i = 0;
+    for (auto cod : AA_list_) {
+      _cod_tab[i] = cod->value();
+      i++;
+    }
+  }
+}
+
+
+Protein_R::Protein_R( GeneticUnit* gen_unit, const std::list<Codon*> codon_list,
+							Strand strand, int32_t shine_dal_pos,
+                            Rna* rna, double w_max )  :
+		Protein::Protein( gen_unit, codon_list, strand, shine_dal_pos, rna, w_max )
+{
+  _rna_R_list.push_back((Rna_R*)rna);
+
+	_initial_concentration = concentration_;
+  _delta_concentration   = 0;
+  _inherited             = false;
+  _signal                = false;
+  is_TF_			       = false;
+  _id = id++;
+
+  if (!AA_list_.empty()) {
+    _cod_tab = new int8_t[AA_list_.size()];
+    int i = 0;
+    for (auto cod : AA_list_) {
+      _cod_tab[i] = cod->value();
+      i++;
+    }
+  }
+}
+
+//used to build the signal protein
+Protein_R::Protein_R( const std::list<Codon*> codon_list, double concentration, double w_max)  :
+		Protein::Protein( codon_list, concentration, w_max )
+{
+  _initial_concentration = 0;
+  _delta_concentration  = 0;
+  _inherited            = false;
+  _signal               = true;
+  is_TF_			 = false;
+  _id = id++;
+
+  if (!AA_list_.empty()) {
+    _cod_tab = new int8_t[AA_list_.size()];
+    int i = 0;
+    for (auto cod : AA_list_) {
+      _cod_tab[i] = cod->value();
+      i++;
+    }
+  }
+}
+
+Protein_R::Protein_R( gzFile backup_file ) : Protein::Protein( backup_file )
+{
+  // the Influence list is re-calculate afterward, and then is not saved, nor use in this consctructor.
+  gzread( backup_file, &_delta_concentration,   	sizeof(_delta_concentration) );
+  gzread( backup_file, &_inherited,   			sizeof(_inherited) );
+  gzread( backup_file, &_signal,   			sizeof(_signal) );
+  is_TF_			 = false;
+  _id = id++;
+
+  if (!AA_list_.empty()) {
+    _cod_tab = new int8_t[AA_list_.size()];
+    int i = 0;
+    for (auto cod : AA_list_) {
+      _cod_tab[i] = cod->value();
+      i++;
+    }
+  }
+}
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Protein_R::~Protein_R( void )
+{
+  for (unsigned int i = 0; i < _rna_R_list.size(); i++)
+    _rna_R_list[i] = NULL;
+
+	_rna_R_list.clear();
+
+  delete [] _cod_tab;
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void Protein_R::compute_delta_concentration( void )
+{
+  _delta_concentration = 0;
+
+  if( _signal == false )
+  {
+    //printf("Protein %ld is generated by ",_id);
+	for (auto& rna: _rna_R_list)
+    {
+      //if (_id == 34483) printf("%ld (influenced by %ld) at %f  - ",rna->get_id(),rna->_operating_coef_list.size(),rna->get_synthesis_rate());
+      assert( _inherited == false);
+
+      _delta_concentration += rna->get_synthesis_rate();
+      ///if (_id == 34483) printf("Prot %ld synthesis by %ld at rate %e\n",_id,rna->get_id(),rna->get_synthesis_rate());
+    }
+    //if (_id == 34483) printf("\n");
+    //if (_id == 34483)  printf("Prot %ld BEFORE DEGRADATION concentration %f %f\n",_id,concentration_,_delta_concentration);
+
+    _delta_concentration -= gen_unit_->exp_m()->exp_s()->get_degradation_rate() * concentration_;
+    _delta_concentration *= 1/((double)gen_unit_->exp_m()->exp_s()->get_nb_degradation_step());
+
+    //if (_id == 34483)  printf("Prot %ld AFTER degradation concentration %f %f\n",_id,concentration_,_delta_concentration);
+  }
+}
+
+int8_t Protein_R::get_codon( int32_t index )
+{
+  return _cod_tab[index];
+}
+
+void Protein_R::save( gzFile backup_file )
+{
+  Protein::save( backup_file );
+
+  // the Influence list is re-calculate afterward, and then is not saved.
+  gzwrite( backup_file, &_delta_concentration,   	sizeof(_delta_concentration) );
+  gzwrite( backup_file, &_inherited,   			sizeof(_inherited) );
+  gzwrite( backup_file, &_signal,   			sizeof(_signal) );
+}
+// =================================================================
+//                           Protected Methods
+// =================================================================
+void Protein_R::remove_influences( void )
+{
+  printf("ALERTE la proteine veut détruire une influence !!!\n");
+
+  _rna_R_list.clear();
+}
+
+
+void Protein_R::add_RNA( Rna * rna )
+{
+  Protein::add_RNA(rna);
+  _initial_concentration += rna->basal_level();
+  //printf("Add RNA %ld to protein %ld (influence by %ld)\n",((Rna_R*)rna)->get_id(),_id,((Rna_R*)rna)->_operating_coef_list.size());
+  _rna_R_list.push_back((Rna_R*)rna);
+}
+
+} // namespace aevol
diff --git a/src/libaevol/ae_env_segment.h b/src/libaevol/raevol/Protein_R.h
similarity index 55%
rename from src/libaevol/ae_env_segment.h
rename to src/libaevol/raevol/Protein_R.h
index b315019..cb8f980 100644
--- a/src/libaevol/ae_env_segment.h
+++ b/src/libaevol/raevol/Protein_R.h
@@ -3,197 +3,202 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_ENV_SEGMENT_H__
-#define __AE_ENV_SEGMENT_H__
- 
- 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-
 
+#ifndef AE_PROTEIN_R_H
+#define AE_PROTEIN_R_H
 
 // =================================================================
-//                            Project Files
+//                              Libraries
 // =================================================================
-#include <ae_macros.h>
-#include <ae_enums.h>
-
-
-
 
 // =================================================================
-//                          Class declarations
+//                            Project Files
 // =================================================================
+#include "Codon.h"
+#include "Protein.h"
+#include "Rna_R.h"
 
+namespace aevol {
 
+//##############################################################################
+//                                                                             #
+//                           Class ae_protein_R                                #
+//                                                                             #
+//##############################################################################
+class GeneticUnit;
 
-
-
- 
-class ae_env_segment : public ae_object
-{  
+class Protein_R : public Protein
+{
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    inline ae_env_segment( double start, double stop, ae_env_axis_feature feature );
-    inline ae_env_segment( const ae_env_segment& source );
-    inline ae_env_segment( gzFile backup_file );
-  
+  Protein_R() = delete;
+  Protein_R(const Protein_R &model) = delete;
+	Protein_R( GeneticUnit* gen_unit, const Protein_R &model );
+	Protein_R( GeneticUnit* gen_unit,
+    		const std::list<Codon*> codon_list,
+    		Strand strand,
+    		int32_t shine_dal_pos,
+    		Rna* rna,
+        double w_max ); // TODO Rna_R?
+	Protein_R( const std::list<Codon*> codon_list, double concentration, double w_max);
+	Protein_R( gzFile backup_file );
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    inline virtual ~ae_env_segment( void );
-  
+    virtual ~Protein_R( void );
+
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+    inline void     set_inherited( bool is_inherited );
+    inline void     set_signal( bool is_signal);
+    inline bool     is_inherited( void );
+    inline bool     is_signal( void );
+
     // =================================================================
     //                            Public Methods
     // =================================================================
-    inline void save( gzFile backup_file ) const;
-    inline void load( gzFile backup_file );
-  
+    //inline ae_protein_R* copy( void );
+    inline void    multiply_concentration( double factor );
+    inline void    set_concentration ( double concentration);
+    inline void    update_concentration( void );
+    inline void    reset_concentration( void );
+    inline void    set_initial_concentration( void );
+           void    compute_delta_concentration( void );
+           int8_t  get_codon( int32_t index );
+//           void    add_influence( ae_influence_R* influence );
+	         void    save( gzFile backup_file );
+//	         void    remove_influence( ae_influence_R* influence );
+    inline int8_t  get_cod_tab(int32_t index) const;
+
+    void  add_RNA( Rna * rna );
+
+    long get_id() { return _id; };
+
     // =================================================================
     //                           Public Attributes
     // =================================================================
-    double start;
-    double stop;
-    ae_env_axis_feature feature;
-  
-  
-  
-  
-  
+	bool is_TF_;
+
+    static long id;
+
+    int8_t*   _cod_tab;
+    //bool _concentration_has_change = true;
   protected :
-  
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    ae_env_segment( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    //~ ae_env_segment( const ae_env_segment &model )
-    //~ {
-      //~ printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
 
-  
     // =================================================================
     //                           Protected Methods
     // =================================================================
-  
+    void remove_influences( void );
+
     // =================================================================
     //                          Protected Attributes
     // =================================================================
+    std::vector<Rna_R*>  _rna_R_list;
+    double    _delta_concentration;
+    bool      _inherited;
+    bool      _signal;
+    double    _initial_concentration; // concentration at cell birth
+    long      _id;
+
 };
 
+// =====================================================================
+//                          Accessors definitions
+// =====================================================================
+//std::vector<ae_influence_R*> ae_protein_R::get_influence_list( void )
+//{
+//  return _influence_list;
+//}
 
+// =====================================================================
+//                       Inline functions' definition
+// =====================================================================
+inline void Protein_R::update_concentration( void )
+{
+ // _concentration_has_change = _delta_concentration != 0 ? true : false;
 
+  concentration_ += _delta_concentration;
+}
 
-//##############################################################################
-//                                                                             #
-//                             Class ae_env_segment                            #
-//                                                                             #
-//##############################################################################
+inline void Protein_R::set_inherited( bool is_inherited )
+{
+  _inherited = is_inherited;
+}
 
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
+inline void Protein_R::set_signal( bool is_signal )
+{
+  _signal = is_signal;
+}
 
-// =================================================================
-//                             Constructors
-// =================================================================
-//~ inline ae_env_segment::ae_env_segment( void )
-//~ {
-  //~ start   = X_MIN;
-  //~ stop    = X_MAX;
-  //~ feature = NEUTRAL;
-//~ }
-
-inline ae_env_segment::ae_env_segment( double start, double stop, ae_env_axis_feature feature )
+inline void Protein_R::reset_concentration( void )
 {
-  this->start   = start;
-  this->stop    = stop;
-  this->feature = feature;
+  concentration_ = _initial_concentration;
 }
 
-inline ae_env_segment::ae_env_segment( const ae_env_segment& source )
+inline void Protein_R::set_initial_concentration( void )
 {
-  this->start   = source.start;
-  this->stop    = source.stop;
-  this->feature = source.feature;
+  _initial_concentration = concentration_;
 }
 
-inline ae_env_segment::ae_env_segment( gzFile backup_file )
+inline bool Protein_R::is_inherited( void )
 {
-  load( backup_file );
+  return _inherited;
 }
 
-// =================================================================
-//                             Destructors
-// =================================================================
-inline ae_env_segment::~ae_env_segment( void )
+inline bool Protein_R::is_signal( void )
 {
+  return _signal;
 }
 
 // =====================================================================
-//                          Accessors definitions
+//                       Inline functions' definition
 // =====================================================================
 
-// =================================================================
-//                            Public Methods
-// =================================================================
-inline void ae_env_segment::save( gzFile backup_file ) const
+inline void Protein_R::multiply_concentration( double factor )
 {
-  gzwrite( backup_file, &start, sizeof(start) );
-  gzwrite( backup_file, &stop,  sizeof(stop) );
-  int8_t tmp_feature = feature;
-  gzwrite( backup_file, &tmp_feature, sizeof(tmp_feature) );
+  concentration_ *= factor;
 }
 
-inline void ae_env_segment::load( gzFile backup_file )
+inline void Protein_R::set_concentration( double concentration )
 {
-  gzread( backup_file, &start,  sizeof(start) );
-  gzread( backup_file, &stop,   sizeof(stop) );
-  int8_t tmp_feature;
-  gzread( backup_file, &tmp_feature, sizeof(tmp_feature) );
-  feature = (ae_env_axis_feature) tmp_feature;
+  concentration_ = concentration;
 }
 
-// =================================================================
-//                           Protected Methods
-// =================================================================
+inline int8_t Protein_R::get_cod_tab(int32_t index) const
+{
+  return _cod_tab[index];
+}
 
+} // namespace aevol
 
 
-#endif // __AE_ENV_SEGMENT_H__
+#endif // AE_PROTEIN_R_H
diff --git a/src/libaevol/raevol/Rna_R.cpp b/src/libaevol/raevol/Rna_R.cpp
new file mode 100644
index 0000000..f13c473
--- /dev/null
+++ b/src/libaevol/raevol/Rna_R.cpp
@@ -0,0 +1,280 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+// 
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// 
+//*****************************************************************************
+
+
+
+
+// =================================================================
+//                              Libraries
+// =================================================================
+#include <math.h>
+#ifdef __BLAS__
+#include <cblas.h>
+#endif
+// =================================================================
+//                            Project Files
+// =================================================================
+#include "Rna_R.h"
+#include "Individual_R.h"
+#include "ExpManager.h"
+
+namespace aevol {
+
+//##############################################################################
+//                                                                             #
+//                           Class ae_rna_R                                    #
+//                                                                             #
+//##############################################################################
+
+// =================================================================
+//                    Definition of static attributes
+// =================================================================
+
+long Rna_R::id = 0;
+// =================================================================
+//                             Constructors
+// =================================================================
+Rna_R::Rna_R( GeneticUnit* gen_unit, const Rna_R &model ) : Rna( gen_unit, model )
+{
+  _protein_list = model._protein_list;
+  _enhancing_coef_list = model._enhancing_coef_list;
+  _operating_coef_list = model._operating_coef_list;
+  _id = model._id;
+  _nb_influences = model._nb_influences;
+}
+
+Rna_R::Rna_R( GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff ) :
+		Rna( gen_unit, strand, index, diff )
+{
+  _id = id++;
+  _nb_influences = 0;
+}
+
+/*
+ae_rna_R::ae_rna_R( ae_rna_R* parent ) :
+ae_rna( parent )
+{
+  _influence_list = parent->_influence_list->copy();
+}
+*/
+
+// =================================================================
+//                             Destructors
+// =================================================================
+Rna_R::~Rna_R( void )
+{
+	_protein_list.clear();
+	_enhancing_coef_list.clear();
+	_operating_coef_list.clear();
+}
+
+// =================================================================
+//                            Public Methods
+// =================================================================
+void Rna_R::set_influences( std::list<Protein*>& protein_list )
+{
+	int32_t enhancer_position = get_enhancer_position();
+	int32_t operator_position = get_operator_position();
+
+	_protein_list.clear();
+  _protein_list.resize(protein_list.size());
+  _enhancing_coef_list.clear();
+	_enhancing_coef_list.resize(protein_list.size());
+  _operating_coef_list.clear();
+	_operating_coef_list.resize(protein_list.size());
+
+  int i = 0;
+  double enhance=0,operate=0;
+  //#pragma omp simd
+	for (auto& prot : protein_list) {
+    enhance = affinity_with_protein( enhancer_position, prot );
+    operate = affinity_with_protein( operator_position, prot );
+
+    if (enhance != 0.0 || operate != 0.0) {
+
+      _protein_list[i] = (Protein_R*) prot;
+
+      _enhancing_coef_list[i] = enhance;
+      _operating_coef_list[i] = operate;
+
+      _protein_list[i]->is_TF_ = true;
+     // _protein_concentration_list[i] = prot->concentration();
+      i++;
+    }
+    //else
+    // _protein_list[i] = nullptr;
+	}
+
+  _nb_influences = i==0 ? 0 : i-1;
+
+  /*if (protein_list.size() > 0)
+    printf("Set Influences of RNA %ld with %ld %ld %ld\n",_id,_enhancing_coef_list.size(),_operating_coef_list.size(),
+         _protein_list.size());*/
+
+}
+
+double Rna_R::get_synthesis_rate( void )
+{
+  double enhancer_activity  = 0;
+  double operator_activity  = 0;
+
+//#ifndef __BLAS__
+  for (int i = 0; i < _nb_influences; i++) {
+  	enhancer_activity  += _enhancing_coef_list[i] * _protein_list[i]->concentration_;
+    operator_activity  += _operating_coef_list[i] * _protein_list[i]->concentration_;
+  }
+/*#else
+  double enhancer_tab[_nb_influences];
+  double operator_tab[_nb_influences];
+
+  for (int i = 0; i < _nb_influences; i++) {
+  	enhancer_tab[i] = _enhancing_coef_list[i] * _protein_list[i]->concentration_;
+    operator_tab[i] = _operating_coef_list[i] * _protein_list[i]->concentration_;
+  }
+
+  enhancer_activity = cblas_dasum(_nb_influences,enhancer_tab,1);
+  operator_activity = cblas_dasum(_nb_influences,operator_tab,1);
+#endif*/
+
+  double enhancer_activity_pow_n  = pow( enhancer_activity, gen_unit_->exp_m()->exp_s()->get_hill_shape_n() );
+  double operator_activity_pow_n  = pow( operator_activity, gen_unit_->exp_m()->exp_s()->get_hill_shape_n() );
+
+  //if (enhancer_activity != 0.0 || operator_activity != 0.0)
+  /*if (_id == 132073) printf("Synthesis of RNA %ld : E %f O %f EP %f OP %f SN %f S %f B %f\n",_id,enhancer_activity,operator_activity,enhancer_activity_pow_n,
+                                                operator_activity_pow_n,gen_unit_->exp_m()->exp_s()->get_hill_shape_n(),
+         gen_unit_->exp_m()->exp_s()->get_hill_shape(),basal_level_);*/
+
+  return   basal_level_
+           * (gen_unit_->exp_m()->exp_s()->get_hill_shape()
+              / (operator_activity_pow_n + gen_unit_->exp_m()->exp_s()->get_hill_shape()))
+           * (1 + ((1 / basal_level_) - 1)
+                  * (enhancer_activity_pow_n /
+                     (enhancer_activity_pow_n + gen_unit_->exp_m()->exp_s()->get_hill_shape())));
+}
+
+// =================================================================
+//                           Protected Methods
+// =================================================================
+int32_t Rna_R::get_enhancer_position( void )
+{
+  if(strand_ == LEADING)
+  {
+    return (pos_ - 20)  % ( gen_unit_->dna()->length() );
+  }
+  else  // strand_ = LAGGING
+  {
+    return (pos_ + 20)  % ( gen_unit_->dna()->length() );
+  }
+}
+
+int32_t Rna_R::get_operator_position( void )
+{
+  if(strand_ == LEADING)
+  {
+    return (pos_ + PROM_SIZE)  % ( gen_unit_->dna()->length() );
+  }
+  else  // strand_ = LAGGING
+  {
+    return (pos_ - PROM_SIZE)  % ( gen_unit_->dna()->length() );
+  }
+}
+
+double Rna_R::affinity_with_protein( int32_t index, Protein *protein )
+{
+  int32_t len = protein->length();
+
+  if (len < 5)
+    return 0.0;
+
+#ifndef __BLAS__
+  double  max = 0;
+  double temp = 1;
+#else
+  double  tab_temp[len-4];
+#endif
+
+
+
+
+	  int32_t quadon_tab[5];
+	//  int32_t* codon_tab;
+	//  codon_tab = new int32_t[len];
+
+	  Individual_R*  indiv = NULL;
+	  Protein_R*     prot  = NULL;
+
+	  // printf("affinity_with_protein - len = %d\n",len);
+
+	  // Putting the quadons and the codons on local tab
+	  indiv = dynamic_cast< Individual_R* >( gen_unit_->indiv() );
+	  prot  = ( Protein_R* )( protein );
+	  for ( int32_t i = 0 ; i < 5; i++ )
+	  {
+	    quadon_tab[i] = indiv->get_quadon( gen_unit_, strand_, (index+i) );
+	  }
+	//  for (int32_t i = 0 ; i < len ; i++ )
+	//  {
+	//    codon_tab[i] = prot->get_codon(i);
+	//  }
+	//
+	//  t2 = high_resolution_clock::now();
+	//    	  duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();
+	//    	  ae_logger::addLog(CODON,duration);
+	//    	  t1 = t2;
+
+	  //// Calculate the affinity
+
+    double (*binding_matrix)[MAX_QUADON][MAX_CODON] = &(gen_unit_->exp_m()->exp_s()->_binding_matrix);
+    #pragma omp simd
+	  for ( int32_t i = 0 ; i < len - 4; i++ )
+	  {
+
+#ifndef __BLAS__
+      temp = 1;
+#else
+      tab_temp[i]  = (*binding_matrix)[quadon_tab[0]][prot->_cod_tab[i]];
+      tab_temp[i]  *= (*binding_matrix)[quadon_tab[1]][prot->_cod_tab[i+1]];
+      tab_temp[i]  *= (*binding_matrix)[quadon_tab[2]][prot->_cod_tab[i+2]];
+      tab_temp[i]  *= (*binding_matrix)[quadon_tab[3]][prot->_cod_tab[i+3]];
+      tab_temp[i]  *= (*binding_matrix)[quadon_tab[4]][prot->_cod_tab[i+4]];
+#endif
+
+#ifndef __BLAS__
+      for ( int8_t j = 0 ; j < 5 ; j++ ) {
+        temp *=    gen_unit_->exp_m()->exp_s()->_binding_matrix[quadon_tab[0]][prot->_cod_tab[i+j]];
+      }
+
+      max = (max < temp) ? temp : max;
+#endif
+	  }
+
+#ifdef __BLAS__
+  return tab_temp[cblas_idamax(len-4,tab_temp,1)];
+#else
+  return max;
+#endif
+}
+} // namespace aevol
diff --git a/src/libaevol/ae_phenotype.h b/src/libaevol/raevol/Rna_R.h
similarity index 74%
rename from src/libaevol/ae_phenotype.h
rename to src/libaevol/raevol/Rna_R.h
index ed4ad3b..a97ad4a 100644
--- a/src/libaevol/ae_phenotype.h
+++ b/src/libaevol/raevol/Rna_R.h
@@ -3,133 +3,128 @@
 //          Aevol - An in silico experimental evolution platform
 //
 // ****************************************************************************
-// 
+//
 // Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
 // Web: http://www.aevol.fr/
 // E-mail: See <http://www.aevol.fr/contact/>
 // Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
+//
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 2 of the License, or
 // (at your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
+//
 // ****************************************************************************
- 
- 
-#ifndef __AE_PHENOTYPE_H__
-#define __AE_PHENOTYPE_H__
- 
- 
+
+
+#ifndef  AEVOL_RNA_R_H_
+#define  AEVOL_RNA_R_H_
+
+
 // =================================================================
 //                              Libraries
 // =================================================================
 #include <inttypes.h>
 
-
-
 // =================================================================
 //                            Project Files
 // =================================================================
-#include <ae_fuzzy_set.h>
-
-#ifdef __X11
-#include <ae_fuzzy_set_X11.h>
-#endif
-
-
+#include "Rna.h"
+#include "Protein_R.h"
 
+namespace aevol {
 
 // =================================================================
 //                          Class declarations
 // =================================================================
-class ae_individual;
-
-
-
 
- 
-#ifdef __NO_X
-class ae_phenotype : public ae_fuzzy_set
-#elif defined __X11
-class ae_phenotype : public ae_fuzzy_set_X11
-#else
-#error You must specify a graphic option
-#endif
+class Protein_R;
+class Rna_R : public Rna
 {
   public :
-  
+
     // =================================================================
     //                             Constructors
     // =================================================================
-    ae_phenotype( void );
-    ae_phenotype( ae_individual* indiv );
-    ae_phenotype( ae_individual* indiv, const ae_phenotype &model );
-  
+    Rna_R( GeneticUnit* gen_unit, const Rna_R &model );
+	  Rna_R( GeneticUnit* gen_unit, Strand strand, int32_t index, int8_t diff );
+
     // =================================================================
     //                             Destructors
     // =================================================================
-    virtual ~ae_phenotype( void );
-  
+    virtual ~Rna_R( void );
+
     // =================================================================
     //                              Accessors
     // =================================================================
-  
+    inline std::vector<Protein_R*> get_protein_list( void );
     // =================================================================
     //                            Public Methods
     // =================================================================
-  
+    void    set_influences( std::list<Protein*>& protein_list );
+    double  get_synthesis_rate( void );
+    double  get_affinity_with_protein( int32_t index, Protein *protein );
+    int32_t get_enhancer_position( void );
+    int32_t get_operator_position( void );
+
+    long get_id() { return _id; };
+
+    int nb_influences() { return _nb_influences; }
     // =================================================================
     //                           Public Attributes
     // =================================================================
-  
-  
-  
-  
-  
+    std::vector<Protein_R*> _protein_list;
+    std::vector<double> _enhancing_coef_list;
+    std::vector<double> _operating_coef_list;
+    //std::vector<double> _protein_concentration_list;
+    static long id;
+
+    int _nb_influences = 0;
   protected :
-  
+
     // =================================================================
     //                         Forbidden Constructors
     // =================================================================
-    //~ ae_phenotype( void )
-    //~ {
-      //~ printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      //~ exit( EXIT_FAILURE );
-    //~ };
-    ae_phenotype( const ae_phenotype &model )
+    /*    ae_rna()
     {
-      printf( "ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
+      printf("ERROR : Call to forbidden constructor in file %s : l%d\n", __FILE__, __LINE__);
+      exit(EXIT_FAILURE);
+      };*/
 
-  
     // =================================================================
     //                           Protected Methods
     // =================================================================
-  
+    //inline  ae_rna_R* copy( void );
+    double    affinity_with_protein( int32_t index, Protein *protein );
+
     // =================================================================
     //                          Protected Attributes
-    // =================================================================
-    ae_individual* _indiv;
+    // ================================================================
+
+    long _id;
+
+
 };
 
 
+
+
 // =====================================================================
 //                          Accessors definitions
 // =====================================================================
-
 // =====================================================================
 //                       Inline functions' definition
 // =====================================================================
 
 
-#endif // __AE_PHENOTYPE_H__
+} // namespace aevol
+
+#endif // AEVOL_RNA_R_H_
diff --git a/src/libaevol/tests/Makefile.am b/src/libaevol/tests/Makefile.am
deleted file mode 100644
index e122956..0000000
--- a/src/libaevol/tests/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-if WITH_CPPUNIT
-
-############################################
-#           Set a few variables            #
-############################################
-AM_CPPFLAGS = $(AEVOLCPPFLAGS) $(CPPUNIT_CFLAGS)
-AM_CXXFLAGS = $(AEVOLCXXFLAGS)
-AM_LDFLAGS = $(AEVOLLDFLAGS)
-
-AM_CPPFLAGS += -I$(top_srcdir)/src/libaevol
-AM_LDFLAGS  += -L$(top_srcdir)/src/libaevol
-
-
-############################################
-#         Set aevol library to use         #
-############################################
-LDADD = $(top_srcdir)/src/libaevol/libaevol.a
-LDADD += $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a $(CPPUNIT_LIBS)
-
-
-############################################
-# C99 exact-width integer specific support #
-############################################
-# __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc)
-# __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( <value> )
-# __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX
-AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
-
-
-############################################
-#           Set programs to build          #
-############################################
-check_PROGRAMS = run_tests
-CLEANFILES = $(check_PROGRAMS)
-TESTS = $(check_PROGRAMS)
-
-
-
-# The target_CPPFLAGS for each target may look useless, it is here to force automake to create
-# prefixed object files so that we don't use an object file built for another set of macrodefinitions
-# e.g. We don't want to use an object file created with NO_X when building the X11 lib
-
-run_tests_SOURCES = run_tests.cpp Test_ae_jumping_mt.cpp Test_ae_jumping_mt.h Test_ae_list.cpp Test_ae_list.h Test_ae_individual.cpp Test_ae_individual.h
-run_tests_CPPFLAGS = $(AM_CPPFLAGS)
-
-
-endif
diff --git a/src/libaevol/tests/Makefile.in b/src/libaevol/tests/Makefile.in
deleted file mode 100644
index 50be94a..0000000
--- a/src/libaevol/tests/Makefile.in
+++ /dev/null
@@ -1,659 +0,0 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
- at WITH_CPPUNIT_TRUE@check_PROGRAMS = run_tests$(EXEEXT)
-subdir = src/libaevol/tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__run_tests_SOURCES_DIST = run_tests.cpp Test_ae_jumping_mt.cpp \
-	Test_ae_jumping_mt.h Test_ae_list.cpp Test_ae_list.h \
-	Test_ae_individual.cpp Test_ae_individual.h
- at WITH_CPPUNIT_TRUE@am_run_tests_OBJECTS =  \
- at WITH_CPPUNIT_TRUE@	run_tests-run_tests.$(OBJEXT) \
- at WITH_CPPUNIT_TRUE@	run_tests-Test_ae_jumping_mt.$(OBJEXT) \
- at WITH_CPPUNIT_TRUE@	run_tests-Test_ae_list.$(OBJEXT) \
- at WITH_CPPUNIT_TRUE@	run_tests-Test_ae_individual.$(OBJEXT)
-run_tests_OBJECTS = $(am_run_tests_OBJECTS)
-run_tests_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
- at WITH_CPPUNIT_TRUE@run_tests_DEPENDENCIES =  \
- at WITH_CPPUNIT_TRUE@	$(top_srcdir)/src/libaevol/libaevol.a \
- at WITH_CPPUNIT_TRUE@	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a \
- at WITH_CPPUNIT_TRUE@	$(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-	-o $@
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(run_tests_SOURCES)
-DIST_SOURCES = $(am__run_tests_SOURCES_DIST)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-ETAGS = etags
-CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
-AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
-AEVOLLDFLAGS = @AEVOLLDFLAGS@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
-CXX = @CXX@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GREP = @GREP@
-HAVE_DOXYGEN = @HAVE_DOXYGEN@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-XMKMF = @XMKMF@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build_alias = @build_alias@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host_alias = @host_alias@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-
-############################################
-#           Set a few variables            #
-############################################
-
-############################################
-# C99 exact-width integer specific support #
-############################################
-# __STDC_FORMAT_MACROS allows us to use exact-width integer format specifiers e.g. PRId32 (for printf etc)
-# __STDC_CONSTANT_MACROS allows us to define exact-width integer macros with e.g. INT32_C( <value> )
-# __STDC_LIMIT_MACROS allows us to use exact-width integer limit macros with e.g. INT32_MAX
- at WITH_CPPUNIT_TRUE@AM_CPPFLAGS = $(AEVOLCPPFLAGS) $(CPPUNIT_CFLAGS) \
- at WITH_CPPUNIT_TRUE@	-I$(top_srcdir)/src/libaevol \
- at WITH_CPPUNIT_TRUE@	-D__STDC_FORMAT_MACROS \
- at WITH_CPPUNIT_TRUE@	-D__STDC_CONSTANT_MACROS \
- at WITH_CPPUNIT_TRUE@	-D__STDC_LIMIT_MACROS
- at WITH_CPPUNIT_TRUE@AM_CXXFLAGS = $(AEVOLCXXFLAGS)
- at WITH_CPPUNIT_TRUE@AM_LDFLAGS = $(AEVOLLDFLAGS) \
- at WITH_CPPUNIT_TRUE@	-L$(top_srcdir)/src/libaevol
-
-############################################
-#         Set aevol library to use         #
-############################################
- at WITH_CPPUNIT_TRUE@LDADD = $(top_srcdir)/src/libaevol/libaevol.a \
- at WITH_CPPUNIT_TRUE@	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a \
- at WITH_CPPUNIT_TRUE@	$(CPPUNIT_LIBS)
- at WITH_CPPUNIT_TRUE@CLEANFILES = $(check_PROGRAMS)
- at WITH_CPPUNIT_TRUE@TESTS = $(check_PROGRAMS)
-
-# The target_CPPFLAGS for each target may look useless, it is here to force automake to create
-# prefixed object files so that we don't use an object file built for another set of macrodefinitions
-# e.g. We don't want to use an object file created with NO_X when building the X11 lib
- at WITH_CPPUNIT_TRUE@run_tests_SOURCES = run_tests.cpp Test_ae_jumping_mt.cpp Test_ae_jumping_mt.h Test_ae_list.cpp Test_ae_list.h Test_ae_individual.cpp Test_ae_individual.h
- at WITH_CPPUNIT_TRUE@run_tests_CPPFLAGS = $(AM_CPPFLAGS)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .cpp .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libaevol/tests/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/libaevol/tests/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-checkPROGRAMS:
-	-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
-run_tests$(EXEEXT): $(run_tests_OBJECTS) $(run_tests_DEPENDENCIES) $(EXTRA_run_tests_DEPENDENCIES) 
-	@rm -f run_tests$(EXEEXT)
-	$(CXXLINK) $(run_tests_OBJECTS) $(run_tests_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/run_tests-Test_ae_individual.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/run_tests-Test_ae_jumping_mt.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/run_tests-Test_ae_list.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/run_tests-run_tests.Po at am__quote@
-
-.cpp.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
-
-.cpp.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-run_tests-run_tests.o: run_tests.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-run_tests.o -MD -MP -MF $(DEPDIR)/run_tests-run_tests.Tpo -c -o run_tests-run_tests.o `test -f 'run_tests.cpp' || echo '$(srcdir)/'`run_tests.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-run_tests.Tpo $(DEPDIR)/run_tests-run_tests.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='run_tests.cpp' object='run_tests-run_tests.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-run_tests.o `test -f 'run_tests.cpp' || echo '$(srcdir)/'`run_tests.cpp
-
-run_tests-run_tests.obj: run_tests.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-run_tests.obj -MD -MP -MF $(DEPDIR)/run_tests-run_tests.Tpo -c -o run_tests-run_tests.obj `if test -f 'run_tests.cpp'; then $(CYGPATH_W) 'run_tests.cpp'; else $(CYGPATH_W) '$(srcdir)/run_tests.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-run_tests.Tpo $(DEPDIR)/run_tests-run_tests.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='run_tests.cpp' object='run_tests-run_tests.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-run_tests.obj `if test -f 'run_tests.cpp'; then $(CYGPATH_W) 'run_tests.cpp'; else $(CYGPATH_W) '$(srcdir)/run_tests.cpp'; fi`
-
-run_tests-Test_ae_jumping_mt.o: Test_ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_jumping_mt.o -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_jumping_mt.Tpo -c -o run_tests-Test_ae_jumping_mt.o `test -f 'Test_ae_jumping_mt.cpp' || echo '$(srcdir)/'`Test_ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_jumping_mt.Tpo $(DEPDIR)/run_tests-Test_ae_jumping_mt.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_jumping_mt.cpp' object='run_tests-Test_ae_jumping_mt.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_jumping_mt.o `test -f 'Test_ae_jumping_mt.cpp' || echo '$(srcdir)/'`Test_ae_jumping_mt.cpp
-
-run_tests-Test_ae_jumping_mt.obj: Test_ae_jumping_mt.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_jumping_mt.obj -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_jumping_mt.Tpo -c -o run_tests-Test_ae_jumping_mt.obj `if test -f 'Test_ae_jumping_mt.cpp'; then $(CYGPATH_W) 'Test_ae_jumping_mt.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_jumping_mt.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_jumping_mt.Tpo $(DEPDIR)/run_tests-Test_ae_jumping_mt.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_jumping_mt.cpp' object='run_tests-Test_ae_jumping_mt.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_jumping_mt.obj `if test -f 'Test_ae_jumping_mt.cpp'; then $(CYGPATH_W) 'Test_ae_jumping_mt.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_jumping_mt.cpp'; fi`
-
-run_tests-Test_ae_list.o: Test_ae_list.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_list.o -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_list.Tpo -c -o run_tests-Test_ae_list.o `test -f 'Test_ae_list.cpp' || echo '$(srcdir)/'`Test_ae_list.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_list.Tpo $(DEPDIR)/run_tests-Test_ae_list.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_list.cpp' object='run_tests-Test_ae_list.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_list.o `test -f 'Test_ae_list.cpp' || echo '$(srcdir)/'`Test_ae_list.cpp
-
-run_tests-Test_ae_list.obj: Test_ae_list.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_list.obj -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_list.Tpo -c -o run_tests-Test_ae_list.obj `if test -f 'Test_ae_list.cpp'; then $(CYGPATH_W) 'Test_ae_list.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_list.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_list.Tpo $(DEPDIR)/run_tests-Test_ae_list.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_list.cpp' object='run_tests-Test_ae_list.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_list.obj `if test -f 'Test_ae_list.cpp'; then $(CYGPATH_W) 'Test_ae_list.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_list.cpp'; fi`
-
-run_tests-Test_ae_individual.o: Test_ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_individual.o -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_individual.Tpo -c -o run_tests-Test_ae_individual.o `test -f 'Test_ae_individual.cpp' || echo '$(srcdir)/'`Test_ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_individual.Tpo $(DEPDIR)/run_tests-Test_ae_individual.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_individual.cpp' object='run_tests-Test_ae_individual.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_individual.o `test -f 'Test_ae_individual.cpp' || echo '$(srcdir)/'`Test_ae_individual.cpp
-
-run_tests-Test_ae_individual.obj: Test_ae_individual.cpp
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT run_tests-Test_ae_individual.obj -MD -MP -MF $(DEPDIR)/run_tests-Test_ae_individual.Tpo -c -o run_tests-Test_ae_individual.obj `if test -f 'Test_ae_individual.cpp'; then $(CYGPATH_W) 'Test_ae_individual.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_individual.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/run_tests-Test_ae_individual.Tpo $(DEPDIR)/run_tests-Test_ae_individual.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='Test_ae_individual.cpp' object='run_tests-Test_ae_individual.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o run_tests-Test_ae_individual.obj `if test -f 'Test_ae_individual.cpp'; then $(CYGPATH_W) 'Test_ae_individual.cpp'; else $(CYGPATH_W) '$(srcdir)/Test_ae_individual.cpp'; fi`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-check-TESTS: $(TESTS)
-	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
-	srcdir=$(srcdir); export srcdir; \
-	list=' $(TESTS) '; \
-	$(am__tty_colors); \
-	if test -n "$$list"; then \
-	  for tst in $$list; do \
-	    if test -f ./$$tst; then dir=./; \
-	    elif test -f $$tst; then dir=; \
-	    else dir="$(srcdir)/"; fi; \
-	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xpass=`expr $$xpass + 1`; \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=XPASS; \
-	      ;; \
-	      *) \
-		col=$$grn; res=PASS; \
-	      ;; \
-	      esac; \
-	    elif test $$? -ne 77; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xfail=`expr $$xfail + 1`; \
-		col=$$lgn; res=XFAIL; \
-	      ;; \
-	      *) \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=FAIL; \
-	      ;; \
-	      esac; \
-	    else \
-	      skip=`expr $$skip + 1`; \
-	      col=$$blu; res=SKIP; \
-	    fi; \
-	    echo "$${col}$$res$${std}: $$tst"; \
-	  done; \
-	  if test "$$all" -eq 1; then \
-	    tests="test"; \
-	    All=""; \
-	  else \
-	    tests="tests"; \
-	    All="All "; \
-	  fi; \
-	  if test "$$failed" -eq 0; then \
-	    if test "$$xfail" -eq 0; then \
-	      banner="$$All$$all $$tests passed"; \
-	    else \
-	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
-	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
-	    fi; \
-	  else \
-	    if test "$$xpass" -eq 0; then \
-	      banner="$$failed of $$all $$tests failed"; \
-	    else \
-	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
-	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
-	    fi; \
-	  fi; \
-	  dashes="$$banner"; \
-	  skipped=""; \
-	  if test "$$skip" -ne 0; then \
-	    if test "$$skip" -eq 1; then \
-	      skipped="($$skip test was not run)"; \
-	    else \
-	      skipped="($$skip tests were not run)"; \
-	    fi; \
-	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$skipped"; \
-	  fi; \
-	  report=""; \
-	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$report"; \
-	  fi; \
-	  dashes=`echo "$$dashes" | sed s/./=/g`; \
-	  if test "$$failed" -eq 0; then \
-	    col="$$grn"; \
-	  else \
-	    col="$$red"; \
-	  fi; \
-	  echo "$${col}$$dashes$${std}"; \
-	  echo "$${col}$$banner$${std}"; \
-	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
-	  test -z "$$report" || echo "$${col}$$report$${std}"; \
-	  echo "$${col}$$dashes$${std}"; \
-	  test "$$failed" -eq 0; \
-	else :; fi
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
-	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic ctags distclean \
-	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
-	uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/libaevol/tests/Test_ae_individual.cpp b/src/libaevol/tests/Test_ae_individual.cpp
deleted file mode 100644
index 7efcc0e..0000000
--- a/src/libaevol/tests/Test_ae_individual.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <string.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include "Test_ae_individual.h"
-#include <ae_macros.h>
-#include <ae_genetic_unit.h>
-#include <ae_rna.h>
-#include <ae_protein.h>
-#include <ae_params_mut.h>
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-
-
-
-
-//############################################################################
-//                                                                           #
-//                         Class Test_ae_individual                          #
-//                                                                           #
-//############################################################################
-CPPUNIT_TEST_SUITE_REGISTRATION( Test_ae_individual );
-
-// ===========================================================================
-//                               Static attributes
-// ===========================================================================
-
-// ===========================================================================
-//                                  Constructors
-// ===========================================================================
-Test_ae_individual::Test_ae_individual( void )
-{
-}
-
-// ===========================================================================
-//                                  Destructors
-// ===========================================================================
-Test_ae_individual::~Test_ae_individual( void )
-{
-}
-
-// ===========================================================================
-//                                   Operators
-// ===========================================================================
-
-// ===========================================================================
-//                                 Public Methods
-// ===========================================================================
-void Test_ae_individual::setUp( void )
-{
-  // Build ad-hoc genomes
-  // (and reverse to test the same things on the lagging strand.):
-  //
-  // indiv1: (AS + prom + AS + AG + AS + term + AS + prom + AS)
-  // indiv2: reverse
-  // indiv3: (AS + AG + AS + term + AS + prom + AS)
-  // indiv4: reverse
-  //
-  // AS = Arbitrary Sequence
-  // AG = Arbitrary Gene
-  // Do not modify the sequences !
-  char as[5][10] = {
-    "0011",
-    "11101",
-    "110011",
-    "11000",
-    "000101"
-  };
-  char gene[255];
-  sprintf(gene, "%s0011000100110110010001", SHINE_DAL_SEQ);
-  char term[TERM_SIZE+1] = "01000001101";
-  char prom[2][23] = {
-    "0101010001110110010110", // dist from consensus: 2 => basal level: 0.6
-    "0101011001110010010010"  // dist from consensus: 1 => basal level: 0.8
-  };
-  char* genome = new char[1024];
-  sprintf( genome, "%s%s%s%s%s%s%s%s%s", as[0], prom[0], as[1], gene, as[2],
-           term, as[3], prom[1], as[4]);
-
-  // Build indiv1
-  ae_params_mut params_mut;
-  indiv1 = new ae_individual(NULL, NULL, NULL, &params_mut, 1.0, 10, 1000, false, 1, "anon-strain-1", 0);
-  indiv1->add_GU(genome, strlen(genome));
-  genome = NULL;
-
-  // Do transcription and translation
-  indiv1->do_transcription();
-  indiv1->do_translation();
-
-
-
-  // Build indiv2
-  genome = indiv1->get_genetic_unit(0)->get_dna()->get_subsequence(0,0,LAGGING);
-  indiv2 = new ae_individual(NULL, NULL, NULL, &params_mut, 1.0, 10, 1000, false, 1, "anon-strain-2", 0);
-  indiv2->add_GU(genome, strlen(genome));
-  genome = NULL;
-
-  // Do transcription and translation
-  indiv2->do_transcription();
-  indiv2->do_translation();
-
-
-
-
-  // Build indiv3
-  genome = new char[1024];
-  sprintf( genome, "%s%s%s%s%s%s%s", as[0], gene, as[1], term, as[2], prom[1], as[3]);
-  indiv3 = new ae_individual(NULL, NULL, NULL, &params_mut, 1.0, 10, 1000, false, 1, "anon-strain-3", 0);
-  indiv3->add_GU(genome, strlen(genome));
-  genome = NULL;
-
-  // Do transcription and translation
-  indiv3->do_transcription();
-  indiv3->do_translation();
-
-
-
-
-  // Build indiv4
-  genome = indiv3->get_genetic_unit(0)->get_dna()->get_subsequence(0,0,LAGGING);
-  indiv4 = new ae_individual(NULL, NULL, NULL, &params_mut, 1.0, 10, 1000, false, 1, "anon-strain-4", 0);
-  indiv4->add_GU(genome, strlen(genome));
-  genome = NULL;
-
-  // Do transcription and translation
-  indiv4->do_transcription();
-  indiv4->do_translation();
-
-
-  // ***************************************************************************
-  // The following commented code allows to print stuff about rnas and proteins
-
-  // printf("%"PRId32" rnas and %"PRId32" prots\n", indiv4->get_rna_list()->get_nb_elts(), indiv4->get_protein_list()->get_nb_elts());
-  // ae_list_node<ae_rna*>* rna_node = indiv4->get_rna_list()->get_first();
-  // while (rna_node != NULL)
-  // {
-  //   printf("%s rna at pos %"PRId32" (%f, %"PRId32")\n",
-  //           rna_node->get_obj()->get_strand() == LEADING ? "LEADING":"LAGGING",
-  //           rna_node->get_obj()->get_promoter_pos(),
-  //           rna_node->get_obj()->get_basal_level(),
-  //           rna_node->get_obj()->get_transcript_length());
-
-  //   rna_node = rna_node->get_next();
-  // }
-
-  // ae_list_node<ae_protein*>* protein_node = indiv4->get_protein_list()->get_first();
-  // while (protein_node != NULL)
-  // {
-  //   printf("%s protein at pos %"PRId32" (length: %"PRId32", concentr: %f, nb_rnas: %"PRId32")\n",
-  //           protein_node->get_obj()->get_strand() == LEADING ? "LEADING":"LAGGING",
-  //           protein_node->get_obj()->get_shine_dal_pos(),
-  //           protein_node->get_obj()->get_length(),
-  //           protein_node->get_obj()->get_concentration(),
-  //           protein_node->get_obj()->get_rna_list()->get_nb_elts());
-
-  //   protein_node = protein_node->get_next();
-  // }
-}
-
-void Test_ae_individual::tearDown( void )
-{
-  delete indiv1;
-  delete indiv2;
-  delete indiv3;
-  delete indiv4;
-}
-
-void Test_ae_individual::test1( void )
-{
-  // Check genome size
-  CPPUNIT_ASSERT( indiv1->get_amount_of_dna() == 109 );
-  CPPUNIT_ASSERT( indiv1->get_genetic_unit_seq_length(0) == 109 );
-
-  // Check RNA list
-  ae_list<ae_rna*>* rna_list = indiv1->get_rna_list();
-  CPPUNIT_ASSERT( rna_list->get_nb_elts() == 2 );
-  ae_rna* rna = rna_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LEADING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 4 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.6 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 50 );
-  rna = rna_list->get_last()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LEADING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 81 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.8 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 82 );
-
-  // Check protein list
-  ae_list<ae_protein*>* prot_list = indiv1->get_protein_list();
-  CPPUNIT_ASSERT( prot_list->get_nb_elts() == 1 );
-  ae_protein* prot = prot_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( prot->get_strand() == LEADING );
-  CPPUNIT_ASSERT( prot->get_shine_dal_pos() == 31 );
-  CPPUNIT_ASSERT( prot->get_length() == 4 );
-  CPPUNIT_ASSERT( prot->get_concentration() == 1.4 );
-  CPPUNIT_ASSERT( prot->get_rna_list()->get_nb_elts() == 2 );
-}
-
-void Test_ae_individual::test2( void )
-{
-  // Check genome size
-  CPPUNIT_ASSERT( indiv2->get_amount_of_dna() == 109 );
-  CPPUNIT_ASSERT( indiv2->get_genetic_unit_seq_length(0) == 109 );
-
-  // Check RNA list
-  ae_list<ae_rna*>* rna_list = indiv2->get_rna_list();
-  CPPUNIT_ASSERT( rna_list->get_nb_elts() == 2 );
-  ae_rna* rna = rna_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LAGGING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 104 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.6 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 50 );
-  rna = rna_list->get_last()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LAGGING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 27 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.8 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 82 );
-
-  // Check protein list
-  ae_list<ae_protein*>* prot_list = indiv2->get_protein_list();
-  CPPUNIT_ASSERT( prot_list->get_nb_elts() == 1 );
-  ae_protein* prot = prot_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( prot->get_strand() == LAGGING );
-  CPPUNIT_ASSERT( prot->get_shine_dal_pos() == 77 );
-  CPPUNIT_ASSERT( prot->get_length() == 4 );
-  CPPUNIT_ASSERT( prot->get_concentration() == 1.4 );
-  CPPUNIT_ASSERT( prot->get_rna_list()->get_nb_elts() == 2 );
-}
-
-void Test_ae_individual::test3( void )
-{
-  // Check genome size
-  CPPUNIT_ASSERT( indiv3->get_amount_of_dna() == 81 );
-  CPPUNIT_ASSERT( indiv3->get_genetic_unit_seq_length(0) == 81 );
-
-  // Check RNA list
-  ae_list<ae_rna*>* rna_list = indiv3->get_rna_list();
-  CPPUNIT_ASSERT( rna_list->get_nb_elts() == 1 );
-  ae_rna* rna = rna_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LEADING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 54 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.8 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 42 );
-
-  // Check protein list
-  ae_list<ae_protein*>* prot_list = indiv3->get_protein_list();
-  CPPUNIT_ASSERT( prot_list->get_nb_elts() == 1 );
-  ae_protein* prot = prot_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( prot->get_strand() == LEADING );
-  CPPUNIT_ASSERT( prot->get_shine_dal_pos() == 4 );
-  CPPUNIT_ASSERT( prot->get_length() == 4 );
-  CPPUNIT_ASSERT( prot->get_concentration() == 0.8 );
-  CPPUNIT_ASSERT( prot->get_rna_list()->get_nb_elts() == 1 );
-}
-
-void Test_ae_individual::test4( void )
-{
-  // Check genome size
-  CPPUNIT_ASSERT( indiv4->get_amount_of_dna() == 81 );
-  CPPUNIT_ASSERT( indiv4->get_genetic_unit_seq_length(0) == 81 );
-
-  // Check RNA list
-  ae_list<ae_rna*>* rna_list = indiv4->get_rna_list();
-  CPPUNIT_ASSERT( rna_list->get_nb_elts() == 1 );
-  ae_rna* rna = rna_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( rna->get_strand() == LAGGING );
-  CPPUNIT_ASSERT( rna->get_promoter_pos() == 26 );
-  CPPUNIT_ASSERT( rna->get_basal_level() == 0.8 );
-  CPPUNIT_ASSERT( rna->get_transcript_length() == 42 );
-
-  // Check protein list
-  ae_list<ae_protein*>* prot_list = indiv4->get_protein_list();
-  CPPUNIT_ASSERT( prot_list->get_nb_elts() == 1 );
-  ae_protein* prot = prot_list->get_first()->get_obj();
-  CPPUNIT_ASSERT( prot->get_strand() == LAGGING );
-  CPPUNIT_ASSERT( prot->get_shine_dal_pos() == 76 );
-  CPPUNIT_ASSERT( prot->get_length() == 4 );
-  CPPUNIT_ASSERT( prot->get_concentration() == 0.8 );
-  CPPUNIT_ASSERT( prot->get_rna_list()->get_nb_elts() == 1 );
-}
-
-// ===========================================================================
-//                                Protected Methods
-// ===========================================================================
-
-// ===========================================================================
-//                              Non inline accessors
-// ===========================================================================
diff --git a/src/libaevol/tests/Test_ae_individual.h b/src/libaevol/tests/Test_ae_individual.h
deleted file mode 100644
index 41bf950..0000000
--- a/src/libaevol/tests/Test_ae_individual.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-#ifndef TEST_AE_INDIVIDUAL
-#define TEST_AE_INDIVIDUAL
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <cstdio>
-#include <cstdlib>
-#include <cppunit/TestCase.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_individual.h>
-
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-using namespace CppUnit;
-using namespace std;
-
-
-
-
-
-
-class Test_ae_individual : public TestFixture
-{
-  CPPUNIT_TEST_SUITE( Test_ae_individual );
-  CPPUNIT_TEST( test1 );
-  CPPUNIT_TEST( test2 );
-  CPPUNIT_TEST( test3 );
-  CPPUNIT_TEST( test4 );
-  CPPUNIT_TEST_SUITE_END();
-  
-  
-  public :
-    
-    // =======================================================================
-    //                                 Enums
-    // =======================================================================
-    
-    // =======================================================================
-    //                               Constructors
-    // =======================================================================
-    Test_ae_individual( void );
-
-    // =======================================================================
-    //                               Destructors
-    // =======================================================================
-    virtual ~Test_ae_individual( void );
-
-    // =======================================================================
-    //                            Accessors: getters
-    // =======================================================================
-
-    // =======================================================================
-    //                            Accessors: setters
-    // =======================================================================
-
-    // =======================================================================
-    //                                Operators
-    // =======================================================================
-
-    // =======================================================================
-    //                              Public Methods
-    // =======================================================================
-    void setUp( void );
-    void tearDown( void );
-    void test1( void );
-    void test2( void );
-    void test3( void );
-    void test4( void );
-
-    // =======================================================================
-    //                             Public Attributes
-    // =======================================================================
-
-
-
-  protected :
-
-    // =======================================================================
-    //                            Forbidden Constructors
-    // =======================================================================
-    /*Test_ae_individual( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    Test_ae_individual( const Test_ae_individual &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =======================================================================
-    //                              Protected Methods
-    // =======================================================================
-
-    // =======================================================================
-    //                             Protected Attributes
-    // =======================================================================
-    ae_individual* indiv1;
-    ae_individual* indiv2;
-    ae_individual* indiv3;
-    ae_individual* indiv4;
-};
-
-
-// ===========================================================================
-//                              Getters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                              Setters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline Operators' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline functions' definition
-// ===========================================================================
-
-
-#endif // TEST_AE_INDIVIDUAL
diff --git a/src/libaevol/tests/Test_ae_jumping_mt.cpp b/src/libaevol/tests/Test_ae_jumping_mt.cpp
deleted file mode 100644
index 9ae137d..0000000
--- a/src/libaevol/tests/Test_ae_jumping_mt.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include "Test_ae_jumping_mt.h"
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-
-
-
-
-//############################################################################
-//                                                                           #
-//                         Class Test_ae_jumping_mt                          #
-//                                                                           #
-//############################################################################
-CPPUNIT_TEST_SUITE_REGISTRATION( Test_ae_jumping_mt );
-
-// ===========================================================================
-//                               Static attributes
-// ===========================================================================
-
-// ===========================================================================
-//                                  Constructors
-// ===========================================================================
-Test_ae_jumping_mt::Test_ae_jumping_mt( void )
-{
-}
-
-// ===========================================================================
-//                                  Destructors
-// ===========================================================================
-Test_ae_jumping_mt::~Test_ae_jumping_mt( void )
-{
-}
-
-// ===========================================================================
-//                                   Operators
-// ===========================================================================
-
-// ===========================================================================
-//                                 Public Methods
-// ===========================================================================
-void Test_ae_jumping_mt::setUp( void )
-{
-  obj1 = new ae_jumping_mt( 56873 );
-  obj2 = new ae_jumping_mt( *obj1 );
-}
-
-void Test_ae_jumping_mt::tearDown( void )
-{
-  delete obj1;
-  delete obj2;
-}
-
-void Test_ae_jumping_mt::test1( void )
-{
-  for ( int i = 0 ; i < 10 ; i++ )
-  {
-    obj1->random();
-    obj2->random();
-  }
-  
-  CPPUNIT_ASSERT( obj1->random() == obj2->random() );
-  CPPUNIT_ASSERT( obj1->random( (int8_t) INT8_MAX ) == obj2->random( (int8_t) INT8_MAX ) );
-  CPPUNIT_ASSERT( obj1->random( (int16_t) INT16_MAX ) == obj2->random( (int16_t) INT16_MAX ) );
-  CPPUNIT_ASSERT( obj1->random( (int32_t) INT32_MAX ) == obj2->random( (int32_t) INT32_MAX ) );
-  CPPUNIT_ASSERT( obj1->random( (int64_t) INT64_MAX ) == obj2->random( (int64_t) INT64_MAX ) );
-  CPPUNIT_ASSERT( obj1->binomial_random( 435, 0.5 ) == obj2->binomial_random( 435, 0.5 ) );
-  CPPUNIT_ASSERT( obj1->gaussian_random() == obj2->gaussian_random() );
-}
-
-void Test_ae_jumping_mt::test2( void )
-{
-  CPPUNIT_ASSERT( true );
-}
-
-// ===========================================================================
-//                                Protected Methods
-// ===========================================================================
-
-// ===========================================================================
-//                              Non inline accessors
-// ===========================================================================
diff --git a/src/libaevol/tests/Test_ae_jumping_mt.h b/src/libaevol/tests/Test_ae_jumping_mt.h
deleted file mode 100644
index e8ab7e7..0000000
--- a/src/libaevol/tests/Test_ae_jumping_mt.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-#ifndef TEST_AE_JUMPING_MT
-#define TEST_AE_JUMPING_MT
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <cstdio>
-#include <cstdlib>
-#include <cppunit/TestCase.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_jumping_mt.h>
-
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-using namespace CppUnit;
-using namespace std;
-
-
-
-
-
-
-class Test_ae_jumping_mt : public TestFixture
-{
-  CPPUNIT_TEST_SUITE( Test_ae_jumping_mt );
-  CPPUNIT_TEST( test1 );
-  CPPUNIT_TEST( test2 );
-  CPPUNIT_TEST_SUITE_END();
-  
-  
-  public :
-    
-    // =======================================================================
-    //                                 Enums
-    // =======================================================================
-    
-    // =======================================================================
-    //                               Constructors
-    // =======================================================================
-    Test_ae_jumping_mt( void );
-
-    // =======================================================================
-    //                               Destructors
-    // =======================================================================
-    virtual ~Test_ae_jumping_mt( void );
-
-    // =======================================================================
-    //                            Accessors: getters
-    // =======================================================================
-
-    // =======================================================================
-    //                            Accessors: setters
-    // =======================================================================
-
-    // =======================================================================
-    //                                Operators
-    // =======================================================================
-
-    // =======================================================================
-    //                              Public Methods
-    // =======================================================================
-    void setUp( void );
-    void tearDown( void );
-    void test1( void );
-    void test2( void );
-
-    // =======================================================================
-    //                             Public Attributes
-    // =======================================================================
-
-
-
-  protected :
-
-    // =======================================================================
-    //                            Forbidden Constructors
-    // =======================================================================
-    /*Test_ae_jumping_mt( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    Test_ae_jumping_mt( const Test_ae_jumping_mt &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =======================================================================
-    //                              Protected Methods
-    // =======================================================================
-
-    // =======================================================================
-    //                             Protected Attributes
-    // =======================================================================
-    ae_jumping_mt* obj1;
-    ae_jumping_mt* obj2;
-};
-
-
-// ===========================================================================
-//                              Getters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                              Setters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline Operators' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline functions' definition
-// ===========================================================================
-
-
-#endif // TEST_AE_JUMPING_MT
diff --git a/src/libaevol/tests/Test_ae_list.cpp b/src/libaevol/tests/Test_ae_list.cpp
deleted file mode 100644
index 3cbdb82..0000000
--- a/src/libaevol/tests/Test_ae_list.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <string>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include "Test_ae_list.h"
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-
-
-
-
-//############################################################################
-//                                                                           #
-//                            Class Test_ae_list                             #
-//                                                                           #
-//############################################################################
-CPPUNIT_TEST_SUITE_REGISTRATION( Test_ae_list );
-
-// ===========================================================================
-//                               Static attributes
-// ===========================================================================
-// Don't change value (hard use in some tests)
-const int Test_ae_list::INT_LIST_SIZE = 20;
-
-// ===========================================================================
-//                                  Constructors
-// ===========================================================================
-Test_ae_list::Test_ae_list( void )
-{
-}
-
-// ===========================================================================
-//                                  Destructors
-// ===========================================================================
-Test_ae_list::~Test_ae_list( void )
-{
-}
-
-// ===========================================================================
-//                                   Operators
-// ===========================================================================
-
-// ===========================================================================
-//                                 Public Methods
-// ===========================================================================
-void Test_ae_list::setUp( void )
-{
-  int_list = new ae_list<int*>();
-  for (int i = 0 ; i < INT_LIST_SIZE ; i++)
-  {
-    int_list->add(new int(i + 1));
-  }
-}
-
-void Test_ae_list::tearDown( void )
-{
-  int_list->erase(true);
-  delete int_list;
-}
-
-void Test_ae_list::basic_tests1( void )
-{
-  // Manually check the content of int_list (checks add(T*))
-  ae_list_node<int*>* node = int_list->get_first();
-  int32_t nb_elts = 0;
-  while (node != NULL)
-  {
-    CPPUNIT_ASSERT_EQUAL(++nb_elts, *node->get_obj());
-    node = node->get_next();
-  }
-  CPPUNIT_ASSERT_EQUAL(INT_LIST_SIZE, nb_elts);
-
-
-  // Construct the same list using add_front
-  ae_list<int*>* expected = new ae_list<int*>();
-  for (int i = INT_LIST_SIZE ; i > 0 ; i--)
-  {
-    expected->add_front(new int(i));
-  }
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-
-  expected->erase(true);
-  delete expected;
-
-
-  // Check erase and is_empty
-  int_list->erase(true);
-  CPPUNIT_ASSERT(int_list->is_empty());
-  CPPUNIT_ASSERT_EQUAL(0, int_list->get_nb_elts());
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_first());
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_last());
-}
-
-void Test_ae_list::basic_tests2( void )
-{
-  // Check get_object(int32_t pos)
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_object(-1));
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_object(INT_LIST_SIZE));
-  for (int i = 0 ; i < INT_LIST_SIZE ; i++)
-  {
-    CPPUNIT_ASSERT_EQUAL(i + 1, *(int_list->get_object(i)));
-  }
-
-
-  // Check get_node(int32_t pos)
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_node(-1));
-  CPPUNIT_ASSERT_EQUAL((void*)NULL, (void*)int_list->get_node(INT_LIST_SIZE));
-  for (int i = 0 ; i < INT_LIST_SIZE-1 ; i++)
-  {
-    CPPUNIT_ASSERT_EQUAL(i + 1, *(int_list->get_node(i)->get_obj()));
-  }
-
-
-  // Check remove(node) (remove first, last and arbitrary elt)
-  int_list->remove(int_list->get_node(0), true, true);
-  int_list->remove(int_list->get_node(INT_LIST_SIZE-2), true, true);
-  int_list->remove(int_list->get_node(INT_LIST_SIZE/2), true, true);
-  ae_list<int*>* expected = new ae_list<int*>();
-  for (int i = 0 ; i < INT_LIST_SIZE/2 ; i++)
-  {
-    expected->add(new int(i + 2));
-  }
-  for (int i = INT_LIST_SIZE/2 ; i < INT_LIST_SIZE-3 ; i++)
-  {
-    expected->add(new int(i + 3));
-  }
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  expected->erase(true);
-  delete expected;
-}
-
-void Test_ae_list::test_extract_sublist( void )
-{
-  // Construct the same list as int_list
-  ae_list<int*>* expected = new ae_list<int*>();
-  for (int i = 0 ; i < INT_LIST_SIZE ; i++)
-  {
-    expected->add(new int(i + 1));
-  }
-
-  // Initial check
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  //printf("HERE %d %d\n", expected->get_nb_elts(), int_list->get_nb_elts());
-
-
-  // **************************************************************************
-  // Extract the first element
-  ae_list<int*>* int_list2 = int_list->extract_sublist(0, 1);
-
-  ae_list<int*>* expected2 = new ae_list<int*>();
-  expected->remove(expected->get_first(), true, true);
-  expected2->add(new int(1));
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  assert_equal(expected2, int_list2, CPPUNIT_SOURCELINE());
-
-  expected2->erase(true);
-  int_list2->erase(true);
-  delete int_list2;
-
-  // **************************************************************************
-  // Extract elements 10 through 13
-  int_list2 = int_list->extract_sublist(10, 4);
-
-  for (int i = 0 ; i < 4 ; i++)
-  {
-    expected->remove(expected->get_node(10), true, true);
-    expected2->add(new int(12 + i));
-  }
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  assert_equal(expected2, int_list2, CPPUNIT_SOURCELINE());
-
-  expected2->erase(true);
-  int_list2->erase(true);
-  delete int_list2;
-
-  // **************************************************************************
-  // Extract last 4 elements
-  int_list2 = int_list->extract_ending_sublist(4);
-
-  for (int i = 0 ; i < 4 ; i++)
-  {
-    expected->remove(expected->get_last(), true, true);
-    expected2->add(new int(17 + i));
-  }
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  assert_equal(expected2, int_list2, CPPUNIT_SOURCELINE());
-
-  expected2->erase(true);
-  int_list2->erase(true);
-  delete int_list2;
-
-  // **************************************************************************
-  // Extract first 3 elements
-
-  int_list2 = int_list->extract_starting_sublist(3);
-
-  for (int i = 0 ; i < 3 ; i++)
-  {
-    expected2->add(new int(*expected->get_first()->get_obj()));
-    expected->remove(expected->get_first(), true, true);
-  }
-
-  assert_equal(expected, int_list, CPPUNIT_SOURCELINE());
-  assert_equal(expected2, int_list2, CPPUNIT_SOURCELINE());
-
-  expected2->erase(true);
-  int_list2->erase(true);
-  delete int_list2;
-}
-
-// ===========================================================================
-//                                Protected Methods
-// ===========================================================================
-template <typename T>
-void Test_ae_list::assert_equal(const ae_list<T>* expected,
-                                const ae_list<T>* actual,
-                                SourceLine SL)
-{
-  // Build message string
-  char* msg = new char[256];
-  sprintf(msg, "From %s:%d", SL.fileName().c_str(), SL.lineNumber());
-
-  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg,
-                               expected->get_nb_elts(),
-                               actual->get_nb_elts());
-
-  ae_list_node<T>* node1 = expected->get_first();
-  ae_list_node<T>* node2 = actual->get_first();
-
-  int32_t nb_elts = 0;
-  while (node1 != NULL && node2 != NULL)
-  {
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, *node1->get_obj(), *node2->get_obj());
-    nb_elts++;
-
-    node1 = node1->get_next();
-    node2 = node2->get_next();
-  }
-
-  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, expected->get_nb_elts(), nb_elts);
-  delete msg;
-}
-
-// ===========================================================================
-//                              Non inline accessors
-// ===========================================================================
diff --git a/src/libaevol/tests/Test_ae_list.h b/src/libaevol/tests/Test_ae_list.h
deleted file mode 100644
index d13d898..0000000
--- a/src/libaevol/tests/Test_ae_list.h
+++ /dev/null
@@ -1,164 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-#ifndef TEST_AE_LIST
-#define TEST_AE_LIST
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <cstdio>
-#include <cstdlib>
-#include <cppunit/TestCase.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_list.h>
-
-
-
-
-// ===========================================================================
-//                             Declare Used Namespaces
-// ===========================================================================
-using namespace CppUnit;
-using namespace std;
-
-
-
-
-
-
-class Test_ae_list : public TestFixture
-{
-  CPPUNIT_TEST_SUITE( Test_ae_list );
-  CPPUNIT_TEST( basic_tests1 );
-  CPPUNIT_TEST( basic_tests2 );
-  CPPUNIT_TEST( test_extract_sublist );
-  CPPUNIT_TEST_SUITE_END();
-
-
-  public :
-
-    // =======================================================================
-    //                                 Enums
-    // =======================================================================
-
-    // =======================================================================
-    //                               Constructors
-    // =======================================================================
-    Test_ae_list( void );
-
-    // =======================================================================
-    //                               Destructors
-    // =======================================================================
-    virtual ~Test_ae_list( void );
-
-    // =======================================================================
-    //                            Accessors: getters
-    // =======================================================================
-
-    // =======================================================================
-    //                            Accessors: setters
-    // =======================================================================
-
-    // =======================================================================
-    //                                Operators
-    // =======================================================================
-
-    // =======================================================================
-    //                              Public Methods
-    // =======================================================================
-    void setUp( void );
-    void tearDown( void );
-
-    void basic_tests1( void );
-    void basic_tests2( void );
-    void test_extract_sublist( void );
-
-    // =======================================================================
-    //                             Public Attributes
-    // =======================================================================
-
-
-
-  protected :
-
-    // =======================================================================
-    //                            Forbidden Constructors
-    // =======================================================================
-    /*Test_ae_list( void )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };
-    Test_ae_list( const Test_ae_list &model )
-    {
-      printf( "%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__ );
-      exit( EXIT_FAILURE );
-    };*/
-
-
-    // =======================================================================
-    //                              Protected Methods
-    // =======================================================================
-    template <typename T> void assert_equal(const ae_list<T>* expected,
-                                            const ae_list<T>* actual,
-                                            SourceLine SL);
-    //void assert_equal(ae_list<int*>* int_list1, ae_list<int*>* int_list2);
-
-    // =======================================================================
-    //                             Protected Attributes
-    // =======================================================================
-    ae_list<int*>* int_list;
-    static const int INT_LIST_SIZE;
-};
-
-
-// ===========================================================================
-//                              Getters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                              Setters' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline Operators' definitions
-// ===========================================================================
-
-// ===========================================================================
-//                          Inline functions' definition
-// ===========================================================================
-
-
-#endif // TEST_AE_LIST
diff --git a/src/post_treatments/IndivAnalysis.cpp b/src/post_treatments/IndivAnalysis.cpp
new file mode 100644
index 0000000..45ac6ca
--- /dev/null
+++ b/src/post_treatments/IndivAnalysis.cpp
@@ -0,0 +1,197 @@
+//
+// Created by dparsons on 31/05/16.
+//
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "IndivAnalysis.h"
+
+#include "aevol.h"
+
+namespace aevol {
+
+// ============================================================================
+//                       Definition of static attributes
+// ============================================================================
+
+// ============================================================================
+//                                Constructors
+// ============================================================================
+IndivAnalysis::IndivAnalysis(const Individual& indiv) : Individual(indiv) {
+
+};
+
+// ============================================================================
+//                                 Destructor
+// ============================================================================
+
+// ============================================================================
+//                                   Methods
+// ============================================================================
+/**
+ * Compute reproduction theoretical proportion of neutral offsprings.
+ *
+ * Compute the theoretical proportion of neutral offsprings given Carole's
+ * formula, based on the mutations and rearrangement rates and not on multiple
+ * replications.
+ *
+ * \return theoretical proportion of neutral offsprings
+ */
+double IndivAnalysis::compute_theoritical_f_nu() {
+  // We first have to collect information about genome structure.
+  // Abbreviations are chosen according to Carole's formula.
+  // Please notice that compared to the formula we have the beginning
+  // and ends of neutral regions instead of 'functional regions'
+  GeneticUnit& chromosome = genetic_unit_list_.front();
+  int32_t L = chromosome.dna()->length();
+  int32_t N_G = chromosome.nb_neutral_regions(); // which is not exactly Carole's original definition
+  int32_t* b_i = chromosome.beginning_neutral_regions();
+  int32_t* e_i = chromosome.end_neutral_regions();
+  int32_t lambda = chromosome.nb_bases_in_neutral_regions();
+  int32_t l = L - lambda; // nb bases in 'functional regions'
+
+  int32_t* lambda_i = NULL;  // nb bases in ith neutral region
+  if (N_G > 0) // all the chromosome may be functional
+  {
+    lambda_i = new int32_t[N_G];
+
+    for (int32_t i = 0; i < N_G - 1; i++) {
+      lambda_i[i] = e_i[i] - b_i[i] + 1;
+    }
+    if (b_i[N_G - 1] > e_i[N_G -
+                           1]) // last neutral region is overlapping on the beginning of chromosome
+    {
+      lambda_i[N_G - 1] = (e_i[N_G - 1] + L) - b_i[N_G - 1] + 1;
+    }
+    else // no overlap
+    {
+      lambda_i[N_G - 1] = e_i[N_G - 1] - b_i[N_G - 1] + 1;
+    }
+  }
+
+  // we now compute the probabilities of neutral reproduction for
+  // each type of mutation and rearrangement and update Fv
+  double Fv = 1;
+
+  // mutation + insertion + deletion
+  double nu_local_mutation = 1 - ((double) l) / L;
+  Fv = pow(1 - point_mutation_rate() * (1 - nu_local_mutation), L);
+  Fv *= pow(1 - small_insertion_rate() * (1 - nu_local_mutation), L);
+  Fv *= pow(1 - small_deletion_rate() * (1 - nu_local_mutation), L);
+
+  // inversion ~ two local mutations
+  double nu_inversion = nu_local_mutation * nu_local_mutation;
+  Fv *= pow(1 - inversion_rate() * (1 - nu_inversion), L);
+
+  // translocation ~ inversion + insertion (mathematically)
+  Fv *= pow(
+      1 - translocation_rate() * (1 - nu_inversion * nu_local_mutation), L);
+
+  // long deletion
+  double nu_deletion = 0; // if N_G == 0, a deletion is always not neutral
+  for (int32_t i = 0; i < N_G; i++) {
+    nu_deletion += lambda_i[i] * (lambda_i[i] + 1);
+  }
+  nu_deletion /= ((double) 2 * L * L);
+  Fv *= pow(1 - deletion_rate() * (1 - nu_deletion), L);
+
+  // duplication ~ big deletion + insertion
+  Fv *= pow(1 - duplication_rate() * (1 - nu_deletion * nu_local_mutation),
+            L);
+
+  if (lambda_i != NULL) delete[] lambda_i;
+
+  return Fv;
+}
+
+/**
+ *
+ */
+void IndivAnalysis::compute_experimental_f_nu(
+    int32_t nb_indiv,
+    std::shared_ptr<JumpingMT> prng,
+    FILE* output_summary /* = nullptr*/,
+    FILE* output_detailed /* = nullptr*/,
+    bool verbose /* = false*/) {
+  double nb_pos = 0;
+  double cumul_delta_err_pos = 0;
+  double nb_neg = 0;
+  double cumul_delta_err_neg = 0;
+  double max_pos = 0;
+  double max_neg = 0;
+  double nb_neutral = 0;
+  int32_t nb_events = 0;
+
+  double parent_metabolic_error = dist_to_target_by_feature(METABOLISM);
+
+  for (int32_t i = 0; i < nb_indiv; i++) {
+    Individual mutant(this, 0, prng, prng);
+    // Perform transfer, rearrangements and mutations
+    if (not mutant.allow_plasmids()) {
+      const GeneticUnit* chromosome = &(mutant.genetic_unit_list().front());
+      nb_events = chromosome->dna()->perform_mutations(id_);
+    }
+    else {
+      printf("WARNING: Mutational Robustness does not handle multiple "
+                 "Genetic Units\n");
+    }
+
+    mutant.EvaluateInContext(habitat());
+    double new_metabolic_error = mutant.dist_to_target_by_feature(
+        METABOLISM);
+
+    if (new_metabolic_error == parent_metabolic_error) {
+      nb_neutral++;
+    }
+    if (new_metabolic_error > parent_metabolic_error) {
+      nb_neg++;
+      if ((new_metabolic_error - parent_metabolic_error) > max_neg) {
+        max_neg =
+            new_metabolic_error -
+            parent_metabolic_error;
+      }
+      cumul_delta_err_neg += new_metabolic_error - parent_metabolic_error;
+    }
+    if (new_metabolic_error < parent_metabolic_error) {
+      nb_pos++;
+      if ((new_metabolic_error - parent_metabolic_error) < max_pos) {
+        max_pos =
+            new_metabolic_error -
+            parent_metabolic_error;
+      }
+      cumul_delta_err_pos += new_metabolic_error - parent_metabolic_error;
+    }
+
+    if (output_detailed) {
+      mutant.compute_statistical_data();
+      fprintf(output_detailed,
+          "%" PRId32 " %.15f %.15f %.15f %.15f% " PRId32 " %" PRId16 "\n",
+          id_, parent_metabolic_error,
+          dist_to_target_by_feature(SECRETION),
+          mutant.dist_to_target_by_feature(METABOLISM),
+          mutant.dist_to_target_by_feature(SECRETION),
+          mutant.amount_of_dna(),
+          mutant.nb_functional_genes());
+    }
+  }
+
+  if (verbose) {
+    printf("f+: %f   f0: %f    f-:%f\n", nb_pos, nb_neutral, nb_neg);
+  }
+
+  if (output_summary) {
+    fprintf(output_summary,
+        "%" PRId64 " %.15f %.15f %.15f %.15f %.15f %.15f %.15f\n",
+        AeTime::time(),
+        nb_pos / nb_indiv, nb_neutral / nb_indiv, nb_neg / nb_indiv,
+        cumul_delta_err_pos / nb_pos, cumul_delta_err_neg / nb_neg,
+        max_pos, max_neg);
+  }
+}
+
+// ============================================================================
+//                            Non inline accessors
+// ============================================================================
+
+} // namespace aevol
diff --git a/src/post_treatments/IndivAnalysis.h b/src/post_treatments/IndivAnalysis.h
new file mode 100644
index 0000000..ebf23e5
--- /dev/null
+++ b/src/post_treatments/IndivAnalysis.h
@@ -0,0 +1,68 @@
+//
+// Created by dparsons on 31/05/16.
+//
+
+#ifndef AEVOL_INDIVANALYSIS_H__
+#define AEVOL_INDIVANALYSIS_H__
+
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include "Individual.h"
+
+namespace aevol {
+
+/**
+ *
+ */
+class IndivAnalysis : public Individual {
+ public :
+  // ==========================================================================
+  //                               Constructors
+  // ==========================================================================
+  IndivAnalysis() = default; //< Default ctor
+  IndivAnalysis(const IndivAnalysis&) = delete; //< Copy ctor
+  IndivAnalysis(IndivAnalysis&&) = delete; //< Move ctor
+
+  IndivAnalysis(const Individual&);
+
+  // ==========================================================================
+  //                                Destructor
+  // ==========================================================================
+  virtual ~IndivAnalysis() = default; //< Destructor
+
+  // ==========================================================================
+  //                                Operators
+  // ==========================================================================
+  /// Copy assignment
+  IndivAnalysis& operator=(const IndivAnalysis& other) = delete;
+  /// Move assignment
+  IndivAnalysis& operator=(IndivAnalysis&& other) = delete;
+
+  // ==========================================================================
+  //                              Public Methods
+  // ==========================================================================
+  double compute_theoritical_f_nu();
+  void compute_experimental_f_nu(int32_t nb_indiv,
+                                 std::shared_ptr<JumpingMT> prng,
+                                 FILE* output_summary = nullptr,
+                                 FILE* output_detailed = nullptr,
+                                 bool verbose = false);
+
+  // ==========================================================================
+  //                                Accessors
+  // ==========================================================================
+
+ protected :
+  // ==========================================================================
+  //                            Protected Methods
+  // ==========================================================================
+
+  // ==========================================================================
+  //                               Attributes
+  // ==========================================================================
+};
+
+} // namespace aevol
+#endif //AEVOL_INDIVANALYSIS_H__
diff --git a/src/post_treatments/Makefile.am b/src/post_treatments/Makefile.am
index 19f8ce8..3611841 100644
--- a/src/post_treatments/Makefile.am
+++ b/src/post_treatments/Makefile.am
@@ -34,36 +34,34 @@ AM_CPPFLAGS += -D_FORTIFY_SOURCE=2
 ############################################
 #           Set programs to build          #
 ############################################
-bin_PROGRAMS = aevol_misc_robustness aevol_misc_ancstats aevol_misc_create_eps aevol_misc_fixed_mutations aevol_misc_gene_families aevol_misc_lineage aevol_misc_compute_pop_stats aevol_misc_extract
+bin_PROGRAMS = \
+aevol_misc_ancestor_stats \
+aevol_misc_ancestor_robustness \
+aevol_misc_create_eps \
+aevol_misc_extract \
+aevol_misc_lineage \
+aevol_misc_mutagenesis \
+aevol_misc_robustness
+# aevol_misc_gene_families
+# aevol_misc_transform_plasmid
+
 if WITH_X
-  bin_PROGRAMS += aevol_misc_view_generation
+  bin_PROGRAMS += aevol_misc_view
 endif # X
-noinst_PROGRAMS = aevol_misc_template
-
-CLEANFILES = aevol_misc_ancstats aevol_misc_compute_pop_stats aevol_misc_create_eps aevol_misc_extract aevol_misc_fixed_mutations aevol_misc_gene_families aevol_misc_lineage aevol_misc_robustness aevol_misc_template aevol_misc_view_generation
-
+# noinst_PROGRAMS = aevol_misc_template
 
+CLEANFILES = $(bin_PROGRAMS)
 
-aevol_misc_ancstats_SOURCES = ancstats.cpp
-
-#aevol_misc_compute_pop_stats_HEADERS = population_statistics.h
-aevol_misc_compute_pop_stats_SOURCES = population_statistics.cpp compute_pop_stats.cpp
-aevol_misc_compute_pop_stats_SOURCES += population_statistics.h
-
+aevol_misc_ancestor_stats_SOURCES = ancestor_stats.cpp
+aevol_misc_ancestor_robustness_SOURCES = ancestor_robustness.cpp IndivAnalysis.cpp
+aevol_misc_ancestor_robustness_SOURCES += IndivAnalysis.h # hack to get make dist to include IndivAnalysis.h
 aevol_misc_create_eps_SOURCES = create_eps.cpp
-
 aevol_misc_extract_SOURCES = extract.cpp
-
-aevol_misc_fixed_mutations_SOURCES = fixed_mutations.cpp
-
-aevol_misc_gene_families_SOURCES = gene_families.cpp
-
+# aevol_misc_gene_families_SOURCES = gene_families.cpp
 aevol_misc_lineage_SOURCES = lineage.cpp
-
-#aevol_misc_robustness_HEADERS = population_statistics.h
-aevol_misc_robustness_SOURCES = population_statistics.cpp robustness.cpp
-aevol_misc_robustness_SOURCES +=population_statistics.h
-
-aevol_misc_template_SOURCES = template.cpp
-
-aevol_misc_view_generation_SOURCES = view_generation.cpp
+aevol_misc_mutagenesis_SOURCES = mutagenesis.cpp
+aevol_misc_robustness_SOURCES = robustness.cpp IndivAnalysis.cpp
+aevol_misc_robustness_SOURCES += IndivAnalysis.h # hack to get make dist to include IndivAnalysis.h
+# aevol_misc_template_SOURCES = template.cpp
+# aevol_misc_transform_plasmid_SOURCES = transform_plasmid.cpp
+aevol_misc_view_SOURCES = view.cpp
diff --git a/src/post_treatments/Makefile.in b/src/post_treatments/Makefile.in
index 693d5e9..c81779b 100644
--- a/src/post_treatments/Makefile.in
+++ b/src/post_treatments/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,38 +86,46 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
-bin_PROGRAMS = aevol_misc_robustness$(EXEEXT) \
-	aevol_misc_ancstats$(EXEEXT) aevol_misc_create_eps$(EXEEXT) \
-	aevol_misc_fixed_mutations$(EXEEXT) \
-	aevol_misc_gene_families$(EXEEXT) aevol_misc_lineage$(EXEEXT) \
-	aevol_misc_compute_pop_stats$(EXEEXT) \
-	aevol_misc_extract$(EXEEXT) $(am__EXEEXT_1)
- at WITH_X_TRUE@am__append_1 = aevol_misc_view_generation
-noinst_PROGRAMS = aevol_misc_template$(EXEEXT)
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aevol_misc_ancestor_stats$(EXEEXT) \
+	aevol_misc_ancestor_robustness$(EXEEXT) \
+	aevol_misc_create_eps$(EXEEXT) aevol_misc_extract$(EXEEXT) \
+	aevol_misc_lineage$(EXEEXT) aevol_misc_mutagenesis$(EXEEXT) \
+	aevol_misc_robustness$(EXEEXT) $(am__EXEEXT_1)
+# aevol_misc_gene_families
+# aevol_misc_transform_plasmid
+ at WITH_X_TRUE@am__append_1 = aevol_misc_view
 subdir = src/post_treatments
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
+	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
+	$(top_srcdir)/m4/ax_boost_system.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
- at WITH_X_TRUE@am__EXEEXT_1 = aevol_misc_view_generation$(EXEEXT)
+ at WITH_X_TRUE@am__EXEEXT_1 = aevol_misc_view$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
-am_aevol_misc_ancstats_OBJECTS = ancstats.$(OBJEXT)
-aevol_misc_ancstats_OBJECTS = $(am_aevol_misc_ancstats_OBJECTS)
-aevol_misc_ancstats_LDADD = $(LDADD)
-aevol_misc_ancstats_DEPENDENCIES =  \
+PROGRAMS = $(bin_PROGRAMS)
+am_aevol_misc_ancestor_robustness_OBJECTS =  \
+	ancestor_robustness.$(OBJEXT) IndivAnalysis.$(OBJEXT)
+aevol_misc_ancestor_robustness_OBJECTS =  \
+	$(am_aevol_misc_ancestor_robustness_OBJECTS)
+aevol_misc_ancestor_robustness_LDADD = $(LDADD)
+aevol_misc_ancestor_robustness_DEPENDENCIES =  \
 	$(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_compute_pop_stats_OBJECTS =  \
-	population_statistics.$(OBJEXT) compute_pop_stats.$(OBJEXT)
-aevol_misc_compute_pop_stats_OBJECTS =  \
-	$(am_aevol_misc_compute_pop_stats_OBJECTS)
-aevol_misc_compute_pop_stats_LDADD = $(LDADD)
-aevol_misc_compute_pop_stats_DEPENDENCIES =  \
+am_aevol_misc_ancestor_stats_OBJECTS = ancestor_stats.$(OBJEXT)
+aevol_misc_ancestor_stats_OBJECTS =  \
+	$(am_aevol_misc_ancestor_stats_OBJECTS)
+aevol_misc_ancestor_stats_LDADD = $(LDADD)
+aevol_misc_ancestor_stats_DEPENDENCIES =  \
 	$(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
 am_aevol_misc_create_eps_OBJECTS = create_eps.$(OBJEXT)
@@ -95,101 +140,129 @@ aevol_misc_extract_LDADD = $(LDADD)
 aevol_misc_extract_DEPENDENCIES =  \
 	$(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_fixed_mutations_OBJECTS = fixed_mutations.$(OBJEXT)
-aevol_misc_fixed_mutations_OBJECTS =  \
-	$(am_aevol_misc_fixed_mutations_OBJECTS)
-aevol_misc_fixed_mutations_LDADD = $(LDADD)
-aevol_misc_fixed_mutations_DEPENDENCIES =  \
-	$(top_srcdir)/src/libaevol/libaevol.a \
-	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_gene_families_OBJECTS = gene_families.$(OBJEXT)
-aevol_misc_gene_families_OBJECTS =  \
-	$(am_aevol_misc_gene_families_OBJECTS)
-aevol_misc_gene_families_LDADD = $(LDADD)
-aevol_misc_gene_families_DEPENDENCIES =  \
-	$(top_srcdir)/src/libaevol/libaevol.a \
-	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
 am_aevol_misc_lineage_OBJECTS = lineage.$(OBJEXT)
 aevol_misc_lineage_OBJECTS = $(am_aevol_misc_lineage_OBJECTS)
 aevol_misc_lineage_LDADD = $(LDADD)
 aevol_misc_lineage_DEPENDENCIES =  \
 	$(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_robustness_OBJECTS = population_statistics.$(OBJEXT) \
-	robustness.$(OBJEXT)
+am_aevol_misc_mutagenesis_OBJECTS = mutagenesis.$(OBJEXT)
+aevol_misc_mutagenesis_OBJECTS = $(am_aevol_misc_mutagenesis_OBJECTS)
+aevol_misc_mutagenesis_LDADD = $(LDADD)
+aevol_misc_mutagenesis_DEPENDENCIES =  \
+	$(top_srcdir)/src/libaevol/libaevol.a \
+	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
+am_aevol_misc_robustness_OBJECTS = robustness.$(OBJEXT) \
+	IndivAnalysis.$(OBJEXT)
 aevol_misc_robustness_OBJECTS = $(am_aevol_misc_robustness_OBJECTS)
 aevol_misc_robustness_LDADD = $(LDADD)
 aevol_misc_robustness_DEPENDENCIES =  \
 	$(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_template_OBJECTS = template.$(OBJEXT)
-aevol_misc_template_OBJECTS = $(am_aevol_misc_template_OBJECTS)
-aevol_misc_template_LDADD = $(LDADD)
-aevol_misc_template_DEPENDENCIES =  \
-	$(top_srcdir)/src/libaevol/libaevol.a \
-	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-am_aevol_misc_view_generation_OBJECTS = view_generation.$(OBJEXT)
-aevol_misc_view_generation_OBJECTS =  \
-	$(am_aevol_misc_view_generation_OBJECTS)
-aevol_misc_view_generation_LDADD = $(LDADD)
-aevol_misc_view_generation_DEPENDENCIES =  \
-	$(top_srcdir)/src/libaevol/libaevol.a \
+am_aevol_misc_view_OBJECTS = view.$(OBJEXT)
+aevol_misc_view_OBJECTS = $(am_aevol_misc_view_OBJECTS)
+aevol_misc_view_LDADD = $(LDADD)
+aevol_misc_view_DEPENDENCIES = $(top_srcdir)/src/libaevol/libaevol.a \
 	$(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_ at AM_V@)
+am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(aevol_misc_ancstats_SOURCES) \
-	$(aevol_misc_compute_pop_stats_SOURCES) \
+AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
+SOURCES = $(aevol_misc_ancestor_robustness_SOURCES) \
+	$(aevol_misc_ancestor_stats_SOURCES) \
 	$(aevol_misc_create_eps_SOURCES) $(aevol_misc_extract_SOURCES) \
-	$(aevol_misc_fixed_mutations_SOURCES) \
-	$(aevol_misc_gene_families_SOURCES) \
-	$(aevol_misc_lineage_SOURCES) $(aevol_misc_robustness_SOURCES) \
-	$(aevol_misc_template_SOURCES) \
-	$(aevol_misc_view_generation_SOURCES)
-DIST_SOURCES = $(aevol_misc_ancstats_SOURCES) \
-	$(aevol_misc_compute_pop_stats_SOURCES) \
+	$(aevol_misc_lineage_SOURCES) \
+	$(aevol_misc_mutagenesis_SOURCES) \
+	$(aevol_misc_robustness_SOURCES) $(aevol_misc_view_SOURCES)
+DIST_SOURCES = $(aevol_misc_ancestor_robustness_SOURCES) \
+	$(aevol_misc_ancestor_stats_SOURCES) \
 	$(aevol_misc_create_eps_SOURCES) $(aevol_misc_extract_SOURCES) \
-	$(aevol_misc_fixed_mutations_SOURCES) \
-	$(aevol_misc_gene_families_SOURCES) \
-	$(aevol_misc_lineage_SOURCES) $(aevol_misc_robustness_SOURCES) \
-	$(aevol_misc_template_SOURCES) \
-	$(aevol_misc_view_generation_SOURCES)
+	$(aevol_misc_lineage_SOURCES) \
+	$(aevol_misc_mutagenesis_SOURCES) \
+	$(aevol_misc_robustness_SOURCES) $(aevol_misc_view_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AEVOLCPPFLAGS = @AEVOLCPPFLAGS@
 AEVOLCXXFLAGS = @AEVOLCXXFLAGS@
 AEVOLLDFLAGS = @AEVOLLDFLAGS@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -201,6 +274,8 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
 HAVE_DOXYGEN = @HAVE_DOXYGEN@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -214,6 +289,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -244,14 +320,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -267,6 +351,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -302,23 +387,23 @@ AM_LDFLAGS = $(AEVOLLDFLAGS) -L$(top_srcdir)/src/libaevol
 #         Set aevol library to use         #
 ############################################
 LDADD = $(top_srcdir)/src/libaevol/libaevol.a $(top_srcdir)/src/libaevol/SFMT-src-1.4/libsfmt.a
-CLEANFILES = aevol_misc_ancstats aevol_misc_compute_pop_stats aevol_misc_create_eps aevol_misc_extract aevol_misc_fixed_mutations aevol_misc_gene_families aevol_misc_lineage aevol_misc_robustness aevol_misc_template aevol_misc_view_generation
-aevol_misc_ancstats_SOURCES = ancstats.cpp
-
-#aevol_misc_compute_pop_stats_HEADERS = population_statistics.h
-aevol_misc_compute_pop_stats_SOURCES = population_statistics.cpp \
-	compute_pop_stats.cpp population_statistics.h
+# noinst_PROGRAMS = aevol_misc_template
+CLEANFILES = $(bin_PROGRAMS)
+aevol_misc_ancestor_stats_SOURCES = ancestor_stats.cpp
+aevol_misc_ancestor_robustness_SOURCES = ancestor_robustness.cpp \
+	IndivAnalysis.cpp IndivAnalysis.h # hack to get make dist to \
+	include IndivAnalysis.h
 aevol_misc_create_eps_SOURCES = create_eps.cpp
 aevol_misc_extract_SOURCES = extract.cpp
-aevol_misc_fixed_mutations_SOURCES = fixed_mutations.cpp
-aevol_misc_gene_families_SOURCES = gene_families.cpp
+# aevol_misc_gene_families_SOURCES = gene_families.cpp
 aevol_misc_lineage_SOURCES = lineage.cpp
-
-#aevol_misc_robustness_HEADERS = population_statistics.h
-aevol_misc_robustness_SOURCES = population_statistics.cpp \
-	robustness.cpp population_statistics.h
-aevol_misc_template_SOURCES = template.cpp
-aevol_misc_view_generation_SOURCES = view_generation.cpp
+aevol_misc_mutagenesis_SOURCES = mutagenesis.cpp
+aevol_misc_robustness_SOURCES = robustness.cpp IndivAnalysis.cpp \
+	IndivAnalysis.h # hack to get make dist to include \
+	IndivAnalysis.h
+# aevol_misc_template_SOURCES = template.cpp
+# aevol_misc_transform_plasmid_SOURCES = transform_plasmid.cpp
+aevol_misc_view_SOURCES = view.cpp
 all: all-am
 
 .SUFFIXES:
@@ -335,7 +420,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/post_treatments/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu src/post_treatments/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -362,10 +446,11 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -386,7 +471,8 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
@@ -394,38 +480,37 @@ uninstall-binPROGRAMS:
 clean-binPROGRAMS:
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
 
-clean-noinstPROGRAMS:
-	-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-aevol_misc_ancstats$(EXEEXT): $(aevol_misc_ancstats_OBJECTS) $(aevol_misc_ancstats_DEPENDENCIES) $(EXTRA_aevol_misc_ancstats_DEPENDENCIES) 
-	@rm -f aevol_misc_ancstats$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_ancstats_OBJECTS) $(aevol_misc_ancstats_LDADD) $(LIBS)
-aevol_misc_compute_pop_stats$(EXEEXT): $(aevol_misc_compute_pop_stats_OBJECTS) $(aevol_misc_compute_pop_stats_DEPENDENCIES) $(EXTRA_aevol_misc_compute_pop_stats_DEPENDENCIES) 
-	@rm -f aevol_misc_compute_pop_stats$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_compute_pop_stats_OBJECTS) $(aevol_misc_compute_pop_stats_LDADD) $(LIBS)
+aevol_misc_ancestor_robustness$(EXEEXT): $(aevol_misc_ancestor_robustness_OBJECTS) $(aevol_misc_ancestor_robustness_DEPENDENCIES) $(EXTRA_aevol_misc_ancestor_robustness_DEPENDENCIES) 
+	@rm -f aevol_misc_ancestor_robustness$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_ancestor_robustness_OBJECTS) $(aevol_misc_ancestor_robustness_LDADD) $(LIBS)
+
+aevol_misc_ancestor_stats$(EXEEXT): $(aevol_misc_ancestor_stats_OBJECTS) $(aevol_misc_ancestor_stats_DEPENDENCIES) $(EXTRA_aevol_misc_ancestor_stats_DEPENDENCIES) 
+	@rm -f aevol_misc_ancestor_stats$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_ancestor_stats_OBJECTS) $(aevol_misc_ancestor_stats_LDADD) $(LIBS)
+
 aevol_misc_create_eps$(EXEEXT): $(aevol_misc_create_eps_OBJECTS) $(aevol_misc_create_eps_DEPENDENCIES) $(EXTRA_aevol_misc_create_eps_DEPENDENCIES) 
 	@rm -f aevol_misc_create_eps$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_create_eps_OBJECTS) $(aevol_misc_create_eps_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_create_eps_OBJECTS) $(aevol_misc_create_eps_LDADD) $(LIBS)
+
 aevol_misc_extract$(EXEEXT): $(aevol_misc_extract_OBJECTS) $(aevol_misc_extract_DEPENDENCIES) $(EXTRA_aevol_misc_extract_DEPENDENCIES) 
 	@rm -f aevol_misc_extract$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_extract_OBJECTS) $(aevol_misc_extract_LDADD) $(LIBS)
-aevol_misc_fixed_mutations$(EXEEXT): $(aevol_misc_fixed_mutations_OBJECTS) $(aevol_misc_fixed_mutations_DEPENDENCIES) $(EXTRA_aevol_misc_fixed_mutations_DEPENDENCIES) 
-	@rm -f aevol_misc_fixed_mutations$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_fixed_mutations_OBJECTS) $(aevol_misc_fixed_mutations_LDADD) $(LIBS)
-aevol_misc_gene_families$(EXEEXT): $(aevol_misc_gene_families_OBJECTS) $(aevol_misc_gene_families_DEPENDENCIES) $(EXTRA_aevol_misc_gene_families_DEPENDENCIES) 
-	@rm -f aevol_misc_gene_families$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_gene_families_OBJECTS) $(aevol_misc_gene_families_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_extract_OBJECTS) $(aevol_misc_extract_LDADD) $(LIBS)
+
 aevol_misc_lineage$(EXEEXT): $(aevol_misc_lineage_OBJECTS) $(aevol_misc_lineage_DEPENDENCIES) $(EXTRA_aevol_misc_lineage_DEPENDENCIES) 
 	@rm -f aevol_misc_lineage$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_lineage_OBJECTS) $(aevol_misc_lineage_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_lineage_OBJECTS) $(aevol_misc_lineage_LDADD) $(LIBS)
+
+aevol_misc_mutagenesis$(EXEEXT): $(aevol_misc_mutagenesis_OBJECTS) $(aevol_misc_mutagenesis_DEPENDENCIES) $(EXTRA_aevol_misc_mutagenesis_DEPENDENCIES) 
+	@rm -f aevol_misc_mutagenesis$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_mutagenesis_OBJECTS) $(aevol_misc_mutagenesis_LDADD) $(LIBS)
+
 aevol_misc_robustness$(EXEEXT): $(aevol_misc_robustness_OBJECTS) $(aevol_misc_robustness_DEPENDENCIES) $(EXTRA_aevol_misc_robustness_DEPENDENCIES) 
 	@rm -f aevol_misc_robustness$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_robustness_OBJECTS) $(aevol_misc_robustness_LDADD) $(LIBS)
-aevol_misc_template$(EXEEXT): $(aevol_misc_template_OBJECTS) $(aevol_misc_template_DEPENDENCIES) $(EXTRA_aevol_misc_template_DEPENDENCIES) 
-	@rm -f aevol_misc_template$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_template_OBJECTS) $(aevol_misc_template_LDADD) $(LIBS)
-aevol_misc_view_generation$(EXEEXT): $(aevol_misc_view_generation_OBJECTS) $(aevol_misc_view_generation_DEPENDENCIES) $(EXTRA_aevol_misc_view_generation_DEPENDENCIES) 
-	@rm -f aevol_misc_view_generation$(EXEEXT)
-	$(CXXLINK) $(aevol_misc_view_generation_OBJECTS) $(aevol_misc_view_generation_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_robustness_OBJECTS) $(aevol_misc_robustness_LDADD) $(LIBS)
+
+aevol_misc_view$(EXEEXT): $(aevol_misc_view_OBJECTS) $(aevol_misc_view_DEPENDENCIES) $(EXTRA_aevol_misc_view_DEPENDENCIES) 
+	@rm -f aevol_misc_view$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(aevol_misc_view_OBJECTS) $(aevol_misc_view_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -433,52 +518,41 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ancstats.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compute_pop_stats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/IndivAnalysis.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ancestor_robustness.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ancestor_stats.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_eps.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/extract.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fixed_mutations.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gene_families.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lineage.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/population_statistics.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mutagenesis.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/robustness.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/template.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/view_generation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/view.Po at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -490,15 +564,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -507,6 +577,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -581,8 +666,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
-	mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -651,18 +735,21 @@ uninstall-am: uninstall-binPROGRAMS
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-noinstPROGRAMS ctags distclean \
-	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+	clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
+	distclean distclean-compile distclean-generic distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-binPROGRAMS install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+	ps ps-am tags tags-am uninstall uninstall-am \
+	uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/post_treatments/ancestor_robustness.cpp b/src/post_treatments/ancestor_robustness.cpp
new file mode 100644
index 0000000..7bf4c0e
--- /dev/null
+++ b/src/post_treatments/ancestor_robustness.cpp
@@ -0,0 +1,303 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <list>
+#include <getopt.h>
+
+#include "aevol.h"
+#include "IndivAnalysis.h"
+
+using namespace aevol;
+
+// Helper functions
+void interpret_cmd_line_options(int argc, char* argv[]);
+void print_help(char* prog_path);
+
+// Command-line option variables
+static char* lineage_file_name = nullptr;
+static int32_t nb_mutants = 1000; //< Number of mutants per individual
+static int32_t begin = 0; //< First generation to analyse
+static int32_t end = -1; //< Last generation to analyse
+static int32_t period = 1; //< Period of analysis
+static char* output_file_name = "robustness_summary.txt";
+static bool verbose = false;
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  // =======================
+  //  Open the lineage file
+  // =======================
+  gzFile lineage_file = gzopen(lineage_file_name, "r");
+  if (lineage_file == Z_NULL) {
+    Utils::ExitWithUsrMsg(std::string("Could not read lineage file ") +
+                          lineage_file_name + "\n");
+  }
+
+  int64_t t0 = 0;
+  int64_t t_end = 0;
+  int32_t final_indiv_index = 0;
+  int32_t final_indiv_rank = 0;
+
+  gzread(lineage_file, &t0, sizeof(t0));
+  gzread(lineage_file, &t_end, sizeof(t_end));
+  gzread(lineage_file, &final_indiv_index, sizeof(final_indiv_index));
+  gzread(lineage_file, &final_indiv_rank, sizeof(final_indiv_rank));
+
+  if (verbose) {
+    printf("\n\n");
+    printf(
+        "===============================================================================\n");
+    printf(" Robustness of the ancestors of indiv. %"
+    PRId32
+    " (rank %"
+    PRId32
+    ") from time %"
+    PRId64
+    " to %"
+    PRId64
+    "\n",
+        final_indiv_index, final_indiv_rank, t0, t_end);
+    printf(
+        "================================================================================\n");
+  }
+
+  // =============================
+  //  Open the experience manager
+  // =============================
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(t0, true, false);
+
+  // The current version doesn't allow for phenotypic variation nor for
+  // different phenotypic targets among the grid
+  if (not exp_manager->world()->phenotypic_target_shared()) {
+    Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented "
+                              "for per grid-cell phenotypic target\n");
+  }
+  auto phenotypicTargetHandler =
+      exp_manager->world()->phenotypic_target_handler();
+  if (phenotypicTargetHandler->var_method() != NO_VAR) {
+    Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented "
+                              "for variable phenotypic targets\n");
+  }
+
+  // =========================
+  //  Open the output file(s)
+  // =========================
+
+  // // Create missing directories
+  // int status;
+  // status = mkdir("stats/ancestor_stats/", 0755);
+  // if ((status == -1) && (errno != EEXIST))
+  //   err(EXIT_FAILURE, "stats/ancestor_stats/");
+
+  FILE* output_summary = fopen(output_file_name, "w");
+  if (output_summary == nullptr) {
+    Utils::ExitWithUsrMsg(std::string("Could not create ") + output_file_name);
+  }
+
+  std::shared_ptr <JumpingMT> prng = std::make_shared<JumpingMT>(9695);
+
+  // ==============================
+  //  Prepare the initial ancestor 
+  // ==============================
+  GridCell* grid_cell = new GridCell(lineage_file, exp_manager, nullptr);
+  IndivAnalysis indiv(*(grid_cell->individual()));
+  indiv.Evaluate();
+  //  indiv->compute_statistical_data();
+  //  indiv->compute_non_coding();
+
+  // ==============================
+  //  Compute robustness of the initial ancestor 
+  // ==============================
+
+  if (begin == 0) {
+    indiv.compute_experimental_f_nu(nb_mutants, prng, output_summary, nullptr,
+                                    verbose);
+  }
+
+  // ==========================================================================
+  //  Replay the mutations to get the successive ancestors and analyze them
+  // ==========================================================================
+  ReplicationReport* rep = nullptr;
+
+  int32_t index;
+
+  aevol::AeTime::plusplus();
+  while ((time() <= t_end) && (((time() < end) || (end == -1)))) {
+    rep = new ReplicationReport(lineage_file, &indiv);
+    index = rep->id(); // who we are building...
+    indiv.Reevaluate();
+
+    if (verbose) {
+      printf("Ancestor at generation %"
+      PRId64
+      " has index %"
+      PRId32
+      "\n", time(), index);
+    }
+
+
+    // 2) Replay replication (create current individual's child)
+    GeneticUnit& gen_unit = indiv.genetic_unit_nonconst(0);
+
+
+    // For each genetic unit, replay the replication (undergo all mutations)
+    // TODO <david.parsons at inria.fr> disabled for multiple GUs
+    const auto& dnarep = rep->dna_replic_report();
+
+    for (const auto& mut: dnarep.HT())
+      gen_unit.dna()->undergo_this_mutation(*mut);
+    for (const auto& mut: dnarep.rearrangements())
+      gen_unit.dna()->undergo_this_mutation(*mut);
+    for (const auto& mut: dnarep.mutations())
+      gen_unit.dna()->undergo_this_mutation(*mut);
+
+    // 3) All the mutations have been replayed, we can now evaluate the new individual
+    indiv.Reevaluate();
+
+    // if we are between "begin" and "end" and at the correct period, compute robustness
+
+    if ((time() >= begin) && ((time() < end) || (end == -1)) &&
+        (((time() - begin) % period) == 0)) {
+      indiv.compute_experimental_f_nu(nb_mutants, prng, output_summary, nullptr,
+                                      verbose);
+    }
+    delete rep;
+
+    aevol::AeTime::plusplus();
+  }
+
+  gzclose(lineage_file);
+  fclose(output_summary);
+  delete exp_manager;
+  return EXIT_SUCCESS;
+}
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  const char* short_options = "hVvn:b:e:p:o:";
+  static struct option long_options[] = {
+        {"help",        no_argument,       nullptr, 'h'},
+        {"version",     no_argument,       nullptr, 'V'},
+        {"verbose",     no_argument,       nullptr, 'v'},
+        {"nb-mutants",  required_argument, nullptr, 'n'},
+        {"begin",       required_argument, nullptr, 'b'},
+        {"end",         required_argument, nullptr, 'e'},
+        {"period",      required_argument, nullptr, 'P'},
+        {"output",      required_argument, nullptr, 'o'},
+        {0, 0, 0, 0}
+    };
+
+  int option;
+  while ((option = getopt_long(argc, argv, short_options, long_options,
+                               nullptr)) != -1) {
+    switch (option) {
+      case 'h' :
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      case 'V' :
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      case 'v' :
+        verbose = true;
+        break;
+      case 'b' :
+        begin = atol(optarg);
+        break;
+      case 'e' :
+        end = atol(optarg);
+        break;
+      case 'n' :
+        nb_mutants = atol(optarg);
+        break;
+      case 'P' :
+        period = atol(optarg);
+        break;
+      case 'o' :
+        output_file_name = new char[strlen(optarg) + 1];
+        sprintf(output_file_name, "%s", optarg);
+        break;
+      default:
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+    }
+  }
+
+  // There should be only one remaining arg: the lineage file
+  if (optind != argc - 1) {
+    Utils::ExitWithUsrMsg("please specify a lineage file");
+  }
+
+  lineage_file_name = new char[strlen(argv[optind]) + 1];
+  sprintf(lineage_file_name, "%s", argv[optind]);
+}
+
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s: generate and analyse mutants for the provided lineage.\n",
+         prog_name);
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s LINEAGE_FILE [-b TIMESTEP] [-e TIMESTEP] [-n NB_MUTANTS] [-P PERIOD] [-o output] [-v]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -b, --begin TIMESTEP\n");
+  printf("\ttimestep at which to start the analysis\n");
+  printf("  -e, --end TIMESTEP\n");
+  printf("\ttimestep at which to stop the analysis\n");
+  printf("  -n, --nb-mutants NB_MUTANTS\n");
+  printf("\tnumber of mutants to be generated\n");
+  printf("  -P, --period\n");
+  printf("\tperiod with which to perform the analysis\n");
+  printf("  -o, --output\n");
+  printf("\toutput file name\n");
+  printf("  -v, --verbose\n\tbe verbose\n");
+}
diff --git a/src/post_treatments/ancestor_stats.cpp b/src/post_treatments/ancestor_stats.cpp
new file mode 100644
index 0000000..58468c0
--- /dev/null
+++ b/src/post_treatments/ancestor_stats.cpp
@@ -0,0 +1,741 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// The input file is produced by the lineage post-treatment, please refer to it
+// for e.g. the file format/content
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <getopt.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+#include <zlib.h>
+#include <err.h>
+#include <cerrno>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <list>
+#include <iostream>
+
+#include "aevol.h"
+
+using namespace aevol;
+
+// Helper functions
+void interpret_cmd_line_options(int argc, char* argv[]);
+void print_help(char* prog_path);
+FILE* open_environment_stat_file(const char* prefix, const char* postfix);
+void write_environment_stats(int64_t t,
+                             const PhenotypicTargetHandler* pth,
+                             FILE* env_file);
+FILE* open_terminators_stat_file(const char* prefix, const char* postfix);
+void write_terminators_stats(int64_t t, Individual* indiv,
+                             FILE* terminator_file);
+FILE* open_zones_stat_file(const char* prefix, const char* postfix);
+void write_zones_stats(int64_t t,
+                       Individual* indiv,
+                       const PhenotypicTargetHandler* phenotypicTargetHandler,
+                       FILE* zone_file);
+FILE* open_operons_stat_file(const char* prefix, const char* postfix);
+void write_operons_stats(int64_t t, Individual* indiv, FILE* operon_file);
+
+// Command-line option variables
+static char* lineage_file_name = nullptr;
+static bool verbose = false;
+static bool full_check = false;
+static bool trace_mutations = false;
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  printf("\n"
+         "WARNING : Parameter change during simulation is not managed in general.\n"
+         "          Only changes in environmental target done with aevol_modify are handled.\n"
+         "\n");
+
+  // =======================
+  //  Open the lineage file
+  // =======================
+  gzFile lineage_file = gzopen(lineage_file_name, "r");
+  if (lineage_file == Z_NULL) {
+    fprintf(stderr, "ERROR : Could not read the lineage file %s\n", lineage_file_name);
+    exit(EXIT_FAILURE);
+  }
+
+  int64_t t0 = 0;
+  int64_t t_end = 0;
+  int32_t final_indiv_index = 0;
+  int32_t final_indiv_rank  = 0;
+
+  gzread(lineage_file, &t0, sizeof(t0));
+  gzread(lineage_file, &t_end, sizeof(t_end));
+  gzread(lineage_file, &final_indiv_index, sizeof(final_indiv_index));
+  gzread(lineage_file, &final_indiv_rank,  sizeof(final_indiv_rank));
+
+  if (verbose) {
+    printf("\n\n""===============================================================================\n");
+    printf(" Statistics of the ancestors of indiv. %" PRId32
+           " (rank %" PRId32 ") from time %" PRId64 " to %" PRId64 "\n",
+           final_indiv_index, final_indiv_rank, t0, t_end);
+    printf("================================================================================\n");
+  }
+
+
+
+  // =============================
+  //  Open the experiment manager
+  // =============================
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(t0, true, false);
+
+  // The current version doesn't allow for phenotypic variation nor for
+  // different phenotypic targets among the grid
+  if (not exp_manager->world()->phenotypic_target_shared())
+    Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented "
+                              "for per grid-cell phenotypic target");
+  auto phenotypicTargetHandler =
+      exp_manager->world()->phenotypic_target_handler();
+  if (not (phenotypicTargetHandler->var_method() == NO_VAR))
+    Utils::ExitWithUsrMsg("sorry, ancestor stats has not yet been implemented "
+                              "for variable phenotypic targets");
+
+  int64_t backup_step = exp_manager->backup_step();
+
+
+  // =========================
+  //  Open the output file(s)
+  // =========================
+  // Create missing directories
+  int status;
+  status = mkdir("stats/ancestor_stats/", 0755);
+  if ((status == -1) && (errno != EEXIST)) {
+    err(EXIT_FAILURE, "stats/ancestor_stats/");
+  }
+
+  // Open main output files (uses the Stats utility class)
+  auto prefix = "ancestor_stats/ancestor_stats";
+  char postfix[255];
+  snprintf(postfix, 255,
+      "-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32,
+      t0, t_end, final_indiv_index, final_indiv_rank);
+  bool best_indiv_only = true;
+  bool addition_old_stats = false;
+  bool delete_old_stats = true;
+  Stats* mystats = new Stats(exp_manager, t0, best_indiv_only, prefix, postfix,
+                             addition_old_stats, delete_old_stats);
+
+  // Optional additional outputs
+  FILE* env_output_file = open_environment_stat_file(prefix, postfix);
+  FILE* term_output_file = open_terminators_stat_file(prefix, postfix);
+  FILE* zones_output_file = NULL;
+
+  // Next line patchy (specific for the constraints mentioned earlier, i.e.
+  // works only for shared and unvarying phenotypic target)
+  if (phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) {
+    zones_output_file = open_zones_stat_file(prefix, postfix);
+  }
+  FILE* operons_output_file = open_operons_stat_file(prefix, postfix);
+
+  // Open optional output files
+  FILE* fixed_mutations_file = nullptr;
+  if (trace_mutations) {
+    char fixed_mutations_file_name[255];
+    snprintf(fixed_mutations_file_name, 60,
+             "stats/fixedmut-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%"
+                 PRId32 "-r%" PRId32 ".out",
+             t0, t_end, final_indiv_index, final_indiv_rank);
+    fixed_mutations_file = fopen(fixed_mutations_file_name, "w");
+    if (fixed_mutations_file == nullptr) {
+      Utils::ExitWithUsrMsg(std::string("Could not create the output file ") +
+                            fixed_mutations_file_name);
+    }
+
+    // Write the header
+    fprintf(fixed_mutations_file, "# #################################################################\n");
+    fprintf(fixed_mutations_file, "#  Mutations in the lineage of the best indiv at generation %" PRId64 "\n", t_end);
+    fprintf(fixed_mutations_file, "# #################################################################\n");
+    fprintf(fixed_mutations_file, "#  1.  Generation       (mut. occurred when producing the indiv. of this generation)\n");
+    fprintf(fixed_mutations_file, "#  2.  Genetic unit     (which underwent the mutation, 0 = chromosome) \n");
+    fprintf(fixed_mutations_file, "#  3.  Mutation type    (0: switch, 1: smallins, 2: smalldel, 3:dupl, 4: del, 5:trans, 6:inv, 7:insert, 8:ins_HT, 9:repl_HT) \n");
+    fprintf(fixed_mutations_file, "#  4.  pos_0            (position for the small events, begin_segment for the rearrangements, begin_segment of the inserted segment for ins_HT, begin_segment of replaced segment for repl_HT) \n");
+    fprintf(fixed_mutations_file, "#  5.  pos_1            (-1 for the small events, end_segment for the rearrangements, end_segment of the inserted segment for ins_HT, begin_segment of donor segment for repl_HT) \n");
+    fprintf(fixed_mutations_file, "#  6.  pos_2            (reinsertion point for duplic., cutting point in segment for transloc., insertion point in the receiver for ins_HT, end_segment of the replaced segment for repl_HT, -1 for other events)\n");
+    fprintf(fixed_mutations_file, "#  7.  pos_3            (reinsertion point for transloc., breakpoint in the donor for ins_HT, end_segment of the donor segment for repl_HT, -1 for other events)\n");
+    fprintf(fixed_mutations_file, "#  8.  invert           (transloc, was the segment inverted (0/1)?, sense of insertion for ins_HT (0=DIRECT, 1=INDIRECT), sense of the donor segment for repl_HT (0=DIRECT, 1=INDIRECT),-1 for other events)\n");
+    fprintf(fixed_mutations_file, "#  9.  align_score      (score that was needed for the rearrangement to occur, score of the first alignment for ins_HT and repl_HT)\n");
+    fprintf(fixed_mutations_file, "#  10. align_score2     (score for the reinsertion for transloc, score of the second alignment for ins_HT and repl_HT)\n");
+    fprintf(fixed_mutations_file, "#  11. seg_len          (segment length for rearrangement, donor segment length for ins_HT and repl_HT)\n");
+    fprintf(fixed_mutations_file, "#  12. repl_seg_len     (replaced segment length for repl_HT, -1 for the others)\n");
+    fprintf(fixed_mutations_file, "#  13. GU_length        (before the event)\n");
+    fprintf(fixed_mutations_file, "#  14. Impact of the mutation on the metabolic error (negative value = smaller gap after = beneficial mutation) \n");
+    fprintf(fixed_mutations_file, "#  15. Number of coding RNAs possibly disrupted by the breakpoints \n");
+    fprintf(fixed_mutations_file, "#  16. Number of coding RNAs completely included in the segment (donor segment in the case of a transfer) \n");
+    fprintf(fixed_mutations_file, "#  17. Number of coding RNAs that were completely included in the replaced segment (meaningful only for repl_HT) \n");
+    fprintf(fixed_mutations_file, "####################################################################################################################\n");
+    fprintf(fixed_mutations_file, "#\n");
+    fprintf(fixed_mutations_file, "# Header for R\n");
+    fprintf(fixed_mutations_file, "gener gen_unit mut_type pos_0 pos_1 pos_2 pos_3 invert align_score align_score_2 seg_len repl_seg_len GU_len impact nbgenesatbreak nbgenesinseg nbgenesinreplseg\n");
+
+  }
+
+  // ==================================================
+  //  Prepare the initial ancestor and write its stats
+  // ==================================================
+  GridCell* grid_cell = new GridCell(lineage_file, exp_manager, nullptr);
+  auto* indiv = grid_cell->individual();
+  indiv->Evaluate();
+  indiv->compute_statistical_data();
+  indiv->compute_non_coding();
+
+  mystats->write_statistics_of_this_indiv(indiv, nullptr);
+
+  // Additional outputs
+  write_environment_stats(t0, phenotypicTargetHandler, env_output_file);
+  write_terminators_stats(t0, indiv, term_output_file);
+  if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1)
+  {
+    write_zones_stats(t0, indiv, phenotypicTargetHandler, zones_output_file);
+  }
+  write_operons_stats(t0, indiv, operons_output_file);
+
+  if (verbose) {
+    printf("Initial fitness     = %f\n", indiv->fitness());
+    printf("Initial genome size = %" PRId32 "\n", indiv->total_genome_size());
+  }
+
+  // ==========================================================================
+  //  Replay the mutations to get the successive ancestors and analyze them
+  // ==========================================================================
+  ReplicationReport* rep = nullptr;
+  int32_t index;
+  ExpManager* exp_manager_backup = nullptr;
+  int32_t unitlen_before;
+  double metabolic_error_before;
+  double impact_on_metabolic_error;
+  char mut_descr_string[255];
+
+  bool check_now = false;
+
+  aevol::AeTime::plusplus();
+  while (time() <= t_end)
+  {
+    rep = new ReplicationReport(lineage_file, indiv);
+    index = rep->id(); // who we are building...
+
+    // Check now?
+    check_now = time() == t_end ||
+        (full_check && Utils::mod(time(), backup_step) == 0);
+
+    if (verbose)
+        printf("Rebuilding ancestor at generation %" PRId64
+            " (index %" PRId32 ")...", time(), index);
+
+    indiv->Reevaluate();
+
+    // 2) Replay replication (create current individual's child)
+    GeneticUnit& gen_unit = indiv->genetic_unit_nonconst(0);
+    GeneticUnit* stored_gen_unit = nullptr;
+    Individual* stored_indiv = nullptr;
+
+    if (check_now)
+    {
+      exp_manager_backup = new ExpManager();
+      exp_manager_backup->load(time(), true, false);
+      stored_indiv = new Individual(
+          *(Individual*) exp_manager_backup->indiv_by_id(index));
+      stored_gen_unit = &(stored_indiv->genetic_unit_nonconst(0));
+    }
+
+    // For each genetic unit, replay the replication (undergo all mutations)
+    // TODO <david.parsons at inria.fr> disabled for multiple GUs
+    const auto& dnarep = rep->dna_replic_report();
+
+    // TODO(dpa) The following 3 for loops should be factorized.
+    // However, this is not as easy as it sounds :-D
+    // see std::list::splice
+    for (const auto& mut: dnarep.HT())
+      gen_unit.dna()->undergo_this_mutation(*mut);
+
+    for (const auto& mut: dnarep.rearrangements()) {
+      if (trace_mutations) {
+        // Store initial values before the mutation
+        metabolic_error_before = indiv->dist_to_target_by_feature(METABOLISM);
+        unitlen_before = gen_unit.dna()->length();
+      }
+
+      // Apply mutation
+      gen_unit.dna()->undergo_this_mutation(*mut);
+
+      if (trace_mutations) {
+        indiv->Reevaluate();
+
+        // Compute the metabolic impact of the mutation
+        impact_on_metabolic_error =
+            indiv->dist_to_target_by_feature(METABOLISM) -
+            metabolic_error_before;
+
+        mut->generic_description_string(mut_descr_string);
+        fprintf(fixed_mutations_file,
+                "%" PRId64 " %" PRId32 " %s %" PRId32 " %.15f \n",
+                time(), 0, mut_descr_string, unitlen_before,
+                impact_on_metabolic_error);
+      }
+    }
+
+    for (const auto& mut: dnarep.mutations()) {
+      if (trace_mutations) {
+        // Store initial values before the mutation
+        metabolic_error_before = indiv->dist_to_target_by_feature(METABOLISM);
+        unitlen_before = gen_unit.dna()->length();
+      }
+
+      // Apply mutation
+      gen_unit.dna()->undergo_this_mutation(*mut);
+
+      if (trace_mutations) {
+        indiv->Reevaluate();
+
+        // Compute the metabolic impact of the mutation
+        impact_on_metabolic_error =
+            indiv->dist_to_target_by_feature(METABOLISM) -
+            metabolic_error_before;
+
+        mut->generic_description_string(mut_descr_string);
+        fprintf(fixed_mutations_file,
+                "%" PRId64 " %" PRId32 " %s %" PRId32 " %.15f \n",
+                time(), 0, mut_descr_string, unitlen_before,
+                impact_on_metabolic_error);
+      }
+    }
+
+    if (check_now) {
+      if (verbose) {
+        printf("Checking the sequence of the unit...");
+        fflush(NULL);
+      }
+
+      char * str1 = new char[gen_unit.dna()->length() + 1];
+      memcpy(str1, gen_unit.dna()->data(), \
+             gen_unit.dna()->length()*sizeof(char));
+      str1[gen_unit.dna()->length()] = '\0';
+
+      char * str2 = new char[(stored_gen_unit->dna())->length() + 1];
+      memcpy(str2, (stored_gen_unit->dna())->data(),
+             (stored_gen_unit->dna())->length()*sizeof(char));
+      str2[(stored_gen_unit->dna())->length()] = '\0';
+
+      if (strncmp(str1, str2, stored_gen_unit->dna()->length()) == 0) {
+        if (verbose)
+          printf(" OK\n");
+      }
+      else {
+        if (verbose) printf(" ERROR !\n");
+        fprintf(stderr, "Error: the rebuilt genetic unit is not the same as \n");
+        fprintf(stderr, "the one saved at generation %" PRId64 "... ", time());
+        fprintf(stderr, "Rebuilt unit : %" PRId32 " bp\n %s\n", (int32_t)strlen(str1), str1);
+        fprintf(stderr, "Stored unit  : %" PRId32 " bp\n %s\n", (int32_t)strlen(str2), str2);
+
+        delete [] str1;
+        delete [] str2;
+        gzclose(lineage_file);
+        if (trace_mutations)
+          gzclose(lineage_file);
+        delete indiv;
+        delete stored_indiv;
+        delete exp_manager_backup;
+        delete exp_manager;
+        exit(EXIT_FAILURE);
+      }
+
+      delete [] str1;
+      delete [] str2;
+    }
+
+    // 3) All the mutations have been replayed, we can now evaluate the new individual
+    indiv->Reevaluate();
+    indiv->compute_statistical_data();
+    indiv->compute_non_coding();
+
+    mystats->write_statistics_of_this_indiv(indiv, rep);
+
+    // Additional outputs
+    write_environment_stats(time(), phenotypicTargetHandler, env_output_file);
+    write_terminators_stats(time(), indiv, term_output_file);
+    if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) {
+      write_zones_stats(time(), indiv, phenotypicTargetHandler,
+                        zones_output_file);
+    }
+    write_operons_stats(time(), indiv, operons_output_file);
+
+    if (verbose) printf(" OK\n");
+
+    delete rep;
+
+    if (check_now) {
+      delete stored_indiv;
+      delete exp_manager_backup;
+    }
+
+    aevol::AeTime::plusplus();
+  }
+
+  gzclose(lineage_file);
+
+  // Additional outputs
+  fclose(env_output_file);
+  fclose(term_output_file);
+  if(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1) {
+    fclose(zones_output_file);
+  }
+  fclose(operons_output_file);
+
+  delete exp_manager;
+  delete mystats;
+  delete indiv;
+
+  return EXIT_SUCCESS;
+}
+
+
+
+
+FILE* open_environment_stat_file(const char* prefix, const char* postfix) {
+  // Open file
+  char* env_output_file_name = new char[80];
+  sprintf(env_output_file_name, "stats/%s_envir%s.out", prefix, postfix);
+  FILE* env_output_file = fopen(env_output_file_name, "w");
+  delete[] env_output_file_name;
+
+  // Write headers
+  // TODO vld: was limited to "if environment->gaussians_provided"
+  // are gaussians always available now?
+  fprintf(env_output_file,
+          "# Each line contains: Generation, and then, for each gaussian: M W H.\n");
+  fprintf(env_output_file, "#\n");
+
+  return env_output_file;
+}
+
+
+void write_environment_stats(int64_t t, const PhenotypicTargetHandler* pth,
+                             FILE* env_output_file) {
+  // Num gener
+  fprintf(env_output_file, "%" PRId64, t);
+
+  for (const Gaussian& g: pth->gaussians())
+    fprintf(env_output_file,
+            "     %.16f %.16f %.16f",
+            g.mean(), g.width(), g.height());
+
+  fprintf(env_output_file, "\n");
+}
+
+
+
+FILE* open_terminators_stat_file(const char* prefix, const char* postfix) {
+  std::string term_output_file_name{std::string("stats/") + prefix + "_nb_term" + postfix + ".out"};
+  FILE* term_output_file = fopen(term_output_file_name.c_str(), "w");
+
+  // Write headers
+  fprintf(term_output_file, "# Each line contains : \n");
+  fprintf(term_output_file, "#   * Generation\n");
+  fprintf(term_output_file, "#   * Genome size\n");
+  fprintf(term_output_file, "#   * Terminator number\n");
+  fprintf(term_output_file, "#\n");
+
+  return term_output_file;
+}
+
+void write_terminators_stats(int64_t t,  Individual* indiv,
+                             FILE* term_output_file) {
+  fprintf(term_output_file, "%" PRId64 " %" PRId32 " %" PRId32 "\n",
+            t,
+            indiv->total_genome_size(),
+            indiv->nb_terminators());
+}
+
+
+
+FILE* open_zones_stat_file(const char* prefix, const char* postfix) {
+  // Open file
+  char* zones_output_file_name = new char[80];
+  sprintf(zones_output_file_name, "stats/%s_zones%s.out", prefix, postfix);
+  FILE* zones_output_file = fopen(zones_output_file_name, "w");
+  delete [] zones_output_file_name;
+
+  // Write headers
+  fprintf(zones_output_file, "# Each line contains : Generation, and then, for each zone:\n");
+  fprintf(zones_output_file, "#   * Number of activation genes\n");
+  fprintf(zones_output_file, "#   * Number of inhibition genes\n");
+  fprintf(zones_output_file, "#   * Geometric area of the activation genes\n");
+  fprintf(zones_output_file, "#   * Geometric area of the inhibition genes\n");
+  fprintf(zones_output_file, "#   * Geometric area of the resulting phenotype\n");
+  fprintf(zones_output_file, "#\n");
+
+  return zones_output_file;
+}
+
+void write_zones_stats(int64_t t,
+                       Individual* indiv,
+                       const PhenotypicTargetHandler* phenotypicTargetHandler,
+                       FILE* zones_output_file)
+{
+  assert(phenotypicTargetHandler->phenotypic_target().nb_segments() > 1);
+
+  int16_t nb_segments = phenotypicTargetHandler->phenotypic_target().nb_segments();
+  int16_t num_segment = 0;
+  PhenotypicSegment** segments =
+      phenotypicTargetHandler->phenotypic_target().segments();
+
+  // Tables : index 0 for the 0 segment
+  //                1 for the neutral segment
+  int32_t nb_genes_activ[nb_segments];
+  int32_t nb_genes_inhib[nb_segments];
+  double  geom_area_activ[nb_segments];
+  double  geom_area_inhib[nb_segments];
+  double  geom_area_phen[nb_segments];
+
+  for (num_segment = 0 ; num_segment < nb_segments ; num_segment++)
+  {
+    nb_genes_activ[num_segment]   = 0;
+    nb_genes_inhib[num_segment]   = 0;
+    geom_area_activ[num_segment]  = 0.0;
+    geom_area_inhib[num_segment]  = 0.0;
+    geom_area_phen[num_segment]   = 0.0;
+  }
+
+
+  AbstractFuzzy* activ = NULL;
+  AbstractFuzzy* inhib = NULL;
+  Phenotype* phen  = NULL;
+
+
+
+  // Compute number of genes in each segment
+  for (const auto& prot: indiv->protein_list()) {
+    // Go to the corresponding segment
+    num_segment = 0;
+    while (prot->mean() > segments[num_segment]->stop)
+    {
+      num_segment++;
+    }
+
+    // Add a genes (activ or inhib)
+    if (prot->is_functional())
+    {
+      if (prot->height() > 0)
+      {
+        nb_genes_activ[num_segment]++;
+      }
+      else if (prot->height() < 0)
+      {
+        nb_genes_inhib[num_segment]++;
+      }
+
+      // It the gene is exactly at the frontier between 2 zones, mark it in both
+      if (prot->mean() == segments[num_segment]->stop && num_segment < nb_segments - 1)
+      {
+        if (prot->height() > 0)
+        {
+          nb_genes_activ[num_segment+1]++;
+        }
+        else if (prot->height() < 0)
+        {
+          nb_genes_inhib[num_segment+1]++;
+        }
+      }
+    }
+  }
+
+  // Compute the geometric areas
+  activ = indiv->phenotype_activ();
+  inhib = indiv->phenotype_inhib();
+  phen  = indiv->phenotype();
+
+  for (num_segment = 0 ; num_segment < nb_segments ; num_segment++)
+  {
+    geom_area_activ[num_segment]  = activ->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop);
+    geom_area_inhib[num_segment]  = inhib->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop);
+    geom_area_phen[num_segment]   = phen->get_geometric_area(segments[num_segment]->start, segments[num_segment]->stop);
+  }
+
+
+  // Print stats to file
+  fprintf(zones_output_file, "%" PRId64, t);
+
+  for (num_segment = 0 ; num_segment < nb_segments ; num_segment++)
+  {
+    fprintf(zones_output_file, "     %" PRId32 " %" PRId32 " %lf %lf %lf",
+              nb_genes_activ[num_segment],
+              nb_genes_inhib[num_segment],
+              geom_area_activ[num_segment],
+              geom_area_inhib[num_segment],
+              geom_area_phen[num_segment]);
+  }
+
+  fprintf(zones_output_file, "\n");
+}
+
+
+
+FILE* open_operons_stat_file(const char* prefix, const char* postfix) {
+  std::string operons_output_file_name{std::string("stats/") + prefix + "_operons" + postfix + ".out"};
+  FILE* operons_output_file = fopen(operons_output_file_name.c_str(), "w");
+
+  // Write headers
+  fprintf(operons_output_file, "# Each line contains : Generation, and then, for 20 RNA, the number of genes inside the RNA\n");
+  return operons_output_file;
+}
+
+void write_operons_stats(int64_t t, Individual* indiv, FILE*  operons_output_file)
+{
+  int32_t nb_genes_per_rna[20];
+  for (int i = 0 ; i < 20 ; i++)
+  {
+    nb_genes_per_rna[i] = 0;
+  }
+
+  for (const auto& rna: indiv->rna_list()) {
+    if (rna->transcribed_proteins().size() >= 20)
+    {
+      printf("Found operon with 20 genes or more : %zu\n", rna->transcribed_proteins().size());
+    }
+
+    nb_genes_per_rna[rna->transcribed_proteins().size()]++;
+  }
+
+  fprintf(operons_output_file, "%" PRId64 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 " %" PRId32 "\n",
+            t,
+            nb_genes_per_rna[0],
+            nb_genes_per_rna[1],
+            nb_genes_per_rna[2],
+            nb_genes_per_rna[3],
+            nb_genes_per_rna[4],
+            nb_genes_per_rna[5],
+            nb_genes_per_rna[6],
+            nb_genes_per_rna[7],
+            nb_genes_per_rna[8],
+            nb_genes_per_rna[9],
+            nb_genes_per_rna[10],
+            nb_genes_per_rna[11],
+            nb_genes_per_rna[12],
+            nb_genes_per_rna[13],
+            nb_genes_per_rna[14],
+            nb_genes_per_rna[15],
+            nb_genes_per_rna[16],
+            nb_genes_per_rna[17],
+            nb_genes_per_rna[18],
+            nb_genes_per_rna[19]);
+}
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // =====================
+  //  Parse command line
+  // =====================
+  const char * short_options = "hVF:vM";
+  static struct option long_options[] = {
+    {"help",                no_argument, NULL, 'h'},
+    {"version",             no_argument, NULL, 'V'},
+    {"full-check",          no_argument, NULL, 'F'},
+    {"trace-mutations",     no_argument, NULL, 'M'},
+    {"verbose",             no_argument, NULL, 'v'},
+    {0, 0, 0, 0}
+  };
+
+  int option;
+  while((option = getopt_long(argc, argv, short_options,
+                              long_options, nullptr)) != -1) {
+    switch(option) {
+      case 'h':
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      case 'V':
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      case 'v':
+        verbose = true;
+        break;
+      case 'F':
+        full_check = true;
+        break;
+      case 'M':
+        trace_mutations = true;
+        break;
+      default:
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+    }
+  }
+
+  // There should be only one remaining arg: the lineage file
+  if (optind != argc - 1) {
+    Utils::ExitWithUsrMsg("please specify a lineage file");
+  }
+
+  lineage_file_name = new char[strlen(argv[optind]) + 1];
+  sprintf(lineage_file_name, "%s", argv[optind]);
+}
+
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s: create an experiment with setup as specified in PARAM_FILE.\n",
+  prog_name);
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s LINEAGE_FILE [-FMv]\n",
+  prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -F, --full-check\n");
+  printf("\tperform genome checks whenever possible\n");
+  printf("  -M, --trace-mutations\n");
+  printf("\toutputs the fixed mutations (in a separate file)\n");
+  printf("  -v, --verbose\n\tbe verbose\n");
+}
diff --git a/src/post_treatments/ancstats.cpp b/src/post_treatments/ancstats.cpp
deleted file mode 100644
index ad3a54e..0000000
--- a/src/post_treatments/ancstats.cpp
+++ /dev/null
@@ -1,889 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-#include <err.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_utils.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_list.h>
-#include <ae_tree.h>
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-//#include <ae_param_loader.h>
-#include <ae_environment.h>
-#include <ae_enums.h>
-//#include <ae_common.h>
-
-//debug
-#include <ae_gaussian.h>
-
-
-
-
-enum check_type
-{
-  FULL_CHECK  = 0,
-  LIGHT_CHECK = 1,
-  ENV_CHECK   = 2,
-  NO_CHECK    = 3
-};
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-FILE* open_environment_stat_file( const char * prefix, const ae_environment * env );
-void write_environment_stats( int32_t num_gener, const ae_environment * env, FILE* env_file);
-
-FILE* open_terminators_stat_file( const char * prefix );
-void write_terminators_stats( int32_t num_gener,  ae_individual * indiv, FILE* terminator_file );
-
-FILE* open_zones_stat_file( const char * prefix );
-void write_zones_stats( int32_t num_gener,  ae_individual * indiv, ae_environment * env, FILE* zone_file );
-
-FILE* open_operons_stat_file( const char * prefix );
-void write_operons_stats( int32_t num_gener,  ae_individual * indiv, FILE* operon_file );
-
-
-double* dist_to_target_segment;
-
-
-int main(int argc, char** argv)
-{
-  // The input file (lineage.ae or lineage.rae) must contain the following information:
-  //
-  // - common data                                                (ae_common::write_to_backup)
-  // - begin gener                                                (int32_t)
-  // - end gener                                                  (int32_t)
-  // - final individual index                                     (int32_t)
-  // - initial genome size                                        (int32_t)
-  // - initial ancestor (nb genetic units + sequences)            (ae_individual::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+1 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+2 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+3 (ae_replic_report::write_to_backup)
-  // - ...
-  // - replication report of ancestor at generation end_gener     (ae_replic_report::write_to_backup)
-
-
-
-
-  // =====================
-  //  Parse command line
-  // =====================
-
-  // Default values
-  char*       lineage_file_name   = NULL;
-  bool        verbose             = false;
-  check_type  check               = LIGHT_CHECK;
-  double      tolerance           = 0;
-
-  const char * short_options = "hVvncf:lt:";
-  static struct option long_options[] =
-  {
-    {"help",        no_argument,       NULL, 'h'},
-    {"version",     no_argument,       NULL, 'V' },
-    {"verbose",     no_argument,       NULL, 'v'},
-    {"nocheck",     no_argument,       NULL, 'n'},
-    {"fullcheck",   no_argument,       NULL, 'c'},
-    {"file",        required_argument, NULL, 'f'},
-    {"tolerance",   required_argument, NULL, 't'},
-    {0, 0, 0, 0}
-  };
-
-  int option;
-  while ( (option = getopt_long(argc, argv, short_options, long_options, NULL)) != -1 )
-  {
-    switch( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'v' : verbose = true;                    break;
-      case 'n' : check = NO_CHECK;                  break;
-      case 'c' : check = FULL_CHECK;                break;
-      case 'f' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -f or --file : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-        lineage_file_name = new char[strlen(optarg) + 1];
-        sprintf( lineage_file_name, "%s", optarg );
-        break;
-      }
-      case 't' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -t or --tolerance : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-        check = ENV_CHECK;
-        tolerance = atof(optarg);
-        break;
-      }
-      default :
-      {
-        fprintf( stderr, "ERROR : Unknown option, check your syntax.\n" );
-        print_help(argv[0]);
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-
-
-  if ( lineage_file_name == NULL )
-  {
-    fprintf( stderr, "ERROR : Option -f or --file missing. \n" );
-    exit( EXIT_FAILURE );
-  }
-
-
-  printf("\n");
-  printf( "WARNING : Parameter change during simulation is not managed in general.\n" );
-  printf( "          Only changes in environmental target done with aevol_modify are handled.\n" );
-  printf("\n");
-
-  // =======================
-  //  Open the lineage file
-  // =======================
-  gzFile lineage_file = gzopen( lineage_file_name, "r" );
-  if ( lineage_file == Z_NULL )
-  {
-    fprintf( stderr, "ERROR : Could not read the lineage file %s\n", lineage_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-  int32_t begin_gener       = 0;
-  int32_t end_gener         = 0;
-  int32_t final_indiv_index = 0;
-  int32_t final_indiv_rank  = 0;
-
-
-  gzread( lineage_file, &begin_gener,       sizeof(begin_gener)       );
-  gzread( lineage_file, &end_gener,         sizeof(end_gener)         );
-  gzread( lineage_file, &final_indiv_index, sizeof(final_indiv_index) );
-  gzread( lineage_file, &final_indiv_rank,  sizeof(final_indiv_rank)  );
-
-  if ( verbose )
-  {
-    printf("\n\n");
-    printf( "===============================================================================\n" );
-    printf( " Statistics of the ancestors of indiv. %"PRId32" (rank %"PRId32") from generation %"PRId32" to %"PRId32"\n",
-            final_indiv_index, final_indiv_rank, begin_gener, end_gener );
-    printf("================================================================================\n");
-  }
-
-
-
-  // =========================
-  //  Open the experience manager
-  // =========================
-
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-
-  exp_manager->load( begin_gener, false, true, false);
-  ae_environment* env = new ae_environment( *(exp_manager->get_env()) ); // independent copy
-
-  int32_t backup_step = exp_manager->get_backup_step();
-
-  // =========================
-  //  Open the output file(s)
-  // =========================
-  // Create missing directories
-  int status;
-  status = mkdir( "stats/ancstats/", 0755 );
-  if ( (status == -1) && (errno != EEXIST) )
-  {
-    err( EXIT_FAILURE, "stats/ancstats/" );
-  }
-
-  char prefix[50];
-  snprintf( prefix, 50, "ancstats/ancstats-b%06"PRId32"-e%06"PRId32"-i%"PRId32"-r%"PRId32,begin_gener, end_gener, final_indiv_index , final_indiv_rank);
-  bool best_indiv_only = true;
-  bool addition_old_stats = false;
-  bool delete_old_stats = true;
-  ae_stats * mystats = new ae_stats(exp_manager, begin_gener, best_indiv_only, prefix, addition_old_stats, delete_old_stats);
-  //mystats->write_headers();
-
-  // Optional outputs
-  FILE* env_output_file = open_environment_stat_file(prefix, env);
-  FILE* term_output_file = open_terminators_stat_file(prefix);
-  FILE* zones_output_file = NULL;
-  if(env->get_nb_segments() > 1)
-  {
-    zones_output_file = open_zones_stat_file(prefix);
-  }
-  FILE* operons_output_file = open_operons_stat_file(prefix);
-
-
-  // ==================================================
-  //  Prepare the initial ancestor and write its stats
-  // ==================================================
-  ae_individual * indiv = new ae_individual(exp_manager, lineage_file );
-  indiv->evaluate( env );
-  indiv->compute_statistical_data();
-  indiv->compute_non_coding();
-
-  mystats->write_statistics_of_this_indiv( indiv, begin_gener );
-
-
-  // Optional outputs
-  write_environment_stats( begin_gener, env, env_output_file );
-  write_terminators_stats( begin_gener, indiv, term_output_file );
-  if(env->get_nb_segments() > 1)
-  {
-    write_zones_stats( begin_gener, indiv, env, zones_output_file );
-  }
-  write_operons_stats( begin_gener, indiv, operons_output_file );
-
-
-  if ( verbose )
-  {
-    printf("Initial fitness     = %f\n", indiv->get_fitness());
-    printf("Initial genome size = %"PRId32"\n", indiv->get_total_genome_size());
-  }
-
-  //delete exp_manager;
-
-  // ===============================================================================
-  //  Replay the mutations to get the successive ancestors and analyze them
-  //  (and, optionally, check that the rebuilt envir is correct each time a backup
-  //  is available)
-  // ===============================================================================
-
-  int32_t num_gener = 0;
-
-  ae_replication_report* rep = NULL;
-  ae_list_node<ae_dna_replic_report*>* dnarepnode  = NULL;
-  ae_dna_replic_report* dnarep = NULL;
-
-  ae_list_node<ae_mutation*>* mnode  = NULL;
-  ae_mutation* mut = NULL;
-
-  ae_list_node<ae_genetic_unit*>* unitnode  = NULL;
-  ae_genetic_unit* unit = NULL;
-
-  ae_individual* stored_indiv = NULL;
-  ae_list_node<ae_genetic_unit*>* storedunitnode  = NULL;
-  ae_genetic_unit* storedunit = NULL;
-
-  int32_t index;
-  int32_t nb_gener = end_gener - begin_gener;
-
-  ae_exp_manager* exp_manager_backup = NULL;
-  ae_environment* backup_env = NULL;
-
-  bool check_now = false;
-
-  for ( int32_t i = 0 ; i < nb_gener ; i++ )
-  {
-    num_gener = begin_gener + i + 1;  // where we are in time..
-
-
-    rep = new ae_replication_report( lineage_file, indiv );
-    index = rep->get_id(); // who we are building...
-    indiv->set_replication_report( rep );
-
-    // Check now?
-    check_now = ( ( check == FULL_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == ENV_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == LIGHT_CHECK && num_gener == end_gener ) );
-
-    if ( verbose ) printf("Rebuilding ancestor at generation %"PRId32" (index %"PRId32")...", num_gener, index);
-
-    // 1) Rebuild environment
-    env->build();
-    env->apply_variation();
-    indiv->reevaluate(env);
-
-    // Check, and possibly update, the environment according to the backup files (update necessary if the env. was modified by aevol_modify at some point)
-    if (ae_utils::mod( num_gener, backup_step ) == 0)
-      {
-        char env_file_name[255];
-        sprintf( env_file_name, "./"ENV_FNAME_FORMAT, num_gener );
-        gzFile env_file = gzopen( env_file_name, "r" );
-        backup_env = new ae_environment();
-        backup_env->load( env_file );
-
-        if ( ! env->is_identical_to(backup_env, tolerance) )
-          {
-            printf("Warning: At t=%"PRId32", the replayed environment is not the same\n", num_gener);
-            printf("         as the one saved at generation %"PRId32"... \n", num_gener );
-            printf("         with tolerance of %lg\n", tolerance);
-            printf("Replacing the replayed environment by the one stored in the backup.\n");
-            delete env;
-            env = new ae_environment(*backup_env);
-          }
-        delete backup_env;
-      }
-
-
-    // Warning: this portion of code won't work if the number of units changes
-    // during the evolution
-
-    // 2) Replay replication (create current individual's child)
-    dnarepnode  = rep->get_dna_replic_reports()->get_first();
-    unitnode    = indiv->get_genetic_unit_list()->get_first();
-
-    if ( check_now )
-    {
-#ifndef __NO_X
-      exp_manager_backup = new ae_exp_manager_X11();
-#else
-      exp_manager_backup = new ae_exp_manager();
-#endif
-      exp_manager_backup->load( num_gener, false, true, false );
-      stored_indiv = new ae_individual( * (ae_individual *)exp_manager_backup->get_indiv_by_id( index ), false );
-      storedunitnode = stored_indiv->get_genetic_unit_list()->get_first();
-    }
-
-    // For each genetic unit, replay the replication (undergo all mutations)
-    while ( dnarepnode != NULL )
-    {
-      assert( unitnode != NULL );
-
-      dnarep  = (ae_dna_replic_report *)  dnarepnode->get_obj();
-      unit    = (ae_genetic_unit *)       unitnode->get_obj();
-
-      unit->get_dna()->set_replic_report( dnarep );
-
-      mnode = dnarep->get_HT()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-        unit->get_dna()->undergo_this_mutation(mut);
-        mnode = mnode->get_next();
-      }
-
-      mnode = dnarep->get_rearrangements()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-        unit->get_dna()->undergo_this_mutation(mut);
-        mnode = mnode->get_next();
-      }
-
-      mnode = dnarep->get_mutations()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-        unit->get_dna()->undergo_this_mutation( mut );
-        mnode = mnode->get_next();
-      }
-
-      if ( check_now )
-      {
-        if ( verbose )
-        {
-          printf("Checking the sequence of the unit...");
-          fflush(NULL);
-        }
-
-        assert( storedunitnode != NULL );
-        storedunit = (ae_genetic_unit *) storedunitnode->get_obj();
-
-        char * str1 = new char[unit->get_dna()->get_length() + 1];
-        memcpy(str1, unit->get_dna()->get_data(), \
-               unit->get_dna()->get_length()*sizeof(char));
-        str1[unit->get_dna()->get_length()] = '\0';
-
-        char * str2 = new char[(storedunit->get_dna())->get_length() + 1];
-        memcpy(str2, (storedunit->get_dna())->get_data(), (storedunit->get_dna())->get_length()*sizeof(char));
-        str2[(storedunit->get_dna())->get_length()] = '\0';
-
-        if ( strncmp( str1, str2, storedunit->get_dna()->get_length() ) == 0 )
-        {
-          if ( verbose ) printf(" OK\n");
-        }
-        else
-        {
-          if ( verbose ) printf( " ERROR !\n" );
-          fprintf( stderr, "Error: the rebuilt genetic unit is not the same as \n");
-          fprintf( stderr, "the one saved at generation %"PRId32"... ", num_gener );
-          fprintf( stderr, "Rebuilt unit : %"PRId32" bp\n %s\n", (int32_t)strlen(str1), str1 );
-          fprintf( stderr, "Stored unit  : %"PRId32" bp\n %s\n", (int32_t)strlen(str2), str2 );
-
-          delete [] str1;
-          delete [] str2;
-          gzclose(lineage_file);
-          delete indiv;
-          delete stored_indiv;
-          delete exp_manager_backup;
-          delete exp_manager;
-          exit(EXIT_FAILURE);
-        }
-
-        delete [] str1;
-        delete [] str2;
-
-        storedunitnode = storedunitnode->get_next();
-      }
-
-
-      dnarepnode = dnarepnode->get_next();
-      unitnode = unitnode->get_next();
-    }
-
-    assert( unitnode == NULL );
-
-    // 3) All the mutations have been replayed, we can now evaluate the new individual
-    indiv->reevaluate( env );
-    indiv->compute_statistical_data();
-    indiv->compute_non_coding();
-
-    mystats->write_statistics_of_this_indiv( indiv, num_gener );
-
-    // Optional outputs
-    write_environment_stats( num_gener, env, env_output_file );
-    write_terminators_stats( num_gener, indiv, term_output_file );
-    if(env->get_nb_segments() > 1)
-    {
-      write_zones_stats( num_gener, indiv, env, zones_output_file );
-    }
-    write_operons_stats( num_gener, indiv, operons_output_file );
-
-    if ( verbose ) printf(" OK\n");
-
-    delete rep;
-
-    if ( check_now )
-    {
-      assert( storedunitnode == NULL );
-      delete stored_indiv;
-      delete exp_manager_backup;
-    }
-  }
-
-  gzclose(lineage_file);
-  delete exp_manager;
-  delete mystats;
-  delete indiv;
-  delete env;
-
-  // Optional outputs
-  fclose( env_output_file );
-  fclose( term_output_file );
-  if(env->get_nb_segments() > 1)
-  {
-    fclose( zones_output_file );
-  }
-  fclose( operons_output_file );
-
-  exit(EXIT_SUCCESS);
-}
-
-
-
-
-FILE* open_environment_stat_file( const char * prefix, const ae_environment * env )
-{
-  // Open file
-  char* env_output_file_name = new char[80];
-  sprintf( env_output_file_name, "stats/%s_envir.out",prefix );
-  FILE* env_output_file = fopen( env_output_file_name, "w" );
-  delete env_output_file_name;
-
-  // Write headers
-  if ( env->get_gaussians() != NULL)
-    {
-      fprintf( env_output_file, "# Each line contains : Generation, and then, for each gaussian: M W H.\n" );
-    }
-  else if ( env->get_custom_points() != NULL )
-    {
-      fprintf( env_output_file, "# Each line contains : Generation, and then, for each point: x y.\n" );
-    }
-  fprintf( env_output_file, "#\n" );
-
-  return env_output_file;
-}
-
-
-void write_environment_stats( int32_t num_gener, const ae_environment * env, FILE*  env_output_file)
-{
-  // Num gener
-  fprintf( env_output_file, "%"PRId32, num_gener );
-
-  if ( env->get_gaussians() != NULL)
-    {
-      // For each gaussian : M W H
-      ae_list_node<ae_gaussian*>* gaussnode  = env->get_gaussians()->get_first();
-      ae_gaussian*  gauss      = NULL;
-      while ( gaussnode != NULL )
-        {
-          gauss = gaussnode->get_obj();
-          fprintf( env_output_file, "     %.16f %.16f %.16f", gauss->get_mean(), gauss->get_width(), gauss->get_height() );
-          gaussnode = gaussnode->get_next();
-        }
-    }
-  else if ( env->get_custom_points() != NULL )
-    {
-      // For each point : x y
-      ae_list_node<ae_point_2d*>* ptnode  = env->get_custom_points()->get_first();
-      ae_point_2d*  pt      = NULL;
-      while ( ptnode != NULL )
-        {
-          pt = ptnode->get_obj();
-          fprintf( env_output_file, "  %.16f %.16f", pt->x, pt->y );
-          ptnode = ptnode->get_next();
-        }
-
-    }
-
-
-  fprintf( env_output_file, "\n" );
-}
-
-
-
-FILE* open_terminators_stat_file( const char * prefix )
-{
-  char* term_output_file_name = new char[80];
-  sprintf( term_output_file_name, "stats/%s_nb_term.out",prefix );
-  FILE* term_output_file = fopen( term_output_file_name, "w" );
-  delete [] term_output_file_name;
-
-  // Write headers
-  fprintf( term_output_file, "# Each line contains : \n" );
-  fprintf( term_output_file, "#   * Generation\n" );
-  fprintf( term_output_file, "#   * Genome size\n" );
-  fprintf( term_output_file, "#   * Terminator number\n");
-  fprintf( term_output_file, "#\n" );
-
-  return term_output_file;
-}
-
-void write_terminators_stats( int32_t num_gener,  ae_individual * indiv, FILE* term_output_file  )
-{
-  fprintf(  term_output_file, "%"PRId32" %"PRId32" %"PRId32"\n",
-            num_gener,
-            indiv->get_total_genome_size(),
-            indiv->get_nb_terminators() );
-}
-
-
-
-FILE* open_zones_stat_file( const char * prefix  )
-{
-  // Open file
-  char* zones_output_file_name = new char[80];
-  sprintf( zones_output_file_name, "stats/%s_zones.out",prefix );
-  FILE* zones_output_file = fopen( zones_output_file_name, "w" );
-  delete [] zones_output_file_name;
-
-  // Write headers
-  fprintf( zones_output_file, "# Each line contains : Generation, and then, for each zone:\n" );
-  fprintf( zones_output_file, "#   * Number of activation genes\n" );
-  fprintf( zones_output_file, "#   * Number of inhibition genes\n" );
-  fprintf( zones_output_file, "#   * Geometric area of the activation genes\n" );
-  fprintf( zones_output_file, "#   * Geometric area of the inhibition genes\n" );
-  fprintf( zones_output_file, "#   * Geometric area of the resulting phenotype\n" );
-  fprintf( zones_output_file, "#\n" );
-
-  return zones_output_file;
-}
-
-void write_zones_stats( int32_t num_gener, ae_individual * indiv, ae_environment * env, FILE* zones_output_file )
-{
-  assert( env->get_nb_segments() > 1 );
-
-  int16_t nb_segments = env->get_nb_segments();
-  int16_t num_segment = 0;
-  ae_env_segment** segments = env->get_segments();
-
-  ae_list<ae_protein*>* prot_list = indiv->get_protein_list();
-  ae_list_node<ae_protein*>* prot_node = NULL;
-  ae_protein* prot = NULL;
-
-  // Tables : index 0 for the 0 segment
-  //                1 for the neutral segment
-  int32_t nb_genes_activ[nb_segments];
-  int32_t nb_genes_inhib[nb_segments];
-  double  geom_area_activ[nb_segments];
-  double  geom_area_inhib[nb_segments];
-  double  geom_area_phen[nb_segments];
-
-  for ( num_segment = 0 ; num_segment < nb_segments ; num_segment++ )
-  {
-    nb_genes_activ[num_segment]   = 0;
-    nb_genes_inhib[num_segment]   = 0;
-    geom_area_activ[num_segment]  = 0.0;
-    geom_area_inhib[num_segment]  = 0.0;
-    geom_area_phen[num_segment]   = 0.0;
-  }
-
-
-  ae_fuzzy_set* activ = NULL;
-  ae_fuzzy_set* inhib = NULL;
-  ae_phenotype* phen  = NULL;
-
-
-
-  // Compute number of genes in each segment
-  prot_node = prot_list->get_first();
-  prot      = NULL;
-
-  while ( prot_node != NULL )
-  {
-    prot = prot_node->get_obj();
-
-    // Go to the corresponding segment
-    num_segment = 0;
-    while ( prot->get_mean() > segments[num_segment]->stop )
-    {
-      num_segment++;
-    }
-
-    // Add a genes (activ or inhib)
-    if ( prot->get_is_functional() )
-    {
-      if ( prot->get_height() > 0 )
-      {
-        nb_genes_activ[num_segment]++;
-      }
-      else if ( prot->get_height() < 0 )
-      {
-        nb_genes_inhib[num_segment]++;
-      }
-
-      // It the gene is exactly at the frontier between 2 zones, mark it in both
-      if ( prot->get_mean() == segments[num_segment]->stop && num_segment < nb_segments - 1 )
-      {
-        if ( prot->get_height() > 0 )
-        {
-          nb_genes_activ[num_segment+1]++;
-        }
-        else if ( prot->get_height() < 0 )
-        {
-          nb_genes_inhib[num_segment+1]++;
-        }
-      }
-    }
-
-    prot_node = prot_node->get_next();
-  }
-
-  // Compute the geometric areas
-  activ = indiv->get_phenotype_activ();
-  inhib = indiv->get_phenotype_inhib();
-  phen  = indiv->get_phenotype();
-
-  for ( num_segment = 0 ; num_segment < nb_segments ; num_segment++ )
-  {
-    geom_area_activ[num_segment]  = activ->get_geometric_area( segments[num_segment]->start, segments[num_segment]->stop );
-    geom_area_inhib[num_segment]  = inhib->get_geometric_area( segments[num_segment]->start, segments[num_segment]->stop );
-    geom_area_phen[num_segment]   = phen->get_geometric_area(  segments[num_segment]->start, segments[num_segment]->stop );
-  }
-
-
-  // Print stats to file
-  fprintf(  zones_output_file, "%"PRId32, num_gener );
-
-  for ( num_segment = 0 ; num_segment < nb_segments ; num_segment++ )
-  {
-    fprintf(  zones_output_file, "     %"PRId32" %"PRId32" %lf %lf %lf",
-              nb_genes_activ[num_segment],
-              nb_genes_inhib[num_segment],
-              geom_area_activ[num_segment],
-              geom_area_inhib[num_segment],
-              geom_area_phen[num_segment] );
-  }
-
-  fprintf(  zones_output_file, "\n" );
-}
-
-
-
-FILE* open_operons_stat_file( const char * prefix  )
-{
-  char* operons_output_file_name = new char[80];
-  sprintf( operons_output_file_name, "stats/%s_operons.out",prefix);
-  FILE* operons_output_file = fopen( operons_output_file_name, "w" );
-  delete [] operons_output_file_name,
-
-  // Write headers
-  fprintf( operons_output_file, "# Each line contains : Generation, and then, for 20 RNA, the number of genes inside the RNA\n" );
-  return operons_output_file;
-}
-
-void write_operons_stats( int32_t num_gener, ae_individual * indiv, FILE*  operons_output_file)
-{
-  int32_t nb_genes_per_rna[20];
-  for ( int i = 0 ; i < 20 ; i++ )
-  {
-    nb_genes_per_rna[i] = 0;
-  }
-
-  ae_list_node<ae_rna*>* rna_node = indiv->get_rna_list()->get_first();
-  ae_rna* rna = NULL;
-
-  while ( rna_node != NULL )
-  {
-    rna = rna_node->get_obj();
-
-    if ( rna->get_transcribed_proteins()->get_nb_elts() >= 20 )
-    {
-      printf( "Found operon with 20 genes or more : %"PRId32"\n", rna->get_transcribed_proteins()->get_nb_elts() );
-      getchar();
-    }
-
-    nb_genes_per_rna[rna->get_transcribed_proteins()->get_nb_elts()]++;
-
-    rna_node = rna_node->get_next();
-  }
-
-  fprintf(  operons_output_file, "%"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n",
-            num_gener,
-            nb_genes_per_rna[0],
-            nb_genes_per_rna[1],
-            nb_genes_per_rna[2],
-            nb_genes_per_rna[3],
-            nb_genes_per_rna[4],
-            nb_genes_per_rna[5],
-            nb_genes_per_rna[6],
-            nb_genes_per_rna[7],
-            nb_genes_per_rna[8],
-            nb_genes_per_rna[9],
-            nb_genes_per_rna[10],
-            nb_genes_per_rna[11],
-            nb_genes_per_rna[12],
-            nb_genes_per_rna[13],
-            nb_genes_per_rna[14],
-            nb_genes_per_rna[15],
-            nb_genes_per_rna[16],
-            nb_genes_per_rna[17],
-            nb_genes_per_rna[18],
-            nb_genes_per_rna[19] );
-}
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*                      Ancstats post-treatment program                 * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "Usage : rancstats -h\n");
-  printf( "or :    rancstats [-vn] -f lineage_file \n" );
-#else
-  printf( "Usage : ancstats -h\n");
-  printf( "or :    ancstats [-vn] -f lineage_file \n" );
-#endif
-  printf( "\n" );
-  printf( "This program compute some statistics for the individuals within lineage_file.\n" );
-  printf( "\n" );
-  printf( "\n" );
-  printf( "\t-h or --help       : Display this help.\n" );
-  printf( "\n" );
-  printf( "\t-v or --verbose    : Be verbose, listing generations as they are \n" );
-  printf( "\t                       treated.\n" );
-  printf( "\n" );
-  printf( "\t-n or --nocheck    : Disable genome sequence checking. Makes the \n");
-  printf( "\t                       program faster, but it is not recommended. \n");
-  printf( "\t                       It is better to let the program check that \n");
-  printf( "\t                       when we rebuild the genomes of the ancestors\n");
-  printf( "\t                       from the lineage file, we get the same sequences\n");
-  printf( "\t                       as those stored in the backup files.\n" );
-  printf( "\n" );
-  printf( "\t-c or --fullcheck  : Will perform the genome and environment checks every\n" );
-  printf( "\t                       <BACKUP_STEP> generations. Default behaviour is\n" );
-  printf( "\t                       lighter as it only perform sthese checks at the\n" );
-  printf( "\t                       ending generation.\n" );
-  printf( "\n" );
-  printf( "\t-f lineage_file or --file lineage_file : \n" );
-  printf( "\t                       Compute the statistics for the individuals within lineage_file.\n" );
-  printf( "\t-t tolerance or --tolerance tolerance : \n");
-  printf( "\t                       Tolerance used to compare the replayed environment to environment in backup\n");
-  printf( "\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
diff --git a/src/post_treatments/compute_pop_stats.cpp b/src/post_treatments/compute_pop_stats.cpp
deleted file mode 100644
index 18ca8cf..0000000
--- a/src/post_treatments/compute_pop_stats.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-#include <inttypes.h>
-#include <getopt.h>
-#include <math.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_macros.h>
-#include <ae_utils.h>
-#include <population_statistics.h>
-//#include <ae_common.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-//#include <ae_param_loader.h>
-
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-
-
-// =====================================================================
-//                         Main Function
-// =====================================================================
-
-
-//#define FV_FILE "fv.out"
-//#define REP_FILE "replications.out"
-
-int main( int argc, char* argv[] )
-{
-  // ----------------------------------------
-  //     command-line option parsing
-  // ----------------------------------------
-  int32_t     nb_children       = 1000;
-  int32_t     backup_step       = 0;
-  int32_t     generation_number = -1;
-  int32_t     wanted_rank       = -1;
-  int32_t     wanted_index      = -1;
-  int32_t     begin_generation  = 0;
-
-  const char * options_list = "hVe:b:r:i:n:";
-  static struct option long_options_list[] = {
-  	{"help",        no_argument,        NULL, 'h'},
-    {"version",     no_argument,        NULL, 'V' },
-    {"end",         required_argument,  NULL, 'e' },
-    {"begin",       required_argument,  NULL, 'b' },
-    {"rank",        required_argument,  NULL, 'r'},
-    {"index",       required_argument,  NULL, 'i'},
-    {"nb-children", required_argument,  NULL, 'n'},
-    {0, 0, 0, 0}
-  };
-
-  int option = -1;
-  while((option=getopt_long(argc,argv,options_list,long_options_list,NULL))!=-1)
-  {
-    switch(option)
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'e' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -e or --end : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-        generation_number = atol( optarg );
-        break;
-      }
-      case 'n' :
-        nb_children = atol(optarg);
-        break;
-      case 'b':
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -b or --begin : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-        begin_generation = atol( optarg );
-        break;
-      }
-      case 'r' :
-        wanted_rank = atol(optarg);
-        wanted_index = -1;
-        break;
-      case 'i' :
-        wanted_index = atol(optarg);
-        wanted_rank = -1;
-        break;
-    }
-  }
-
-  if(wanted_rank == -1 && wanted_index ==-1){
-    wanted_rank = 1;
-  }
-
-  if ( generation_number == -1 )
-  {
-    printf( "%s: error: You must provide a generation number.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
-
-  analysis_type type = MULTIPLE_GENERATIONS;
-
-  population_statistics* population_statistics_compute = new population_statistics(type, nb_children, wanted_rank, wanted_index);
-
-  // Load simulation
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-  exp_manager->load( begin_generation, false, true, false );
-  backup_step = exp_manager->get_backup_step();
-
-  printf("\n\n Generation : %d\n\n", begin_generation);
-  population_statistics_compute->compute_reproduction_stats(exp_manager,begin_generation);
-  population_statistics_compute->compute_population_stats(begin_generation);
-  delete exp_manager;
-
-  for ( int32_t i = begin_generation + backup_step  ; i <= generation_number ; i += backup_step )
-  {
-  	printf("\n\n Generation : %d\n\n", i);
-    #ifndef __NO_X
-    	exp_manager = new ae_exp_manager_X11();
-  	#else
-    	exp_manager = new ae_exp_manager();
-  	#endif
-    exp_manager->load( i, false, true, false );
-
-    population_statistics_compute->compute_reproduction_stats(exp_manager,i);
-    population_statistics_compute->compute_population_stats(i);
-    delete exp_manager;
-  }
-
-  delete population_statistics_compute;
-
-  return EXIT_SUCCESS;
-}
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( ( prog_name = strrchr( prog_path, '/' ) ) ) prog_name++;
-  else prog_name = prog_path;
-
-  printf( "******************************************************************************\n" );
-  printf( "*                                                                            *\n" );
-  printf( "*                        aevol - Artificial Evolution                        *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "******************************************************************************\n" );
-  printf( "\n" );
-  printf( "%s: computes some population and replication statistics at each available backup from begin_gener until end_gener.\n", prog_name );
-  printf( "These statistics are saved in global_pop_stats.out and in files inside stats/pop_stats.\n");
-  printf( "The replication statistics (information about the children_nb offsprings) of the individual of given rank or index are written at each backup.\n" );
-  printf( "\n" );
-  printf( "WARNING: This program should not be used for simulations run with lateral\n" );
-  printf( "transfer. When an individual has more than one parent, the notion of lineage\n" );
-  printf( "used here is not relevant.\n" );
-  printf( "\n" );
-  printf( "Usage : %s -h\n", prog_name);
-  printf( "   or : %s -V or --version\n", prog_name );
-  printf( "   or : %s -e GENER2 [-b GENER1] [-r RANK | -i INDEX]\n", prog_name );
-  printf( "\nOptions\n" );
-  printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-  printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-  printf( "  -b GENER1 or --begin GENER1 :\n" );
-  printf( "\tFirst backup used to compute the statistics\n" );
-  printf( "\t-e GENER2 or --end GENER2 :\n" );
-  printf( "\tLast backup used to compute the statistics\n" );
-  printf( "\t-i INDEX or --index INDEX :\n" );
-  printf( "\tIndex of individual of whom we want information about the offsprings at each backup\n" );
-  printf( "\n" );
-  printf( "\t-r RANK or --rank RANK :\n" );
-  printf( "\tRank of individual of whom we want information about the offsprings at each backup\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
-
diff --git a/src/post_treatments/create_eps.cpp b/src/post_treatments/create_eps.cpp
index 6422d07..68a2c37 100644
--- a/src/post_treatments/create_eps.cpp
+++ b/src/post_treatments/create_eps.cpp
@@ -22,41 +22,22 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
-//*****************************************************************************
-
-
-
+// ****************************************************************************
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <cerrno>
 #include <getopt.h>
-#include <math.h>
 #include <sys/stat.h>  // for the permission symbols used with mkdir
-#include <errno.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-//#include <ae_common.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_environment.h>
-#include <ae_protein.h>
-#include <ae_rna.h>
-#include <ae_list.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-#include <ae_utils.h>
 
+#include "aevol.h"
 
+using namespace aevol;
 
 // ========
 //  TO DO
@@ -65,200 +46,115 @@
 //  * option --color ?
 //  * Raevol-specific output (EPS file with the network) ?
 
+// Command-line option variables
+static int64_t timestep = -1;
+static int32_t indiv_index = -1;
+static int32_t indiv_rank = -1;
 
-
-// =================================================================
-//                         Function declarations
-// =================================================================
+// Helper functions
 void print_help(char* prog_path);
-void print_version( void );
-
+void interpret_cmd_line_options(int argc, char* argv[]);
 
-// The height of each triangle is proportional to the product c*m, where c is the
-// concentration of the protein and m its intrinsic efficiency (depending on its
-// aminoacid sequence). In the case of Raevol, the concentration used here is the
-// final one, i.e. the one reached after all the time steps of the lifetime.
+// The height of each triangle is proportional to the product c*m,
+// where c is the concentration of the protein and m its intrinsic efficacy
+// (depending on its aminoacid sequence).
+// In the case of Raevol, the concentration used here is the final one,
+// i.e. the one reached after all the time steps of the lifetime.
 // If a coding sequence has several promoters, only one triangle is drawn.
-void draw_triangles( ae_individual* indiv, ae_environment* env, char * directoryName );
-
+void draw_triangles(Individual* indiv, const PhenotypicTarget& target,
+                    char* directoryName);
 
 
 // In the case of Raevol, the profile is drawn using the final concentrations
-// of the proteins, i.e. the ones reached after all the time steps of the lifetime.
-void draw_pos_neg_profiles( ae_individual * indiv, ae_environment* env, char * directoryName );
-
+// of the proteins, i.e. the ones reached after all the time steps of the
+// lifetime.
+void draw_pos_neg_profiles(Individual* indiv, const PhenotypicTarget& target,
+                           char* directoryName);
 
 
 // In the case of Raevol, the phenotype is drawn using the final concentrations
-// of the proteins, i.e. the ones reached after all the time steps of the lifetime.
-void draw_phenotype( ae_individual * indiv, ae_environment * envir, char * directoryName );
-
-
-
-
-// The chromosome is drawn as a circle. Coding sequences are represented by arcs starting
-// at the start codon and ending at the stop codon. Coding sequences that are on the
-// leading (resp. lagging) strand are drawn outside (resp. inside) the circle. If a coding
-// sequence has several promoters, only one arc is drawn.
-void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName );
-
-
-// The chromosome is drawn as a circle. Transcribed sequences are represented by arcs starting
-// at the first trasncribed position codon and ending at the last transcribed position. mRNAs
-// that are on the leading (resp. lagging) strand are drawn outside (resp. inside) the circle.
-// mRNAs which include at least one coding sequence are black, the others are gray.
- void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryName );
-
-
-int main( int argc, char* argv[] )
-{
-  // =================================================================
-  //                      Get command-line options
-  // =================================================================
-  //
-  // 1) Initialize command-line option variables with default values
-
-  //~ bool  verbose           = false;
-  //~ char* backup_file_name  = NULL;
-  int32_t num_gener       = -1;
-  int32_t indiv_index     = -1;
-  int32_t indiv_rank      = -1;
-
-  // 2) Define allowed options
-  const char * options_list = "hVvi:r:g:";
-  static struct option long_options_list[] = {
-    {"help",      no_argument,       NULL, 'h'},
-    {"version",   no_argument,       NULL, 'V' },
-    {"index",     required_argument, NULL, 'i'},
-    {"rank",      required_argument, NULL, 'r'},
-    {"gener",     required_argument, NULL, 'g' },
-    { 0, 0, 0, 0 }
-  };
+// of the proteins, i.e. the ones reached after all the time steps of the
+// lifetime.
+void draw_phenotype(Individual* indiv, const PhenotypicTarget& target,
+                    char* directoryName);
 
-  // 3) Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 )
-  {
-    switch ( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'i' :
-        indiv_index  = atol(optarg);
-        break;
-      case 'r' :
-        indiv_rank  = atol(optarg);
-        break;
-      case 'g' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -g or --gener : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
 
-        num_gener = atol( optarg );
+// The chromosome is drawn as a circle. Coding sequences are represented by
+// arcs starting at the start codon and ending at the stop codon.
+// Coding sequences that are on the leading (resp. lagging) strand are
+// drawn outside (resp. inside) the circle. If a coding sequence has several
+// promoters, only one arc is drawn.
+void draw_genetic_unit_with_CDS(GeneticUnit* gen_unit, char* directoryName);
 
-        break;
-      }
-    }
-  }
-
-  // Check mandatory arguments
-  if ( num_gener == -1 )
-  {
-    printf( "%s: error: You must provide a generation number.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
 
-  if (indiv_index != -1 && indiv_rank != -1)
-  {
-    printf( "%s: error: You must provide either the index or the rank of the individual to plot.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
+// The chromosome is drawn as a circle. Transcribed sequences are represented
+// by arcs starting at the first transcribed position and ending at the last
+// transcribed position. mRNAs that are on the leading (resp. lagging) strand
+// are drawn outside (resp. inside) the circle.
+// mRNAs that include at least one coding sequence are black,
+// the others are gray.
+void draw_genetic_unit_with_mRNAs(GeneticUnit* gen_unit, char* directoryName);
 
 
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
 
-  printf( "Creating eps files for generation %"PRId32"...\n", num_gener );
+  printf("Creating eps files for generation %" PRId64 "...\n", timestep);
 
   // =================================================================
   //                       Read the backup file
   // =================================================================
-  ae_individual*  indiv;
-  ae_environment* env;
+  Individual*  indiv;
 
   // Load the simulation
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-  exp_manager->load( num_gener, false, true, false );
-
-  env = exp_manager->get_env();
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(timestep, true, false);
 
-
-  if (indiv_index == -1 && indiv_rank == -1)
-  {
-  	indiv = new ae_individual(*exp_manager->get_best_indiv(), false);
+  if (indiv_index == -1 && indiv_rank == -1) {
+    indiv = exp_manager->best_indiv();
   }
-  else
-  {
-  	if (indiv_rank != -1)
-  	{
-  		indiv = new ae_individual(*exp_manager->get_indiv_by_rank(indiv_rank), false);
-  	}
-  	else
-  	{
-  		indiv = new ae_individual(*exp_manager->get_indiv_by_id(indiv_index), false);
-  	}
+  else {
+    // TODO <david.parsons at inria.fr> tmp disabled
+//     if (indiv_rank != -1) {
+//       indiv = new Individual(*exp_manager->indiv_by_rank(indiv_rank), false);
+//     }
+//     else {
+//       indiv = new Individual(*exp_manager->indiv_by_id(indiv_index), false);
+//     }
   }
 
-
   // The constructor of the exp_manager has read the genomes of the individuals
   // and located their promoters, but has not performed the translation nor the
   // phenotype computation. We must do it now.
-  // However, as the individuals in the backups are sorted, we don't need to evaluate
-  // all the individuals, only those we are interested in (here only the best one)
-
-  indiv->evaluate( env );
+  // However, as the individuals in the backups are sorted, we don't need to
+  // evaluate all the individuals, only the one we are interested in
+  indiv->Evaluate();
 
   // =================================================================
   //                      Create the EPS files
   // =================================================================
-
-  char directory_name[30];
-  sprintf( directory_name, "files-generation%06"PRId32, num_gener );
+  char directory_name[64];
+  snprintf(directory_name, 63, "analysis-generation_" TIMESTEP_FORMAT,
+           timestep);
 
   // Check whether the directory already exists and is writable
-  if ( access( directory_name, F_OK ) == 0 )
-  {
+  if (access(directory_name, F_OK) == 0) {
 //       struct stat status;
-//       stat( directory_name, &status );
-//       if ( status.st_mode & S_IFDIR ) cout << "The directory exists." << endl;
+//       stat(directory_name, &status);
+//       if (status.st_mode & S_IFDIR) cout << "The directory exists." << endl;
 //       else cout << "This path is a file." << endl;
 
-    if ( access( directory_name, X_OK | W_OK) != 0 )
-    {
+    if (access(directory_name, X_OK | W_OK) != 0) {
       fprintf(stderr, "Error: cannot enter or write in directory %s.\n", directory_name);
-      exit( EXIT_FAILURE );
+      exit(EXIT_FAILURE);
     }
   }
-  else
-  {
+  else {
     // Create the directory with permissions : rwx r-x r-x
-    if ( mkdir( directory_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0 )
-    {
+    if (mkdir(directory_name,
+              S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
       fprintf(stderr, "Error: cannot create directory %s.\n", directory_name);
-      exit( EXIT_FAILURE );
+      exit(EXIT_FAILURE);
     }
   }
 
@@ -268,155 +164,81 @@ int main( int argc, char* argv[] )
   //                  Write the data in the EPS files
   // =================================================================
 
-  ae_genetic_unit*  indiv_main_genome = indiv->get_genetic_unit( 0 );
+  GeneticUnit*  indiv_main_genome = &indiv->genetic_unit_nonconst(0);
 
-  printf( "Creating the EPS file with the triangles of the chosen individual... " );
+  printf("Creating the EPS file with the triangles of the chosen individual... ");
   fflush(stdout);
-  draw_triangles( indiv, env, directory_name );
-  printf( "OK\n" );
+  draw_triangles(indiv, indiv->phenotypic_target(), directory_name);
+  printf("OK\n");
 
-  printf( "Creating the EPS file with the positive and negatives profiles of the chosen individual... " );
+  printf("Creating the EPS file with the positive and negatives profiles of the chosen individual... ");
   fflush(stdout);
-  draw_pos_neg_profiles( indiv, env, directory_name );
-  printf( "OK\n" );
+  draw_pos_neg_profiles(indiv, indiv->phenotypic_target(), directory_name);
+  printf("OK\n");
 
 
-  printf( "Creating the EPS file with the phenotype of the chosen individual... " );
+  printf("Creating the EPS file with the phenotype of the chosen individual... ");
   fflush(stdout);
-  draw_phenotype( indiv, env, directory_name );
-  printf( "OK\n" );
+  draw_phenotype(indiv, indiv->phenotypic_target(), directory_name);
+  printf("OK\n");
 
-  printf( "Creating the EPS file with the CDS of the chosen individual... " );
+  printf("Creating the EPS file with the CDS of the chosen individual... ");
   fflush(stdout);
-  draw_genetic_unit_with_CDS( indiv_main_genome, directory_name );
-  printf( "OK\n" );
+  draw_genetic_unit_with_CDS(indiv_main_genome, directory_name);
+  printf("OK\n");
 
-  printf( "Creating the EPS file with the mRNAs of the chosen individual... " );
+  printf("Creating the EPS file with the mRNAs of the chosen individual... ");
   fflush(stdout);
-  draw_genetic_unit_with_mRNAs( indiv_main_genome, directory_name );
-  printf( "OK\n" );
+  draw_genetic_unit_with_mRNAs(indiv_main_genome, directory_name);
+  printf("OK\n");
 
 
 
-  delete indiv;
   delete exp_manager;
-  //   delete env;  // already done by the destructor of the exp_manager
 
   return EXIT_SUCCESS;
 }
 
 
-
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*                      EPS creation post-treatment program             * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "Usage : rcreate_eps -h\n");
-  printf( "or :    rcreate_eps [-i index | -r rank] -g generation \n" );
-#else
-  printf( "Usage : create_eps -h\n");
-  printf( "or :    create_eps  [-i index | -r rank] -g generation \n" );
-#endif
-  printf( "\n" );
-  printf( "This program creates 5 EPS files with the triangles, the positive and negatives \n" );
-  printf( "profiles, the phenotype, the CDS, the mRNAs of the chosen individual or the best\n");
-  printf( "individual. This program requires at least one population backup file and one \n" );
-  printf( "environment backup file of end_gener\n" );
-  printf( "\n" );
-  printf( "\n" );
-  printf( "\t-h or --help    : Display this help.\n" );
-  printf( "\n" );
-  printf( "\t-i index or --index index : \n" );
-  printf( "\t                  Creates the EPS files for the individual whose\n" );
-  printf( "\t                  index is index. The index must be comprised \n" );
-  printf( "\t                  between 0 and N-1, with N the size of the \n" );
-  printf( "\t                  population at the ending generation. If neither\n" );
-  printf( "\t                  index nor rank are specified, the program creates \n" );
-  printf( "\t                  the EPS files of the best individual\n" );
-  printf( "\n" );
-  printf( "\t-r rank or --rank rank : \n" );
-  printf( "\t                  Creates the EPS files for the individual whose\n" );
-  printf( "\t                  rank is rank. The rank must be comprised \n" );
-  printf( "\t                  between 0 and N-1, with N the size of the \n" );
-  printf( "\t                  population at the ending generation. If neither\n" );
-  printf( "\t                  index nor rank are specified, the program creates \n" );
-  printf( "\t                  the EPS files of the best individual\n" );
-  printf( "\n" );
-  printf( "\t-g generation or --gener generation : \n" );
-  printf( "\t                  Create the EPS files for the chosen individual of end_gener\n" );
-  printf( "\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
-
-
-
-
-void draw_triangles( ae_individual* indiv, ae_environment* env, char * directoryName )
-{
+void draw_triangles(Individual* indiv, const PhenotypicTarget& target,
+                    char* directoryName) {
   const uint8_t bbsize = 200;  // a4 paper: 595*842
   double margin = 0.1;
   double scalex = 0.8*(1 - 2*margin);
   double scaley = 0.4*(1 - 2*margin);
 
-  char filename[50];
-  strncpy( filename, directoryName, 29 );
-  strcat(  filename, "/best_triangles.eps" );
-  FILE * drawingfile = fopen( filename, "w" );
+  char filename[128];
+  snprintf(filename, 127, "%s/best_triangles.eps", directoryName);
+  FILE * drawingfile = fopen(filename, "w");
 
 
-  fprintf( drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
-  fprintf( drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize );
-  fprintf( drawingfile, "%d %d scale\n", bbsize, bbsize );
-  fprintf( drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize );
-  fprintf( drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n" );
+  fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
+  fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n");
 
 
   // -----------------------------
   //  paint neutral zones in grey
   // -----------------------------
-  if ( env->get_nb_segments() > 1 )
+  if (target.nb_segments() > 1)
   {
-    int16_t nb_segments = env->get_nb_segments();
-    ae_env_segment** segments = env->get_segments();
+    int16_t nb_segments = target.nb_segments();
+    PhenotypicSegment** segments = target.segments();
 
-    for ( int16_t i = 0 ; i < nb_segments ; i++ )
+    for (int16_t i = 0 ; i < nb_segments ; i++)
     {
-      if ( segments[i]->feature == NEUTRAL )
+      if (segments[i]->feature == NEUTRAL)
       {
-        fprintf( drawingfile, "%lf 0 moveto\n", margin + scalex * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->stop );
-        fprintf( drawingfile, "%lf 0 lineto\n", margin + scalex * segments[i]->stop );
-        fprintf( drawingfile, "closepath\n" );
-        fprintf( drawingfile, "0.8 setgray\n" );
-        fprintf( drawingfile, "fill\n" );
-        fprintf( drawingfile, "0 setgray\n" );
+        fprintf(drawingfile, "%lf 0 moveto\n", margin + scalex * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scalex * segments[i]->stop);
+        fprintf(drawingfile, "%lf 0 lineto\n", margin + scalex * segments[i]->stop);
+        fprintf(drawingfile, "closepath\n");
+        fprintf(drawingfile, "0.8 setgray\n");
+        fprintf(drawingfile, "fill\n");
+        fprintf(drawingfile, "0 setgray\n");
       }
     }
   }
@@ -428,134 +250,112 @@ void draw_triangles( ae_individual* indiv, ae_environment* env, char * directory
   double arrowsize = 0.03;
   double arrowangle = 3.14/6;
 
-  fprintf( drawingfile, "0.001 setlinewidth\n" );
-  fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
+  fprintf(drawingfile, "0.001 setlinewidth\n");
+  fprintf(drawingfile, "0 0 0 setrgbcolor\n");
 
   // axis X + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin/2, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin/2, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
   // axis Y + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, margin/2);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
   // max degree = 1
-  fprintf( drawingfile, "[0.02 0.02] 0 setdash\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 0.5 + 1.0*scaley);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin, 0.5 + 1.0*scaley);
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "[0.02 0.02] 0 setdash\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5 + 1.0*scaley);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5 + 1.0*scaley);
+  fprintf(drawingfile, "stroke\n");
 
   // ----------------
   //  draw triangles
   // ----------------
 
-  fprintf( drawingfile,"[ ] 0 setdash\n" );
+  fprintf(drawingfile,"[ ] 0 setdash\n");
 
   double h;
-  ae_list_node<ae_genetic_unit*>* gen_unit_node = indiv->get_genetic_unit_list()->get_first();
-  ae_genetic_unit*  gen_unit = NULL;
-
-  while ( gen_unit_node != NULL )
-  {
-    gen_unit = (ae_genetic_unit*) gen_unit_node->get_obj();
-
-    ae_list_node<ae_protein*>* prot_node = NULL;
-    ae_protein* prot = NULL;
 
-    prot_node = (gen_unit->get_protein_list())[LEADING]->get_first();
-    while ( prot_node != NULL )
-    {
-      prot = (ae_protein*) prot_node->get_obj();
-      h = prot->get_height() * prot->get_concentration();
-      fprintf( drawingfile, "%lf %lf moveto\n", margin, 0.5);
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean() - prot->get_width()), 0.5);
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean()), 0.5 + scaley*(h));
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean() + prot->get_width()), 0.5);
-      fprintf( drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5);
-      fprintf( drawingfile, "stroke\n" );
-      prot_node = prot_node->get_next();
+  for (auto& gu: indiv->genetic_unit_list_nonconst()) { // should use const version
+    for (const auto& prot: gu.protein_list(LEADING)) {
+      h = prot.height() * prot.concentration();
+      fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5);
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() - prot.width()), 0.5);
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean()), 0.5 + scaley*(h));
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() + prot.width()), 0.5);
+      fprintf(drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5);
+      fprintf(drawingfile, "stroke\n");
     }
 
-
-    prot_node = (gen_unit->get_protein_list())[LAGGING]->get_first();
-    while ( prot_node != NULL )
-    {
-      prot = (ae_protein*) prot_node->get_obj();
-      h = prot->get_height() * prot->get_concentration();
-      fprintf( drawingfile, "%lf %lf moveto\n", margin, 0.5);
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean() - prot->get_width()), 0.5);
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean()), 0.5 + scaley*(h));
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scalex*(prot->get_mean() + prot->get_width()), 0.5);
-      fprintf( drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5);
-      fprintf( drawingfile, "stroke\n" );
-
-      prot_node = prot_node->get_next();
+    for (const auto& prot: gu.protein_list(LAGGING)) {
+      h = prot.height() * prot.concentration();
+      fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5);
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() - prot.width()), 0.5);
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean()), 0.5 + scaley*(h));
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scalex*(prot.mean() + prot.width()), 0.5);
+      fprintf(drawingfile, "%lf %lf moveto\n", margin + scalex*(1), 0.5);
+      fprintf(drawingfile, "stroke\n");
     }
-
-    gen_unit_node = gen_unit_node->get_next();
   }
 
 
 
-  fprintf( drawingfile,"%%%%EOF\n" );
+  fprintf(drawingfile,"%%%%EOF\n");
   fclose(drawingfile);
 
 }
 
 
-
-void draw_pos_neg_profiles( ae_individual * indiv, ae_environment* env, char * directoryName )
-{
+void draw_pos_neg_profiles(Individual* indiv, const PhenotypicTarget& target,
+                           char* directoryName) {
   const uint8_t bbsize = 200;  // a4 paper: 595*842
   double margin = 0.1;
   double scale = 0.8*(1 - 2*margin);
 
-  char filename[50];
-  strncpy( filename, directoryName, 29 );
-  strcat(  filename, "/best_pos_neg_profiles.eps" );
-  FILE * drawingfile = fopen( filename, "w" );
+  char filename[128];
+  snprintf(filename, 127, "%s/best_pos_neg_profiles.eps", directoryName);
+  FILE * drawingfile = fopen(filename, "w");
 
 
-  fprintf( drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
-  fprintf( drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d scale\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
-  fprintf( drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n" );
+  fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
+  fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n");
 
 
   // -----------------------------
   //  paint neutral zones in grey
   // -----------------------------
-  if ( env->get_nb_segments() > 1 )
+  if (target.nb_segments() > 1)
   {
-    int16_t nb_segments = env->get_nb_segments();
-    ae_env_segment** segments = env->get_segments();
+    int16_t nb_segments = target.nb_segments();
+    PhenotypicSegment** segments = target.segments();
 
-    for ( int16_t i = 0 ; i < nb_segments ; i++ )
+    for (int16_t i = 0 ; i < nb_segments ; i++)
     {
-      if ( segments[i]->feature == NEUTRAL )
+      if (segments[i]->feature == NEUTRAL)
       {
-        fprintf( drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop );
-        fprintf( drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop );
-        fprintf( drawingfile, "closepath\n" );
-        fprintf( drawingfile, "0.8 setgray\n" );
-        fprintf( drawingfile, "fill\n" );
-        fprintf( drawingfile, "0 setgray\n" );
+        fprintf(drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop);
+        fprintf(drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop);
+        fprintf(drawingfile, "closepath\n");
+        fprintf(drawingfile, "0.8 setgray\n");
+        fprintf(drawingfile, "fill\n");
+        fprintf(drawingfile, "0 setgray\n");
       }
     }
   }
@@ -568,87 +368,86 @@ void draw_pos_neg_profiles( ae_individual * indiv, ae_environment* env, char * d
   double arrowsize = 0.03;
   double arrowangle = 3.14/6;
 
-  fprintf( drawingfile, "0.001 setlinewidth\n" );
-  fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
+  fprintf(drawingfile, "0.001 setlinewidth\n");
+  fprintf(drawingfile, "0 0 0 setrgbcolor\n");
 
   // axis X + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin/2, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin/2, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 + arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), 0.5 - arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
   // axis Y + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, margin/2);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
 
   // -----------------------
   //  draw positive profile
   // -----------------------
 
-  fprintf( drawingfile,"[ ] 0 setdash\n" );
-  fprintf( drawingfile, "0.002 setlinewidth\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 0.5);
-
-  ae_list_node<ae_point_2d*>* node = indiv->get_phenotype_activ()->get_points()->get_first();
-  ae_point_2d* pt = NULL;
-  while (node != NULL)
-  {
-    pt = node->get_obj();
-    fprintf( drawingfile, "%lf %lf lineto\n", margin + scale*pt->x, 0.5 + scale*pt->y);
-    node = node->get_next();
-  }
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile,"[ ] 0 setdash\n");
+  fprintf(drawingfile, "0.002 setlinewidth\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5);
 
+  if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0)
+    for (const auto& p: ((Fuzzy*)indiv->phenotype_activ())->points())
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, 0.5 + scale * p.y);
+  else
+    for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size(); i++) {
+      int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size());
+      fprintf(drawingfile, "%lf %lf lineto\n", margin +
+                                               scale * xi, 0.5 + scale *
+                                               ((HybridFuzzy*) indiv->phenotype_activ())->points()[i]);
+    }
+  fprintf(drawingfile, "stroke\n" );
 
   // -----------------------
   //  draw negative profile
   // -----------------------
 
-  fprintf( drawingfile,"[ ] 0 setdash\n" );
-  fprintf( drawingfile, "0.002 setlinewidth\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 0.5);
+  fprintf(drawingfile,"[ ] 0 setdash\n");
+  fprintf(drawingfile, "0.002 setlinewidth\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 0.5);
 
-  node = ((indiv->get_phenotype_inhib())->get_points())->get_first();
-  pt = NULL;
-  while (node != NULL)
-  {
-    pt = (ae_point_2d *) node->get_obj();
-    fprintf( drawingfile, "%lf %lf lineto\n", margin + scale*pt->x, 0.5 + scale*pt->y);
-    node = node->get_next();
-  }
+  if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0)
+    for (const auto& p: ((Fuzzy*)indiv->phenotype_inhib())->points())
+      fprintf( drawingfile, "%lf %lf lineto\n", margin + scale * p.x, 0.5 + scale * p.y);
+  else
+    for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_inhib())->get_pheno_size(); i++) {
+      int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_inhib())->get_pheno_size());
+      fprintf(drawingfile, "%lf %lf lineto\n", margin +
+                                               scale * xi, 0.5 + scale *
+                                                                 ((HybridFuzzy*) indiv->phenotype_inhib())->points()[i]);
+    }
   fprintf( drawingfile, "stroke\n" );
 
-  fprintf( drawingfile,"%%%%EOF\n" );
+  fprintf(drawingfile,"%%%%EOF\n");
   fclose(drawingfile);
-
 }
 
 
-
-
-void draw_phenotype( ae_individual* indiv, ae_environment* env, char* directoryName )
-{
+void draw_phenotype(Individual* indiv, const PhenotypicTarget& target,
+                    char* directoryName) {
   const uint8_t bbsize = 200;  // a4 paper: 595*842
   double margin = 0.1;
   double scale = 0.8*(1 - 2*margin);
 
 
-  char filename[50];
-  strncpy( filename, directoryName, 29 );
-  strcat(  filename, "/best_phenotype.eps" );
-  FILE * drawingfile = fopen( filename, "w" );
+  char filename[128];
+  snprintf(filename, 127, "%s/best_phenotype.eps", directoryName);
+  FILE * drawingfile = fopen(filename, "w");
 
   if (drawingfile == NULL)
     {
@@ -657,33 +456,33 @@ void draw_phenotype( ae_individual* indiv, ae_environment* env, char* directoryN
     }
 
 
-  fprintf( drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
-  fprintf( drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d scale\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
-  fprintf( drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n" );
+  fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
+  fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n");
 
 
   // -----------------------------
   //  paint neutral zones in grey
   // -----------------------------
-  if ( env->get_nb_segments() > 1 )
+  if (target.nb_segments() > 1)
   {
-    int16_t nb_segments = env->get_nb_segments();
-    ae_env_segment** segments = env->get_segments();
+    int16_t nb_segments = target.nb_segments();
+    PhenotypicSegment** segments = target.segments();
 
-    for ( int16_t i = 0 ; i < nb_segments ; i++ )
+    for (int16_t i = 0 ; i < nb_segments ; i++)
     {
-      if ( segments[i]->feature == NEUTRAL )
+      if (segments[i]->feature == NEUTRAL)
       {
-        fprintf( drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start );
-        fprintf( drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop );
-        fprintf( drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop );
-        fprintf( drawingfile, "closepath\n" );
-        fprintf( drawingfile, "0.8 setgray\n" );
-        fprintf( drawingfile, "fill\n" );
-        fprintf( drawingfile, "0 setgray\n" );
+        fprintf(drawingfile, "%lf 0 moveto\n", margin + scale * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->start);
+        fprintf(drawingfile, "%lf 1 lineto\n", margin + scale * segments[i]->stop);
+        fprintf(drawingfile, "%lf 0 lineto\n", margin + scale * segments[i]->stop);
+        fprintf(drawingfile, "closepath\n");
+        fprintf(drawingfile, "0.8 setgray\n");
+        fprintf(drawingfile, "fill\n");
+        fprintf(drawingfile, "0 setgray\n");
       }
     }
   }
@@ -696,51 +495,55 @@ void draw_phenotype( ae_individual* indiv, ae_environment* env, char* directoryN
   double arrowsize = 0.03;
   double arrowangle = 3.14/6;
 
-  fprintf( drawingfile, "0.001 setlinewidth\n" );
-  fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
+  fprintf(drawingfile, "0.001 setlinewidth\n");
+  fprintf(drawingfile, "0 0 0 setrgbcolor\n");
 
   // axis X + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin/2, margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin, margin);
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin + arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 1-margin, margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin - arrowsize*sin(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin/2, margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, margin);
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin + arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 1-margin, margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin-arrowsize*cos(arrowangle), margin - arrowsize*sin(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
   // axis Y + arrow
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, margin/2);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, 1-margin);
-  fprintf( drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle) );
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, margin/2);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin-arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, 1-margin);
+  fprintf(drawingfile, "%lf %lf lineto\n", margin+arrowsize*sin(arrowangle), 1 - margin - arrowsize*cos(arrowangle));
+  fprintf(drawingfile, "stroke\n");
 
   // max degree = 1
-  fprintf( drawingfile, "[0.02 0.02] 0 setdash\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", margin, margin + 1*scale);
-  fprintf( drawingfile, "%lf %lf lineto\n", 1-margin, margin + 1*scale);
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "[0.02 0.02] 0 setdash\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", margin, margin + 1*scale);
+  fprintf(drawingfile, "%lf %lf lineto\n", 1-margin, margin + 1*scale);
+  fprintf(drawingfile, "stroke\n");
 
 
   // ----------------
   //  draw phenotype
   // ----------------
+
   fprintf( drawingfile,"[ ] 0 setdash\n" );
   fprintf( drawingfile, "0.002 setlinewidth\n" );
   fprintf( drawingfile, "%lf %lf moveto\n", margin, margin);
-  ae_list_node<ae_point_2d*>* node = indiv->get_phenotype()->get_points()->get_first();
-  ae_point_2d* pt = NULL;
-  while (node != NULL)
-    {
-      pt = (ae_point_2d *) node->get_obj();
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scale*pt->x, margin + scale*pt->y);
-      node = node->get_next();
-    }
+
+  if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0)
+    for (const auto& p: ((Fuzzy*)indiv->phenotype_activ())->points())
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, margin + scale * p.y);
+  else
+    for (int i=0; i < ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size(); i++) {
+      int xi = (int) ( i / ((HybridFuzzy*)indiv->phenotype_activ())->get_pheno_size());
+      fprintf(drawingfile, "%lf %lf lineto\n", margin +
+                                             scale * xi, margin + scale *
+                                                               ((HybridFuzzy*) indiv->phenotype_activ())->points()[i]);
+  }
   fprintf( drawingfile, "stroke\n" );
 
 
@@ -750,78 +553,70 @@ void draw_phenotype( ae_individual* indiv, ae_environment* env, char* directoryN
   fprintf( drawingfile,"[ ] 0 setdash\n" );
   fprintf( drawingfile, "0.001 setlinewidth\n" );
   fprintf( drawingfile, "%lf %lf moveto\n", margin, margin);
-  node = (env->get_points())->get_first();
-  pt = NULL;
-  while (node != NULL)
-    {
-      pt = (ae_point_2d *) node->get_obj();
-      fprintf( drawingfile, "%lf %lf lineto\n", margin + scale*pt->x, margin + scale*pt->y);
-      node = node->get_next();
-    }
+  if (indiv->exp_m()->exp_s()->get_fuzzy_flavor() == 0)
+    for (const auto& p: ((Fuzzy*)target.fuzzy())->points())
+      fprintf(drawingfile, "%lf %lf lineto\n", margin + scale * p.x, margin + scale * p.y);
+  else
+  for (int i=0; i < ((HybridFuzzy*)target.fuzzy())->get_pheno_size(); i++) {
+    int xi = (int) ( i / ((HybridFuzzy*)target.fuzzy())->get_pheno_size());
+    fprintf(drawingfile, "%lf %lf lineto\n", margin +
+                                             scale * xi, margin + scale *
+                                                                  ((HybridFuzzy*) target.fuzzy())->points()[i]);
+  }
   fprintf( drawingfile, "stroke\n" );
 
 
 
-  fprintf( drawingfile,"%%%%EOF\n" );
+  fprintf(drawingfile,"%%%%EOF\n");
   fclose(drawingfile);
 
 }
 
 
-
-
-
-
-
-void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName )
-{
+void draw_genetic_unit_with_CDS(GeneticUnit* gen_unit, char* directoryName) {
   const uint8_t bbsize = 200;  // a4 paper: 595*842
-  int32_t gen_length = (gen_unit->get_dna())->get_length();
+  int32_t gen_length = (gen_unit->dna())->length();
   double r = 0.35;
   double scale = 2*M_PI*r/gen_length;
 
-  char filename[50];
-  strncpy( filename, directoryName, 29 );
-  strcat(  filename, "/best_genome_with_CDS.eps" );
-  FILE * drawingfile = fopen( filename, "w" );
+  char filename[128];
+  snprintf(filename, 127, "%s/best_genome_with_CDS.eps", directoryName);
+  FILE * drawingfile = fopen(filename, "w");
 
-  fprintf( drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
-  fprintf( drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d scale\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
-  fprintf( drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n" );
+  fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
+  fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n");
 
   // -----------
   //  chromosome
   // -----------
 
-  fprintf( drawingfile, "0.001 setlinewidth\n" );
-  fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
-  fprintf( drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "0.001 setlinewidth\n");
+  fprintf(drawingfile, "0 0 0 setrgbcolor\n");
+  fprintf(drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc
+  fprintf(drawingfile, "stroke\n");
 
   // -----------
   //  scale
   // -----------
 
   double scalesize = 0.15;
-  fprintf( drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5);
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "/Helvetica findfont\n" );
-  fprintf( drawingfile, "0.035 scalefont\n" );
-  fprintf( drawingfile, "setfont\n" );
-  fprintf( drawingfile, "newpath\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52);
-  fprintf( drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale);
+  fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5);
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "/Helvetica findfont\n");
+  fprintf(drawingfile, "0.035 scalefont\n");
+  fprintf(drawingfile, "setfont\n");
+  fprintf(drawingfile, "newpath\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52);
+  fprintf(drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale);
 
   // -----------
   //  genes
   // -----------
 
-  ae_list_node<ae_protein*>* node = NULL;
-  ae_protein* prot = NULL;
-
   int32_t first;
   int32_t last;
   int8_t  layer = 0;
@@ -845,48 +640,45 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
   bool* occupied_sectors[2][50];
   occupied_sectors[LEADING][0] = new bool[360];
   occupied_sectors[LAGGING][0] = new bool[360];
-  for ( int16_t angle = 0 ; angle < 360 ; angle++ )
+  for (int16_t angle = 0 ; angle < 360 ; angle++)
   {
     occupied_sectors[LEADING][0][angle] = false;
     occupied_sectors[LAGGING][0][angle] = false;
   }
 
 
-  // printf("LEADING\n" );
-  node = (gen_unit->get_protein_list())[LEADING]->get_first();
-  while (node != NULL)
-  {
-    prot = (ae_protein *) node->get_obj();
-    first = prot->get_first_translated_pos();
-    last = prot->get_last_translated_pos();
-    // h = prot->get_height() * prot->get_concentration();
+  // printf("LEADING\n");
+  for (const auto& prot: gen_unit->protein_list(LEADING)) {
+    first = prot.first_translated_pos();
+    last = prot.last_translated_pos();
+    // h = prot.height() * prot.concentration();
 
-    alpha_first   = (int16_t) round(  (double)(360 * first) / (double)gen_length );  //  == sect1 == alphaB
-    alpha_last    = (int16_t) round(  (double)(360 * last)  / (double)gen_length );  //  == sect2 == alphaA
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );  //  == tetaB
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );  //   == tetaA
-    if ( theta_first == theta_last ) theta_first = ae_utils::mod( theta_first + 1, 360 );
+    alpha_first   = (int16_t) round((double)(360 * first) / (double)gen_length);  //  == sect1 == alphaB
+    alpha_last    = (int16_t) round((double)(360 * last)  / (double)gen_length);  //  == sect2 == alphaA
+    theta_first   = Utils::mod(90 - alpha_first, 360);  //  == tetaB
+    theta_last    = Utils::mod(90 - alpha_last, 360);  //   == tetaA
+    if (theta_first == theta_last) theta_first = Utils::mod(theta_first + 1, 360);
 
-    nb_sect = ae_utils::mod( theta_first - theta_last + 1, 360 );
+    nb_sect = Utils::mod(theta_first - theta_last + 1, 360);
 
 
     // Outside the circle, look for the inmost layer that has all the sectors between
     // theta_first and theta_last free
     layer = 0;
     sectors_free = false;
-    while ( ! sectors_free )
+    while (! sectors_free)
     {
       sectors_free = true;
-      for ( rho = 0 ; rho < nb_sect ; rho++ )
+      for (rho = 0 ; rho < nb_sect ; rho++)
       {
-        if ( occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - rho, 360)] )
+        if (occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)])
         {
           sectors_free = false;
           break;
         }
       }
 
-      if ( sectors_free )
+      if (sectors_free)
       {
         break; // All the needed sectors are free on the current layer
       }
@@ -894,12 +686,12 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
       {
         layer++;
 
-        if ( (layer >= outmost_layer) && (layer < 49) )
+        if ((layer >= outmost_layer) && (layer < 49))
         {
           // Add a new layer (actually, 2 layers, to maintain the symmetry)
           occupied_sectors[LEADING][outmost_layer] = new bool[360];
           occupied_sectors[LAGGING][outmost_layer] = new bool[360];
-          for ( int16_t angle = 0 ; angle < 360 ; angle++ )
+          for (int16_t angle = 0 ; angle < 360 ; angle++)
           {
             occupied_sectors[LEADING][outmost_layer][angle] = false;
             occupied_sectors[LAGGING][outmost_layer][angle] = false;
@@ -908,7 +700,7 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
           outmost_layer++;
           break; // A new layer is necessarily free, no need to look further
         }
-        if ( layer == 49 )
+        if (layer == 49)
         {
           // We shall not create a 51th layer, the CDS will be drawn on the
           // layer, probably over another CDS
@@ -920,74 +712,69 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
     // printf("f %d, l %d, af %d, al %d, tf %d, tl %d, nbsect %d, layer %d\n", first, last, alpha_first, alpha_last, theta_first, theta_last, nb_sect, layer);
 
     // Mark sectors to be drawn as occupied
-    for ( rho = 0 ; rho < nb_sect ; rho++ )
+    for (rho = 0 ; rho < nb_sect ; rho++)
     {
-      occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - rho, 360)] = true;
+      occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)] = true;
     }
     // Mark flanking sectors as occupied
-    occupied_sectors[LEADING][layer][ae_utils::mod(theta_first + 1, 360)] = true;
-    occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - nb_sect, 360)] = true;
+    occupied_sectors[LEADING][layer][Utils::mod(theta_first + 1, 360)] = true;
+    occupied_sectors[LEADING][layer][Utils::mod(theta_first - nb_sect, 360)] = true;
 
 
     // draw !
-    fprintf( drawingfile, "0.018 setlinewidth\n" );
-    // fprintf( drawingfile, "%lf %lf %lf setrgbcolor\n",  1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2));
+    fprintf(drawingfile, "0.018 setlinewidth\n");
+    // fprintf(drawingfile, "%lf %lf %lf setrgbcolor\n",  1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2));
     layer++; // index starting at 0 but needed to start at 1
 
     if (theta_last > theta_first)
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360);
-      fprintf( drawingfile, "stroke\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360);
+      fprintf(drawingfile, "stroke\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first);
+      fprintf(drawingfile, "stroke\n");
     }
     else
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first);
+      fprintf(drawingfile, "stroke\n");
     }
-
-    node = node->get_next();
   }
 
 
-  // printf("LAGGING\n" );
-  node = (gen_unit->get_protein_list())[LAGGING]->get_first();
-  while (node != NULL)
-  {
-    prot = (ae_protein *) node->get_obj();
-    first = prot->get_first_translated_pos();
-    last = prot->get_last_translated_pos();
-    // h = prot->get_height() * prot->get_concentration();
+  // printf("LAGGING\n");
+  for (const auto& prot: gen_unit->protein_list(LAGGING)) {
+    first = prot.first_translated_pos();
+    last = prot.last_translated_pos();
+    // h = prot.height() * prot.concentration();
 
-    alpha_first   = (int16_t) round(  (double)(360 * first) / (double)gen_length );
-    alpha_last    = (int16_t) round(  (double)(360 * last)  / (double)gen_length );
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    if ( theta_first == theta_last ) theta_last = ae_utils::mod( theta_last + 1, 360 );
+    alpha_first   = (int16_t) round((double)(360 * first) / (double)gen_length);
+    alpha_last    = (int16_t) round((double)(360 * last)  / (double)gen_length);
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    theta_last    = Utils::mod(90 - alpha_last, 360);
+    if (theta_first == theta_last) theta_last = Utils::mod(theta_last + 1, 360);
 
-    nb_sect = ae_utils::mod( theta_last - theta_first + 1, 360 );
+    nb_sect = Utils::mod(theta_last - theta_first + 1, 360);
 
 
     // Inside the circle, look for the inmost layer that has all the sectors between
     // theta_first and theta_last free
     layer = 0;
     sectors_free = false;
-    while ( ! sectors_free )
+    while (! sectors_free)
     {
       sectors_free = true;
-      for ( rho = 0 ; rho < nb_sect ; rho++ )
+      for (rho = 0 ; rho < nb_sect ; rho++)
       {
-        if ( occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + rho, 360)] )
+        if (occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)])
         {
           sectors_free = false;
           break;
         }
       }
 
-      if ( sectors_free )
+      if (sectors_free)
       {
         break; // All the needed sectors are free on the current layer
       }
@@ -995,12 +782,12 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
       {
         layer++;
 
-        if ( (layer >= outmost_layer) && (layer < 49) )
+        if ((layer >= outmost_layer) && (layer < 49))
         {
           // Add a new layer (actually, 2 layers, to maintain the symmetry)
           occupied_sectors[LEADING][outmost_layer] = new bool[360];
           occupied_sectors[LAGGING][outmost_layer] = new bool[360];
-          for ( angle = 0 ; angle < 360 ; angle++ )
+          for (angle = 0 ; angle < 360 ; angle++)
           {
             occupied_sectors[LEADING][outmost_layer][angle] = false;
             occupied_sectors[LAGGING][outmost_layer][angle] = false;
@@ -1009,7 +796,7 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
           outmost_layer++;
           break; // A new layer is necessarily free, no need to look further
         }
-        if ( layer == 49 )
+        if (layer == 49)
         {
           // We shall not create a 51th layer, the CDS will be drawn on the
           // layer, probably over another CDS
@@ -1021,44 +808,42 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
     // printf("f %d, l %d, af %d, al %d, tf %d, tl %d, nbsect %d, layer %d\n", first, last, alpha_first, alpha_last, theta_first, theta_last, nb_sect, layer);
 
     // Mark sectors to be drawn as occupied
-    for ( rho = 0 ; rho < nb_sect ; rho++ )
+    for (rho = 0 ; rho < nb_sect ; rho++)
     {
-      occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + rho, 360)] = true;
+      occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)] = true;
     }
     // Mark flanking sectors as occupied
-    occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first - 1, 360)] = true;
-    occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + nb_sect, 360)] = true;
+    occupied_sectors[LAGGING][layer][Utils::mod(theta_first - 1, 360)] = true;
+    occupied_sectors[LAGGING][layer][Utils::mod(theta_first + nb_sect, 360)] = true;
 
 
     // draw !
-    fprintf( drawingfile, "0.018 setlinewidth\n" );
-    // fprintf( drawingfile, "%lf %lf %lf setrgbcolor\n",  1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2));
+    fprintf(drawingfile, "0.018 setlinewidth\n");
+    // fprintf(drawingfile, "%lf %lf %lf setrgbcolor\n",  1-(0.8*h/max_height + 0.2), 1-(0.8*h/max_height + 0.2),1-(0.8*h/max_height + 0.2));
     layer++; // index starting at 0 but needed to start at 1
 
     if (theta_first > theta_last)
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360);
-      fprintf( drawingfile, "stroke\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360);
+      fprintf(drawingfile, "stroke\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last);
+      fprintf(drawingfile, "stroke\n");
     }
     else
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last);
+      fprintf(drawingfile, "stroke\n");
     }
-
-    node = node->get_next();
   }
 
 
-  fprintf( drawingfile,"showpage\n" );
-  fprintf( drawingfile,"%%%%EOF\n" );
+  fprintf(drawingfile,"showpage\n");
+  fprintf(drawingfile,"%%%%EOF\n");
   fclose(drawingfile);
 
-  for ( layer = 0 ; layer < outmost_layer ; layer++ )
+  for (layer = 0 ; layer < outmost_layer ; layer++)
   {
     delete occupied_sectors[LEADING][layer];
     delete occupied_sectors[LAGGING][layer];
@@ -1067,57 +852,50 @@ void draw_genetic_unit_with_CDS( ae_genetic_unit* gen_unit, char * directoryName
 }
 
 
-
-
-void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryName )
-{
+void draw_genetic_unit_with_mRNAs(GeneticUnit* gen_unit, char* directoryName) {
   const uint8_t bbsize = 200;  // a4 paper: 595*842
-  int32_t gen_length = (gen_unit->get_dna())->get_length();
+  int32_t gen_length = (gen_unit->dna())->length();
   double r = 0.35;
   double scale = 2*M_PI*r/gen_length;
 
-  char filename[50];
-  strncpy( filename, directoryName, 29 );
-  strcat(  filename, "/best_genome_with_mRNAs.eps" );
-  FILE * drawingfile = fopen( filename, "w" );
+  char filename[128];
+  snprintf(filename, 127, "%s/best_genome_with_mRNAs.eps", directoryName);
+  FILE * drawingfile = fopen(filename, "w");
 
-  fprintf( drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
-  fprintf( drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d scale\n", bbsize, bbsize);
-  fprintf( drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
-  fprintf( drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n" );
+  fprintf(drawingfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  fprintf(drawingfile, "%%%%BoundingBox: 0 0 %d %d\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d scale\n", bbsize, bbsize);
+  fprintf(drawingfile, "%d %d 8 [100 0 0 -100 0 100]\n",bbsize, bbsize);
+  fprintf(drawingfile, "{currentfile 3 100 mul string readhexstring pop} bind\n");
 
   // -----------
   //  chromosome
   // -----------
 
-  fprintf( drawingfile, "0.001 setlinewidth\n" );
-  fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
-  fprintf( drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc
-  fprintf( drawingfile, "stroke\n" );
+  fprintf(drawingfile, "0.001 setlinewidth\n");
+  fprintf(drawingfile, "0 0 0 setrgbcolor\n");
+  fprintf(drawingfile, "%lf %lf %lf 0 360 arc\n", 0.5, 0.5, r); // arcn = clockwise arc
+  fprintf(drawingfile, "stroke\n");
 
   // -----------
   //  scale
   // -----------
 
   double scalesize = 0.15;
-  fprintf( drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5);
-  fprintf( drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5);
-  fprintf( drawingfile, "stroke\n" );
-  fprintf( drawingfile, "/Helvetica findfont\n" );
-  fprintf( drawingfile, "0.035 scalefont\n" );
-  fprintf( drawingfile, "setfont\n" );
-  fprintf( drawingfile, "newpath\n" );
-  fprintf( drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52);
-  fprintf( drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale);
+  fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/2, 0.5);
+  fprintf(drawingfile, "%lf %lf lineto\n", 0.5+scalesize/2, 0.5);
+  fprintf(drawingfile, "stroke\n");
+  fprintf(drawingfile, "/Helvetica findfont\n");
+  fprintf(drawingfile, "0.035 scalefont\n");
+  fprintf(drawingfile, "setfont\n");
+  fprintf(drawingfile, "newpath\n");
+  fprintf(drawingfile, "%lf %lf moveto\n", 0.5-scalesize/3, 0.52);
+  fprintf(drawingfile, "(scale : %.0lf bp) show\n", scalesize/scale);
 
   // -----------
   //  mRNAs
   // -----------
 
-  ae_list_node<ae_rna*>* node  = NULL;
-  ae_rna* rna = NULL;
-
   int32_t first;
   int32_t last;
   int8_t  layer = 0;
@@ -1141,7 +919,7 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
   bool* occupied_sectors[2][50];
   occupied_sectors[LEADING][0] = new bool[360];
   occupied_sectors[LAGGING][0] = new bool[360];
-  for ( int16_t angle = 0 ; angle < 360 ; angle++ )
+  for (int16_t angle = 0 ; angle < 360 ; angle++)
   {
     occupied_sectors[LEADING][0][angle] = false;
     occupied_sectors[LAGGING][0][angle] = false;
@@ -1149,40 +927,37 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
 
 
 
-  node = (gen_unit->get_rna_list())[LEADING]->get_first();
-  while (node != NULL)
-  {
-    rna = (ae_rna *) node->get_obj();
-    first = rna->get_first_transcribed_pos();
-    last = rna->get_last_transcribed_pos();
+  for (const auto& rna: gen_unit->rna_list()[LEADING]) {
+    first = rna.first_transcribed_pos();
+    last = rna.last_transcribed_pos();
 
 
-    alpha_first   = (int16_t) round(  (double)(360 * first) / (double)gen_length );  //  == sect1 == alphaB
-    alpha_last    = (int16_t) round(  (double)(360 * last)  / (double)gen_length );  //  == sect2 == alphaA
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );  //  == tetaB
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );  //   == tetaA
-    if ( theta_first == theta_last ) theta_first = ae_utils::mod( theta_first + 1, 360 );
+    alpha_first   = (int16_t) round((double)(360 * first) / (double)gen_length);  //  == sect1 == alphaB
+    alpha_last    = (int16_t) round((double)(360 * last)  / (double)gen_length);  //  == sect2 == alphaA
+    theta_first   = Utils::mod(90 - alpha_first, 360);  //  == tetaB
+    theta_last    = Utils::mod(90 - alpha_last, 360);  //   == tetaA
+    if (theta_first == theta_last) theta_first = Utils::mod(theta_first + 1, 360);
 
-    nb_sect = ae_utils::mod( theta_first - theta_last + 1, 360 );
+    nb_sect = Utils::mod(theta_first - theta_last + 1, 360);
 
 
     // Outside the circle, look for the inmost layer that has all the sectors between
     // theta_first and theta_last free
     layer = 0;
     sectors_free = false;
-    while ( ! sectors_free )
+    while (! sectors_free)
     {
       sectors_free = true;
-      for ( rho = 0 ; rho < nb_sect ; rho++ )
+      for (rho = 0 ; rho < nb_sect ; rho++)
       {
-        if ( occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - rho, 360)] )
+        if (occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)])
         {
           sectors_free = false;
           break;
         }
       }
 
-      if ( sectors_free )
+      if (sectors_free)
       {
         break; // All the needed sectors are free on the current layer
       }
@@ -1190,12 +965,12 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
       {
         layer++;
 
-        if ( (layer >= outmost_layer) && (layer < 49) )
+        if ((layer >= outmost_layer) && (layer < 49))
         {
           // Add a new layer (actually, 2 layers, to maintain the symmetry)
           occupied_sectors[LEADING][outmost_layer] = new bool[360];
           occupied_sectors[LAGGING][outmost_layer] = new bool[360];
-          for ( int16_t angle = 0 ; angle < 360 ; angle++ )
+          for (int16_t angle = 0 ; angle < 360 ; angle++)
           {
             occupied_sectors[LEADING][outmost_layer][angle] = false;
             occupied_sectors[LAGGING][outmost_layer][angle] = false;
@@ -1204,7 +979,7 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
           outmost_layer++;
           break; // A new layer is necessarily free, no need to look further
         }
-        if ( layer == 49 )
+        if (layer == 49)
         {
           // We shall not create a 51th layer, the CDS will be drawn on the
           // layer, probably over another CDS
@@ -1214,74 +989,69 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
     }
 
     // Mark sectors to be drawn as occupied
-    for ( rho = 0 ; rho < nb_sect ; rho++ )
+    for (rho = 0 ; rho < nb_sect ; rho++)
     {
-      occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - rho, 360)] = true;
+      occupied_sectors[LEADING][layer][Utils::mod(theta_first - rho, 360)] = true;
     }
 
     // Mark flanking sectors as occupied
-    occupied_sectors[LEADING][layer][ae_utils::mod(theta_first + 1, 360)] = true;
-    occupied_sectors[LEADING][layer][ae_utils::mod(theta_first - nb_sect, 360)] = true;
+    occupied_sectors[LEADING][layer][Utils::mod(theta_first + 1, 360)] = true;
+    occupied_sectors[LEADING][layer][Utils::mod(theta_first - nb_sect, 360)] = true;
 
 
     // draw !
-    fprintf( drawingfile, "0.018 setlinewidth\n" );
-    if ( rna->is_coding() ) fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
-    else fprintf( drawingfile, "0.7 0.7 0.7 setrgbcolor\n" );
+    fprintf(drawingfile, "0.018 setlinewidth\n");
+    if (rna.is_coding()) fprintf(drawingfile, "0 0 0 setrgbcolor\n");
+    else fprintf(drawingfile, "0.7 0.7 0.7 setrgbcolor\n");
     layer++; // index starting at 0 but needed to start at 1
 
     if (theta_last > theta_first)
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360);
-      fprintf( drawingfile, "stroke\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, 360);
+      fprintf(drawingfile, "stroke\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, 0, theta_first);
+      fprintf(drawingfile, "stroke\n");
     }
     else
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r + layer*0.02, theta_last, theta_first);
+      fprintf(drawingfile, "stroke\n");
     }
-
-    node = node->get_next();
   }
 
 
 
-  node = (gen_unit->get_rna_list())[LAGGING]->get_first();
-  while (node != NULL)
-  {
-    rna = (ae_rna *) node->get_obj();
-    first = rna->get_first_transcribed_pos();
-    last = rna->get_last_transcribed_pos();
+  for (const auto& rna: gen_unit->rna_list()[LAGGING]) {
+    first = rna.first_transcribed_pos();
+    last = rna.last_transcribed_pos();
 
 
-    alpha_first   = (int16_t) round(  (double)(360 * first) / (double)gen_length );
-    alpha_last    = (int16_t) round(  (double)(360 * last)  / (double)gen_length );
-    theta_first   = ae_utils::mod( 90 - alpha_first, 360 );
-    theta_last    = ae_utils::mod( 90 - alpha_last, 360 );
-    nb_sect = ae_utils::mod( alpha_first - alpha_last + 1,  360 );
+    alpha_first   = (int16_t) round((double)(360 * first) / (double)gen_length);
+    alpha_last    = (int16_t) round((double)(360 * last)  / (double)gen_length);
+    theta_first   = Utils::mod(90 - alpha_first, 360);
+    theta_last    = Utils::mod(90 - alpha_last, 360);
+    nb_sect = Utils::mod(alpha_first - alpha_last + 1,  360);
 
 
     // Inside the circle, look for the inmost layer that has all the sectors between
     // theta_first and theta_last free
     layer = 0;
     sectors_free = false;
-    while ( ! sectors_free )
+    while (! sectors_free)
     {
       sectors_free = true;
-      for ( rho = 0 ; rho < nb_sect ; rho++ )
+      for (rho = 0 ; rho < nb_sect ; rho++)
       {
-        if ( occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + rho, 360)] )
+        if (occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)])
         {
           sectors_free = false;
           break;
         }
       }
 
-      if ( sectors_free )
+      if (sectors_free)
       {
         break; // All the needed sectors are free on the current layer
       }
@@ -1289,12 +1059,12 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
       {
         layer++;
 
-        if ( (layer >= outmost_layer) && (layer < 49) )
+        if ((layer >= outmost_layer) && (layer < 49))
         {
           // Add a new layer (actually, 2 layers, to maintain the symmetry)
           occupied_sectors[LEADING][outmost_layer] = new bool[360];
           occupied_sectors[LAGGING][outmost_layer] = new bool[360];
-          for ( angle = 0 ; angle < 360 ; angle++ )
+          for (angle = 0 ; angle < 360 ; angle++)
           {
             occupied_sectors[LEADING][outmost_layer][angle] = false;
             occupied_sectors[LAGGING][outmost_layer][angle] = false;
@@ -1303,7 +1073,7 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
           outmost_layer++;
           break; // A new layer is necessarily free, no need to look further
         }
-        if ( layer == 49 )
+        if (layer == 49)
         {
           // We shall not create a 51th layer, the CDS will be drawn on the
           // layer, probably over another CDS
@@ -1313,49 +1083,147 @@ void draw_genetic_unit_with_mRNAs( ae_genetic_unit* gen_unit, char * directoryNa
     }
 
     // Mark sectors to be drawn as occupied
-    for ( rho = 0 ; rho < nb_sect ; rho++ )
+    for (rho = 0 ; rho < nb_sect ; rho++)
     {
-      occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + rho, 360)] = true;
+      occupied_sectors[LAGGING][layer][Utils::mod(theta_first + rho, 360)] = true;
     }
 
     // Mark flanking sectors as occupied
-    occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first - 1, 360)] = true;
-    occupied_sectors[LAGGING][layer][ae_utils::mod(theta_first + nb_sect, 360)] = true;
+    occupied_sectors[LAGGING][layer][Utils::mod(theta_first - 1, 360)] = true;
+    occupied_sectors[LAGGING][layer][Utils::mod(theta_first + nb_sect, 360)] = true;
 
 
     // draw !
-    fprintf( drawingfile, "0.018 setlinewidth\n" );
-    if ( rna->is_coding() ) fprintf( drawingfile, "0 0 0 setrgbcolor\n" );
-    else fprintf( drawingfile, "0.7 0.7 0.7 setrgbcolor\n" );
+    fprintf(drawingfile, "0.018 setlinewidth\n");
+    if (rna.is_coding()) fprintf(drawingfile, "0 0 0 setrgbcolor\n");
+    else fprintf(drawingfile, "0.7 0.7 0.7 setrgbcolor\n");
     layer++; // index starting at 0 but needed to start at 1
 
     if (theta_first > theta_last)
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360);
-      fprintf( drawingfile, "stroke\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, 360);
+      fprintf(drawingfile, "stroke\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, 0, theta_last);
+      fprintf(drawingfile, "stroke\n");
     }
     else
     {
-      fprintf( drawingfile, "newpath\n" );
-      fprintf( drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last);
-      fprintf( drawingfile, "stroke\n" );
+      fprintf(drawingfile, "newpath\n");
+      fprintf(drawingfile, "%lf %lf %lf %d %d arc\n", 0.5, 0.5, r - layer*0.02, theta_first, theta_last);
+      fprintf(drawingfile, "stroke\n");
     }
-
-    node = node->get_next();
   }
 
 
-  fprintf( drawingfile,"showpage\n" );
-  fprintf( drawingfile,"%%%%EOF\n" );
+  fprintf(drawingfile,"showpage\n");
+  fprintf(drawingfile,"%%%%EOF\n");
   fclose(drawingfile);
 
-  for ( layer = 0 ; layer < outmost_layer ; layer++ )
+  for (layer = 0 ; layer < outmost_layer ; layer++)
   {
     delete occupied_sectors[LEADING][layer];
     delete occupied_sectors[LAGGING][layer];
   }
 
 }
+
+
+/**
+ * \brief print help and exist
+ */
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s:\n", prog_name);
+  printf("\tCreates EPS files with the triangles, the positive and negative\n");
+  printf("\tprofiles, the phenotype, the CDS and the mRNAs of the\n");
+  printf("\tindividual of interest.\n");
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP] [-I INDEX | -R RANK]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -t, --timestep TIMESTEP\n");
+  printf("\tspecify timestep of the individual of interest\n");
+  printf("  -I, --index INDEX\n");
+  printf("\tspecify the index of the individual of interest\n");
+  printf("  -R, --rank RANK\n");
+  printf("\tspecify the rank of the individual of interest\n");
+}
+
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char * options_list = "hVI:R:t:";
+  static struct option long_options_list[] = {
+      {"help",      no_argument,       NULL, 'h'},
+      {"version",   no_argument,       NULL, 'V' },
+      {"index",     required_argument, NULL, 'I'},
+      {"rank",      required_argument, NULL, 'R'},
+      {"timestep",  required_argument, NULL, 't' },
+      { 0, 0, 0, 0 }
+  };
+
+  // Get actual values of the command-line options
+  int option;
+  while ((option = getopt_long(argc, argv, options_list,
+                               long_options_list, NULL)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 'I' : {
+        indiv_index  = atol(optarg);
+        break;
+      }
+      case 'R' : {
+        indiv_rank  = atol(optarg);
+        break;
+      }
+      case 't' : {
+        if (strcmp(optarg, "") == 0) {
+          printf("%s: error: Option -t or --timestep: missing argument.\n",
+                 argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        timestep = atol(optarg);
+        break;
+      }
+    }
+  }
+
+  // If timestep wasn't provided, use default
+  if (timestep < 0) {
+    timestep = OutputManager::last_gener();
+  }
+
+  // If neither the rank nor the index were provided, the individual of interest
+  // will be the best individual at the provided timestep
+}
diff --git a/src/post_treatments/extract.cpp b/src/post_treatments/extract.cpp
index 44f5011..52d59a0 100644
--- a/src/post_treatments/extract.cpp
+++ b/src/post_treatments/extract.cpp
@@ -1,466 +1,333 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-//
-// This program extracts some data about the individuals and write
-// them into text files easy to parse with e.g. matlab.
-//
-// Two kinds of data can be extracted :
-//
-//  * data about the phenotype (option -t) : write information about
-//    the proteins in a text file. A space delimits two proteins, a
-//    new line delimits two individuals. For each protein, the output
-//    is "m_h_w_c_r_s_f_l_z_g" where :
-//        * m, h, w and c are the mean, height, width and concentration of the protein
-//        * r is an identifier of the rna it belongs (usefull to
-//            know if several proteins are on the same rna)
-//        * s indicates the strand (LEADING/LAGGING)
-//        * f and l are the first and last translated base
-//        * z indicates the feature (at the center of the protein)
-//        * g indicates the genetic unit to which the protein belongs (0=chromosome, 1=plasmid)
-//
-//  * sequences of the individuals (option -s) : write the sequences
-//    in a text file. A new line delimits two individuals. In case
-//    there are several GU, they are separated by spaces.
-//
-// The option -b only treats the best individual
-//
-// The input can be either a generation number, in which case we
-// will attempt to load a full backup tree, or a population file,
-// in which case features of the proteins won't be outputed as we
-// need to know the environment to infer them.
-//
-// Examples :
-//
-// For generation 20000, write infos about the phenotypes of all the
-// individuals in phe_020000 and the sequences of all the
-// individuals in seq_020000 :
-//
-//    extract -r 20000 -t phe_020000 -s seq_020000
-//
-// For generation 20000, write the best individual's sequence in
-// seq_020000_best :
-//
-//    extract -b -r 20000 -s seq_020000_best
-// or extract -b -p populations/pop_020000.ae -s seq_020000_best
-//
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <signal.h>
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_environment.h>
-#include <ae_list.h>
-#include <ae_exp_manager.h>
-
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-void analyse_indiv( ae_individual* indiv, FILE* triangles_file, FILE* sequence_file, int16_t gu, ae_environment* env );
-void analyse_gu( ae_genetic_unit* gen_unit, int32_t gen_unit_number, FILE* triangles_file, ae_environment* env );
-
-
-
-
-int main( int argc, char* argv[] )
-{
-  // Initialize command-line option variables with default values
-  char* pop_file_name  = NULL;
-  char* triangles_file_name  = NULL;
-  char* sequence_file_name  = NULL;
-  bool best_only = false;
-  int16_t gu = -1;
-  int32_t num_gener = -1;
-
-  // Define allowed options
-  const char * options_list = "hVp:r:t:s:bg:";
-  static struct option long_options_list[] = {
-    {"help",      no_argument,        NULL, 'h'},
-    {"version",   no_argument,        NULL, 'V'},
-    {"popfile",   required_argument,  NULL, 'p'},
-    {"resume",    required_argument,  NULL, 'r'},
-    {"triangles", required_argument,  NULL, 't'},
-    {"sequence",  required_argument,  NULL, 's'},
-    {"best",      no_argument,        NULL, 'b'},
-    {"gu",        required_argument,  NULL, 'g'},
-    {0, 0, 0, 0}
-  };
-
-  // Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 )
-  {
-    switch ( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'p' :
-        pop_file_name = new char[strlen(optarg) + 1];
-        sprintf( pop_file_name, "%s", optarg );
-        break;
-      case 'r':
-        num_gener = atol( optarg );
-        break;
-      case 't' :
-        triangles_file_name = new char[strlen(optarg) + 1];
-        sprintf( triangles_file_name, "%s", optarg );
-        break;
-      case 's' :
-        sequence_file_name = new char[strlen(optarg) + 1];
-        sprintf( sequence_file_name, "%s", optarg );
-        break;
-      case 'g' :
-        gu = atoi( optarg );
-        break;
-      case 'b' :
-        best_only = true;
-        break;
-    }
-  }
-
-  // Open the files
-  FILE* triangles_file = NULL;
-  FILE* sequence_file = NULL;
-
-  if ( triangles_file_name != NULL )
-  {
-    triangles_file = fopen(triangles_file_name,"w");
-  }
-  if ( sequence_file_name != NULL )
-  {
-    sequence_file = fopen(sequence_file_name,"w");
-  }
-
-  ae_population* pop = NULL;
-  ae_environment* env = NULL;
-  ae_exp_manager* exp_manager = new ae_exp_manager();
-
-  // Two possible sources: either the user provided a "full" simulation via a generation number (option '-r'), either he just provided a population file (option '-p').
-  if ( num_gener != -1 )
-  {
-    exp_manager->load( num_gener, false, false, false );
-    pop = exp_manager->get_pop();
-    env = exp_manager->get_env();
-  }
-  else
-  {
-    if ( pop_file_name == NULL )
-    {
-      printf("You must specify either a generation number or a source population file");
-      exit(EXIT_FAILURE);
-    }
-
-    // Load the simulation from population file
-    pop = new ae_population(exp_manager);
-
-    gzFile pop_file = gzopen( pop_file_name, "r" );
-    if ( pop_file == Z_NULL )
-    {
-      printf( "%s:%d: error: could not open backup file %s\n", __FILE__, __LINE__, pop_file_name );
-      exit( EXIT_FAILURE );
-    }
-    pop->load( pop_file, false );
-    gzclose( pop_file );
-  }
-
-  // The best individual is already known because it is the last in the list
-  // Thus we do not need to know anything about the environment and to evaluate the individuals
-
-  // Parse the individuals
-  if (best_only)
-  {
-    ae_individual* best = pop->get_best();
-    best->do_transcription_translation_folding(); // We need to recompute proteins if not already done (ie if using a population file and not a full backup)
-    analyse_indiv(best, triangles_file, sequence_file, gu, env);
-  }
-  else
-  {
-    ae_list_node<ae_individual*>* indiv_node = pop->get_indivs()->get_first();
-    ae_individual* indiv      = NULL;
-    while( indiv_node != NULL )
-    {
-      indiv = (ae_individual *) indiv_node->get_obj();
-      indiv->do_transcription_translation_folding(); // We need to recompute proteins if not already done (ie if using a population file and not a full backup)
-      analyse_indiv(indiv, triangles_file, sequence_file, gu, env);
-      indiv_node = indiv_node->get_next();
-    }
-  }
-
-  if (sequence_file_name != NULL)
-  {
-    fclose(sequence_file);
-  }
-  if (triangles_file_name != NULL)
-  {
-    fclose(triangles_file);
-  }
-
-  if (pop_file_name != NULL) {delete [] pop_file_name;}
-  if (triangles_file_name != NULL) {delete [] triangles_file_name;}
-  if (sequence_file_name != NULL) {delete [] sequence_file_name;}
-
-  delete exp_manager;
-  if ((num_gener == -1)&&(pop!=NULL)) {delete pop;}
-
-  return EXIT_SUCCESS;
-}
-
-// Parsing an individual
-inline void analyse_indiv( ae_individual* indiv, FILE* triangles_file, FILE* sequence_file, int16_t gu, ae_environment* env )
-{
-  if ( gu == -1 ) // We want to treat all genetic units
-  {
-    int32_t gen_unit_number = 0;
-    ae_list_node<ae_genetic_unit*>* gen_unit_node = indiv->get_genetic_unit_list()->get_first();
-    while ( gen_unit_node != NULL )
-    {
-      ae_genetic_unit* gen_unit = (ae_genetic_unit*) gen_unit_node->get_obj();
-
-      if ( triangles_file != NULL )
-      {
-        analyse_gu(gen_unit, gen_unit_number, triangles_file, env); // We call the triangle parser for each GU successively
-      }
-      if ( sequence_file != NULL )
-      {
-        const char* dna = gen_unit->get_dna()->get_data();
-        int32_t length = gen_unit->get_dna()->get_length();
-        fprintf(sequence_file,"%.*s ",length,dna); // We output the sequences of each GU separated by a space
-      }
-
-      gen_unit_node = gen_unit_node->get_next();
-      gen_unit_number++;
-    }
-  }
-  else // User specified a genetic unit
-  {
-    ae_genetic_unit* gen_unit = indiv->get_genetic_unit(gu);
-    if ( triangles_file != NULL )
-    {
-      analyse_gu(gen_unit, gu, triangles_file, env); // We call the triangle parser
-    }
-    if ( sequence_file != NULL )
-    {
-      const char* dna = gen_unit->get_dna()->get_data();
-      int32_t length = gen_unit->get_dna()->get_length();
-      fprintf(sequence_file,"%.*s",length,dna); // We output the sequence
-    }
-  }
-
-  // We go to next line in each file
-  if ( triangles_file != NULL )
-  {
-    fprintf(triangles_file,"\n");
-  }
-  if ( sequence_file != NULL )
-  {
-    fprintf(sequence_file,"\n");
-  }
-}
-
-// Parsing a GU
-inline void analyse_gu( ae_genetic_unit* gen_unit, int32_t gen_unit_number, FILE* triangles_file, ae_environment* env )
-{
-  // Construct the list of all rnas
-  ae_list<ae_rna*>** llrnas = gen_unit->get_rna_list();
-  ae_list<ae_rna*>* lrnas = new ae_list<ae_rna*>();
-  lrnas->add_list(llrnas[LEADING]);
-  lrnas->add_list(llrnas[LAGGING]);
-
-  // Parse this list
-  ae_list_node<ae_rna*>* rna_node = lrnas->get_first();;
-
-  ae_rna* rna = NULL;
-  int rna_nb = 0;
-
-  while( rna_node != NULL )
-  {
-    rna = (ae_rna *) rna_node->get_obj();
-
-    ae_list<ae_protein*>* lprot = rna->get_transcribed_proteins();
-    ae_list_node<ae_protein*>* prot_node = lprot->get_first();
-    ae_protein* prot = NULL;
-
-    while( prot_node != NULL )
-    {
-      prot = (ae_protein*) prot_node->get_obj();
-
-      double height = prot->get_height();
-      double width = prot->get_width();
-      double mean = prot->get_mean();
-      double concentration=rna->get_basal_level();
-      int32_t fpos = prot->get_first_translated_pos();
-      int32_t lpos = prot->get_last_translated_pos();
-
-      int nfeat = -1;
-      // Retrieving the feature of the protein also necessitates the an environment file.
-      if ( env != NULL )
-      {
-        for ( int i=0; i<=(env->get_nb_segments() - 1); i++ )
-        {
-          if ( (mean > env->get_segment_boundaries(i) ) && (mean < env->get_segment_boundaries(i+1)) )
-          {
-            nfeat = env->get_axis_feature(i);
-            break;
-          }
-        }
-      }
-
-      fprintf(triangles_file,"%f_%f_%f_%f_%d_%d_%i_%i_%d_%d ",mean,height,width,concentration,rna_nb,rna->get_strand(),fpos,lpos,nfeat,gen_unit_number);
-
-      prot_node = prot_node->get_next();
-    }
-
-    rna_node = rna_node->get_next();
-    rna_nb++;
-  }
-
-  delete lrnas;
-}
-
-
-void print_help(char* prog_path)
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ((prog_name = strrchr(prog_path, '/'))) prog_name++;
-  else prog_name = prog_path;
-
-  printf("******************************************************************************\n");
-  printf("*                                                                            *\n");
-  printf("*                        aevol - Artificial Evolution                        *\n");
-  printf("*                                                                            *\n");
-  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
-  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
-  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
-  printf("* transcriptome.                                                             *\n");
-  printf("*                                                                            *\n");
-  printf("******************************************************************************\n");
-  printf("\n");
-  printf("%s: extracts the genotype and/or data about the phenotype of individuals in the provided population and write them into text files easy to parse with e.g. matlab.\n", prog_name);
-  printf("\n");
-  printf("Usage : %s -h\n", prog_name);
-  printf("   or : %s -V or --version\n", prog_name);
-  printf("   or :    %s [-r GENER | -p POP_FILE] [-t PHEN_FILE] [-s SEQ_FILE] [-g NUM_GU] [-b]\n", prog_name);
-  printf("\nOptions\n");
-  printf("  -h, --help\n\tprint this help, then exit\n\n");
-  printf("  -V, --version\n\tprint version number, then exit\n\n");
-  printf("  -r GENER  :\n");
-  printf("\tread generation GENER from a full aevol backup\n");
-  printf("  -p POP_FILE:\n");
-  printf("\tread the population saved in population file POP_FILE\n");
-  printf("  -t PHEN_FILE:\n");
-  printf("\textract and save some infos about the phenotypes of the individuals to file PHEN_FILE\n");
-  printf("  -s SEQ_FILE:\n");
-  printf("\textract and save the sequences of the individuals to file SEQ_FILE\n");
-  printf("  -g NUM_GU:\n");
-  printf("\tonly treat this genetic unit (by default: treat all genetic units)\n");
-  printf("  -b:\n");
-  printf("\tonly treat the best individual\n");
-  printf("\n\n");
-
-  printf("\n\
-This program extracts some data about the individuals and write\n\
-them into text files easy to parse with e.g. matlab.\n\
-\n\
-Two kinds of data can be extracted :\n\
-\n\
- * data about the phenotype (option -t) : write information about\n\
-   the proteins in a text file. A space delimits two proteins, a\n\
-   new line delimits two individuals. For each protein, the output\n\
-   is \"m_h_w_c_r_s_f_l_z_g\" where :\n\
-       * m, h, w and c are the mean, height, width and concentration of the protein\n\
-       * r is an identifier of the rna it belongs (usefull to\n\
-           know if several proteins are on the same rna)\n\
-       * s indicates the strand (LEADING/LAGGING)\n\
-       * f and l are the first and last translated base\n\
-       * z indicates the feature (at the center of the protein)\n\
-       * g indicates the genetic unit to which the protein belongs (0=chromosome, 1=plasmid)\n\
-\n\
- * sequences of the individuals (option -s) : write the sequences\n\
-   in a text file. A new line delimits two individuals. In case\n\
-   there are several GU, they are separated by whitespaces.\n\
-\n\
-With option -b, only the best individual is treated.\n\
-\n\
-The input can be either a generation number, in which case we\n\
-will attempt to load a full backup tree, or a population file,\n\
-in which case features of the proteins won't be outputed as we\n\
-need to know the environment to infer them.\n\
-\n\
-Examples :\n\
-\n\
-For generation 20000, write infos about the phenotypes of all the\n\
-individuals in phe_020000 and the sequences of all the\n\
-individuals in seq_020000 :\n\
-\n\
-   extract -r 20000 -t phe_020000 -s seq_020000\n\
-\n\
-For generation 20000, write the best individual's sequence in\n\
-seq_020000_best :\n\
-\n\
-   extract -b -r 20000 -s seq_020000_best\n\
-or extract -b -p populations/pop_020000.ae -s seq_020000_best\n");
-
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <getopt.h>
+#include <cstdlib>
+#include <cstdio>
+
+#include "aevol.h"
+
+using namespace aevol;
+
+// Command-line option variables
+static char* triangles_file_name  = nullptr;
+static char* sequence_file_name  = nullptr;
+static bool best_only = true;
+static int16_t gu = -1;
+static int32_t timestep = -1;
+
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
+
+void analyse_indiv(Individual* indiv, FILE* triangles_file, FILE* sequence_file,
+                   int16_t gu, const PhenotypicTarget& phenotypicTarget);
+
+void analyse_gu(GeneticUnit* gen_unit, int32_t gen_unit_number,
+                FILE* triangles_file, const PhenotypicTarget& phenotypicTarget);
+
+
+
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  // Open the files
+  FILE* triangles_file = nullptr;
+  FILE* sequence_file = nullptr;
+
+  if (triangles_file_name != nullptr) {
+    triangles_file = fopen(triangles_file_name, "w");
+
+    // Write file headers
+    int key = 1;
+    fprintf(triangles_file, "# %2.d individual's identifier (id)\n", key++);
+    fprintf(triangles_file, "# %2.d chromosome or plasmid (c_or_p)\n", key++);
+    fprintf(triangles_file, "# %2.d strand\n", key++);
+    fprintf(triangles_file, "# %2.d protein position (pos)\n", key++);
+    fprintf(triangles_file, "# %2.d length (len)\n", key++);
+    fprintf(triangles_file, "# %2.d position of last translated nucleotide (lpos)\n", key++);
+    fprintf(triangles_file, "# %2.d primary sequence (sequence)\n", key++);
+    fprintf(triangles_file, "# %2.d mean (m)\n", key++);
+    fprintf(triangles_file, "# %2.d width (w)\n", key++);
+    fprintf(triangles_file, "# %2.d height (h)\n", key++);
+    fprintf(triangles_file, "# %2.d concentration (c)\n", key++);
+    fprintf(triangles_file, "# %2.d feature (f)\n", key++);
+    fprintf(triangles_file, "# %2.d promoter position (prom_pos)\n", key++);
+    fprintf(triangles_file, "# %2.d RNA length (rna_len)\n", key++);
+    fprintf(triangles_file, "# %2.d basal level (basal_level)\n", key++);
+    fprintf(triangles_file, "\n");
+    fprintf(triangles_file,
+            "id c_or_p strand pos len lpos sequence m w h c f "
+                "prom_pos rna_len basal_level\n");
+  }
+  if (sequence_file_name != nullptr) {
+    sequence_file = fopen(sequence_file_name,"w");
+  }
+
+  auto exp_manager = new ExpManager();
+  exp_manager->load(timestep, false, false);
+
+
+  // The best individual is already known because it is the last in the list
+  // Thus we do not need to know anything about the environment and to evaluate
+  // the individuals
+
+  // Parse the individuals
+  if (best_only) {
+    Individual* best = exp_manager->best_indiv();
+    analyse_indiv(best, triangles_file, sequence_file, gu,
+                  best->habitat().phenotypic_target());
+  }
+  else {
+    for (const auto& indiv: exp_manager->indivs()) {
+      analyse_indiv(indiv, triangles_file, sequence_file, gu,
+                    indiv->habitat().phenotypic_target());
+    }
+  }
+
+  if (sequence_file_name != nullptr) {
+    fclose(sequence_file);
+  }
+  if (triangles_file_name != nullptr) {
+    fclose(triangles_file);
+  }
+
+  delete [] triangles_file_name;
+  delete [] sequence_file_name;
+
+  delete exp_manager;
+
+  return EXIT_SUCCESS;
+}
+
+// Parsing an individual
+inline void analyse_indiv(Individual* indiv, FILE* triangles_file,
+                          FILE* sequence_file, int16_t gu,
+                          const PhenotypicTarget & phenotypicTarget) {
+  if (gu == -1) { // We want to treat all genetic units
+    int32_t gen_unit_number = 0;
+    for (auto& gen_unit: indiv->genetic_unit_list_nonconst()) {
+      if (triangles_file != nullptr) {
+        analyse_gu(&gen_unit, gen_unit_number, triangles_file,
+                   phenotypicTarget);
+      }
+      if (sequence_file != nullptr) {
+        // The sequences of different GUs are separated by a space
+        if (gen_unit_number > 0) fprintf(sequence_file, " ");
+
+        const char* dna = gen_unit.dna()->data();
+        int32_t length = gen_unit.dna()->length();
+        fprintf(sequence_file, "%.*s", length, dna);
+      }
+
+      gen_unit_number++;
+    }
+  }
+  else { // User has specified a genetic unit
+    GeneticUnit* gen_unit = &indiv->genetic_unit_nonconst(gu);
+    if (triangles_file != nullptr) {
+      analyse_gu(gen_unit, gu, triangles_file, phenotypicTarget);
+    }
+    if (sequence_file != nullptr) {
+      const char* dna = gen_unit->dna()->data();
+      int32_t length = gen_unit->dna()->length();
+      fprintf(sequence_file, "%.*s", length, dna);
+    }
+  }
+
+  // We go to next line in each file
+  if (triangles_file != nullptr) {
+    fprintf(triangles_file, "\n");
+  }
+  if (sequence_file != nullptr) {
+    fprintf(sequence_file, "\n");
+  }
+}
+
+// Parsing a GU
+inline void analyse_gu(GeneticUnit* gen_unit, int32_t gen_unit_number,
+                       FILE* triangles_file,
+                       const PhenotypicTarget& phenotypicTarget) {
+  // Construct the list of all rnas
+  auto llrnas = gen_unit->rna_list();
+  auto lrnas = llrnas[LEADING];
+  lrnas.splice(lrnas.end(), llrnas[LAGGING]);
+
+  // Parse this list
+  int rna_nb = 0;
+  for (const auto& rna: lrnas) {
+    for (const auto& protein: rna.transcribed_proteins()) {
+      double mean = protein->mean();
+
+      int nfeat = -1;
+      for (size_t i = 0 ;
+           i <= static_cast<size_t>(phenotypicTarget.nb_segments()) - 1 ;
+           ++i) {
+        if ((mean > phenotypicTarget.segments()[i]->start) and
+            (mean < phenotypicTarget.segments()[i]->stop)) {
+          nfeat = phenotypicTarget.segments()[i]->feature;
+          break;
+        }
+      }
+
+      char *dummy;
+      fprintf(triangles_file,
+              "%" PRId32 " %s %s %" PRId32 " %" PRId32 " %" PRId32
+                  " %s %f %f %f %f %d %" PRId32 " %" PRId32 " %f\n",
+              gen_unit->indiv()->id(),
+              gen_unit_number != 0 ? "PLASMID" :
+              "CHROM  ",
+              protein->strand() == LEADING ? "LEADING" :
+              "LAGGING",
+              protein->first_translated_pos(),
+              protein->length(),
+              protein->last_translated_pos(),
+              dummy = protein->AA_sequence('_'),
+              mean,
+              protein->width(),
+              protein->height(),
+              protein->concentration(),
+              nfeat,
+              rna.promoter_pos(),
+              rna.transcript_length(),
+              rna.basal_level());
+      delete dummy;
+    }
+    rna_nb++;
+  }
+}
+
+
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) prog_name++;
+  else prog_name = prog_path;
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s:\n", prog_name);
+  printf("\tExtracts the genotype and/or data about the phenotype of individuals\n");
+  printf("\tin the provided population and write them into text files easy to parse\n");
+  printf("\twith e.g. matlab.\n");
+  printf("\n");
+  printf("Usage : %s -h\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP] [-S SEQ_FILE] [-T TRIANGLE_FILE] [-U NUM_GU] [-a]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -t TIMESTEP\n");
+  printf("\tspecify timestep of the individual(s) of interest\n");
+  printf("  -S SEQ_FILE\n");
+  printf("\textract sequences into file SEQ_FILE\n");
+  printf("  -T TRIANGLE_FILE\n");
+  printf("\textract phenotypic data into file TRIANGLE_FILE\n");
+  printf("  -U NUM_GU\n");
+  printf("\tonly treat genetic unit #NUM_GU (default: treat all genetic units)\n");
+  printf("  -a\n");
+  printf("\ttreat all the individuals (default: treat only the best)\n");
+}
+
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char * options_list = "hVt:aU:S:T:";
+  static struct option long_options_list[] = {
+      {"help",      no_argument,        nullptr, 'h'},
+      {"version",   no_argument,        nullptr, 'V'},
+      {"timestep",  required_argument,  nullptr, 't'},
+      {"all",       no_argument,        nullptr, 'a'},
+      {"gu",        required_argument,  nullptr, 'U'},
+      {"sequence",  required_argument,  nullptr, 'S'},
+      {"triangles", required_argument,  nullptr, 'T'},
+      {0, 0, 0, 0}
+  };
+
+  // Get actual values of the command-line options
+  int option;
+  while ((option = getopt_long(argc, argv, options_list,
+                               long_options_list, nullptr)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 't' : {
+        timestep = atol(optarg);
+        break;
+      }
+      case 'a' : {
+        best_only = false;
+        break;
+      }
+      case 'U' : {
+        gu = atoi(optarg);
+        break;
+      }
+      case 'S' : {
+        sequence_file_name = new char[strlen(optarg) + 1];
+        sprintf(sequence_file_name, "%s", optarg);
+        break;
+      }
+      case 'T' : {
+        triangles_file_name = new char[strlen(optarg) + 1];
+        sprintf(triangles_file_name, "%s", optarg);
+        break;
+      }
+    }
+  }
+
+  // If timestep wasn't provided, use default
+  if (timestep < 0) {
+    timestep = OutputManager::last_gener();
+  }
+
+  // If neither the sequence_file_name nor the triangles_file_name was provided,
+  // we will output only the sequence in a default-named file
+  if (sequence_file_name == nullptr && triangles_file_name == nullptr) {
+    sequence_file_name = new char[255];
+    strcpy(sequence_file_name, "sequence");
+  }
+}
diff --git a/src/post_treatments/fixed_mutations.cpp b/src/post_treatments/fixed_mutations.cpp
deleted file mode 100644
index cfdecdb..0000000
--- a/src/post_treatments/fixed_mutations.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_utils.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_list.h>
-#include <ae_tree.h>
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-//#include <ae_param_loader.h>
-
-
-
-
-enum check_type
-{
-  FULL_CHECK  = 0,
-  LIGHT_CHECK = 1,
-  ENV_CHECK   = 2,
-  NO_CHECK    = 3
-};
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-double* dist_to_target_segment;
-
-
-
-
-
-
-int main(int argc, char** argv)
-{
-  // The input file (lineage.ae or lineage.rae) must contain the following information:
-  //
-  // - common data                                                (ae_common::write_to_backup)
-  // - begin gener                                                (int32_t)
-  // - end gener                                                  (int32_t)
-  // - final individual index                                     (int32_t)
-  // - initial genome size                                        (int32_t)
-  // - initial ancestor (nb genetic units + sequences)            (ae_individual::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+1 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+2 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+3 (ae_replic_report::write_to_backup)
-  // - ...
-  // - replication report of ancestor at generation end_gener     (ae_replic_report::write_to_backup)
-
-
-
-
-  // =====================
-  //  Parse command line
-  // =====================
-
-  // Default values
-  check_type  check               = LIGHT_CHECK;
-  char*       lineage_file_name   = NULL;
-  bool        verbose             = false;
-  double      tolerance           = 0;
-
-
-  const char * short_options = "hVvncf:t:";
-  static struct option long_options[] =
-  {
-    {"help",      no_argument,       NULL, 'h'},
-    {"version",   no_argument,       NULL, 'V' },
-    {"verbose",   no_argument,       NULL, 'v'},
-    {"nocheck",   no_argument,       NULL, 'n'},
-    {"fullcheck", no_argument,       NULL, 'c'},
-    {"file",      required_argument, NULL, 'f'},
-    {"tolerance",   required_argument, NULL, 't'},
-    {0, 0, 0, 0}
-  };
-
-  int option;
-  while( (option = getopt_long(argc, argv, short_options, long_options, NULL)) != -1 )
-  {
-    switch( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'v' : verbose = true;                    break;
-      case 'n' : check = NO_CHECK;                  break;
-      case 'c' : check = FULL_CHECK;                break;
-      case 'f' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -f or --file : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-
-        lineage_file_name = new char[strlen(optarg) + 1];
-        sprintf( lineage_file_name, "%s", optarg );
-        break;
-      }
-      case 't' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -t or --tolerance : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-        check = ENV_CHECK;
-        tolerance = atof(optarg);
-        break;
-      }
-      default :
-      {
-        fprintf( stderr, "ERROR : Unknown option, check your syntax.\n" );
-        print_help(argv[0]);
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-  if ( lineage_file_name == NULL )
-  {
-    fprintf( stderr, "ERROR : Option -f or --file missing. \n" );
-    exit( EXIT_FAILURE );
-  }
-
-  printf("\n");
-  printf( "WARNING : Parameter change during simulation is not managed in general.\n" );
-  printf( "          Only changes in environmental target done with aevol_modified are handled.\n" );
-  printf("\n");
-
-
-  // =======================
-  //  Open the lineage file
-  // =======================
-
-  gzFile lineage_file = gzopen( lineage_file_name, "r" );
-  if (lineage_file == Z_NULL)
-  {
-    fprintf( stderr, "ERROR : Could not read the lineage file %s\n", lineage_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-  int32_t begin_gener, end_gener, final_index, num_gener, final_indiv_rank;
-  gzread(lineage_file, &begin_gener, sizeof(begin_gener));
-  gzread(lineage_file, &end_gener, sizeof(end_gener));
-  gzread(lineage_file, &final_index, sizeof(final_index) );
-  gzread(lineage_file, &final_indiv_rank,   sizeof(final_indiv_rank) );
-
-  if ( verbose )
-  {
-    printf("\n\n");
-    printf("================================================================================\n");
-    printf(" Statistics of the ancestors of indiv. #%"PRId32" (t=%"PRId32" to %"PRId32")\n",
-            final_index, begin_gener, end_gener);
-    printf("================================================================================\n");
-  }
-
-
-  // =========================
-  //  Open the experience manager
-  // =========================
-
-  // Open the experiment manager
-#ifndef __NO_X
-  ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-#else
-  ae_exp_manager* exp_manager = new ae_exp_manager();
-#endif
-  exp_manager->load( begin_gener, false, true, false );
-  ae_environment* env = new ae_environment( *(exp_manager->get_env()) ); // independent copy
-
-  int32_t backup_step = exp_manager->get_backup_step();
-
-
-  // =========================
-  //  Open the output file(s)
-  // =========================
-
-  char output_file_name[60];
-  snprintf( output_file_name, 60, "stats/fixedmut-b%06"PRId32"-e%06"PRId32"-i%"PRId32"-r%"PRId32".out",begin_gener, end_gener, final_index, final_indiv_rank );
-
-  FILE * output = fopen( output_file_name, "w" );
-  if ( output == NULL )
-  {
-    fprintf( stderr, "ERROR : Could not create the output file %s\n", output_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-
-  // Write the header
-  fprintf( output, "# #################################################################\n" );
-  fprintf( output, "#  Mutations in the lineage of the best indiv at generation %"PRId32"\n", end_gener );
-  fprintf( output, "# #################################################################\n" );
-  fprintf( output, "#  1.  Generation       (mut. occurred when producing the indiv. of this generation)\n" );
-  fprintf( output, "#  2.  Genetic unit     (which underwent the mutation, 0 = chromosome) \n" );
-  fprintf( output, "#  3.  Mutation type    (0: switch, 1: smallins, 2: smalldel, 3:dupl, 4: del, 5:trans, 6:inv, 7:insert, 8:ins_HT, 9:repl_HT) \n" );
-  fprintf( output, "#  4.  pos_0            (position for the small events, begin_segment for the rearrangements, begin_segment of the inserted segment for ins_HT, begin_segment of replaced segment for repl_HT) \n" );
-  fprintf( output, "#  5.  pos_1            (-1 for the small events, end_segment for the rearrangements, end_segment of the inserted segment for ins_HT, begin_segment of donor segment for repl_HT) \n" );
-  fprintf( output, "#  6.  pos_2            (reinsertion point for duplic., cutting point in segment for transloc., insertion point in the receiver for ins_HT, end_segment of the replaced segment for repl_HT, -1 for other events)\n" );
-  fprintf( output, "#  7.  pos_3            (reinsertion point for transloc., breakpoint in the donor for ins_HT, end_segment of the donor segment for repl_HT, -1 for other events)\n" );
-  fprintf( output, "#  8.  invert           (transloc, was the segment inverted (0/1)?, sense of insertion for ins_HT (0=DIRECT, 1=INDIRECT), sense of the donor segment for repl_HT (0=DIRECT, 1=INDIRECT),-1 for other events)\n" );
-  fprintf( output, "#  9.  align_score      (score that was needed for the rearrangement to occur, score of the first alignment for ins_HT and repl_HT)\n" );
-  fprintf( output, "#  10. align_score2     (score for the reinsertion for transloc, score of the second alignment for ins_HT and repl_HT)\n" );
-  fprintf( output, "#  11. seg_len          (segment length for rearrangement, donor segment length for ins_HT and repl_HT)\n" );
-  fprintf( output, "#  12. repl_seg_len     (replaced segment length for repl_HT, -1 for the others)\n" );
-  fprintf( output, "#  13. GU_length        (before the event)\n" );
-  fprintf( output, "#  14. Impact of the mutation on the metabolic error (negative value = smaller gap after = beneficial mutation) \n" );
-  fprintf( output, "#  15. Number of coding RNAs possibly disrupted by the breakpoints \n" );
-  fprintf( output, "#  16. Number of coding RNAs completely included in the segment (donor segment in the case of a transfer) \n" );
-  fprintf( output, "#  17. Number of coding RNAs that were completely included in the replaced segment (meaningful only for repl_HT) \n" );
-  fprintf( output, "####################################################################################################################\n" );
-  fprintf( output, "#\n" );
-  fprintf( output, "# Header for R\n" );
-  fprintf( output, "gener gen_unit mut_type pos_0 pos_1 pos_2 pos_3 invert align_score align_score_2 seg_len repl_seg_len GU_len impact nbgenesatbreak nbgenesinseg nbgenesinreplseg\n" );
-
-
-
-  // ==============================
-  //  Prepare the initial ancestor
-  // ==============================
-
-  ae_individual * indiv = new ae_individual(exp_manager, lineage_file );
-  indiv->evaluate( env );
-  indiv->compute_statistical_data();
-
-  if ( verbose )
-  {
-    printf("Initial fitness     = %f\n", indiv->get_fitness());
-    printf("Initial genome size = %"PRId32"\n", indiv->get_total_genome_size());
-  }
-
-
-
-  // ===============================================================================
-  //  Replay the mutation to get the successive ancestors and analyze them
-  //  (and, optionally, check that the rebuilt envir and genome are correct each
-  //   time a backup is available)
-  // ===============================================================================
-  ae_replication_report* rep = NULL;
-  ae_list_node<ae_dna_replic_report*>* dnarepnode = NULL;
-  ae_dna_replic_report* dnarep = NULL;
-
-  ae_list_node<ae_mutation*>* mnode = NULL;
-  ae_mutation* mut = NULL;
-
-  ae_list_node<ae_genetic_unit*>* unitnode = NULL;
-  ae_genetic_unit* unit = NULL;
-
-  ae_individual* stored_indiv = NULL;
-  ae_list_node<ae_genetic_unit*>* stored_unit_node = NULL;
-  ae_genetic_unit*  stored_unit = NULL;
-
-  int32_t i, index, genetic_unit_number, unitlen_before;
-  int32_t nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment;
-  double metabolic_error_before, metabolic_error_after, impact_on_metabolic_error;
-  char mut_descr_string[80];
-
-  ae_exp_manager* exp_manager_backup = NULL;
-  ae_environment* backup_env = NULL;
-
-  bool check_now = false;
-
-  for ( i = 0; i < end_gener - begin_gener; i++ )
-  {
-    num_gener = begin_gener + i + 1;  // where are we in time...
-
-    rep = new ae_replication_report( lineage_file, indiv );
-    index = rep->get_id(); // who are we building...
-    indiv->set_replication_report(rep);
-
-    // Check now?
-    check_now = ( ( check == FULL_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == ENV_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == LIGHT_CHECK && num_gener == end_gener ) );
-
-
-    if ( verbose ) printf("Rebuilding ancestor at generation %"PRId32" (index %"PRId32")...", num_gener, index);
-
-    env->build();
-    env->apply_variation();
-    indiv->reevaluate(env);
-
-    // Check, and possibly update, the environment according to the backup files (update necessary if the env. was modified by aevol_modify at some point)
-    if (ae_utils::mod( num_gener, backup_step ) == 0)
-      {
-        char env_file_name[255];
-        sprintf( env_file_name, "./"ENV_FNAME_FORMAT, num_gener );
-        gzFile env_file = gzopen( env_file_name, "r" );
-        backup_env = new ae_environment();
-        backup_env->load( env_file );
-
-        if ( ! env->is_identical_to(backup_env, tolerance) )
-          {
-            printf("Warning: At t=%"PRId32", the replayed environment is not the same\n", num_gener);
-            printf("         as the one saved at generation %"PRId32"... \n", num_gener );
-            printf("         with tolerance of %lg\n", tolerance);
-            printf("Replacing the replayed environment by the one stored in the backup.\n");
-            delete env;
-            env = new ae_environment(*backup_env);
-          }
-        delete backup_env;
-      }
-
-
-    // Warning: this portion of code won't work if the number of units changes
-    // during the evolution, or if some translocations occurred between different genetic units
-
-    genetic_unit_number = 0;
-    dnarepnode = (rep->get_dna_replic_reports())->get_first();
-    unitnode   = (indiv->get_genetic_unit_list())->get_first();
-
-    if ( check_now && ae_utils::mod(num_gener, backup_step) == 0)
-    {
-#ifndef __NO_X
-      exp_manager_backup = new ae_exp_manager_X11();
-#else
-      exp_manager_backup = new ae_exp_manager();
-#endif
-      exp_manager_backup->load( num_gener, false, true, false );
-      stored_indiv = new ae_individual( * (ae_individual *)exp_manager_backup->get_indiv_by_id( index ), false );
-      stored_unit_node = stored_indiv->get_genetic_unit_list()->get_first();
-    }
-
-    while ( dnarepnode != NULL )
-    {
-      assert( unitnode != NULL );
-
-      dnarep = (ae_dna_replic_report *) dnarepnode->get_obj();
-      unit   = (ae_genetic_unit *) unitnode->get_obj();
-
-      unit->get_dna()->set_replic_report( dnarep );
-
-      // ***************************************
-      //             Transfer events
-      // ***************************************
-
-      mnode = dnarep->get_HT()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        unit->compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment);
-
-
-        unit->get_dna()->undergo_this_mutation( mut );
-        indiv->reevaluate(env);
-
-
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-
-        mut->get_generic_description_string( mut_descr_string );
-        fprintf( output, "%"PRId32" %"PRId32" %s %"PRId32" %.15f  %"PRId32" %"PRId32" %"PRId32" \n",\
-                 num_gener, genetic_unit_number, \
-                 mut_descr_string, unitlen_before, \
-                 impact_on_metabolic_error, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment );
-
-
-
-        mnode = mnode->get_next();
-      }
-
-
-      // ***************************************
-      //           Rearrangement events
-      // ***************************************
-
-      mnode = dnarep->get_rearrangements()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        unit->compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints, nb_genes_in_segment,  nb_genes_in_replaced_segment);
-
-        unit->get_dna()->undergo_this_mutation( mut );
-
-        indiv->reevaluate(env);
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-        mut->get_generic_description_string( mut_descr_string );
-        fprintf( output, "%"PRId32" %"PRId32" %s %"PRId32" %.15f %"PRId32" %"PRId32" %"PRId32" \n",\
-                 num_gener, genetic_unit_number, \
-                 mut_descr_string, unitlen_before, \
-                 impact_on_metabolic_error, nb_genes_at_breakpoints, nb_genes_in_segment,  nb_genes_in_replaced_segment );
-
-
-        mnode = mnode->get_next();
-      }
-
-
-      // ***************************************
-      // Local events (point mutations & small indels)
-      // ***************************************
-
-      mnode = dnarep->get_mutations()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        unit->compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment);
-
-        unit->get_dna()->undergo_this_mutation( mut );
-
-        indiv->reevaluate(env);
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-        mut->get_generic_description_string( mut_descr_string );
-        fprintf( output, "%"PRId32" %"PRId32" %s %"PRId32" %.15f %"PRId32" %"PRId32" %"PRId32" \n",\
-                 num_gener, genetic_unit_number, \
-                 mut_descr_string, unitlen_before, \
-                 impact_on_metabolic_error, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment );
-
-        mnode = mnode->get_next();
-      }
-
-      if ( check_now && ae_utils::mod(num_gener, backup_step) == 0)
-      {
-        if ( verbose )
-        {
-          printf("Checking the sequence of the unit...");
-          fflush(NULL);
-        }
-
-        assert( stored_unit_node != NULL );
-        stored_unit = (ae_genetic_unit *) stored_unit_node->get_obj();
-
-        char * str1 = new char[unit->get_dna()->get_length() + 1];
-        memcpy(str1, unit->get_dna()->get_data(), \
-               unit->get_dna()->get_length()*sizeof(char));
-        str1[unit->get_dna()->get_length()] = '\0';
-
-        char * str2 = new char[(stored_unit->get_dna())->get_length() + 1];
-        memcpy(str2, (stored_unit->get_dna())->get_data(), (stored_unit->get_dna())->get_length()*sizeof(char));
-        str2[(stored_unit->get_dna())->get_length()] = '\0';
-
-        if(strncmp(str1,str2, (stored_unit->get_dna())->get_length())==0)
-        {
-          if ( verbose ) printf(" OK\n");
-        }
-        else
-        {
-          if ( verbose ) printf( " ERROR !\n" );
-          fprintf( stderr, "Error: the rebuilt unit is not the same as \n");
-          fprintf( stderr, "the one saved at generation %"PRId32"... ", begin_gener );
-          fprintf( stderr, "Rebuilt unit : %zu bp\n %s\n", strlen(str1), str1 );
-          fprintf( stderr, "Stored unit  : %zu bp\n %s\n", strlen(str2), str2 );
-          delete [] str1;
-          delete [] str2;
-          gzclose(lineage_file);
-          delete indiv;
-          delete stored_indiv;
-          delete exp_manager_backup;
-          delete exp_manager;
-          exit(EXIT_FAILURE);
-        }
-
-        delete [] str1;
-        delete [] str2;
-
-        stored_unit_node = stored_unit_node->get_next();
-      }
-
-
-      dnarepnode = dnarepnode->get_next();
-      unitnode = unitnode->get_next();
-      genetic_unit_number ++;
-    }
-
-    assert( unitnode == NULL );
-
-
-    if ( verbose ) printf(" OK\n");
-
-    delete rep;
-
-    if ( check_now && ae_utils::mod(num_gener, backup_step) == 0 )
-    {
-      assert(stored_unit_node == NULL);
-      delete stored_indiv;
-      delete exp_manager_backup;
-    }
-  }
-
-  gzclose(lineage_file);
-  fclose(output);
-  delete exp_manager;
-  delete indiv;
-  delete env;
-
-  exit(EXIT_SUCCESS);
-
-}
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*               Fixed mutations post-treatment program                 * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "Usage : rfixed_mutations -h\n");
-  printf( "or :    rfixed_mutations [-vn] -f lineage_file \n" );
-#else
-  printf( "Usage : fixed_mutations -h\n");
-  printf( "or :    fixed_mutations [-vn] -f lineage_file \n" );
-#endif
-  printf( "\n" );
-  printf( "This program computes the fixed mutations of the individuals within the lineage\n" );
-  printf( "of lineage_file\n" );
-  printf( "\n" );
-  printf( "WARNING: This program should not be used for simulations run with several genetic units\n" );
-  printf( "(eg chromosome + plasmids). It works only for simulations with only a single chromosome.\n" );
-  printf( "\n" );
-  printf( "\t-h or --help       : Display this help.\n" );
-  printf( "\n" );
-  printf( "\t-v or --verbose    : Be verbose, listing generations as they are \n" );
-  printf( "\t                       treated.\n" );
-  printf( "\n" );
-  printf( "\t-n or --nocheck    : Disable genome sequence checking. Makes the \n");
-  printf( "\t                       program faster, but it is not recommended. \n");
-  printf( "\t                       It is better to let the program check that \n");
-  printf( "\t                       when we rebuild the genomes of the ancestors\n");
-  printf( "\t                       from the lineage file, we get the same sequences\n");
-  printf( "\t                       as those stored in the backup files.\n" );
-  printf( "\n" );
-  printf( "\t-c or --fullcheck  : Will perform the genome and environment checks every\n" );
-  printf( "\t                       <BACKUP_STEP> generations. Default behaviour is\n" );
-  printf( "\t                       lighter as it only perform sthese checks at the\n" );
-  printf( "\t                       ending generation.\n" );
-  printf( "\n" );
-  printf( "\t-f lineage_file or --file lineage_file : \n" );
-  printf( "\t                       Compute the fixed mutations of the individuals within lineage_file.\n" );
-  printf( "\n" );
-  printf( "\t-t tolerance or --tolerance tolerance : \n");
-  printf( "\t                       Tolerance used to compare the replayed environment to environment in backup\n");
-  printf( "\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
diff --git a/src/post_treatments/gene_families.cpp b/src/post_treatments/gene_families.cpp
deleted file mode 100644
index 3f49392..0000000
--- a/src/post_treatments/gene_families.cpp
+++ /dev/null
@@ -1,872 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <inttypes.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-#include <sys/stat.h>  // for the permission symbols used with mkdir
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_utils.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_list.h>
-#include <ae_tree.h>
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-#include <ae_gene_tree.h>
-#include <ae_enums.h>
-
-
-// TODO : predire la position de tous les genes apres la mutation
-// puis verifier dans la liste des genes de l'indiv apres evaluation
-// s'il y a bien toujours un gene a cet endroit
-
-
-// TODO : transfers
-// TODO : in gene tree file, print gene sequence, final position, list of proteins and M, W, H
-
-
-enum check_type
-{
-  FULL_CHECK  = 0,
-  LIGHT_CHECK = 1,
-  ENV_CHECK   = 2,
-  NO_CHECK    = 3
-};
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-void update_pointers_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_genetic_unit * unit);
-void anticipate_mutation_effect_on_genes_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_mutation * mut, int32_t unitlen_before);
-void register_actual_mutation_effect_on_genes_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error);
-void search_protein_in_gene_trees(ae_list<ae_gene_tree*> * gene_trees, ae_protein * prot, ae_gene_tree ** resultTree, ae_gene_tree_node ** resultNode);
-void set_end_gener_if_active_leaves_in_trees(ae_list<ae_gene_tree*> * gene_trees, int32_t gener);
-void write_gene_trees_to_files(ae_list<ae_gene_tree*> * gene_trees, int32_t end_gener);
-void print_gene_trees_to_screen(ae_list<ae_gene_tree*> * gene_trees); // For debug purposes
-
-
-
-
-
-
-int main(int argc, char** argv)
-{
-  // The input file (lineage.ae or lineage.rae) must contain the following information:
-  //
-  // - common data                                                (ae_common::write_to_backup)
-  // - begin gener                                                (int32_t)
-  // - end gener                                                  (int32_t)
-  // - final individual index                                     (int32_t)
-  // - initial genome size                                        (int32_t)
-  // - initial ancestor (nb genetic units + sequences)            (ae_individual::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+1 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+2 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+3 (ae_replic_report::write_to_backup)
-  // - ...
-  // - replication report of ancestor at generation end_gener     (ae_replic_report::write_to_backup)
-
-
-
-
-  // =====================
-  //  Parse command line
-  // =====================
-
-  // Default values
-  check_type  check               = LIGHT_CHECK;
-  char*       lineage_file_name   = NULL;
-  bool        verbose             = false;
-  double      tolerance           = 0;
-
-
-  const char * short_options = "hVvncf:t:";
-  static struct option long_options[] =
-  {
-    {"help",      no_argument,       NULL, 'h'},
-    {"version",   no_argument,       NULL, 'V' },
-    {"verbose",   no_argument,       NULL, 'v'},
-    {"nocheck",   no_argument,       NULL, 'n'},
-    {"fullcheck", no_argument,       NULL, 'c'},
-    {"file",      required_argument, NULL, 'f'},
-    {"tolerance",   required_argument, NULL, 't'},
-    {0, 0, 0, 0}
-  };
-
-  int option;
-  while( (option = getopt_long(argc, argv, short_options, long_options, NULL)) != -1 )
-  {
-    switch( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'v' : verbose = true;                    break;
-      case 'n' : check = NO_CHECK;                  break;
-      case 'c' : check = FULL_CHECK;                break;
-      case 'f' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -f or --file : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-
-        lineage_file_name = new char[strlen(optarg) + 1];
-        sprintf( lineage_file_name, "%s", optarg );
-        break;
-      }
-      case 't' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          fprintf( stderr, "ERROR : Option -t or --tolerance : missing argument.\n" );
-          exit( EXIT_FAILURE );
-        }
-        check = ENV_CHECK;
-        tolerance = atof(optarg);
-        break;
-      }
-      default :
-      {
-        fprintf( stderr, "ERROR : Unknown option, check your syntax.\n" );
-        print_help(argv[0]);
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-  if ( lineage_file_name == NULL )
-  {
-    fprintf( stderr, "ERROR : Option -f or --file missing. \n" );
-    exit( EXIT_FAILURE );
-  }
-
-
-  printf("\n");
-  printf( "WARNING : Parameter change during simulation is not managed in general.\n" );
-  printf( "          Only changes in environmental target done with aevol_modify are handled.\n" );
-  printf("\n");
-
-
-  // =======================
-  //  Open the lineage file
-  // =======================
-
-  gzFile lineage_file = gzopen( lineage_file_name, "r" );
-  if (lineage_file == Z_NULL)
-  {
-    fprintf( stderr, "ERROR : Could not read the lineage file %s\n", lineage_file_name );
-    exit( EXIT_FAILURE );
-  }
-
-  int32_t begin_gener, end_gener, final_index, num_gener, final_indiv_rank;
-  gzread(lineage_file, &begin_gener, sizeof(begin_gener));
-  gzread(lineage_file, &end_gener, sizeof(end_gener));
-  gzread(lineage_file, &final_index, sizeof(final_index) );
-  gzread(lineage_file, &final_indiv_rank,   sizeof(final_indiv_rank) );
-
-  if ( verbose )
-  {
-    printf("\n\n");
-    printf("================================================================================\n");
-    printf(" Gene families of the ancestors of indiv. #%"PRId32" (t=%"PRId32" to %"PRId32")\n",
-            final_index, begin_gener, end_gener);
-    printf("================================================================================\n");
-  }
-
-
-
-
-  // =========================
-  //  Open the experience manager
-  // =========================
-
-
-#ifndef __NO_X
-  ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-#else
-  ae_exp_manager* exp_manager = new ae_exp_manager();
-#endif
-  exp_manager->load( begin_gener, false, true, false );
-  ae_environment* env = new ae_environment( *(exp_manager->get_env()) ); // independent copy
-
-  int32_t backup_step = exp_manager->get_backup_step();
-
-
-  // ==============================
-  //  Prepare the initial ancestor
-  // ==============================
-
-  ae_individual * indiv = new ae_individual(exp_manager, lineage_file );
-  indiv->evaluate( env );
-  indiv->compute_statistical_data();
-
-  if ( verbose )
-  {
-    printf("Initial fitness     = %e\n", indiv->get_fitness());
-    printf("Initial genome size = %"PRId32"\n", indiv->get_total_genome_size());
-  }
-
-
-  // ===========================================================================
-  //  Prepare the initial gene trees (one for each coding RNA in the ancestor)
-  // ===========================================================================
-
-  // Each initial gene in this ancestral genome will be the root of a gene tree,
-  // where the paralogs (gene copies created by duplication) will be monitored
-
-  ae_list<ae_gene_tree*> * gene_trees = new ae_list<ae_gene_tree*>();
-  ae_list_node<ae_genetic_unit*>*   unitnode = NULL;
-  ae_genetic_unit *  unit = NULL;
-  ae_list_node<ae_protein*> *prot_node = NULL;
-  ae_protein *prot = NULL;
-
-  unitnode = indiv->get_genetic_unit_list()->get_first();
-  while (unitnode != NULL)
-    {
-      unit = unitnode->get_obj();
-      prot_node = (unit->get_protein_list()[LEADING])->get_first();
-      while(prot_node != NULL)
-        {
-          prot = prot_node->get_obj();
-          gene_trees->add(new ae_gene_tree(begin_gener, prot));
-          prot_node = prot_node->get_next();
-        }
-      prot_node = (unit->get_protein_list()[LAGGING])->get_first();
-      while(prot_node != NULL)
-        {
-          prot = prot_node->get_obj();
-          gene_trees->add(new ae_gene_tree(begin_gener, prot));
-          prot_node = prot_node->get_next();
-        }
-      unitnode = unitnode->get_next();
-    }
-
-
-
-
-
-  // ===============================================================================
-  //  Replay the mutation to get the successive ancestors and analyze them
-  //  (and, optionally, check that the rebuilt envir and genome are correct each
-  //   time a backup is available)
-  // ===============================================================================
-  ae_replication_report* rep = NULL;
-  ae_list_node<ae_dna_replic_report*>* dnarepnode = NULL;
-  ae_dna_replic_report* dnarep = NULL;
-
-  ae_list_node<ae_mutation*>* mnode = NULL;
-  ae_mutation* mut = NULL;
-
-  unitnode = NULL;
-  unit = NULL;
-
-  ae_individual* stored_indiv = NULL;
-  ae_list_node<ae_genetic_unit*>* stored_unit_node = NULL;
-  ae_genetic_unit*  stored_unit = NULL;
-
-  int32_t i, index, genetic_unit_number, unitlen_before;
-  double metabolic_error_before, metabolic_error_after, impact_on_metabolic_error;
-
-
-  ae_gene_tree * genetree = NULL;
-  ae_gene_tree_node * genetreenode = NULL;
-
-  ae_exp_manager* exp_manager_backup = NULL;
-  ae_environment* backup_env = NULL;
-
-  bool check_now = false;
-
-  for ( i = 0; i < end_gener - begin_gener; i++ )
-  {
-    num_gener = begin_gener + i + 1;  // where are we in time...
-
-    env->build();
-
-    rep = new ae_replication_report( lineage_file, indiv );
-    index = rep->get_id(); // who are we building...
-    indiv->set_replication_report(rep);
-
-    // Check now?
-    check_now = ( ( check == FULL_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == ENV_CHECK && ae_utils::mod( num_gener, backup_step ) == 0 ) ||
-                  ( check == LIGHT_CHECK && num_gener == end_gener ) );
-
-
-    if ( verbose ) printf("Rebuilding ancestor at generation %"PRId32" (index %"PRId32")...", num_gener, index);
-
-    env->build();
-    env->apply_variation();
-    indiv->reevaluate(env);
-
-    // Check, and possibly update, the environment according to the backup files (update necessary if the env. was modified by aevol_modify at some point)
-    if (ae_utils::mod( num_gener, backup_step ) == 0)
-      {
-        char env_file_name[255];
-        sprintf( env_file_name, "./"ENV_FNAME_FORMAT, num_gener );
-        gzFile env_file = gzopen( env_file_name, "r" );
-        backup_env = new ae_environment();
-        backup_env->load( env_file );
-
-        if ( ! env->is_identical_to(backup_env, tolerance) )
-          {
-            printf("Warning: At t=%"PRId32", the replayed environment is not the same\n", num_gener);
-            printf("         as the one saved at generation %"PRId32"... \n", num_gener );
-            printf("         with tolerance of %lg\n", tolerance);
-            printf("Replacing the replayed environment by the one stored in the backup.\n");
-            delete env;
-            env = new ae_environment(*backup_env);
-          }
-        delete backup_env;
-      }
-
-
-    // Warning: this portion of code won't work if the number of units changes
-    // during the evolution, or if some translocations occurred between different genetic units
-
-    genetic_unit_number = 0;
-    dnarepnode = (rep->get_dna_replic_reports())->get_first();
-    unitnode   = (indiv->get_genetic_unit_list())->get_first();
-
-
-    if ( check_now )
-    {
-#ifndef __NO_X
-      exp_manager_backup = new ae_exp_manager_X11();
-#else
-      exp_manager_backup = new ae_exp_manager();
-#endif
-      exp_manager_backup->load( num_gener, false, true, false );
-      stored_indiv = new ae_individual( * (ae_individual *)exp_manager_backup->get_indiv_by_id( index ), false );
-      stored_unit_node = stored_indiv->get_genetic_unit_list()->get_first();
-    }
-
-
-    while ( dnarepnode != NULL )
-    {
-      assert( unitnode != NULL );
-
-      dnarep = dnarepnode->get_obj();
-      unit   = unitnode->get_obj();
-
-      unit->get_dna()->set_replic_report( dnarep );
-
-      update_pointers_in_trees(gene_trees, unit); // because of the reevaluate at each new generation (envir. variation possible)
-
-      // ***************************************
-      //             Transfer events
-      // ***************************************
-
-      // TO DO
-     /*
-      mnode = dnarep->get_HT()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        unit->compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment);
-
-
-        unit->get_dna()->undergo_this_mutation( mut );
-        indiv->reevaluate(env);
-
-
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-
-        mut->get_generic_description_string( mut_descr_string );
-        fprintf( output, "%"PRId32" %"PRId32" %s %"PRId32" %.15f  %"PRId32" %"PRId32" %"PRId32" \n",\
-                 num_gener, genetic_unit_number, \
-                 mut_descr_string, unitlen_before, \
-                 impact_on_metabolic_error, nb_genes_at_breakpoints, nb_genes_in_segment, nb_genes_in_replaced_segment );
-
-
-
-        mnode = mnode->get_next();
-      } */
-
-
-      // ***************************************
-      //           Rearrangement events
-      // ***************************************
-
-      mnode = dnarep->get_rearrangements()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        anticipate_mutation_effect_on_genes_in_trees(gene_trees, mut, unitlen_before);
-
-        unit->get_dna()->undergo_this_mutation( mut );
-
-        indiv->reevaluate(env);
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-        register_actual_mutation_effect_on_genes_in_trees(gene_trees, mut, unit, num_gener, impact_on_metabolic_error);
-
-        /* New genes that have been created "from scratch", i.e. not by duplication => new gene tree */
-        prot_node = (unit->get_protein_list()[LEADING])->get_first();
-        while (prot_node != NULL)
-          {
-            prot = prot_node->get_obj();
-            search_protein_in_gene_trees(gene_trees, prot, &genetree, &genetreenode);
-            if (genetreenode == NULL)
-              {
-                gene_trees->add(new ae_gene_tree(num_gener, prot, mut));
-              }
-            prot_node = prot_node->get_next();
-          }
-         prot_node = (unit->get_protein_list()[LAGGING])->get_first();
-         while (prot_node != NULL)
-          {
-            prot = prot_node->get_obj();
-            search_protein_in_gene_trees(gene_trees, prot, &genetree, &genetreenode);
-            if (genetreenode == NULL)
-              {
-                gene_trees->add(new ae_gene_tree(num_gener, prot, mut));
-              }
-            prot_node = prot_node->get_next();
-          }
-         // print_gene_trees_to_screen(gene_trees);// DEBUG
-         // indiv->print_protein_list(); // DEBUG
-         mnode = mnode->get_next();
-      }
-
-
-      // ***************************************
-      // Local events (point mutations & small indels)
-      // ***************************************
-
-      mnode = dnarep->get_mutations()->get_first();
-      while ( mnode != NULL )
-      {
-        mut = (ae_mutation *) mnode->get_obj();
-
-        metabolic_error_before = indiv->get_dist_to_target_by_feature( METABOLISM );
-        unitlen_before = unit->get_dna()->get_length();
-        anticipate_mutation_effect_on_genes_in_trees(gene_trees, mut, unitlen_before);
-        unit->get_dna()->undergo_this_mutation( mut );
-
-        indiv->reevaluate(env);
-        metabolic_error_after = indiv->get_dist_to_target_by_feature( METABOLISM );
-        impact_on_metabolic_error = metabolic_error_after - metabolic_error_before;
-
-        register_actual_mutation_effect_on_genes_in_trees(gene_trees, mut, unit, num_gener, impact_on_metabolic_error);
-
-        /* New genes that have been created "from scratch", i.e. not by duplication => new gene tree */
-        prot_node = (unit->get_protein_list()[LEADING])->get_first();
-        while (prot_node != NULL)
-          {
-            prot = prot_node->get_obj();
-            search_protein_in_gene_trees(gene_trees, prot, &genetree, &genetreenode);
-            if (genetreenode == NULL)
-              {
-                gene_trees->add(new ae_gene_tree(num_gener, prot, mut));
-              }
-            prot_node = prot_node->get_next();
-          }
-         prot_node = (unit->get_protein_list()[LAGGING])->get_first();
-         while (prot_node != NULL)
-          {
-            prot = prot_node->get_obj();
-            search_protein_in_gene_trees(gene_trees, prot, &genetree, &genetreenode);
-            if (genetreenode == NULL)
-              {
-                gene_trees->add(new ae_gene_tree(num_gener, prot,  mut));
-              }
-            prot_node = prot_node->get_next();
-          }
-
-         // print_gene_trees_to_screen(gene_trees);// DEBUG
-         // indiv->print_protein_list(); // DEBUG
-         mnode = mnode->get_next();
-      }
-
-      if ( check_now && ae_utils::mod(num_gener, backup_step) == 0)
-      {
-        if ( verbose )
-        {
-          printf("Checking the sequence of the unit...");
-          fflush(NULL);
-        }
-
-        assert( stored_unit_node != NULL );
-        stored_unit = (ae_genetic_unit *) stored_unit_node->get_obj();
-
-        char * str1 = new char[unit->get_dna()->get_length() + 1];
-        memcpy(str1, unit->get_dna()->get_data(), \
-               unit->get_dna()->get_length()*sizeof(char));
-        str1[unit->get_dna()->get_length()] = '\0';
-
-        char * str2 = new char[(stored_unit->get_dna())->get_length() + 1];
-        memcpy(str2, (stored_unit->get_dna())->get_data(), (stored_unit->get_dna())->get_length()*sizeof(char));
-        str2[(stored_unit->get_dna())->get_length()] = '\0';
-
-        if(strncmp(str1,str2, (stored_unit->get_dna())->get_length())==0)
-        {
-          if ( verbose ) printf(" OK\n");
-        }
-        else
-        {
-          if ( verbose ) printf( " ERROR !\n" );
-          fprintf( stderr, "Error: the rebuilt unit is not the same as \n");
-          fprintf( stderr, "the one saved at generation %"PRId32"... ", begin_gener );
-          fprintf( stderr, "Rebuilt unit : %zu bp\n %s\n", strlen(str1), str1 );
-          fprintf( stderr, "Stored unit  : %zu bp\n %s\n", strlen(str2), str2 );
-          delete [] str1;
-          delete [] str2;
-          gzclose(lineage_file);
-          delete indiv;
-          delete stored_indiv;
-          delete exp_manager_backup;
-          delete exp_manager;
-          exit(EXIT_FAILURE);
-        }
-
-        delete [] str1;
-        delete [] str2;
-
-        stored_unit_node = stored_unit_node->get_next();
-      }
-
-
-      dnarepnode = dnarepnode->get_next();
-      unitnode = unitnode->get_next();
-      genetic_unit_number ++;
-    }
-
-    assert( unitnode == NULL );
-
-
-    if ( verbose ) printf(" OK\n");
-
-    delete rep;
-
-    if ( check_now && ae_utils::mod(num_gener, backup_step) == 0 )
-    {
-      assert(stored_unit_node == NULL);
-      delete stored_indiv;
-      delete exp_manager_backup;
-    }
-  }
-
-  set_end_gener_if_active_leaves_in_trees(gene_trees, end_gener);
-  write_gene_trees_to_files(gene_trees, end_gener);
-  gene_trees->erase(true);
-  delete gene_trees;
-
-  gzclose(lineage_file);
-  delete exp_manager;
-  delete indiv;
-  delete env;
-
-  exit(EXIT_SUCCESS);
-
-}
-
-
-
-
-
-
-void search_protein_in_gene_trees(ae_list<ae_gene_tree*> * gene_trees, ae_protein * prot, ae_gene_tree ** resultTree, ae_gene_tree_node ** resultNode)
-{
-  fflush(stdout);
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  ae_gene_tree_node * result = NULL;
-  int32_t tree_number = 0;
-  while ((n!= NULL) && (result==NULL))
-    {
-      tree = n->get_obj();
-      result = tree->search_in_leaves(prot);
-      n = n->get_next();
-      tree_number++;
-    }
-
-  if(result != NULL)
-    {
-      *resultTree = tree;
-      *resultNode = result;
-    }
-  else
-    {
-      *resultTree = NULL;
-      *resultNode = NULL;
-    }
-}
-
-
-
-void update_pointers_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_genetic_unit * unit)
-{
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      tree->update_pointers_in_tree_leaves(unit);
-      n = n->get_next();
-    }
-}
-
-
-void anticipate_mutation_effect_on_genes_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_mutation * mut, int32_t unitlen_before)
-{
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      tree->anticipate_mutation_effect_on_genes_in_tree_leaves(mut, unitlen_before);
-      n = n->get_next();
-    }
-}
-
-void register_actual_mutation_effect_on_genes_in_trees(ae_list<ae_gene_tree*> * gene_trees, ae_mutation * mut, ae_genetic_unit * unit, int32_t gener, double impact_on_metabolic_error)
-{
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      tree->register_actual_mutation_effect_on_genes_in_tree_leaves(mut, unit, gener, impact_on_metabolic_error);
-      n = n->get_next();
-    }
-
-}
-
-
-
-void set_end_gener_if_active_leaves_in_trees(ae_list<ae_gene_tree*> * gene_trees, int32_t gener)
-{
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      tree->set_end_gener_if_active_leaves(gener);
-      n = n->get_next();
-    }
-}
-
-
-void print_gene_trees_to_screen(ae_list<ae_gene_tree*> * gene_trees)
-{
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree* tree = NULL;
-  int32_t tree_number = 0;
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      printf("Content of tree %d :\n", tree_number);
-      tree->print_to_screen();
-      n = n->get_next();
-      tree_number++;
-    }
-}
-
-
-void write_gene_trees_to_files(ae_list<ae_gene_tree*> * gene_trees, int32_t end_gener)
-{
-  // Prepare the directory for the outputs files related to the gene trees
-  char directory_name[] = "gene_trees";
-
-  // Check whether the directory already exists and is writable
-  if ( access( directory_name, F_OK ) == 0 )
-    {
-      //       struct stat status;
-      //       stat( directory_name, &status );
-      //       if ( status.st_mode & S_IFDIR ) cout << "The directory exists." << endl;
-      //       else cout << "This path is a file." << endl;
-
-      if ( access( directory_name, X_OK | W_OK) != 0 )
-        {
-          fprintf(stderr, "Error: cannot enter or write in directory %s.\n", directory_name);
-          exit( EXIT_FAILURE );
-        }
-    }
-  else
-    {
-      // Create the directory with permissions : rwx r-x r-x
-      if ( mkdir( directory_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0 )
-        {
-          fprintf(stderr, "Error: cannot create directory %s.\n", directory_name);
-          exit( EXIT_FAILURE );
-        }
-    }
-
-
-  FILE * tree_statistics_file = fopen("gene_trees/gene_tree_statistics.txt", "w");
-  if (tree_statistics_file == NULL)
-    {
-      fprintf(stderr, "Error: cannot create file gene_trees/gene_tree_statistics.txt.\n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(tree_statistics_file, "treeID creationType beginGener endGener nbNodes nbInternalNodes nbLeaves nbActiveLeaves\n");
-
-
-  FILE * nodeattr_tabular_file = fopen("gene_trees/nodeattr_tabular.txt", "w");
-  if (nodeattr_tabular_file == NULL)
-    {
-      fprintf(stderr, "Error: cannot create file gene_trees/nodeattr_tabular.txt.\n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(nodeattr_tabular_file, "treeID nodeID parentID leftchildID rightchildID nodeCreationDate dnaCreationDate nodeStatus geneLossOrDupDate strand shineDalPos nbProm meanTriangle widthTriangle heightTriangle concentration nbMutTot nbLocalmutUpstreamNeutral nbLocalmutUpstreamBenef nbLocalmutUpstreamDelet nbLocalmutCdsNeutral nbLocalmutCdsBenef nbLocalmutCdsDelet nbRearUpstreamNeutral nbRearUpstreamBenef nbRearUpstreamDelet nbRearCdsNeutral nbRearCdsBenef nbRearCdsDelet\n");
-
-  char topol_file_name[128];
-  char node_attr_file_name[128];
-  ae_list_node<ae_gene_tree*> * n = gene_trees->get_first();
-  ae_gene_tree * tree = NULL;
-  int32_t tree_number = 0;
-
-  while (n!= NULL)
-    {
-      tree = n->get_obj();
-      fprintf(tree_statistics_file, "%"PRId32" ", tree_number);
-      if (tree->get_creation_type() == INITIALIZATION)  fprintf(tree_statistics_file, "INITIALIZATION ");
-      else if (tree->get_creation_type() == LOCAL_MUTATION)  fprintf(tree_statistics_file, "LOCAL_MUTATION ");
-      else if (tree->get_creation_type() == REARRANGEMENT)  fprintf(tree_statistics_file, "REARRANGEMENT ");
-      else fprintf(tree_statistics_file, "TRANSFER ");
-      fprintf(tree_statistics_file, "%"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32" %"PRId32"\n", tree->get_begin_gener(), tree->get_end_gener(), tree->get_total_nb_nodes(), tree->get_nb_internal_nodes(), tree->get_nb_leaves(), tree->get_nb_active_leaves());
-      sprintf(topol_file_name, "gene_trees/genetree%06"PRId32"-topology.tre", tree_number);
-      sprintf(node_attr_file_name, "gene_trees/genetree%06"PRId32"-nodeattr.txt", tree_number);
-      tree->write_to_files(topol_file_name, node_attr_file_name, end_gener);
-      tree->write_nodes_in_tabular_file(tree_number, nodeattr_tabular_file);
-      n = n->get_next();
-      tree_number ++;
-    }
-
-  fclose(tree_statistics_file);
-  fclose(nodeattr_tabular_file);
-}
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*                 Gene families post-treatment program                 * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "Usage : rgene_families -h\n");
-  printf( "or :    rgene_families [-vn] -f lineage_file \n" );
-#else
-  printf( "Usage : gene_families -h\n");
-  printf( "or :    gene_families [-vn] -f lineage_file \n" );
-#endif
-  printf( "\n" );
-  printf( "This program traces the evolution of gene families on a lineage.\n" );
-  printf( "of lineage_file\n" );
-  printf( "\n" );
-  printf( "WARNING: This program should not be used for simulations run with several genetic units\n" );
-  printf( "(eg chromosome + plasmids). It works only for simulations with only a single chromosome.\n" );
-  printf( "\n" );
-  printf( "\t-h or --help       : Display this help.\n" );
-  printf( "\n" );
-  printf( "\t-v or --verbose    : Be verbose, listing generations as they are \n" );
-  printf( "\t                       treated.\n" );
-  printf( "\n" );
-  printf( "\t-n or --nocheck    : Disable genome sequence checking. Makes the \n");
-  printf( "\t                       program faster, but it is not recommended. \n");
-  printf( "\t                       It is better to let the program check that \n");
-  printf( "\t                       when we rebuild the genomes of the ancestors\n");
-  printf( "\t                       from the lineage file, we get the same sequences\n");
-  printf( "\t                       as those stored in the backup files.\n" );
-  printf( "\n" );
-  printf( "\t-c or --fullcheck  : Will perform the genome and environment checks every\n" );
-  printf( "\t                       <BACKUP_STEP> generations. Default behaviour is\n" );
-  printf( "\t                       lighter as it only perform sthese checks at the\n" );
-  printf( "\t                       ending generation.\n" );
-  printf( "\n" );
-  printf( "\t-f lineage_file or --file lineage_file : \n" );
-  printf( "\t                       Compute the fixed mutations of the individuals within lineage_file.\n" );
-  printf( "\n" );
-  printf( "\t-t tolerance or --tolerance tolerance : \n");
-  printf( "\t                       Tolerance used to compare the replayed environment to environment in backup\n");
-  printf( "\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
diff --git a/src/post_treatments/lineage.cpp b/src/post_treatments/lineage.cpp
index 4fdbee2..2e106b6 100644
--- a/src/post_treatments/lineage.cpp
+++ b/src/post_treatments/lineage.cpp
@@ -22,193 +22,93 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
-//*****************************************************************************
-
-
+// ****************************************************************************
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cerrno>
+#include <cinttypes>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <errno.h>
-#include <inttypes.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <zlib.h>
 #include <sys/stat.h>
+#include <getopt.h>
 
+#include <list>
 
+#include "aevol.h"
 
+using namespace aevol;
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_macros.h>
-#include <ae_utils.h>
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-#include <ae_individual.h>
-#include <ae_genetic_unit.h>
-#include <ae_list.h>
-#include <ae_tree.h>
-#include <ae_replication_report.h>
-#include <ae_dna_replic_report.h>
-#include <ae_mutation.h>
-//#include <ae_param_loader.h>
-
-
-
-
-enum check_type
-{
-  FULL_CHECK  = 0,
-  LIGHT_CHECK = 1,
-  NO_CHECK    = 2
-};
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
+// Helper functions
 void print_help(char* prog_path);
-void print_version( void );
-
-
-
-
-
-int main(int argc, char** argv)
-{
-  // The output file (lineage.ae or lineage.rae) contains the following information:
+void interpret_cmd_line_options(int argc, char* argv[]);
+
+// Command-line option variables
+static bool full_check = false;
+static bool verbose = false;
+static int64_t t0 = 0;
+static int64_t t_end = -1;
+static int32_t final_indiv_index = -1;
+static int32_t final_indiv_rank  = -1;
+static char tree_file_name[255]; // TODO(dpa) remove magic number
+
+int main(int argc, char** argv) {
+  // The output file (lineage.ae) contains the following information:
+  // You may check that this information is up-to-date by searching
+  // "lineage_file" in this source file
   //
-  // - common data                                                (ae_common::write_to_backup)
-  // - begin gener                                                (int32_t)
-  // - end gener                                                  (int32_t)
-  // - final individual index                                     (int32_t)
-  // - initial genome size                                        (int32_t)
-  // - initial ancestor (nb genetic units + sequences)            (ae_individual::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+1 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+2 (ae_replic_report::write_to_backup)
-  // - replication report of ancestor at generation begin_gener+3 (ae_replic_report::write_to_backup)
+  // - t0
+  // - t_end
+  // - final individual index
+  // - final individual rank
+  // - initial_ancestor information (including its genome)
+  // - replication report of ancestor at generation t0+1
+  // - replication report of ancestor at generation t0+2
+  // - replication report of ancestor at generation t0+3
   // - ...
-  // - replication report of ancestor at generation end_gener     (ae_replic_report::write_to_backup)
-
-
-  printf("\n  WARNING : Parameters' change in the middle of a simulation is not managed.\n");
-
+  // - replication report of ancestor at generation t_end
 
-  // =====================
-  //  Parse command line
-  // =====================
+  interpret_cmd_line_options(argc, argv);
 
-  // Default values
-  check_type  check_genome      = LIGHT_CHECK;
-  bool        verbose           = false;
-  int32_t     begin_gener       = 0;
-  int32_t     end_gener         = -1;
-  int32_t     final_indiv_index = -1;
-  int32_t     final_indiv_rank  = -1;
-  char tree_file_name[50];
-
-  const char * short_options = "hVvncb:i:r:e:";
-  static struct option long_options[] = {
-    {"help",      no_argument,       NULL,  'h'},
-    {"version",   no_argument,       NULL,  'V'},
-    {"verbose",   no_argument,       NULL,  'v'},
-    {"nocheck",   no_argument,       NULL,  'n'},
-    {"fullcheck", no_argument,       NULL,  'c'},
-    {"begin",     required_argument, NULL,  'b'},
-    {"index",     required_argument, NULL,  'i'},
-    {"rank",      required_argument, NULL,  'r'},
-    {"end",       required_argument,  NULL, 'e' },
-    {0, 0, 0, 0}
-  };
-
-  int option;
-  while( (option = getopt_long(argc, argv, short_options, long_options, NULL)) != -1 )
-  {
-    switch( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'v' : verbose = true;                    break;
-      case 'n' : check_genome = NO_CHECK;           break;
-      case 'c' : check_genome = FULL_CHECK;         break;
-      case 'b' : begin_gener  = atol(optarg);       break;
-      case 'i' : final_indiv_index  = atol(optarg); break;
-      case 'r' : final_indiv_rank  = atol(optarg);  break;
-      case 'e' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -e or --end : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-
-        end_gener = atol( optarg );
-
-        break;
-      }
-    }
-  }
-
-  if ( end_gener == -1 )
-  {
-    printf( "%s: error: You must provide a generation number.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
+  printf("\n  WARNING : Parameter change in the middle of a simulation is not managed.\n");
 
   // Load the simulation
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-  exp_manager->load( end_gener, false, true, false );
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(t_end, true, false);
 
-  if ( exp_manager->get_tree_mode() == LIGHT )
-  {
-    printf( "%s: error: The light tree mode is not managed", argv[0] );
-    exit( EXIT_FAILURE );
+  // Check that the tree was recorded
+  if (not exp_manager->record_tree()) {
+    Utils::ExitWithUsrMsg("The phylogenetic tree wasn't recorded during "
+                          "evolution, could not reconstruct the lineage");
   }
 
-  int32_t tree_step = exp_manager->get_tree_step();
+  int64_t tree_step = exp_manager->tree_step();
 
   //delete exp_manager;
 
 
   // The tree
-  ae_tree * tree = NULL;
+  Tree* tree = nullptr;
 
   // Indices, ranks and replication reports of the individuals in the lineage
-  int32_t *                 indices = new int32_t[end_gener - begin_gener + 1];
-  //~ int32_t *                 ranks   = new int32_t[end_gener - begin_gener + 1];
-  ae_replication_report **  reports = new ae_replication_report*[end_gener - begin_gener];
-  // NB: we do not need the report of the ancestor at generation begin_gener
-  // (it might be the generation 0, for which we have no reports)
-  // reports[0] = how ancestor at generation begin_gener + 1 was created
-  // reports[i] = how ancestor at generation begin_gener + i + 1 was created
-  // reports[end_gener - begin_gener - 1] = how the final individual was created
+  int32_t* indices = new int32_t[t_end - t0 + 1];
+  ReplicationReport** reports = new ReplicationReport*[t_end - t0];
+  // NB: we do not need the report of the ancestor at time t0 since we have
+  // retrieved the individual itself from the initial backup
+  // (plus it might be the generation 0, for which we have no reports)
+  // reports[0] = how ancestor at t0 + 1 was created
+  // reports[i] = how ancestor at t0 + i + 1 was created
+  // reports[t_end - t0 - 1] = how the final individual was created
   //
-  //            -----------------------------------------------------------------------------------------
-  //  reports  | gener_0 => gener_1 | gener_1 => gener_2 | ... | gener_n-1 => gener_n | //////////////// |
-  //            -----------------------------------------------------------------------------------------
-  //  indices  |  index at gener_0  |  index at gener_1  | ... |  index at gener_n-1  | index at gener_n |
-  //            -----------------------------------------------------------------------------------------
+  //           ---------------------------------------------------------------
+  //  reports |  t0 => t1   |  t1 => t2   |...| t_n-1 => t_n   | XXXXXXXXXXXX |
+  //           ---------------------------------------------------------------
+  //  indices | index at t0 | index at t1 |...| index at t_n-1 | index at t_n |
+  //           ---------------------------------------------------------------
 
 
 
@@ -216,73 +116,69 @@ int main(int argc, char** argv)
   //  Load the last tree file
   // =========================
 
-  if ( verbose )
-  {
-    printf( "\n\n" );
-    printf( "====================================\n" );
-    printf( " Loading the last tree file ... " );
-    fflush( stdout );
+  if (verbose) {
+    printf("\n\n");
+    printf("====================================\n");
+    printf(" Loading the last tree file ... ");
+    fflush(stdout);
   }
 
 
-  // Example for ae_common::rec_params->get_tree_step() == 100 :
+  // Example for ae_common::rec_params->tree_step() == 100 :
   //
-  // tree_000100.ae ==>  generations   1 to 100.
-  // tree_000200.ae ==>  generations 101 to 200.
-  // tree_000300.ae ==>  generations 201 to 300.
+  // tree_000100.ae ==>  timesteps 1 to 100.
+  // tree_000200.ae ==>  timesteps 101 to 200.
+  // tree_000300.ae ==>  timesteps 201 to 300.
   // etc.
   //
-  // Thus, the information for generation end_gener are located
-  // in the file called (end_gener/ae_common::rec_params->get_tree_step() + 1) * ae_common::rec_params->get_tree_step(),
-  // except if end_gener%ae_common::rec_params->get_tree_step()==0.
 
   #ifdef __REGUL
-    sprintf( tree_file_name,"tree/tree_%06"PRId32".rae", end_gener );
+    sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", t_end);
   #else
-    sprintf( tree_file_name,"tree/tree_%06"PRId32".ae", end_gener );
+    sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".ae", t_end);
   #endif
-  char pop_file_name[255];
-  sprintf( pop_file_name, POP_FNAME_FORMAT, end_gener );
 
-  tree = new ae_tree( exp_manager, tree_file_name );
+  tree = new Tree(exp_manager, tree_file_name);
 
-  if ( verbose )
-  {
+  if (verbose) {
     printf("OK\n");
     printf("====================================\n");
   }
 
 
   // ============================================================================
-  //  Find the index of the final individual and retreive its replication report
+  //  Find the index of the final individual and retrieve its replication report
   // ============================================================================
-  if ( final_indiv_index != -1 )
-  {
+  if (final_indiv_index != -1) {
     // The index was directly provided, get the replication report and update the indices and ranks tables
-    reports[end_gener - begin_gener - 1] = new ae_replication_report( *(tree->get_report_by_index(end_gener, final_indiv_index)) );
-    final_indiv_rank = reports[end_gener - begin_gener - 1]->get_rank();
+    reports[t_end - t0 - 1] =
+        new ReplicationReport(*(tree->report_by_index(t_end,
+                                                      final_indiv_index)));
+    final_indiv_rank = reports[t_end - t0 - 1]->rank();
 
-    indices[end_gener - begin_gener]  = final_indiv_index;
-    //~ ranks[end_gener - begin_gener]    = final_indiv_rank;
+    indices[t_end - t0]  = final_indiv_index;
   }
-  else
-  {
-    if ( final_indiv_rank == -1 )
-    {
+  else {
+    if (final_indiv_rank == -1) {
       // No index nor rank was given in the command line.
       // By default, we construct the lineage of the best individual, the rank of which
       // is simply the number of individuals in the population.
-      final_indiv_rank = tree->get_nb_indivs( end_gener );
+      final_indiv_rank = exp_manager->nb_indivs();
     }
 
-    reports[end_gener - begin_gener - 1] = new ae_replication_report( *(tree->get_report_by_rank(end_gener, final_indiv_rank)) );
-    final_indiv_index = reports[end_gener - begin_gener - 1]->get_id();
+    // Retrieve the replication report of the individual of interest (at t_end)
+    reports[t_end - t0 - 1] =
+        new ReplicationReport(*(tree->report_by_rank(t_end, final_indiv_rank)));
+    final_indiv_index = reports[t_end - t0 - 1]->id();
 
-    indices[end_gener - begin_gener]  = final_indiv_index;
+    indices[t_end - t0]  = final_indiv_index;
     //~ ranks[end_gener - begin_gener]    = final_indiv_rank;
   }
 
-  if ( verbose ) printf( "The final individual has the index %"PRId32" (rank %"PRId32")\n", final_indiv_index, final_indiv_rank );
+  if (verbose) {
+    printf("The final individual has index %" PRId32
+           " (rank %" PRId32 ")\n", final_indiv_index, final_indiv_rank);
+  }
 
 
   // =======================
@@ -291,15 +187,18 @@ int main(int argc, char** argv)
   char output_file_name[101];
 
   #ifdef __REGUL
-    snprintf( output_file_name, 100, "lineage-b%06"PRId32"-e%06"PRId32"-i%"PRId32"-r%"PRId32".rae", begin_gener, end_gener, final_indiv_index, final_indiv_rank);
+    snprintf(output_file_name, 100,
+        "lineage-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 ".rae",
+        t0, t_end, final_indiv_index, final_indiv_rank);
   #else
-    snprintf( output_file_name, 100, "lineage-b%06"PRId32"-e%06"PRId32"-i%"PRId32"-r%"PRId32".ae",  begin_gener, end_gener, final_indiv_index, final_indiv_rank);
+    snprintf(output_file_name, 100,
+        "lineage-b" TIMESTEP_FORMAT "-e" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 ".ae",
+        t0, t_end, final_indiv_index, final_indiv_rank);
   #endif
 
   gzFile lineage_file = gzopen(output_file_name, "w");
-  if ( lineage_file == NULL )
-  {
-    fprintf(stderr, "File %s could not be created, exiting.\n", output_file_name);
+  if (lineage_file == nullptr) {
+    fprintf(stderr, "File %s could not be created.\n", output_file_name);
     fprintf(stderr, "Please check your permissions in this directory.\n");
     exit(EXIT_FAILURE);
   }
@@ -311,8 +210,7 @@ int main(int argc, char** argv)
   //  Retrieve the replication reports of the ancestors
   // ===================================================
 
-  if ( verbose )
-  {
+  if (verbose) {
     printf("\n\n\n");
     printf("======================================================================\n");
     printf(" Parsing tree files to retrieve the ancestors' replication reports... \n");
@@ -320,83 +218,75 @@ int main(int argc, char** argv)
   }
 
 
-  // Retreive the index of the first ancestor from the last replicatino report
-  indices[end_gener - begin_gener -1] = reports[end_gener - begin_gener -1]->get_parent_id();
+  // Retrieve the index of the first ancestor from the last replication report
+  indices[t_end - t0 -1] = reports[t_end - t0 - 1]->parent_id();
+
+  // For each generation (going backwards), retrieve the index of the parent and
+  // the corresponding replication report
+  for (int64_t i = t_end - t0 - 2 ; i >= 0 ; i--) {
+    int64_t t = t0 + i + 1;
 
-  int32_t i, num_gener;
-  for ( i = end_gener - begin_gener - 2 ; i >= 0 ; i-- )
-  {
     // We want to fill reports[i], that is to say, how the ancestor
     // at generation begin_gener + i + 1  was created
+    if (verbose)
+      printf("Getting the replication report for the ancestor at generation %" PRId64 "\n", t);
 
-    num_gener = begin_gener + i + 1;
-    if ( verbose ) printf( "Getting the replication report for the ancestor at generation %"PRId32"\n", num_gener );
-
-
-    if ( ae_utils::mod( num_gener, tree_step ) == 0 )
-    {
+    // If we've exhausted the current tree file, load the next one
+    if (Utils::mod(t, tree_step) == 0) {
       // Change the tree file
       delete tree;
 
       #ifdef __REGUL
-        sprintf( tree_file_name,"tree/tree_%06"PRId32".rae", num_gener );
+        sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".rae", t);
       #else
-        sprintf( tree_file_name,"tree/tree_%06"PRId32".ae",  num_gener );
+        sprintf(tree_file_name,"tree/tree_" TIMESTEP_FORMAT ".ae", t);
       #endif
 
-      sprintf( pop_file_name,       POP_FNAME_FORMAT,       num_gener );
-
-      tree = new ae_tree( exp_manager, tree_file_name );
+      tree = new Tree(exp_manager, tree_file_name);
     }
 
     // Copy the replication report of the ancestor
-    reports[i] = new ae_replication_report( *(tree->get_report_by_index(num_gener, indices[i + 1])) );
+    reports[i] =
+        new ReplicationReport(*(tree->report_by_index(t, indices[i + 1])));
 
     // Retreive the index and rank of the next ancestor from the report
-    indices[i] = reports[i]->get_parent_id();
+    indices[i] = reports[i]->parent_id();
   }
   delete exp_manager;
 
 
-  if ( verbose )  printf("OK\n");
+  if (verbose) printf("OK\n");
 
 
   // =============================================================================
-  //  Get the intial genome from the backup file, and write it in the output file
+  //  Get the initial genome from the backup file and write it in the output file
   // =============================================================================
 
-  if ( verbose )
-  {
+  if (verbose) {
     printf("\n\n\n");
     printf("=============================================== \n");
     printf(" Getting the initial genome sequence... ");
-    fflush(NULL);
+    fflush(nullptr);
   }
 
   // Load the simulation
-  #ifndef __NO_X
-    exp_manager = new ae_exp_manager_X11();
-  #else
-    exp_manager = new ae_exp_manager();
-  #endif
-  exp_manager->load( begin_gener, false, true, false );
+  exp_manager = new ExpManager();
+  exp_manager->load(t0, true, false);
 
   // Copy the initial ancestor
   // NB : The list of individuals is sorted according to the index
-  ae_individual * initial_ancestor_tmp  = exp_manager->get_indiv_by_id( indices[0] );
-  ae_individual * initial_ancestor      = new ae_individual( *initial_ancestor_tmp, false );
+  const Individual& initial_ancestor = *(exp_manager->indiv_by_id(indices[0]));
 
+  // Write file "header"
+  gzwrite(lineage_file, &t0, sizeof(t0));
+  gzwrite(lineage_file, &t_end, sizeof(t_end));
+  gzwrite(lineage_file, &final_indiv_index, sizeof(final_indiv_index));
+  gzwrite(lineage_file, &final_indiv_rank, sizeof(final_indiv_rank));
 
-  gzwrite( lineage_file, &begin_gener,        sizeof(begin_gener) );
-  gzwrite( lineage_file, &end_gener,          sizeof(end_gener)   );
-  gzwrite( lineage_file, &final_indiv_index,  sizeof(final_indiv_index) );
-  gzwrite( lineage_file, &final_indiv_rank,   sizeof(final_indiv_rank) );
+  initial_ancestor.grid_cell()->save(lineage_file);
 
-  initial_ancestor->save( lineage_file );
 
-
-  if ( verbose )
-  {
+  if (verbose) {
     printf("OK\n");
     printf("=============================================== \n");
   }
@@ -408,284 +298,248 @@ int main(int argc, char** argv)
   //  is available)
   // ===============================================================================
 
-  if ( verbose )
-  {
+  if (verbose) {
     printf("\n\n\n");
     printf("============================================================ \n");
     printf(" Write the replication reports in the output file... \n");
     printf("============================================================ \n");
   }
 
+  std::list<GeneticUnit>::const_iterator unit;
 
-  ae_list_node<ae_dna_replic_report*>*  report_node = NULL;
-  ae_list_node<ae_mutation*>*           mut_node = NULL;
-  ae_list_node<ae_genetic_unit*>*       gen_unit_node = NULL;
-  ae_dna_replic_report* rep   = NULL;
-  ae_mutation*          mut   = NULL;
-  ae_genetic_unit*      unit  = NULL;
-
-  ae_individual*   stored_indiv          = NULL;
-  ae_list_node<ae_genetic_unit*>*    stored_gen_unit_node  = NULL;
-  ae_genetic_unit* stored_gen_unit       = NULL;
+  Individual* stored_indiv = nullptr;
+  std::list<GeneticUnit>::const_iterator stored_gen_unit;
 
-  ae_exp_manager* exp_manager_backup = NULL;
+  ExpManager* exp_manager_backup = nullptr;
 
-  // NB: I must keep the genome encapsulated inside an ae_individual, because
+  // NB: I must keep the genome encapsulated inside an Individual, because
   // replaying the mutations has side effects on the list of promoters,
   // which is stored in the individual
   bool check_genome_now = false;
 
-  for ( i = 0 ; i < end_gener - begin_gener ; i++ )
-  {
+  for (int64_t i = 0 ; i < t_end - t0 ; i++) {
     // Where are we in time...
-    num_gener = begin_gener + i + 1;
+    int64_t t = t0 + i + 1;
 
     // Do we need to check the genome now?
-    check_genome_now =  ( ( check_genome == FULL_CHECK && ae_utils::mod( num_gener, tree_step ) == 0 ) ||
-                          ( check_genome == LIGHT_CHECK && num_gener == end_gener ) );
+    check_genome_now = t == t_end ||
+        (full_check && Utils::mod(t, exp_manager->backup_step()) == 0);
 
     // Write the replication report of the ancestor for current generation
-    if ( verbose )
-    {
-      printf( "Writing the replication report for generation %"PRId32" (built from indiv %"PRId32" at generation %"PRId32")\n",
-              num_gener, indices[i], num_gener-1 );
+    if (verbose) {
+      printf("Writing the replication report for t= %" PRId64
+             " (built from indiv %" PRId32 " at t= %" PRId64 ")\n",
+             t, indices[i], t-1);
     }
-    reports[i]->write_to_tree_file( lineage_file );
-    if ( verbose ) printf( " OK\n" );
+    reports[i]->write_to_tree_file(lineage_file);
+    if (verbose) printf(" OK\n");
 
 
-    if ( check_genome_now )
-    {
+    if (check_genome_now) {
       // Load the simulation
-  	  #ifndef __NO_X
-    	exp_manager_backup = new ae_exp_manager_X11();
-  	  #else
-    	exp_manager_backup = new ae_exp_manager();
-      #endif
-      exp_manager_backup->load( num_gener, false, true, false );
+      exp_manager_backup = new ExpManager();
+      exp_manager_backup->load(t, true, false);
 
       // Copy the ancestor from the backup
-      // NB : The list of individuals is sorted according to the index
-      ae_individual * stored_indiv_tmp  = exp_manager_backup->get_indiv_by_id( indices[i+1] );
-      stored_indiv = new ae_individual( *stored_indiv_tmp, false );
-      stored_gen_unit_node = stored_indiv->get_genetic_unit_list()->get_first();
+      stored_indiv = exp_manager_backup->indiv_by_id(indices[i + 1]);
+      stored_gen_unit = stored_indiv->genetic_unit_list().cbegin();
     }
 
 
     // Warning: this portion of code won't work if the number of units changes
     // during the evolution
 
-    report_node   = reports[i]->get_dna_replic_reports()->get_first();
-    gen_unit_node = initial_ancestor->get_genetic_unit_list()->get_first();
-
-    while ( report_node != NULL )
-    {
-      assert( gen_unit_node != NULL );
-
-      rep = (ae_dna_replic_report *) report_node->get_obj();
-      unit = (ae_genetic_unit *) gen_unit_node->get_obj();
-
-      mut_node = rep->get_HT()->get_first();
-      while ( mut_node != NULL )
-      {
-        mut = (ae_mutation *) mut_node->get_obj();
-        (unit->get_dna())->undergo_this_mutation( mut );
-        mut_node = mut_node->get_next();
-      }
-
-      mut_node = rep->get_rearrangements()->get_first();
-      while ( mut_node != NULL )
-      {
-        mut = (ae_mutation *) mut_node->get_obj();
-        (unit->get_dna())->undergo_this_mutation( mut );
-        mut_node = mut_node->get_next();
-      }
+    // Replay the mutations stored in the current replication report on the
+    // current genome
+    unit = initial_ancestor.genetic_unit_list().cbegin();
+    for (const auto& mut: reports[i]->dna_replic_report().HT()) {
+      (unit->dna())->undergo_this_mutation(*mut);
+    }
+    for (const auto& mut: reports[i]->dna_replic_report().rearrangements()) {
+      (unit->dna())->undergo_this_mutation(*mut);
+    }
+    for (const auto& mut: reports[i]->dna_replic_report().mutations()) {
+      unit->dna()->undergo_this_mutation(*mut);
+    }
 
-      mut_node = rep->get_mutations()->get_first();
-      while ( mut_node != NULL )
-      {
-        mut = (ae_mutation *) mut_node->get_obj();
-        unit->get_dna()->undergo_this_mutation( mut );
-        mut_node = mut_node->get_next();
+    if (check_genome_now) {
+      if (verbose) {
+        printf("Checking the sequence of the unit...");
+        fflush(stdout);
       }
+      assert(stored_gen_unit != stored_indiv->genetic_unit_list().cend());
 
-      if ( check_genome_now )
-      {
-        if ( verbose )
-        {
-          printf( "Checking the sequence of the unit..." );
-          fflush( stdout );
-        }
-        assert( stored_gen_unit_node != NULL );
-
-        stored_gen_unit = (ae_genetic_unit *) stored_gen_unit_node->get_obj();
-
-        char * str1 = new char[unit->get_dna()->get_length() + 1];
-        memcpy( str1, unit->get_dna()->get_data(), unit->get_dna()->get_length() * sizeof(char) );
-        str1[unit->get_dna()->get_length()] = '\0';
+      char * str1 = new char[unit->dna()->length() + 1];
+      memcpy(str1, unit->dna()->data(),
+             unit->dna()->length() * sizeof(char));
+      str1[unit->dna()->length()] = '\0';
 
-        char * str2 = new char[stored_gen_unit->get_dna()->get_length() + 1];
-        memcpy(str2, stored_gen_unit->get_dna()->get_data(), stored_gen_unit->get_dna()->get_length() * sizeof(char));
-        str2[stored_gen_unit->get_dna()->get_length()] = '\0';
-
-        if ( strncmp( str1, str2, stored_gen_unit->get_dna()->get_length() ) == 0 )
-        {
-          if ( verbose ) printf( " OK\n" );
-        }
-        else
-        {
-          if ( verbose ) printf( " ERROR !\n" );
-          fprintf( stderr, "Error: the rebuilt unit is not the same as \n");
-          fprintf( stderr, "the one stored in backup file at %"PRId32"\n", num_gener);
-          //fprintf( stderr, "Rebuilt unit : %"PRId32" bp\n %s\n", (int32_t)strlen(str1), str1 );
-          //fprintf( stderr, "Stored unit  : %"PRId32" bp\n %s\n", (int32_t)strlen(str2), str2 );
-          delete [] str1;
-          delete [] str2;
-          gzclose( lineage_file );
-          delete initial_ancestor;
-          delete stored_indiv;
-          delete exp_manager_backup;
-          delete exp_manager;
-          delete [] reports;
-          fflush( stdout );
-          exit(EXIT_FAILURE);
-        }
+      char * str2 = new char[stored_gen_unit->dna()->length() + 1];
+      memcpy(str2, stored_gen_unit->dna()->data(),
+             stored_gen_unit->dna()->length() * sizeof(char));
+      str2[stored_gen_unit->dna()->length()] = '\0';
 
+      if (strncmp(str1, str2, stored_gen_unit->dna()->length()) == 0) {
+        if (verbose) printf(" OK\n");
+      }
+      else {
+        if (verbose) printf(" ERROR !\n");
+        fprintf(stderr, "Error: the rebuilt unit is not the same as \n");
+        fprintf(stderr, "the one stored in backup file at %" PRId64 "\n", t);
+        fprintf(stderr, "Rebuilt unit : %" PRId32 " bp\n %s\n",
+                (int32_t)strlen(str1), str1);
+        fprintf(stderr, "Stored unit  : %" PRId32 " bp\n %s\n",
+                (int32_t)strlen(str2), str2);
         delete [] str1;
         delete [] str2;
-
-        stored_gen_unit_node = stored_gen_unit_node->get_next();
+        gzclose(lineage_file);
+        delete exp_manager_backup;
+        delete exp_manager;
+        delete [] reports;
+        fflush(stdout);
+        exit(EXIT_FAILURE);
       }
 
-      report_node   = report_node->get_next();
-      gen_unit_node = gen_unit_node->get_next();
+      delete [] str1;
+      delete [] str2;
+
+      ++stored_gen_unit;
     }
+    ++unit;
 
-    assert( gen_unit_node == NULL );
-    if ( check_genome_now )
-    {
-      assert( stored_gen_unit_node == NULL );
-      delete stored_indiv;
+    assert(unit == initial_ancestor.genetic_unit_list().cend());
+    if (check_genome_now) {
+      assert(stored_gen_unit == stored_indiv->genetic_unit_list().cend());
       delete exp_manager_backup;
     }
   }
 
 
   gzclose(lineage_file);
-  delete initial_ancestor;
   delete [] reports;
   delete exp_manager;
 
   exit(EXIT_SUCCESS);
-
 }
 
+/**
+ * \brief print help and exist
+ */
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
 
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  // default values :
-  // begin_gener = 0
-  // indiv  = best individual at generation end_gener
-
-  // there must be a genome backup file for begin_gener
-
-  // not relevant if crossover
-
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*                      Lineage post-treatment program                  * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "Usage : rlineage -h\n");
-  printf( "or :    rlineage [-vn] [-i index | -r rank] [-b gener1] -e end_gener \n" );
-#else
-  printf( "Usage : lineage -h\n");
-  printf( "or :    lineage [-vn] [-i index | -r rank] [-b gener1] -e end_gener \n" );
-#endif
-  printf( "\n" );
-#ifdef __REGUL
-  printf( "This program retrieves the ancestral lineage of an individual and writes \n" );
-  printf( "it in an output file called lineage.rae. Specifically, it retrieves the \n");
-  printf( "lineage of the individual of end_gener whose index is index, going \n" );
-  printf( "back in time up to gener1. This program requires at least one population backup\n" );
-  printf( "file (for the generation gener1), one environment backup file (for the generation gener1)\n" );
-  printf( "and all tree files for generations gener1 to end_gener.\n" );
-#else
-  printf( "This program retrieves the ancestral lineage of an individual and writes \n" );
-  printf( "it in an output file called lineage.ae. Specifically, it retrieves the \n");
-  printf( "lineage of the individual of end_gener whose index is index, going \n" );
-  printf( "back in time up to gener1. This program requires at least one population backup\n" );
-  printf( "file (for the generation gener1), one environment backup file (for the generation gener1)\n" );
-  printf( "and all tree files for generations gener1 to end_gener.\n" );
-#endif
-  printf( "\n" );
-  printf( "WARNING: This program should not be used for simulations run with lateral\n" );
-  printf( "transfer. When an individual has more than one parent, the notion of lineage\n" );
-  printf( "used here is not relevant.\n" );
-  printf( "\n" );
-  printf( "\t-h or --help    : Display this help.\n" );
-  printf( "\n" );
-  printf( "\t-v or --verbose : Be verbose, listing generations as they are \n" );
-  printf( "\t                  treated.\n" );
-  printf( "\n" );
-  printf( "\t-n or --nocheck    : Disable genome sequence checking. Makes the \n");
-  printf( "\t                       program faster, but it is not recommended. \n");
-  printf( "\t                       It is better to let the program check that \n");
-  printf( "\t                       when we rebuild the genomes of the ancestors\n");
-  printf( "\t                       from the lineage file, we get the same sequences\n");
-  printf( "\t                       as those stored in the backup files.\n" );
-  printf( "\n" );
-  printf( "\t-c or --fullcheck  : Will perform the genome checks every <BACKUP_STEP>\n" );
-  printf( "\t                       generations. Default behaviour is lighter as it\n" );
-  printf( "\t                       only performs these checks at the ending generation.\n" );
-  printf( "\n" );
-  printf( "\t-i index or --index index : \n" );
-  printf( "\t                  Retrieve the lineage of the individual whose\n" );
-  printf( "\t                  index is index. The index must be comprised \n" );
-  printf( "\t                  between 0 and N-1, with N the size of the \n" );
-  printf( "\t                  population at the ending generation. If neither\n" );
-  printf( "\t                  index nor rank are specified, the program computes \n" );
-  printf( "\t                  the lineage of the best individual of the ending \n" );
-  printf( "\t                  generation.\n");
-  printf( "\n" );
-  printf( "\t-r rank or --rank rank : \n" );
-  printf( "\t                  Retrieve the lineage of the individual whose\n" );
-  printf( "\t                  rank is rank. The rank must be comprised \n" );
-  printf( "\t                  between 1 and N, with N the size of the \n" );
-  printf( "\t                  population at the endind generation. If neither\n" );
-  printf( "\t                  index nor rank are specified, the program computes \n" );
-  printf( "\t                  the lineage of the best individual of the ending \n" );
-  printf( "\t                  generation.\n");
-  printf( "\n" );
-  printf( "\t-b gener1 or --begin gener1 : \n" );
-  printf( "\t                  Retrieve the lineage up to generation gener1.\n" );
-  printf( "\t                  There must be a genome backup file for this\n" );
-  printf( "\t                  generation. If not specified, the program \n" );
-  printf( "\t                  retrieves the lineage up to generation 0.\n");
-  printf( "\n" );
-  printf( "\t-e end_gener or --end end_gener : \n" );
-  printf( "\t                  Retrieve the lineage of the individual of end_gener \n" );
-  printf( "\n" );
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s:\n", prog_name);
+  printf("\tReconstruct the lineage of a given individual from the tree files\n");
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-b TIMESTEP] [-e TIMESTEP] [-I INDEX | -R RANK] [-F] [-v]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -b, --begin TIMESTEP\n");
+  printf("\tspecify time t0 up to which to reconstruct the lineage\n");
+  printf("  -e, --end TIMESTEP\n");
+  printf("\tspecify time t_end of the indiv whose lineage is to be reconstructed\n");
+  printf("  -I, --index INDEX\n");
+  printf("\tspecify the index of the indiv whose lineage is to be reconstructed\n");
+  printf("  -R, --rank RANK\n");
+  printf("\tspecify the rank of the indiv whose lineage is to be reconstructed\n");
+  printf("  -F, --full-check\n");
+  printf("\tperform genome checks whenever possible\n");
+  printf("  -v, --verbose\n\tbe verbose\n");
 }
 
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char * short_options = "hVb:e:FI:R:v";
+  static struct option long_options[] = {
+      {"help",      no_argument,       nullptr, 'h'},
+      {"version",   no_argument,       nullptr, 'V'},
+      {"begin",     required_argument, nullptr, 'b'},
+      {"end",       required_argument, nullptr, 'e'},
+      {"fullcheck", no_argument,       nullptr, 'F'},
+      {"index",     required_argument, nullptr, 'I'},
+      {"rank",      required_argument, nullptr, 'R'},
+      {"verbose",   no_argument,       nullptr, 'v'},
+      {0, 0, 0, 0}
+  };
 
-/*!
-  \brief Print aevol version number
+  // Get actual values of the command-line options
+  int option;
+  while((option = getopt_long(argc, argv, short_options,
+                              long_options, nullptr)) != -1) {
+    switch(option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 'b' : {
+        if (strcmp(optarg, "") == 0) {
+          printf("%s: error: Option -b or --begin : missing argument.\n",
+                 argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        t0  = atol(optarg);
+        break;
+      }
+      case 'e' : {
+        if (strcmp(optarg, "") == 0) {
+          printf("%s: error: Option -e or --end : missing argument.\n",
+                 argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        t_end = atol(optarg);
+        break;
+      }
+      case 'F' : {
+        full_check = true;
+        break;
+      }
+      case 'I' : {
+        final_indiv_index  = atoi(optarg);
+        break;
+      }
+      case 'R' : {
+        final_indiv_rank  = atoi(optarg);
+        break;
+      }
+      case 'v' : {
+        verbose = true;
+        break;
+      }
+      default : {
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
 
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
+  // If t_end wasn't provided, use default
+  if (t_end < 0) {
+    t_end = OutputManager::last_gener();
+  }
 }
diff --git a/src/post_treatments/mutagenesis.cpp b/src/post_treatments/mutagenesis.cpp
new file mode 100644
index 0000000..eba90f9
--- /dev/null
+++ b/src/post_treatments/mutagenesis.cpp
@@ -0,0 +1,1185 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+#include <cerrno>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+#include <cinttypes>
+#include <cmath>
+#include <cassert>
+#include <getopt.h>
+#include <sys/stat.h>
+#include <list>
+#include <zlib.h>
+
+#include "aevol.h"
+
+using std::list;
+
+using namespace aevol;
+
+// =================================================================
+//                     Command line option variables
+// =================================================================
+int32_t wanted_rank = -1;
+int32_t wanted_index = -1;
+int64_t num_gener = 0;
+int32_t mutation_type = 0;
+int32_t nb_mutants = -1;
+
+// =================================================================
+//                         Function declarations
+// =================================================================
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  // ------------------------------------------------------
+  //  Load the backup and get the individual to be mutated
+  // ------------------------------------------------------
+
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(num_gener, true, false);
+
+  if (exp_manager->output_m()->record_tree() == false) {
+    // The following instruction is needed to ensure that methods
+    // like ae_dna::do_deletion, ae_dna::do_inversion, etc
+    // will create ae_mutation objects (otherwise they return NULL)
+    exp_manager->output_m()->init_tree(exp_manager, 100);
+  }
+
+  if ((wanted_rank == -1) && (wanted_index == -1)) {
+    wanted_rank = exp_manager->nb_indivs();  // the best one has rank N
+  }
+
+  // TODO: factor with duplicated code in robustness.cpp
+  Individual* initial_indiv = nullptr;
+
+  { // (local scope for variable `indivs` used as a shorthand)
+    bool found = false;
+    int32_t current_rank = -1;
+    int32_t current_index = -1;
+    list<Individual*> indivs = exp_manager->indivs();
+    for (auto indiv = indivs.rbegin();
+         not found and indiv != indivs.rend(); ++indiv) {
+      current_index = (*indiv)->id();
+      current_rank = (*indiv)->rank();
+
+      if (wanted_index != -1 and current_index == wanted_index) {
+        found = true;
+        initial_indiv = (*indiv);
+        wanted_rank = current_rank;
+      }
+      else if (current_rank == wanted_rank) {
+        // no index was specified, we use the desired rank
+        found = true;
+        initial_indiv = (*indiv);
+        wanted_index = current_index;
+      }
+    }
+
+    if (not found) {
+      Utils::ExitWithUsrMsg("sorry, the individual you have requested has not "
+                            "been found");
+    }
+  }
+
+  initial_indiv->Evaluate();
+  initial_indiv->compute_statistical_data();
+  initial_indiv->compute_non_coding();
+
+  // ---------------------
+  //  Prepare the output
+  // ---------------------
+
+
+  char mutation_type_name[24];
+  switch (mutation_type) {
+    case SWITCH: {
+      snprintf(mutation_type_name, 23, "point-mutation");
+      break;
+    }
+    case S_INS: {
+      snprintf(mutation_type_name, 23, "small-insertion");
+      break;
+    }
+    case S_DEL: {
+      snprintf(mutation_type_name, 23, "small-deletion");
+      break;
+    }
+    case DUPL: {
+      snprintf(mutation_type_name, 23, "duplication");
+      break;
+    }
+    case DEL: {
+      snprintf(mutation_type_name, 23, "large-deletion");
+      break;
+    }
+    case TRANS: {
+      snprintf(mutation_type_name, 23, "translocation");
+      break;
+    }
+    case INV: {
+      snprintf(mutation_type_name, 23, "inversion");
+      break;
+    }
+    default: {
+      fprintf(stderr, "Error, unexpected mutation type.\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+
+  char directory_name[64];
+  snprintf(directory_name, 63, "analysis-generation_" TIMESTEP_FORMAT,
+           num_gener);
+
+  // Check whether the directory already exists and is writable
+  if (access(directory_name, F_OK) == 0) {
+    if (access(directory_name, X_OK | W_OK) != 0) {
+      fprintf(stderr, "Error: cannot enter or write in directory %s.\n",
+              directory_name);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else {
+    // Create the directory with permissions : rwx r-x r-x
+    if (mkdir(directory_name,
+              S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
+      fprintf(stderr, "Error: cannot create directory %s.\n", directory_name);
+      exit(EXIT_FAILURE);
+    }
+  }
+
+
+  char output_file_name[256];
+  snprintf(output_file_name, 255,
+           "%s/mutagenesis-t" TIMESTEP_FORMAT "-i%" PRId32 "-r%" PRId32 "-%s.out", \
+            directory_name, num_gener, wanted_index, wanted_rank,
+           mutation_type_name);
+
+  FILE* output = fopen(output_file_name, "w");
+  if (output == NULL) {
+    fprintf(stderr, "ERROR : Could not create the output file %s\n",
+            output_file_name);
+    exit(EXIT_FAILURE);
+  }
+
+
+  // Write the header
+
+  int16_t col = 1;
+
+  fprintf(output,
+          "# ####################################################################################################\n");
+  fprintf(output,
+          "#   Single %s mutants of individual %" PRId32 " (rank %" PRId32 ") at generation %" PRId64 "\n",
+          mutation_type_name, wanted_index, wanted_rank, num_gener);
+  fprintf(output,
+          "# ####################################################################################################\n");
+  fprintf(output,
+          "#  %" PRId16 ".  Mutation type    (0: switch, 1: smallins, 2: smalldel, 3:dupl, 4: del, 5:trans, 6:inv) \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Genetic unit which underwent the mutation (0 = chromosome) \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Length of this genetic unit before the event \n",
+          col);
+  col++;
+
+  switch (mutation_type) {
+    case SWITCH: {
+      // Even though not all five columns are relevant for point mutations, we still write them all
+      // to make the statistical analysis easier if other types of mutants are to be generated.
+      // This way, for a given experiment, the number of columns will be the same for all types of mutants.
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (position of the point mutation on the genetic unit) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (irrelevant for point mutations) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (irrelevant for point mutations) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for point mutations) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for point mutations) \n",
+              col);
+      col++;
+      break;
+    }
+    case S_INS: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (position of the small insertion on the genetic unit) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (irrelevant for small insertions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (irrelevant for small insertions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for small insertions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for small insertions) \n",
+              col);
+      col++;
+      break;
+    }
+    case S_DEL: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (position of the small deletion on the genetic unit) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (irrelevant for small deletions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (irrelevant for small deletions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for small deletions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for small deletions) \n",
+              col);
+      col++;
+      break;
+    }
+    case DUPL: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (begin of the duplicated segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (end of the duplicated segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (reinsertion point of the duplicate in the genetic unit) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for duplications) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for duplications) \n",
+              col);
+      col++;
+      break;
+    }
+    case DEL: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (begin of the deleted segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (end of the deleted segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (irrelevant for large deletions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for large deletions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for large deletions) \n",
+              col);
+      col++;
+      break;
+    }
+    case TRANS: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (begin of the excised segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (end of the excised segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (cutting point in the excised segment when reinserted) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (reinsertion point of the segment in the genetic unit) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (was the segment inverted when reinserted (0: no, 1: yes)) \n",
+              col);
+      col++;
+      break;
+    }
+    case INV: {
+      fprintf(output,
+              "#  %" PRId16 ".  pos0            (begin of the inverted segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos1            (end of the inverted segment) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos2            (irrelevant for inversions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  pos3            (irrelevant for inversions) \n",
+              col);
+      col++;
+      fprintf(output,
+              "#  %" PRId16 ".  invert          (irrelevant for inversions) \n",
+              col);
+      col++;
+      break;
+    }
+    default: {
+      fprintf(stderr, "Error: unexpected mutation type.\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+
+
+  if (initial_indiv->with_alignments()) {
+    fprintf(output,
+            "#  %" PRId16 ".  align_score1    (score that was needed for the rearrangement to occur)\n",
+            col);
+    col++;
+    fprintf(output,
+            "#  %" PRId16 ".  align_score2    (score for the reinsertion for translocations)\n",
+            col);
+    col++;
+  }
+
+
+  fprintf(output,
+          "#  %" PRId16 ".  Length of the {inserted, deleted, duplicated, translocated, inverted} segment \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of coding RNAs possibly disrupted by the breakpoint(s) \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of coding RNAs completely included in the segment \n",
+          col);
+  col++;
+  fprintf(output, "#  %" PRId16 ".  Metabolic error after the mutation \n",
+          col);
+  col++;
+
+  if (exp_manager->with_secretion()) {
+    fprintf(output, "#  %" PRId16 ".  Secretion error after the mutation \n",
+            col);
+    col++;
+  }
+
+  if ((exp_manager->with_plasmids()) &&
+      (exp_manager->tune_donor_ability() != 0.0)) {
+    fprintf(output,
+            "#  %" PRId16 ".  Error on the donor ability after the mutation \n",
+            col);
+    col++;
+  }
+
+  if ((exp_manager->with_plasmids()) &&
+      (exp_manager->tune_recipient_ability() != 0.0)) {
+    fprintf(output,
+            "#  %" PRId16 ".  Error on the recipient ability after the mutation \n",
+            col);
+    col++;
+  }
+
+  fprintf(output, "#  %" PRId16 ".  Total genome size after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of coding RNAs after the mutation \n", col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of non coding RNAs after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of functional coding sequences after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of non functional coding sequences after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of coding bases after the mutation \n", col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of transcribed but not translated bases after the mutation\n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of non transcribed bases after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of bases belonging to at least one coding RNA, after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "#  %" PRId16 ".  Number of bases not belonging to any coding RNA, after the mutation \n",
+          col);
+  col++;
+  fprintf(output,
+          "####################################################################################################################\n");
+  fprintf(output,
+          "#  Values for the initial individual [irr = irrelevant]: \n");
+  fprintf(output,
+          "####################################################################################################################\n");
+  fprintf(output, "#  ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr "); // genetic unit number (0 for the chromosome)
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  if (initial_indiv->with_alignments()) {
+    fprintf(output, "irr ");
+    fprintf(output, "irr ");
+  }
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "irr ");
+  fprintf(output, "%e ",
+          initial_indiv->dist_to_target_by_feature(METABOLISM));
+  if (exp_manager->with_secretion()) {
+    fprintf(output, "%e ",
+            initial_indiv->dist_to_target_by_feature(SECRETION));
+  }
+  if ((exp_manager->with_plasmids()) &&
+      (exp_manager->tune_donor_ability() != 0.0)) {
+    fprintf(output, "%e ", initial_indiv->dist_to_target_by_feature(DONOR));
+  }
+  if ((exp_manager->with_plasmids()) &&
+      (exp_manager->tune_recipient_ability() != 0.0)) {
+    fprintf(output, "%e ",
+            initial_indiv->dist_to_target_by_feature(RECIPIENT));
+  }
+  fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size());
+  fprintf(output, "%" PRId32 " ", initial_indiv->nb_coding_RNAs());
+  fprintf(output, "%" PRId32 " ", initial_indiv->nb_non_coding_RNAs());
+  fprintf(output, "%" PRId32 " ", initial_indiv->nb_functional_genes());
+  fprintf(output, "%" PRId32 " ", initial_indiv->nb_non_functional_genes());
+  fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() -
+                                  initial_indiv->nb_bases_in_0_CDS()); // coding bp
+  fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() -
+                                  initial_indiv->nb_bases_in_0_RNA() -
+                                  (initial_indiv->total_genome_size() -
+                                   initial_indiv->nb_bases_in_0_CDS())); // transcribed but not translated bp
+  fprintf(output, "%" PRId32 " ",
+          initial_indiv->nb_bases_in_0_RNA()); // not transcribed bp
+  fprintf(output, "%" PRId32 " ", initial_indiv->total_genome_size() -
+                                  initial_indiv->nb_bases_in_0_coding_RNA());
+  fprintf(output, "%" PRId32 " ",
+          initial_indiv->nb_bases_in_0_coding_RNA());
+  fprintf(output, "\n");
+  fprintf(output,
+          "####################################################################################################################\n");
+
+  // ---------------------------------------
+  //  Create the mutants and evaluate them
+  // ---------------------------------------
+
+  Individual* mutant = NULL;
+  Mutation* mut = NULL;
+  int32_t nb_genetic_units = initial_indiv->nb_genetic_units();
+  double* relative_lengths_genetic_units = NULL;
+  int32_t u = 0;
+  double alea, cumul;
+  int32_t pos, pos0, pos1, pos2, pos3;
+  int32_t mut_length;
+  int16_t align_score1, align_score2;
+  bool invert;
+  VisAVis* alignment_1 = NULL;
+  VisAVis* alignment_2 = NULL;
+  int32_t nb_pairs;
+  Dna* initial_dna = NULL;
+  int32_t initial_len;
+  bool rear_done;
+  int32_t nb_genes_at_breakpoints;
+  int32_t nb_genes_in_segment;
+  int32_t nb_genes_in_replaced_segment;
+  double metabolic_error_after = -1.0, secretion_error_after = -1.0;
+
+  if (mutation_type == SWITCH) {
+    // *********************  Exhaustive mutagenesis  *************************
+    pos0 = pos1 = pos2 = pos3 = -1;
+    mut_length = -1;
+    align_score1 = align_score2 = -1;
+    invert = false;
+    metabolic_error_after = -1.0;
+    secretion_error_after = -1.0;
+
+    for (const auto& gu: initial_indiv->genetic_unit_list()) {
+      initial_len = gu.dna()->length();
+
+      for (pos = 0; pos < initial_len; pos++) {
+        mutant = new Individual(*initial_indiv);
+        mutant->genetic_unit(u).dna()->do_switch(pos);
+        mut = new PointMutation(pos);
+        mut_length = 1;
+        pos0 = pos;
+
+        initial_indiv->genetic_unit_nonconst(
+            u).compute_nb_of_affected_genes(mut, nb_genes_at_breakpoints,
+                                            nb_genes_in_segment,
+                                            nb_genes_in_replaced_segment);
+
+        // Evaluate the mutant, compute its statistics
+        mutant->ReevaluateInContext(initial_indiv->habitat());
+        mutant->compute_statistical_data();
+        mutant->compute_non_coding();
+
+        metabolic_error_after = mutant->dist_to_target_by_feature(
+            METABOLISM);
+        if (exp_manager->with_secretion()) {
+          secretion_error_after = mutant->dist_to_target_by_feature(
+              SECRETION);
+        }
+
+        // Write the description of the mutant in the output file
+        fprintf(output, "%" PRId32 " ", mutation_type);
+        fprintf(output, "%" PRId32 " ",
+                u); // genetic unit number (0 for the chromosome)
+        fprintf(output, "%" PRId32 " ", initial_indiv->genetic_unit(
+            u).dna()->length()); // Length of GU before the event
+        fprintf(output, "%" PRId32 " ", pos0);
+        fprintf(output, "%" PRId32 " ", pos1);
+        fprintf(output, "%" PRId32 " ", pos2);
+        fprintf(output, "%" PRId32 " ", pos3);
+        if (invert) fprintf(output, "1 "); else fprintf(output, "0 ");
+        if (mutant->with_alignments()) {
+          fprintf(output, "%" PRId16 " ", align_score1);
+          fprintf(output, "%" PRId16 " ", align_score2);
+        }
+        fprintf(output, "%" PRId32 " ", mut_length);
+        fprintf(output, "%" PRId32 " ", nb_genes_at_breakpoints);
+        fprintf(output, "%" PRId32 " ", nb_genes_in_segment);
+        fprintf(output, "%e ", metabolic_error_after);
+        if (exp_manager->with_secretion()) {
+          fprintf(output, "%e ", secretion_error_after);
+        }
+        if ((exp_manager->with_plasmids()) &&
+            (exp_manager->tune_donor_ability() != 0.0)) {
+          fprintf(output, "%e ", mutant->dist_to_target_by_feature(DONOR));
+        }
+        if ((exp_manager->with_plasmids()) &&
+            (exp_manager->tune_recipient_ability() != 0.0)) {
+          fprintf(output, "%e ",
+                  mutant->dist_to_target_by_feature(RECIPIENT));
+        }
+        fprintf(output, "%" PRId32 " ", mutant->total_genome_size());
+        fprintf(output, "%" PRId32 " ", mutant->nb_coding_RNAs());
+        fprintf(output, "%" PRId32 " ", mutant->nb_non_coding_RNAs());
+        fprintf(output, "%" PRId32 " ", mutant->nb_functional_genes());
+        fprintf(output, "%" PRId32 " ", mutant->nb_non_functional_genes());
+        fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                        mutant->nb_bases_in_0_CDS()); // coding bp
+        fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                        mutant->nb_bases_in_0_RNA() -
+                                        (mutant->total_genome_size() -
+                                         mutant->nb_bases_in_0_CDS())); // transcribed but not translated bp
+        fprintf(output, "%" PRId32 " ",
+                mutant->nb_bases_in_0_RNA()); // not transcribed bp
+        fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                        mutant->nb_bases_in_0_coding_RNA());
+        fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_coding_RNA());
+        fprintf(output, "\n");
+
+        delete mutant;
+        delete mut;
+      }
+
+      u++;
+    }
+
+  }
+  else {
+    // *******************************  Sampling nb_mutants mutants  **********************************
+
+    relative_lengths_genetic_units = new double[nb_genetic_units];
+
+    for (const auto& gu: initial_indiv->genetic_unit_list())
+      relative_lengths_genetic_units[u++] =
+          gu.dna()->length() /
+          static_cast<double>(initial_indiv->total_genome_size());
+
+    for (int32_t i = 0; i < nb_mutants; i++) {
+      mutant = new Individual(*initial_indiv);
+
+      // Pick the genetic unit which will undergo the mutation
+      alea = mutant->mut_prng()->random();
+      u = 0;
+      cumul = relative_lengths_genetic_units[0];
+      while (alea > cumul) {
+        u++;
+        cumul += relative_lengths_genetic_units[u];
+      }
+
+
+      // Ask the genetic unit to perform the mutation and store it
+      pos0 = pos1 = pos2 = pos3 = -1;
+      mut_length = -1;
+      align_score1 = align_score2 = -1;
+      invert = false;
+
+      alignment_1 = NULL;
+      alignment_2 = NULL;
+      initial_dna = initial_indiv->genetic_unit(u).dna();
+      initial_len = initial_dna->length();
+      metabolic_error_after = -1.0;
+      secretion_error_after = -1.0;
+
+      switch (mutation_type) {
+        // Locally we need the precise type of the mutation. Outside of the
+        // switch, we will need the generic 'mut'. We could have static_casted
+        // 'mut' here but it felt better declaring a specific variable
+        // instead...
+        case S_INS: {
+          // cf. comment at top of switch statement
+          SmallInsertion* small_ins;
+          do {
+            mut = small_ins = mutant->genetic_unit(u).dna()->
+                do_small_insertion();
+          } while (mut == NULL);
+          pos0 = small_ins->pos();
+          mut_length = small_ins->length();
+          break;
+        }
+        case S_DEL: {
+          // cf. comment at top of switch statement
+          SmallDeletion* small_del;
+          do {
+            mut = small_del = mutant->genetic_unit(u).dna()->
+                do_small_deletion();
+          } while (mut == NULL);
+          pos0 = small_del->pos();
+          mut_length = small_del->length();
+          break;
+        }
+        case DUPL: {
+          // cf. comment at top of switch statement
+          Duplication* duplication;
+          if (mutant->with_alignments()) {
+            // TODO(dpa) Encapsulate in method do_duplication_align()
+            rear_done = false;
+            do {
+              do {
+                nb_pairs = initial_len;
+                alignment_1 = initial_dna->search_alignment(initial_dna,
+                                                            nb_pairs, DIRECT);
+              } while (alignment_1 == NULL);
+              mut_length = Utils::mod(
+                  alignment_1->i_2() - alignment_1->i_1(), initial_len);
+              rear_done = mutant->genetic_unit(u).dna()->do_duplication(
+                  alignment_1->i_1(), alignment_1->i_2(),
+                  alignment_1->i_2());
+            } while (!rear_done);
+
+            mut = duplication = new Duplication(alignment_1->i_1(),
+                                                alignment_1->i_2(),
+                                                alignment_1->i_2(),
+                                                mut_length,
+                                                alignment_1->score());
+          }
+          else {
+            do {
+              mut = duplication = mutant->genetic_unit(u).dna()->
+                  do_duplication();
+            } while (mut == NULL);
+          }
+
+          pos0 = duplication->pos1();
+          pos1 = duplication->pos2();
+          pos2 = duplication->pos3();
+          align_score1 = duplication->align_score();
+          mut_length = duplication->length();
+          break;
+        }
+        case DEL: {
+          // cf. comment at top of switch statement
+          Deletion* deletion;
+          if (mutant->with_alignments()) {
+            rear_done = false;
+            do {
+              do {
+                nb_pairs = initial_len;
+                alignment_1 = initial_dna->search_alignment(initial_dna,
+                                                            nb_pairs, DIRECT);
+              } while (alignment_1 == NULL);
+              mut_length = Utils::mod(
+                  alignment_1->i_2() - alignment_1->i_1(), initial_len);
+              rear_done = mutant->genetic_unit(u).dna()->do_deletion(
+                  alignment_1->i_1(), alignment_1->i_2());
+            } while (!rear_done);
+
+            mut = deletion = new Deletion(alignment_1->i_1(),
+                                          alignment_1->i_2(),
+                                          mut_length,
+                                          alignment_1->score());
+          }
+          else {
+            do {
+              mut = deletion = mutant->genetic_unit(u).dna()->
+                  do_deletion();
+            } while (mut == NULL);
+          }
+
+          pos0 = deletion->pos1();
+          pos1 = deletion->pos2();
+          align_score1 = deletion->align_score();
+          mut_length = deletion->length();
+          break;
+        }
+        case TRANS: {
+          // cf. comment at top of switch statement
+          Translocation* translocation;
+          // TO DO: problems might arise because the ae_mutation does not
+          //        record whether it was an intra- or interGU translocation
+
+          if (mutant->with_alignments()) {
+            // TODO(dpa) Encapsulate in method do_duplication_align()
+            rear_done = false;
+            do {
+              do {
+                nb_pairs = initial_len;
+                alignment_1 = initial_dna->search_alignment(initial_dna,
+                                                            nb_pairs, DIRECT);
+              } while (alignment_1 == NULL);
+              // Make sure the segment to be translocated doesn't contain OriC
+              // TODO(dpa) is that still necessary?
+              if (alignment_1->i_1() > alignment_1->i_2()) {
+                alignment_1->swap();
+              }
+              mut_length = Utils::mod(
+                  alignment_1->i_2() - alignment_1->i_1(), initial_len);
+
+              // Extract the segment to be translocated
+              GeneticUnit* tmp_segment = mutant->genetic_unit(
+                  u).dna()->extract_into_new_GU(alignment_1->i_1(),
+                                                    alignment_1->i_2());
+              // Look for a "new" alignment between this segment and the
+              // remaining of the chromosome
+              do {
+                nb_pairs = initial_len;
+                alignment_2 = tmp_segment->dna()->search_alignment(
+                    mutant->genetic_unit(u).dna(), nb_pairs,
+                    BOTH_SENSES);
+              } while (alignment_2 == NULL);
+              invert = (alignment_2->sense() == INDIRECT);
+              // Reinsert the segment into the genetic unit
+              mutant->genetic_unit(u).dna()->
+                  insert_GU(tmp_segment, alignment_2->i_2(),
+                            alignment_2->i_1(), invert);
+              rear_done = true;
+              delete tmp_segment;
+            } while (!rear_done);
+
+            mut = translocation = new Translocation(alignment_1->i_1(),
+                                                    alignment_1->i_2(),
+                                                    alignment_2->i_1(),
+                                                    alignment_2->i_2(),
+                                                    mut_length, invert,
+                                                    alignment_1->score(),
+                                                    alignment_2->score());
+          }
+          else {
+            do {
+              mut = translocation = mutant->genetic_unit(u).dna()->
+                  do_translocation();
+            }
+            while (mut == NULL);
+          }
+
+          pos0 = translocation->pos1();
+          pos1 = translocation->pos2();
+          pos2 = translocation->pos3();
+          pos3 = translocation->pos4();
+          align_score1 = translocation->align_score_1();
+          align_score2 = translocation->align_score_2();
+          invert = translocation->invert();
+          mut_length = translocation->length();
+          break;
+        }
+        case INV: {
+          // cf. comment at top of switch statement
+          Inversion* inversion;
+          if (mutant->with_alignments()) {
+            // TODO(dpa) Encapsulate in method do_duplication_align()
+            rear_done = false;
+            do {
+              do {
+                nb_pairs = initial_len;
+                alignment_1 = initial_dna->search_alignment(initial_dna,
+                                                            nb_pairs, INDIRECT);
+              } while (alignment_1 == NULL);
+              // Make sure the segment to be inverted doesn't contain OriC
+              if (alignment_1->i_1() > alignment_1->i_2()) {
+                alignment_1->swap();
+              }
+              mut_length = Utils::mod(
+                  alignment_1->i_2() - alignment_1->i_1(), initial_len);
+              rear_done = mutant->genetic_unit(u).dna()->do_inversion(
+                  alignment_1->i_1(), alignment_1->i_2());
+            } while (!rear_done);
+            mut = inversion = new Inversion(alignment_1->i_1(),
+                                            alignment_1->i_2(),
+                                            mut_length,
+                                            alignment_1->score());
+          }
+          else {
+            do {
+              mut = inversion = mutant->genetic_unit(u).dna()->
+                  do_inversion();
+            }
+            while (mut == NULL);
+          }
+
+          pos0 = inversion->pos1();
+          pos1 = inversion->pos2();
+          align_score1 = inversion->align_score();
+          mut_length = inversion->length();
+          break;
+        }
+        default: {
+          fprintf(stderr, "Error, unexpected mutation type\n");
+          break;
+        }
+      }
+
+      // TO DO: improve this method to make it work also with
+      // interGU translocations
+      initial_indiv->genetic_unit_nonconst(u).compute_nb_of_affected_genes(
+          mut, nb_genes_at_breakpoints, nb_genes_in_segment,
+          nb_genes_in_replaced_segment);
+
+
+      // Evaluate the mutant, compute its statistics
+      mutant->Reevaluate();
+      mutant->compute_statistical_data();
+      mutant->compute_non_coding();
+
+      metabolic_error_after = mutant->dist_to_target_by_feature(METABOLISM);
+      if (exp_manager->with_secretion()) {
+        secretion_error_after = mutant->dist_to_target_by_feature(
+            SECRETION);
+      }
+
+      // Write the description of the mutant in the output file
+      fprintf(output, "%" PRId32 " ", mutation_type);
+      fprintf(output, "%" PRId32 " ",
+              u); // genetic unit number (0 for the chromosome)
+      fprintf(output, "%" PRId32 " ", initial_indiv->genetic_unit(
+          u).dna()->length()); // Length of GU before the event
+      fprintf(output, "%" PRId32 " ", pos0);
+      fprintf(output, "%" PRId32 " ", pos1);
+      fprintf(output, "%" PRId32 " ", pos2);
+      fprintf(output, "%" PRId32 " ", pos3);
+      if (invert) fprintf(output, "1 "); else fprintf(output, "0 ");
+      if (mutant->with_alignments()) {
+        fprintf(output, "%" PRId16 " ", align_score1);
+        fprintf(output, "%" PRId16 " ", align_score2);
+      }
+      fprintf(output, "%" PRId32 " ", mut_length);
+      fprintf(output, "%" PRId32 " ", nb_genes_at_breakpoints);
+      fprintf(output, "%" PRId32 " ", nb_genes_in_segment);
+      fprintf(output, "%e ", metabolic_error_after);
+      if (exp_manager->with_secretion()) {
+        fprintf(output, "%e ", secretion_error_after);
+      }
+      if ((exp_manager->with_plasmids()) &&
+          (exp_manager->tune_donor_ability() != 0.0)) {
+        fprintf(output, "%e ", mutant->dist_to_target_by_feature(DONOR));
+      }
+      if ((exp_manager->with_plasmids()) &&
+          (exp_manager->tune_recipient_ability() != 0.0)) {
+        fprintf(output, "%e ",
+                mutant->dist_to_target_by_feature(RECIPIENT));
+      }
+      fprintf(output, "%" PRId32 " ", mutant->total_genome_size());
+      fprintf(output, "%" PRId32 " ", mutant->nb_coding_RNAs());
+      fprintf(output, "%" PRId32 " ", mutant->nb_non_coding_RNAs());
+      fprintf(output, "%" PRId32 " ", mutant->nb_functional_genes());
+      fprintf(output, "%" PRId32 " ", mutant->nb_non_functional_genes());
+      fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                      mutant->nb_bases_in_0_CDS()); // coding bp
+      fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                      mutant->nb_bases_in_0_RNA() -
+                                      (mutant->total_genome_size() -
+                                       mutant->nb_bases_in_0_CDS())); // transcribed but not translated bp
+      fprintf(output, "%" PRId32 " ",
+              mutant->nb_bases_in_0_RNA()); // not transcribed bp
+      fprintf(output, "%" PRId32 " ", mutant->total_genome_size() -
+                                      mutant->nb_bases_in_0_coding_RNA());
+      fprintf(output, "%" PRId32 " ", mutant->nb_bases_in_0_coding_RNA());
+      fprintf(output, "\n");
+
+
+      delete mutant;
+      delete mut;
+    }
+
+    delete[] relative_lengths_genetic_units;
+  }
+
+
+  delete exp_manager;
+
+  return EXIT_SUCCESS;
+}
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  const char* options_list = "hVg:r:i:m:n:";
+  static struct option long_options_list[] = {
+      {"help",          no_argument,       NULL, 'h'},
+      {"version",       no_argument,       NULL, 'V'},
+      {"gener",         required_argument, NULL, 'g'},
+      {"rank",          required_argument, NULL, 'r'},
+      {"index",         required_argument, NULL, 'i'},
+      {"mutation-type", required_argument, NULL, 'm'},
+      {"nb-mutants",    required_argument, NULL, 'n'},
+      {0, 0, 0,                                  0}
+  };
+
+  int option = -1;
+  bool rank_already_set = false;
+  bool index_already_set = false;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               NULL)) != -1) {
+    switch (option) {
+      case 'h':
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      case 'V':
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      case 'g':
+        if (strcmp(optarg, "") == 0) {
+          fprintf(stderr,
+                  "%s: error: Option -g or --gener : missing argument.\n",
+                  argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        num_gener = atol(optarg);
+        break;
+      case 'r':
+        if (index_already_set) {
+          fprintf(stderr,
+                  "%s: error: Options -r and -i are incompatible. Please choose one of them only.\n",
+                  argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        wanted_rank = atol(optarg);
+        rank_already_set = true;
+        break;
+      case 'i':
+        if (rank_already_set) {
+          fprintf(stderr,
+                  "%s: error: Options -r and -i are incompatible. Please choose one of them only.\n",
+                  argv[0]);
+          fprintf(stderr, "           Use %s --help for more information.\n",
+                  argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        wanted_index = atol(optarg);
+        index_already_set = true;
+        break;
+      case 'm':
+        mutation_type = (MutationType) atol(optarg);
+        if (mutation_type == SWITCH) {
+        }
+        else if ((mutation_type == S_INS) || (mutation_type == S_DEL) ||
+                 (mutation_type == DUPL) || (mutation_type == DEL) ||
+                 (mutation_type == TRANS) || (mutation_type == INV)) {
+        }
+        else {
+          fprintf(stderr,
+                  "%s: error: So far, mutagenesis is implemented only for "
+                      "point mutations, small insertions, \n"
+                      "           small deletions, duplications, deletions, "
+                      "translocations or inversions.\n"
+                      "           It is not available yet for lateral transfer.\n",
+                  argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        break;
+      case 'n':
+        nb_mutants = atol(optarg);
+        if (nb_mutants <= 0) {
+          fprintf(stderr,
+                  "%s: error: The number of mutants (option -n) must be "
+                      "positive.\n",
+                  argv[0]);
+          exit(EXIT_FAILURE);
+        }
+        break;
+    }
+  }
+
+
+  if ((mutation_type == SWITCH) && (nb_mutants != -1)) {
+    printf("For point mutations, the mutagenesis will be exhaustive, "
+               "the number of \n"
+               "mutants will be ignored.\n");
+  }
+  else if ((mutation_type != SWITCH) && (nb_mutants == -1)) {
+    nb_mutants = 1000;
+    printf("Mutagenesis cannot be exhaustive in a reasonable time for "
+               "mutations \n");
+    printf("other than point mutations. A sample of %" PRId32 " mutants will "
+               "be generated.\n",
+           nb_mutants);
+  }
+}
+
+/*!
+  \brief
+
+*/
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else { prog_name = prog_path; }
+
+  printf("\n");
+  printf(
+      "*********************** aevol - Artificial Evolution ******************* \n");
+  printf(
+      "*                                                                      * \n");
+  printf(
+      "*                    Mutagenesis post-treatment program                * \n");
+  printf(
+      "*                                                                      * \n");
+  printf(
+      "************************************************************************ \n");
+  printf("\n\n");
+  printf("This program is Free Software. No Warranty.\n");
+  printf("\n");
+  printf("Usage : %s -h\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf(
+      "   or : %s -g NUMGENER [-r RANK | -i INDEX] [-m MUTATIONTYPE] [-n NBMUTANTS]\n",
+      prog_name);
+  printf("\n");
+  printf(
+      "This program creates and evaluates single mutants of an individual saved in a backup, \n");
+  printf(
+      "by default the best of its generation. Use either the -r or the -i option to\n");
+  printf(
+      "select another individual than the best one: with -i, you have to provide the\n");
+  printf(
+      "ID of the individual, and with -r the rank (1 for the individual with the lowest\n");
+  printf("fitness, N for the fittest one). \n\n");
+  printf(
+      "The type of mutations to perform must be specified with the -m option. \n");
+  printf(
+      "Choose 0 to create mutants with a point mutation, 1 for a small insertion, \n");
+  printf(
+      "2 for a small deletion, 3 for a duplication, 4 for a large deletion, \n");
+  printf("5 for a translocation or 6 for an inversion. \n\n");
+  printf(
+      "For the point mutations, all single mutants will be created and evaluated. For the\n");
+  printf(
+      "other mutation types, an exhaustive mutagenesis would be too long, hence only a\n");
+  printf(
+      "sample of mutants (1000 by default) will be generated. Use option -n to specify\n");
+  printf("another sample size.\n\n");
+  printf(
+      "The output file will be placed in a subdirectory called analysis-generationNUMGENER.\n");
+  printf("\n");
+  printf("\n");
+  printf("\t-h or --help    : Display this help, then exit\n");
+  printf("\n");
+  printf("\t-V or --version : Print version number, then exit\n");
+  printf("\n");
+  printf("\t-g NUMGENER or --gener NUMGENER : \n");
+  printf(
+      "\t                  Generation of the backup containing the individual of interest\n");
+  printf("\n");
+  printf("\t-i INDEX or --index INDEX : \n");
+  printf(
+      "\t                  Index of individual of interest. Should be comprised between 0 and N-1, where\n");
+  printf("\t                  N is the size of the population.\n");
+  printf("\n");
+  printf("\t-r RANK or --rank RANK : \n");
+  printf(
+      "\t                  Rank of individual of interest. Should be comprised between 1 and N, where\n");
+  printf(
+      "\t                  N is the size of the population. Default = N (fittest individual).\n");
+  printf("\n");
+  printf("\t-m MUTATIONTYPE or --mutation-type MUTATIONTYPE : \n");
+  printf(
+      "\t                  Integer type of the mutation carried by each mutant: 0 for a point mutation, 1 for a \n");
+  printf(
+      "\t                  small insertion, 2 for small deletions, 3 for a duplication, 4 for a large deletion, \n");
+  printf("\t                  5 for a translocation or 6 for an inversion. \n");
+  printf("\n");
+  printf("\t-n NBMUTANTS or --nb-mutants NBMUTANTS : \n");
+  printf(
+      "\t                  Number of single mutants to create and evaluate. Default = 1000. Note that this option\n");
+  printf(
+      "\t                  is ignored in the case of point mutations, where all single mutants are created \n");
+  printf("\t                  (exhaustive mutagenesis). \n");
+  printf("\n");
+
+  printf("\n");
+}
diff --git a/src/post_treatments/population_statistics.cpp b/src/post_treatments/population_statistics.cpp
deleted file mode 100644
index 17126de..0000000
--- a/src/post_treatments/population_statistics.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-// 
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-// 
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <math.h>
-#include <algorithm>
-#include <err.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include "population_statistics.h"
-
-#define STATS_DIR                   "stats"
-#define ROBUSTNESS_FILE             STATS_DIR"/robustness_%06"PRId32".out"
-#define REPLICATION_FILE            STATS_DIR"/replication_%06"PRId32".out"
-#define POP_STAT_FILE               STATS_DIR"/global_pop_stats.out"
-#define POP_STAT_DIR                STATS_DIR"/pop_stats/"
-#define POP_STATE_BASE              "gen_%06"PRId32
-#define POP_STATE_ROBUSTNESS_FILE   POP_STAT_DIR"/robustness_%06"PRId32".out"
-#define POP_STATE_REPLICATION_FILE  POP_STAT_DIR"/replication_%06"PRId32".out"
-
-
-
-
-//##############################################################################
-//                                                                             #
-//                  Class population_statistics                                #
-//                                                                             #
-//##############################################################################
-
-// =================================================================
-//                    Definition of static attributes
-// =================================================================
-
-// =================================================================
-//                             Constructors
-// =================================================================
-
-/*!
-  \brief Default constructor of population_statitistics class
-
-  Initialisation of default values _nb_children (number of replications to compute proportion of neutral offsrpings), _wanted_rank and _wanted_index (indications of 
-  individual of whom we want more replication information), and anaylsis type
-  By default, the number of replications is 1,000 and the wanted individual is the best one (rank = 1) and the analysis is only one generation).
-*/
-population_statistics::population_statistics( void )
-{
-    _output_file = NULL;
-    _replication_file = NULL;
-    _robustness_file = NULL;
-    
-    _nb_children = 1000;
-    _wanted_rank = 1;
-    _wanted_index = -1;
-
-    _f_nu_pop = NULL;
-    _reprod_proba = NULL;
-    _fitness = NULL;
-    
-    _type = ONE_GENERATION;	
-}
-
-/*!
-  \brief Constructor of population_statitistics class with non-default values
-
-  Initialisation of _nb_children, _wanted_rank and _wanted_index and _type with the given values
-  
-  \param type analysis type: ONE_GENERATION or MULTIPLE_GENERATIONS
-  \param nb_children  number of replications needed to compute the proportion of neutral offsprings of each individual
-  \param wanted_rank rank of the individual of whom we want more replication information
-  \param wanted_index index of the individual of whom we want more replication information
-*/
-population_statistics::population_statistics( analysis_type type, int32_t nb_children, int32_t wanted_rank, int32_t wanted_index)
-{   
-    _nb_children = nb_children;
-    _wanted_rank = wanted_rank;
-    _wanted_index = wanted_index;
-    _type = type;
-    
-    _f_nu_pop = NULL;
-    _reprod_proba = NULL;
-    _fitness = NULL;
-    
-    _output_file = NULL;
-    _replication_file = NULL;
-    _robustness_file = NULL;
-     
-    
-    if (_type != ONE_GENERATION) 
-    {
-      _output_file = fopen(POP_STAT_FILE,"w");
-      int status = mkdir( POP_STAT_DIR, 0755 );
-      if ( (status == -1) && (errno != EEXIST) )
-      {
-        err( EXIT_FAILURE, POP_STAT_DIR );
-      }
-      assert(_output_file!=NULL);
-    }
-    
-    
-    fflush( stderr );    
-}
-
-
-// =================================================================
-//                             Destructors
-// =================================================================
-
-/*!
-  \brief Destructor of population_statistics class
-*/
-population_statistics::~population_statistics( void )
-{
-  if (_output_file != NULL) { fclose(_output_file); }
-  
-  delete [] _f_nu_pop;
-  delete [] _reprod_proba;
-  delete [] _fitness;
-}
-
-
-// =================================================================
-//                            Public Methods
-// =================================================================
-
-/*!
-  \brief Compute statistics of reproduction at population level at generation num_gener
-
-  Compute at generation num_gener for each individual:
-  * Fitness
-  * Metabolic error
-  * Genome size
-  * Functional gene number
-  * Reproduction probability
-  * Proportion of neutral offsprings
-  * Proportion of beneficial offsprings
-  * Proportion of deleterious offsprings
-  * Theoretical proportion of deleterious offsprings
-  * Fitness mean of offsprings
-  * Fitness variance of offsprings
-  * Genome size mean of offsprings
-  * Genome size variance of offsprings
-  * Functional gene number mean of offsprings;
-  * 17. Functional gene number variance of offsprings
-  Write this information in a file robustness_numgener.out 
-  
-  Compute for each offspring of a choosen individual (by index or rank):
-  * Fitness
-  * Metabolic error
-  * Genome size
-  * Functional gene number
-  * Number of coding bases
-  * Number of transcribed but not translated bases
-  * Number of non transcribed bases
-  Write this information in a file replication_numgener.out 
-  
-  Complete _f_nu_pop, _reprod_proba, _fitness with proportion of neutral offspring, reproduction probability and fitness of each individual at num_gener
-  
-  \param exp_manager  current exp_manager
-  \param num_gener    current generation number
-*/
-void population_statistics::compute_reproduction_stats(ae_exp_manager* exp_manager, int32_t num_gener)
-{
-  // ----------------------------------------
-  //              Open output files
-  // ----------------------------------------
-
-  char* robustness_file_name  = new char[255];
-  char* replication_file_name = new char[255];
-  if (_type == ONE_GENERATION) 
-  {
-    sprintf( robustness_file_name,  ROBUSTNESS_FILE,  num_gener );
-    sprintf( replication_file_name, REPLICATION_FILE, num_gener );
-  }
-  else
-  {
-    sprintf( robustness_file_name,  POP_STATE_ROBUSTNESS_FILE,  num_gener );
-    sprintf( replication_file_name, POP_STATE_REPLICATION_FILE, num_gener );
-  }
-  _robustness_file = fopen(robustness_file_name,"w");
-  _replication_file = fopen(replication_file_name,"w");  
-  
-  assert(_replication_file!=NULL);
-  assert(_robustness_file!=NULL);
-  delete [] robustness_file_name;
-  delete [] replication_file_name;
-  
-  
-  // -------------------------------------
-  //            Write header
-  // -------------------------------------
-  fprintf(_robustness_file, "# ######################################################################\n" );
-  fprintf(_robustness_file, "# Robustness data of individuals at generation %"PRId32"\n",num_gener );
-  fprintf(_robustness_file, "# ######################################################################\n" );
-  fprintf(_robustness_file,"#  1.  Rank\n");
-  fprintf(_robustness_file,"#  2.  Index\n");
-  fprintf(_robustness_file,"#  3.  Fitness\n");
-  fprintf(_robustness_file,"#  4.  Metabolic error\n");
-  fprintf(_robustness_file,"#  5.  Genome size\n");
-  fprintf(_robustness_file,"#  6.  Functional gene number\n");
-  fprintf(_robustness_file,"#  7.  Reproduction probability\n");
-  fprintf(_robustness_file,"#  8.  Proportion of neutral offsprings\n");
-  fprintf(_robustness_file,"#  9. Proportion of beneficial offsprings\n");
-  fprintf(_robustness_file,"#  10. Proportion of deleterious offsprings\n");
-  fprintf(_robustness_file,"#  11. Theoretical proportion of netural offsprings\n");
-  fprintf(_robustness_file,"#  12. Fitness mean of offsprings\n");
-  fprintf(_robustness_file,"#  13. Fitness variance of offsprings\n");
-  fprintf(_robustness_file,"#  14. Genome size mean of offsprings\n");
-  fprintf(_robustness_file,"#  15. Genome size variance of offsprings\n");
-  fprintf(_robustness_file,"#  16. Functional gene number mean of offsprings\n");
-  fprintf(_robustness_file,"#  17. Functional gene number variance of offsprings\n");
-  fprintf(_robustness_file, "# ######################################################################\n" );
-  
-  fprintf(_replication_file, "# #######################################################################################################\n" );
-  fprintf(_replication_file,"#  Offspring details of individual with rank %"PRId32" and index %"PRId32" at generation %"PRId32" \n",_wanted_rank, _wanted_index, num_gener );
-  fprintf(_replication_file, "# #######################################################################################################\n" );
-  fprintf(_replication_file,"#  1.  Fitness\n");
-  fprintf(_replication_file,"#  2.  Metabolic error\n");
-  fprintf(_replication_file,"#  3.  Genome size\n");
-  fprintf(_replication_file,"#  4.  Functional gene number\n");
-  fprintf(_replication_file,"#  5.  Number of coding bases\n");
-  fprintf(_replication_file,"#  6.  Number of transcribed but not translated bases\n");
-  fprintf(_replication_file,"#  7.  Number of non transcribed bases\n");
-  fprintf(_replication_file, "# #######################################################################################################\n" );
-  
-  // --------------------------------------------------------------
-  //       Get genome(s) of interest and compute Fv
-  // --------------------------------------------------------------
-  
-  _pop_size = exp_manager->get_nb_indivs();
-  
-  ae_individual* initial_indiv = NULL;
-  ae_list_node<ae_individual*>* node = exp_manager->get_pop()->get_indivs()->get_last();
-  int32_t current_rank = 1;
-  int32_t current_index = -1;
-  
-  double* reproduction_statistics =  new double[3];
-  double* offsprings_statistics =  new double[6];
-  double th_fv;
-  
-  if (_f_nu_pop != NULL) { delete [] _f_nu_pop;}
-  if (_fitness != NULL) { delete [] _fitness;}
-  if (_reprod_proba != NULL) { delete [] _reprod_proba;}
-  
-  _f_nu_pop = new double[_pop_size];
-  _fitness = new double[_pop_size];  
-  _reprod_proba = new double [_pop_size];
-  
-  exp_manager->get_exp_s()->get_sel()->compute_prob_reprod();
-  double* tmp_reprod = exp_manager->get_exp_s()->get_sel()->get_prob_reprod();
-  
-  // simply parse through individuals and keep those that are wanted
-  while (node != NULL)
-  {
-    ae_individual* tmpind = (ae_individual*) node->get_obj();
-    node = node->get_prev();
-    
-    // ------------------------------------
-    //         Get initial individual
-    // ------------------------------------
-    #ifdef __NO_X
-      #ifndef __REGUL
-        initial_indiv = new ae_individual( tmpind, current_index, exp_manager->get_exp_s()->get_sel()->get_prng(), exp_manager->get_exp_s()->get_sel()->get_prng());
-      #else
-        initial_indiv = new ae_individual_R( (dynamic_cast<ae_individual_R*>(tmpind)), current_index, exp_manager->get_exp_s()->get_sel()->get_prng(), exp_manager->get_exp_s()->get_sel()->get_prng());
-          #endif
-    #elif defined __X11
-      #ifndef __REGUL
-        initial_indiv = new ae_individual_X11( (dynamic_cast<ae_individual_X11*>(tmpind)), current_index, exp_manager->get_exp_s()->get_sel()->get_prng(), exp_manager->get_exp_s()->get_sel()->get_prng() );
-      #else
-        initial_indiv = new ae_individual_R_X11( (dynamic_cast<ae_individual_R_X11*>(tmpind)), current_index, exp_manager->get_exp_s()->get_sel()->get_prng(), exp_manager->get_exp_s()->get_sel()->get_prng() );
-      #endif
-    #endif
-    
-    current_index = tmpind->get_id();
-    current_rank = _pop_size - tmpind->get_rank() + 1;
-
-    initial_indiv->evaluate(exp_manager->get_env());
-    _fitness[current_rank] = initial_indiv->get_fitness();
-    _reprod_proba[current_rank] = tmp_reprod[_pop_size-current_rank];
-    
-    // ------------------------------------
-    //              Compute Fv
-    // ------------------------------------	
-    th_fv = initial_indiv->compute_theoritical_f_nu();
-    
-    if ( (_wanted_rank == current_rank) || (_wanted_index == current_index))
-    {
-      initial_indiv->compute_experimental_f_nu( _nb_children, reproduction_statistics, offsprings_statistics, _replication_file);
-    }
-    else
-    {
-      initial_indiv->compute_experimental_f_nu( _nb_children, reproduction_statistics, offsprings_statistics);
-    }
-    _f_nu_pop[current_rank] = reproduction_statistics[0];
-    
-    // ------------------------------------
-    //            Write to file
-    // ------------------------------------ 
-    fprintf( _robustness_file, "%"PRId32" %"PRId32" %le %le %"PRId32" %"PRId32" %le %le %le %le %le %le %le %le %le %le %le\n",
-                              current_rank, current_index, initial_indiv->get_fitness(),initial_indiv->get_dist_to_target_by_feature(METABOLISM ),initial_indiv->get_total_genome_size(),
-                              initial_indiv->get_nb_functional_genes(), _reprod_proba[current_rank-1], reproduction_statistics[0], reproduction_statistics[1], reproduction_statistics[2], th_fv,
-                              offsprings_statistics[0], offsprings_statistics[1], offsprings_statistics[2], offsprings_statistics[3],offsprings_statistics[4],offsprings_statistics[5]);
-    delete initial_indiv;
-    
-  }
-  //delete exp_manager;
-  delete [] reproduction_statistics;
-  delete [] offsprings_statistics;
-  
-  fclose(_replication_file); 
-  fclose(_robustness_file);
-}
-
-/*!
-  \brief Compute statistics at population level at generation num_gener
-
-  Compute at generation num_gener for each individual:
-  * Variation
-  * Population_variability
-  * Proportion of neutral offspring of the best individual
-  * Variability of the best individual
-  * Size of the first quasi species
-  * Number of different fitness
-  Write this information in _output_file
-  
-  Before this function, compute_reproduction_stats have to be called
-  \see compute_reproduction_stats(ae_exp_manager* exp_manager, int32_t num_gener)
-  
-  \param num_gener    current generation number  
-*/
-void population_statistics::compute_population_stats(int32_t num_gener)
-{
-  printf("\n\nCompute population stats\n");
-  double variation = 0;
-  double population_variability = 0; 
-  
-  double best_variability = 1. - _f_nu_pop[0];
-  
-  int fitness_number = 1;
-  int quasi_species_size = 1;
-  
-  population_variability = _f_nu_pop[0] * _reprod_proba[0];
-  for (int i = 1; i < _pop_size; i++)
-  {
-    if ( fabs(_fitness[i] - _fitness[i-1]) > 1e-10*std::max(_fitness[i],_fitness[i-1]))
-    {
-      fitness_number += 1;
-    }
-    else if ( fitness_number == 1)
-    {
-      quasi_species_size += 1;
-    }
-    population_variability += _f_nu_pop[i] * _reprod_proba[i];
-  }
-  
-  population_variability = 1. - population_variability;
-  variation = (static_cast<double>(fitness_number)) / (static_cast<double>(_pop_size));
-  
-  printf("\n Global population stats : \n \tgeneration : %"PRId32"\n \tpopulation size : %"PRId32"\n \tvariation : %le\n \tpopulation variability : %le\n \tbest f nu : %le\n \tbest variability : %le\n \tbest quasi species size : %d\n \tfitness number : %d\n", num_gener, 
-	   _pop_size, variation, population_variability, _f_nu_pop[0], best_variability, 
-	   quasi_species_size, fitness_number);
-  
-  fprintf( _output_file, "%"PRId32" %"PRId32" %le %le %le %le %d %d\n", num_gener, _pop_size, variation, population_variability, _f_nu_pop[0], best_variability, quasi_species_size, fitness_number);
-  fflush( _output_file );
-}
-
-// =================================================================
-//                            Protected Methods
-// =================================================================
-
-// count how many proteins were modified after replication
-/*int population_statistics::count_affected_genes( ae_individual* parent, ae_individual* child )
-{
-  // ------------------------------------------------------------
-  //       list all functional proteins of the child
-  // ------------------------------------------------------------
-  
-  // Copy protein list
-  ae_list<ae_protein*>* child_protein_list = new ae_list<ae_protein*>( *(child->get_protein_list()) );
-  // Delete all nodes containing degenerated proteins
-  ae_list_node<ae_protein*>* current_prot_node = child_protein_list->get_first();
-  ae_list_node<ae_protein*>* next_prot_node = NULL;
-  ae_protein* current_prot = NULL;
-  while ( current_prot_node != NULL )
-  {
-    current_prot = current_prot_node->get_obj();
-    next_prot_node = current_prot_node->get_next();
-    if ( current_prot->get_is_functional() == false ) 
-    {
-      //delete the node but not the protein
-      child_protein_list->remove( current_prot_node, true, false );
-    }
-    current_prot_node = next_prot_node;
-  }
-  
-  // ----------------------------------------------------------------
-  //    for each functional protein of the parent, search for
-  //    the same one in the child's proteins and pop it out of the  
-  //    list if found
-  // ----------------------------------------------------------------
-  ae_list_node<ae_protein*>* parent_prot_node = parent->get_protein_list()->get_first();
-  ae_protein* parent_prot = NULL;
-  ae_list_node<ae_protein*>* child_prot_node = NULL;
-  ae_protein* child_prot = NULL;
-  bool found = false;
-
-  int nb_proteins_left = 0;
-
-  // parse parent protein list
-  while ( parent_prot_node != NULL )
-  {
-    parent_prot = parent_prot_node->get_obj();
-    if ( parent_prot->get_is_functional() == true )
-    {
-      found = false;
-      // parse remaining protein list of the child
-      child_prot_node = child_protein_list->get_first();
-      while ( child_prot_node != NULL )
-      {
-	child_prot = (ae_protein*) child_prot_node->get_obj();
-	// compare the two proteins
-	if ( (fabs(child_prot->get_mean() - parent_prot->get_mean()) < 1e-20)
-	     && (fabs(child_prot->get_width() - parent_prot->get_width()) < 1e-20)
-	     && (fabs(child_prot->get_height() - parent_prot->get_height()) < 1e-20) )
-	{
-	  found = true;
-	  // delete the node but not the protein
-	  child_protein_list->remove( child_prot_node, true, false);
-	  child_prot_node=NULL;
-	}
-	else
-	{
-	  child_prot_node=child_prot_node->get_next();
-	}
-      }
-      // ------------------------------------------------------------------------------------
-      //  if the protein was not found, it means that one of the genes were modified in child
-      // ------------------------------------------------------------------------------------
-      if (found==false) nb_proteins_left++;
-    }
-    parent_prot_node = parent_prot_node->get_next();
-  }
-  
-  // --------------------------------------------------------------
-  //   with low probability, some genes [dis]appeared
-  //   therefore, the number of proteins of the parent not
-  //   retreived in the child might not be equal to the number
-  //   of proteins left in child. We keep the biggest element,
-  //   neglecting possible compensations
-  // --------------------------------------------------------------
-  //~ printf("%d %d \n",child_protein_list->get_nb_elts(), nb_proteins_left);
-  int result = (child_protein_list->get_nb_elts() > nb_proteins_left) ? child_protein_list->get_nb_elts() : nb_proteins_left;
-
-  delete child_protein_list;
-
-  return result;
-}*/
-
-
-// print stats about replications of the individual
-/*void population_statistics::print_replication_stats( ae_individual* initial_indiv, double* fitnesses, int* nb_aff_genes )
-{
-  if ( _replication_output == NULL ) return;
-  
-  double fitness_initial_indiv = initial_indiv->get_fitness();
-
-  // --------------------------------------------------------------
-  //              compute statistics on fitness variations
-  // --------------------------------------------------------------
-  double average_fit = 0.0;
-  double sd = 0.0;
-  double prop_better_than_parent = 0;
-  double prop_same_as_parent = 0;
-  double prop_no_genes_affected = 0;
-  double avg_nb_aff_genes = 0.0;
-
-  for (int i = 0; i < _nb_children; i++)
-  {
-    average_fit += fitnesses[i];
-    avg_nb_aff_genes += nb_aff_genes[i];
-    sd += fitnesses[i]*fitnesses[i];
-    if ( fabs(fitnesses[i] - fitness_initial_indiv) < 1e-10*std::max(fitnesses[i],fitness_initial_indiv) ) { prop_same_as_parent += 1; }
-    else if ( fitnesses[i] > fitness_initial_indiv ) { prop_better_than_parent += 1; }
-    if ( nb_aff_genes[i] == 0 ) { prop_no_genes_affected += 1; }
-  }
-  average_fit /= _nb_children;
-  avg_nb_aff_genes /= _nb_children;
-  prop_no_genes_affected /= _nb_children;
-  sd /= _nb_children;
-  sd -= (average_fit)*(average_fit);
-  sd = sqrt(sd);
-  prop_better_than_parent /= _nb_children;
-  prop_same_as_parent /= _nb_children;
-
-  // --------------------------------------------------------------
-  //         print statistics on current line
-  // --------------------------------------------------------------
-  fprintf(_replication_output, " %le %le %le %le %le %le ", average_fit, sd, prop_same_as_parent, prop_better_than_parent, prop_no_genes_affected, avg_nb_aff_genes);
-  fprintf(_replication_output, "\n");
-  
-  // --------------------------------------------------------------
-  //         print fitness statistics for each child
-  // --------------------------------------------------------------
-  for (int i = 0; i < _nb_children; i++)
-  {
-    fprintf(_replication_output, "%le %d \n", fitnesses[i], nb_aff_genes[i]);
-  }
-}*/
-
diff --git a/src/post_treatments/population_statistics.h b/src/post_treatments/population_statistics.h
deleted file mode 100644
index ed862bc..0000000
--- a/src/post_treatments/population_statistics.h
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
-/** \class
- *  \brief
- */
-
-
-#ifndef __POPULATION_STATISTICS_H__
-#define __POPULATION_STATISTICS_H__
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-#include <inttypes.h>
-#include <getopt.h>
-#include <math.h>
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_list.h>
-//#include <ae_common.h>
-#include <ae_exp_manager.h>
-#include <ae_population.h>
-#include <ae_protein.h>
-
-#ifdef __NO_X
-#ifdef __REGUL
-#include <ae_individual_R.h>
-#else
-#include <ae_individual.h>
-#endif
-#elif defined __X11
-#ifdef __REGUL
-#include <ae_individual_R_X11.h>
-#else
-#include <ae_individual_X11.h>
-#endif
-#endif
-
-
-
-// =================================================================
-//                          Class declarations
-// =================================================================
-
-
-enum analysis_type
-{
-  ONE_GENERATION = 0,
-  MULTIPLE_GENERATIONS = 1
-};
-
-
-
-class population_statistics 
-{
-  public :
-
-    // =================================================================
-    //                             Constructors
-    // =================================================================
-    population_statistics( void );
-    population_statistics( analysis_type type, int32_t nb_children = 1000, int32_t wanted_rank = 1, int32_t wanted_index = -1);
-
-    // =================================================================
-    //                             Destructors
-    // =================================================================
-    virtual ~population_statistics( void );
-
-    // =================================================================
-    //                              Accessors
-    // =================================================================
-
-
-    // =================================================================
-    //                            Public Methods
-    // =================================================================
-    
-    void compute_reproduction_stats(ae_exp_manager* exp_manager, int32_t num_gener);
-    void compute_population_stats(int32_t num_gener);
-
-
-    // =================================================================
-    //                           Public Attributes
-    // =================================================================
-
-
-
-  protected :
-    
-
-
-    // =================================================================
-    //                         Forbidden Constructors
-    // =================================================================
-
-
-
-    // =================================================================
-    //                           Protected Methods
-    // =================================================================
-    
-    //int count_affected_genes( ae_individual* parent, ae_individual* child );
-    //void print_replication_stats( ae_individual* initial_indiv, double* fitnesses, int* nb_aff_genes );
-    
-    
-    // =================================================================
-    //                          Protected Attributes
-    // =================================================================
-    
-    FILE* _output_file;
-    FILE*	_robustness_file;
-    FILE*	_replication_file;
-    
-    int 	_nb_children;
-    int 	_wanted_rank;
-    int 	_wanted_index;
-    int32_t	_pop_size;
-
-    double*	_f_nu_pop;
-    double*	_reprod_proba;
-    double*	_fitness;
-    analysis_type	_type;	
-};
-
-#endif // __POPULATION_STATISTICS_H__
diff --git a/src/post_treatments/robustness.cpp b/src/post_treatments/robustness.cpp
index 20a3c7b..d33ba39 100644
--- a/src/post_treatments/robustness.cpp
+++ b/src/post_treatments/robustness.cpp
@@ -22,204 +22,249 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
-//*****************************************************************************
-
+// ****************************************************************************
 
 
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cerrno>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+#include <cinttypes>
+#include <cmath>
 
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <zlib.h>
-#include <inttypes.h>
 #include <getopt.h>
-#include <math.h>
+#include <zlib.h>
 #include <sys/stat.h>
 
+#include <list>
 
+#include "aevol.h"
+#include "IndivAnalysis.h"
 
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_macros.h>
-#include <population_statistics.h>
-
-#ifndef __NO_X
-  #include <ae_exp_manager_X11.h>
-#else
-  #include <ae_exp_manager.h>
-#endif
-
+using std::list;
+using namespace aevol;
 
-
-// =================================================================
-//                         Function declarations
-// =================================================================
+// Helper functions
 void print_help(char* prog_path);
-void print_version( void );
+void interpret_cmd_line_options(int argc, char* argv[]);
+
+// Command-line option variables
+static int32_t nb_children = 1000;
+static int32_t wanted_rank = -1;
+static int32_t wanted_index = -1;
+static int64_t timestep = -1;
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+  
+  // ----------------------
+  //  Prepare the outputs
+  // ----------------------
+  char directory_name[255];
+  snprintf(directory_name, 255, "analysis-generation_" TIMESTEP_FORMAT,
+      timestep);
+  
+  // Check whether the directory already exists and is writable
+  if (access(directory_name, F_OK) == 0) {
+    if (access(directory_name, X_OK | W_OK) != 0) {
+      fprintf(stderr, "Error: cannot enter or write in directory %s.\n",
+              directory_name);
+      exit(EXIT_FAILURE);
+    }
+  }
+  else {
+    // Create the directory with permissions : rwx r-x r-x
+    if (mkdir(directory_name,
+              S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
+      fprintf(stderr, "Error: cannot create directory %s.\n", directory_name);
+      exit(EXIT_FAILURE);
+    }
+  }
 
+  // -----------------------------------------------------------------------------------
+  //  Load the backup and get the individual for which detailed information is desired
+  // -----------------------------------------------------------------------------------
+  ExpManager* exp_manager = new ExpManager();
+  exp_manager->load(timestep, true, false);
 
+  Individual* indiv_tmp = nullptr;
 
+  // If neither a rank nor an index was provided, consider the best indiv
+  if ((wanted_rank == -1) && (wanted_index == -1)) {
+    indiv_tmp = exp_manager->best_indiv();
+  }
+  else if (wanted_index != -1) {
+    indiv_tmp = exp_manager->indiv_by_id(wanted_index);
+  }
+  else {
+    indiv_tmp = exp_manager->indiv_by_rank(wanted_rank);
+  }
+  // Update id and rank
+  wanted_index = indiv_tmp->id();
+  wanted_rank = indiv_tmp->rank();
+
+  IndivAnalysis wanted_indiv(*indiv_tmp);
+  indiv_tmp = nullptr;
+
+  // Now that we have the index and rank of the indiv of interest, we can
+  // generate the output file name and hence open that file
+  char filename[255];
+  snprintf(filename, 255, "%s/robustness-summary-%" PRId64 "-i%" PRId32 "-r%" PRId32,
+      directory_name, timestep, wanted_index, wanted_rank);
+  FILE* output_summary = fopen(filename, "w");
+  if (output_summary == nullptr) {
+    Utils::ExitWithUsrMsg(std::string("Could not open file ") + filename);
+  }
+  snprintf(filename, 255, "%s/robustness-detailed-%" PRId64 "-i%" PRId32 "-r%" PRId32,
+      directory_name, timestep, wanted_index, wanted_rank);
+  FILE* output_detailed = fopen(filename, "w");
+  if (output_detailed == nullptr) {
+    Utils::ExitWithUsrMsg(std::string("Could not open file ") + filename);
+  }
 
+  fprintf(output_summary, "###############################################################################\n");
+  fprintf(output_summary, "#  Summary of the mutants generated from individual with rank %" PRId32
+  " and index %" PRId32 " at timestep %" PRId64 " \n",
+      wanted_rank, wanted_index, timestep);
+  fprintf(output_summary, "###############################################################################\n");
+  fprintf(output_summary, "#  1.  Timestep\n");
+  fprintf(output_summary, "#  2.  Proportion of mutants that are better than their parent\n");
+  fprintf(output_summary, "#  3.  Proportion of mutants that are as good as their parent was\n");
+  fprintf(output_summary, "#  4.  Proportion of mutants that are worse than their parent\n");
+  fprintf(output_summary, "#  5.  Average difference in metabolic error btw good mutants and their parent\n");
+  fprintf(output_summary, "#  6.  Average difference in metabolic error btw bad mutants and their parent\n");
+  fprintf(output_summary, "#  7.  Maximum gain in metabolic error among good mutants\n");
+  fprintf(output_summary, "#  8.  Maximum loss of metabolic error among bad mutants\n");
+  fprintf(output_summary, "###############################################################################\n");
+
+  fprintf(output_detailed, "###############################################################################\n");
+  fprintf(output_detailed, "#  Mutants generated from individual with rank %" PRId32
+  " and index %" PRId32 " at timestep %" PRId64 " \n",
+      wanted_rank, wanted_index, timestep);
+  fprintf(output_detailed, "###############################################################################\n");
+  fprintf(output_detailed, "#  1.  Parent id\n");
+  fprintf(output_detailed, "#  2.  Parent metabolic error\n");
+  fprintf(output_detailed, "#  3.  Parent secretion\n");
+  fprintf(output_detailed, "#  4.  Mutant metabolic error\n");
+  fprintf(output_detailed, "#  5.  Mutant secretion\n");
+  fprintf(output_detailed, "#  6.  Mutant genome size\n");
+  fprintf(output_detailed, "#  7.  Mutant number of functional genes\n");
+  fprintf(output_detailed, "###############################################################################\n");
+
+  wanted_indiv.Evaluate();
+  wanted_indiv.compute_statistical_data();
+  wanted_indiv.compute_non_coding();
+
+  wanted_indiv.compute_experimental_f_nu(
+      nb_children,
+      std::make_shared<JumpingMT>(time(nullptr)),
+      output_summary,
+      output_detailed);
+
+  fclose(output_summary);
+  fclose(output_detailed);
+  delete exp_manager;
+  return EXIT_SUCCESS;
+}
 
-// =====================================================================
-//                         Main Function
-// =====================================================================
 
+/**
+ * \brief print help and exist
+ */
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
 
-int main( int argc, char* argv[] )
-{
-  // ----------------------------------------
-  //     command-line option parsing
-  // ----------------------------------------
-  int32_t nb_children     = 1000;
-  int32_t wanted_rank     = -1;
-  int32_t wanted_index    = -1;
-  int32_t num_gener       = 0;
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s:\n", prog_name);
+  printf("\tComputes replication statistics of a given individual\n");
+  printf("\tThis is achieved by performing NB_MUTANTS replications\n");
+  printf("\tof the individual of interest and evaluating them\n");
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP] [-I INDEX | -R RANK] [-n NB_MUTANTS]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n");
+  printf("  -V, --version\n\tprint version number, then exit\n");
+  printf("  -t, --timestep TIMESTEP\n");
+  printf("\tspecify timestep of the individual of interest\n");
+  printf("  -I, --index INDEX\n");
+  printf("\tspecify the index of the individual of interest\n");
+  printf("  -R, --rank RANK\n");
+  printf("\tspecify the rank of the individual of interest\n");
+  printf("  -n, --nb-mutants NB_MUTANTS\n");
+  printf("\tspecify the number of mutants to be generated\n");
+}
 
-  const char * options_list = "hVg:n:r:i:";
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  const char* options_list = "hVt:n:R:I:";
   static struct option long_options_list[] = {
-    {"help",          no_argument,        NULL, 'h'},
-    {"version",       no_argument,        NULL, 'V'},
-    {"gener",           required_argument,  NULL, 'g'},
-    {"nb-children",   required_argument,  NULL, 'n'},
-    {"rank",          required_argument,  NULL, 'r'},
-    {"index",         required_argument,  NULL, 'i'},
-    {0, 0, 0, 0}
+      {"help",       no_argument,       NULL, 'h'},
+      {"version",    no_argument,       NULL, 'V'},
+      {"timestep",   required_argument, NULL, 't'},
+      {"nb-mutants", required_argument, NULL, 'n'},
+      {"rank",       required_argument, NULL, 'R'},
+      {"index",      required_argument, NULL, 'I'},
+      {0, 0, 0, 0}
   };
 
-  int option = -1;
-  while((option=getopt_long(argc,argv,options_list,long_options_list,NULL))!=-1)
-  {
-    switch(option)
-    {
+  int option;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               NULL)) != -1) {
+    switch (option) {
       case 'h' :
-      {
         print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
+        exit(EXIT_SUCCESS);
       case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'g' :
-      {
-        if ( strcmp( optarg, "" ) == 0 )
-        {
-          printf( "%s: error: Option -g or --gener : missing argument.\n", argv[0] );
-          exit( EXIT_FAILURE );
-        }
-
-        num_gener = atol( optarg );
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      case 't' :
+        timestep = atol(optarg);
         break;
-      }
       case 'n' :
         nb_children = atol(optarg);
         break;
-      case 'r' :
+      case 'R' :
+        if (wanted_index != -1) {
+          Utils::ExitWithUsrMsg("Options -R and -I are incompatible");
+        }
         wanted_rank = atol(optarg);
-        wanted_index = -1;
         break;
-      case 'i' :
+      case 'I' :
+        if (wanted_rank != -1) {
+          Utils::ExitWithUsrMsg("Options -R and -I are incompatible");
+        }
         wanted_index = atol(optarg);
-        wanted_rank = -1;
         break;
+      default :
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
     }
   }
 
-  if(wanted_rank == -1 && wanted_index ==-1){
-    wanted_rank = 1;
+  // If timestep wasn't provided, use default
+  if (timestep < 0) {
+    timestep = OutputManager::last_gener();
   }
-
-  analysis_type type = ONE_GENERATION;
-
-  population_statistics* population_statistics_compute = new population_statistics(type, nb_children, wanted_rank, wanted_index);
-
-  // Load simulation
-  #ifndef __NO_X
-    ae_exp_manager* exp_manager = new ae_exp_manager_X11();
-  #else
-    ae_exp_manager* exp_manager = new ae_exp_manager();
-  #endif
-  exp_manager->load( num_gener, false, true, false );
-
-  population_statistics_compute->compute_reproduction_stats(exp_manager, num_gener);
-
-  delete exp_manager;
-  delete population_statistics_compute;
-
-  return EXIT_SUCCESS;
-}
-
-
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ( ( prog_name = strrchr( prog_path, '/' )) ) prog_name++;
-  else prog_name = prog_path;
-
-  printf( "\n" );
-  printf( "*********************** aevol - Artificial Evolution ******************* \n" );
-  printf( "*                                                                      * \n" );
-  printf( "*                     Robustness post-treatment program                * \n" );
-  printf( "*                                                                      * \n" );
-  printf( "************************************************************************ \n" );
-  printf( "\n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "\n" );
-  printf( "Usage : %s -h\n", prog_name);
-  printf( "   or : %s -V or --version\n", prog_name );
-  printf( "   or : %s -g numgener [-n nbchildren] [-r rank | -i index]\n", prog_name);
-  printf( "\n" );
-  printf( "This program computes the replication statistics of all the individuals of a given generation,\n");
-  printf( "like the proportion of neutral, beneficial, deleterious offsprings. This is done by simulating\n");
-  printf( "\'nbchildren\' replications for each individual, with its mutation, rearrangement and transfer rates.\n" );
-  printf( "Depending on those rates and genome size, there can be several events per replication.\n" );
-  printf( "Those global statistics are written in %s/robustness_numgener.out, one line per individual\n", STATS_DIR );
-  printf( "in the specified generation.\n\n" );
-  printf( "The program also outputs detailed statistics for one of the individuals (the best one by default). \n");
-  printf( "The detailed statistics for this individual are written in %s/replication_numgener.out,\n", STATS_DIR);
-  printf( "with one line per simulated child of this particular individual.\n");
-  printf( "\n" );
-  printf( "\n" );
-  printf( "\t-h or --help    : Display this help, then exit\n" );
-  printf( "\n" );
-  printf( "\t-V or --version : Print version number, then exit\n" );
-  printf( "\n" );
-  printf( "\t-g numgener or --gener numgener : \n" );
-  printf( "\t                  Generation at which the statistics are computed\n" );
-  printf( "\n" );
-  printf( "\t-n nbchildren or --nb-children nbchildren : \n" );
-  printf( "\t                  Use nbchildren replications per individual to compute its statistics. Default = 1000.\n" );
-  printf( "\n" );
-  printf( "\t-i index or --index index : \n" );
-  printf( "\t                  Index of individual for whom we want detailed information about the simulated offsprings\n" );
-  printf( "\n" );
-  printf( "\t-r rank or --rank rank : \n" );
-  printf( "\t                  Rank of individual for whom we want detailed information about the simulated offsprings\n" );
-
-
-  printf( "\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
 }
diff --git a/src/post_treatments/template.cpp b/src/post_treatments/template.cpp
deleted file mode 100644
index 30478db..0000000
--- a/src/post_treatments/template.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <getopt.h>
-
-
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_manager.h>
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-
-
-
-
-int main( int argc, char* argv[] )
-{
-  // 1) Initialize command-line option variables with default values
-  bool  opt = false;
-  char* input_dir = NULL;
-  int32_t num_gener = -1;
-
-
-  // 2) Define allowed options
-  const char * options_list = "hVoi:g:";
-  static struct option long_options_list[] = {
-    { "help",     no_argument,        NULL, 'h' },
-    { "version",  no_argument,        NULL, 'V' },
-    { "opt",      no_argument,        NULL, 'o' },
-    { "in",       required_argument,  NULL, 'i' },
-    { "gener",    required_argument,  NULL, 'g' },
-    { 0, 0, 0, 0 }
-  };
-
-
-  // 3) Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 )
-  {
-    switch ( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'o' :
-      {
-        opt = true;
-        break;
-      }
-      case 'i' :
-      {
-        input_dir = new char[strlen(optarg)+1];
-        strcpy( input_dir, optarg );
-        break;
-      }
-      case 'g' :
-      {
-        num_gener = atol(optarg);
-        break;
-      }
-      default :
-      {
-        // An error message is printed in getopt_long, we just need to exit
-        exit( EXIT_FAILURE );
-      }
-    }
-  }
-
-  // 4) Check for missing mandatory arguments
-  if (input_dir == NULL)
-  {
-    printf( "%s: error: You must provide an input directory.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
-  if ( num_gener == -1 )
-  {
-    printf( "%s: error: You must provide a generation number.\n", argv[0] );
-    exit( EXIT_FAILURE );
-  }
-
-
-  // Load the experiment
-  ae_exp_manager* exp = new ae_exp_manager();
-  exp->load(input_dir, num_gener, false, false, false);
-
-
-  // *********************************************************************** //
-  // Do something here
-  // *********************************************************************** //
-
-  delete exp;
-}
-
-
-/*!
-  \brief
-
-*/
-void print_help(char* prog_path)
-{
-  // Get the program file-name in prog_name (strip prog_path of the path)
-  char* prog_name; // No new, it will point to somewhere inside prog_path
-  if ((prog_name = strrchr(prog_path, '/'))) prog_name++;
-  else prog_name = prog_path;
-
-  printf( "******************************************************************************\n" );
-  printf( "*                                                                            *\n" );
-  printf( "*                        aevol - Artificial Evolution                        *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "* Aevol is a simulation platform that allows one to let populations of       *\n" );
-  printf( "* digital organisms evolve in different conditions and study experimentally  *\n" );
-  printf( "* the mechanisms responsible for the structuration of the genome and the     *\n" );
-  printf( "* transcriptome.                                                             *\n" );
-  printf( "*                                                                            *\n" );
-  printf( "******************************************************************************\n" );
-  printf( "\n" );
-  printf( "%s: does nothing (template file).\n", prog_name );
-  printf( "\n" );
-  printf( "Usage : %s -h or --help\n", prog_name );
-  printf( "   or : %s -V or --version\n", prog_name );
-  printf( "   or : %s [-o] -a arg\n", prog_name );
-  printf( "\nOptions\n" );
-  printf( "  -h, --help\n\tprint this help, then exit\n\n" );
-  printf( "  -V, --version\n\tprint version number, then exit\n\n" );
-  printf( "  -o, --opt\n\toption with no argument\n" );
-  printf( "  -a, --arg argument\n\toption with an argument\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}
-
-
-
-
-
-
-
-
diff --git a/src/post_treatments/view.cpp b/src/post_treatments/view.cpp
new file mode 100644
index 0000000..ea00512
--- /dev/null
+++ b/src/post_treatments/view.cpp
@@ -0,0 +1,158 @@
+// ****************************************************************************
+//
+//          Aevol - An in silico experimental evolution platform
+//
+// ****************************************************************************
+//
+// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
+// Web: http://www.aevol.fr/
+// E-mail: See <http://www.aevol.fr/contact/>
+// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// ****************************************************************************
+
+// ============================================================================
+//                                   Includes
+// ============================================================================
+#include <cstdlib>
+#include <cstdio>
+
+#include <getopt.h>
+
+#ifdef __NO_X
+  #error This program requires graphics libraries
+#else
+  #include <X11/Xlib.h>
+#endif
+
+#include "aevol.h"
+
+using namespace aevol;
+
+// Helper functions
+void print_help(char* prog_path);
+void interpret_cmd_line_options(int argc, char* argv[]);
+
+// Command-line option variables
+static int64_t timestep = -1;
+
+
+int main(int argc, char* argv[]) {
+  interpret_cmd_line_options(argc, argv);
+
+  // If timestep wasn't provided, use default
+  if (timestep < 0) {
+    timestep = OutputManager::last_gener();
+  }
+
+  printf("Displaying timestep %" PRId64 "...\n", timestep);
+
+  // =================================================================
+  //                       Read the backup file
+  // =================================================================
+  // Load simulation from backup
+  ExpManager_X11* exp_manager = new ExpManager_X11();
+  exp_manager->load(timestep, false, false);
+
+  // =================================================================
+  //                       Draw the windows
+  // =================================================================
+  // Display is off by default, switch it on
+  exp_manager->toggle_display_on_off();
+
+  // Display is usually triggered in ExpManager::run_evolution(), here we want
+  // to call it manually
+  exp_manager->display();
+
+  // Handle user events until he quits
+  while (not exp_manager->quit_signal_received()) {
+    exp_manager->handle_events();
+  }
+
+  delete exp_manager;
+  return EXIT_SUCCESS;
+}
+
+
+void print_help(char* prog_path) {
+  // Get the program file-name in prog_name (strip prog_path of the path)
+  char* prog_name; // No new, it will point to somewhere inside prog_path
+  if ((prog_name = strrchr(prog_path, '/'))) {
+    prog_name++;
+  }
+  else {
+    prog_name = prog_path;
+  }
+
+  printf("******************************************************************************\n");
+  printf("*                                                                            *\n");
+  printf("*                        aevol - Artificial Evolution                        *\n");
+  printf("*                                                                            *\n");
+  printf("* Aevol is a simulation platform that allows one to let populations of       *\n");
+  printf("* digital organisms evolve in different conditions and study experimentally  *\n");
+  printf("* the mechanisms responsible for the structuration of the genome and the     *\n");
+  printf("* transcriptome.                                                             *\n");
+  printf("*                                                                            *\n");
+  printf("******************************************************************************\n");
+  printf("\n");
+  printf("%s: view the simulation at the provided timestep\n",
+         prog_name);
+  printf("\n");
+  printf("Usage : %s -h or --help\n", prog_name);
+  printf("   or : %s -V or --version\n", prog_name);
+  printf("   or : %s [-t TIMESTEP]\n",
+         prog_name);
+  printf("\nOptions\n");
+  printf("  -h, --help\n\tprint this help, then exit\n\n");
+  printf("  -V, --version\n\tprint version number, then exit\n\n");
+  printf("  -t, --timestep TIMESTEP\n");
+  printf("\tspecify timestep to display (default value read in last_gener.txt)\n");
+}
+
+void interpret_cmd_line_options(int argc, char* argv[]) {
+  // Define allowed options
+  const char* options_list = "hVt:";
+  static struct option long_options_list[] = {
+      {"help",       no_argument,       nullptr, 'h'},
+      {"version",    no_argument,       nullptr, 'V'},
+      {"timestep",   required_argument, nullptr, 't'},
+      {0, 0, 0, 0}
+  };
+
+  // Get actual values of the CLI options
+  int option;
+  while ((option = getopt_long(argc, argv, options_list, long_options_list,
+                               nullptr)) != -1) {
+    switch (option) {
+      case 'h' : {
+        print_help(argv[0]);
+        exit(EXIT_SUCCESS);
+      }
+      case 'V' : {
+        Utils::PrintAevolVersion();
+        exit(EXIT_SUCCESS);
+      }
+      case 't' : {
+        timestep = atol(optarg);
+        break;
+      }
+      default : {
+        // An error message is printed in getopt_long, we just need to exit
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
+}
diff --git a/src/post_treatments/view_generation.cpp b/src/post_treatments/view_generation.cpp
deleted file mode 100644
index e6c3882..0000000
--- a/src/post_treatments/view_generation.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-// ****************************************************************************
-//
-//          Aevol - An in silico experimental evolution platform
-//
-// ****************************************************************************
-//
-// Copyright: See the AUTHORS file provided with the package or <www.aevol.fr>
-// Web: http://www.aevol.fr/
-// E-mail: See <http://www.aevol.fr/contact/>
-// Original Authors : Guillaume Beslon, Carole Knibbe, David Parsons
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-//*****************************************************************************
-
-
-
-
-// =================================================================
-//                              Libraries
-// =================================================================
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <signal.h>
-
-#ifdef __NO_X
-#error This program requires graphics libraries
-#else
-#include <X11/Xlib.h>
-#endif
-
-// =================================================================
-//                            Project Files
-// =================================================================
-#include <ae_exp_manager_X11.h>
-#include <ae_population.h>
-#include <ae_individual.h>
-#include <ae_list.h>
-
-
-
-
-// =================================================================
-//                         Function declarations
-// =================================================================
-void print_help(char* prog_path);
-void print_version( void );
-
-
-
-
-
-int main( int argc, char* argv[] )
-{
-
-
-
-  // =================================================================
-  //                      Get command-line options
-  // =================================================================
-  //
-  // 1) Initialize command-line option variables with default values
-  int32_t gener = 0;
-
-  // 2) Define allowed options
-  const char * options_list = "hVg:";
-  static struct option long_options_list[] = {
-    {"version",   no_argument,       NULL, 'V' },
-    { "gener", 1, NULL, 'g' },
-    { 0, 0, 0, 0 }
-  };
-
-  // 3) Get actual values of the command-line options
-  int option;
-  while ( ( option = getopt_long(argc, argv, options_list, long_options_list, NULL) ) != -1 )
-  {
-  switch ( option )
-    {
-      case 'h' :
-      {
-        print_help(argv[0]);
-        exit( EXIT_SUCCESS );
-      }
-      case 'V' :
-      {
-        print_version();
-        exit( EXIT_SUCCESS );
-      }
-      case 'g' :
-      {
-	      if ( strcmp( optarg, "" ) == 0 )
-    		{
-    		  printf( "%s: error: Option -g or --gener : missing argument.\n", argv[0] );
-    		  exit( EXIT_FAILURE );
-    		}
-
-	      gener = atol( optarg );
-        break;
-      }
-    }
-  }
-
-
-
-  printf( "Displaying generation %"PRId32"...\n", gener );
-
-  // =================================================================
-  //                       Read the backup file
-  // =================================================================
-  // Load simulation from backup
-  ae_exp_manager_X11* exp_manager = new ae_exp_manager_X11();
-  exp_manager->load( gener, false, true, false );
-
-
-
-  // =================================================================
-  //                       Draw the windows
-  // =================================================================
-
-
-  exp_manager->toggle_display_on_off();
-  exp_manager->display();
-  while ( exp_manager->quit_signal_received() == false )
-  {
-    exp_manager->handle_events();
-  }
-
-
-
-  delete exp_manager;
-
-  return EXIT_SUCCESS;
-}
-
-
-void print_help(char* prog_name)
-{
-  printf( "\n************* aevol - Artificial Evolution ************* \n\n" );
-  printf( "This program is Free Software. No Warranty.\n" );
-  printf( "Copyright (C) 2009  LIRIS.\n" );
-  printf( "Usage : %s -h\n", prog_name );
-  printf( "   or : %s -f file.ae\n", prog_name );
-  printf( "\t-h : Display this screen\n" );
-  printf( "\t-g or --gener n    : Display the population at generation n\n" );
-}
-
-
-/*!
-  \brief Print aevol version number
-
-*/
-void print_version( void )
-{
-  printf( "aevol %s\n", VERSION );
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/aevol.git



More information about the debian-med-commit mailing list