diff --git a/src/bias/.gitignore b/src/bias/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..4888552338441b5d99a97ec7a2cb2ce448e9e4e6
--- /dev/null
+++ b/src/bias/.gitignore
@@ -0,0 +1,9 @@
+/*
+# in this directory, only accept source, Makefile and README
+!/.gitignore
+!/*.c
+!/*.cpp
+!/*.h
+!/Makefile
+!/README
+!/module.type
diff --git a/src/bias/ActionRegister.h b/src/bias/ActionRegister.h
new file mode 100644
index 0000000000000000000000000000000000000000..732046c8f75a2263f6615ad8caf56ff2b5ef7de5
--- /dev/null
+++ b/src/bias/ActionRegister.h
@@ -0,0 +1 @@
+#include "core/ActionRegister.h"
diff --git a/src/core/Bias.cpp b/src/bias/Bias.cpp
similarity index 98%
rename from src/core/Bias.cpp
rename to src/bias/Bias.cpp
index 1a0864a78f9afd67bae1a7eacfa2725f70fe47b9..0e38ed5af6dbff761e38bb8732d8876c5afb183c 100644
--- a/src/core/Bias.cpp
+++ b/src/bias/Bias.cpp
@@ -20,7 +20,6 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Bias.h"
-#include "Colvar.h"
 
 using namespace PLMD;
 using namespace std;
diff --git a/src/core/Bias.h b/src/bias/Bias.h
similarity index 94%
rename from src/core/Bias.h
rename to src/bias/Bias.h
index 00321cf0adb32081ee3015478bae9a76251fbe47..68f126135138970668f25b4cb86edc427de95f1b 100644
--- a/src/core/Bias.h
+++ b/src/bias/Bias.h
@@ -22,9 +22,9 @@
 #ifndef __PLUMED_Bias_h
 #define __PLUMED_Bias_h
 
-#include "ActionPilot.h"
-#include "ActionWithValue.h"
-#include "ActionWithArguments.h"
+#include "core/ActionPilot.h"
+#include "core/ActionWithValue.h"
+#include "core/ActionWithArguments.h"
 
 #define PLUMED_BIAS_INIT(ao) Action(ao),Bias(ao)
 
diff --git a/src/core/BiasExternal.cpp b/src/bias/BiasExternal.cpp
similarity index 100%
rename from src/core/BiasExternal.cpp
rename to src/bias/BiasExternal.cpp
diff --git a/src/core/BiasLWalls.cpp b/src/bias/BiasLWalls.cpp
similarity index 100%
rename from src/core/BiasLWalls.cpp
rename to src/bias/BiasLWalls.cpp
diff --git a/src/core/BiasMetaD.cpp b/src/bias/BiasMetaD.cpp
similarity index 99%
rename from src/core/BiasMetaD.cpp
rename to src/bias/BiasMetaD.cpp
index c397daff5e402f435809757814ac836803bf4daf..141a888b639e6097ab3be15537b22c1152612907 100644
--- a/src/core/BiasMetaD.cpp
+++ b/src/bias/BiasMetaD.cpp
@@ -22,10 +22,10 @@
 #include "Bias.h"
 #include "ActionRegister.h"
 #include "tools/Grid.h"
-#include "PlumedMain.h"
-#include "Atoms.h"
+#include "core/PlumedMain.h"
+#include "core/Atoms.h"
 #include "tools/PlumedException.h"
-#include "FlexibleBin.h"
+#include "core/FlexibleBin.h"
 #include "tools/Matrix.h"
 #include "tools/Random.h"
 #include <string>
diff --git a/src/core/BiasMovingRestraint.cpp b/src/bias/BiasMovingRestraint.cpp
similarity index 100%
rename from src/core/BiasMovingRestraint.cpp
rename to src/bias/BiasMovingRestraint.cpp
diff --git a/src/core/BiasRatchet.cpp b/src/bias/BiasRatchet.cpp
similarity index 100%
rename from src/core/BiasRatchet.cpp
rename to src/bias/BiasRatchet.cpp
diff --git a/src/core/BiasRestraint.cpp b/src/bias/BiasRestraint.cpp
similarity index 100%
rename from src/core/BiasRestraint.cpp
rename to src/bias/BiasRestraint.cpp
diff --git a/src/core/BiasUWalls.cpp b/src/bias/BiasUWalls.cpp
similarity index 100%
rename from src/core/BiasUWalls.cpp
rename to src/bias/BiasUWalls.cpp
diff --git a/src/core/BiasValue.cpp b/src/bias/BiasValue.cpp
similarity index 100%
rename from src/core/BiasValue.cpp
rename to src/bias/BiasValue.cpp
diff --git a/src/bias/Makefile b/src/bias/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..43a7e56203b0b338b423b8e9a2349e05c248c312
--- /dev/null
+++ b/src/bias/Makefile
@@ -0,0 +1,5 @@
+USE=core tools
+BUILDAFTER=config
+
+#generic makefile
+include ../maketools/make.module
diff --git a/src/bias/module.type b/src/bias/module.type
new file mode 100644
index 0000000000000000000000000000000000000000..fc25731b66113b18d1a475c4aacc51104db7f883
--- /dev/null
+++ b/src/bias/module.type
@@ -0,0 +1 @@
+default-on
diff --git a/src/colvar/.gitignore b/src/colvar/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..4888552338441b5d99a97ec7a2cb2ce448e9e4e6
--- /dev/null
+++ b/src/colvar/.gitignore
@@ -0,0 +1,9 @@
+/*
+# in this directory, only accept source, Makefile and README
+!/.gitignore
+!/*.c
+!/*.cpp
+!/*.h
+!/Makefile
+!/README
+!/module.type
diff --git a/src/colvar/ActionRegister.h b/src/colvar/ActionRegister.h
new file mode 100644
index 0000000000000000000000000000000000000000..732046c8f75a2263f6615ad8caf56ff2b5ef7de5
--- /dev/null
+++ b/src/colvar/ActionRegister.h
@@ -0,0 +1 @@
+#include "core/ActionRegister.h"
diff --git a/src/colvar/Colvar.h b/src/colvar/Colvar.h
new file mode 100644
index 0000000000000000000000000000000000000000..fab079d4d31b8f7670919f96cb121600e84f7875
--- /dev/null
+++ b/src/colvar/Colvar.h
@@ -0,0 +1 @@
+#include "core/Colvar.h"
diff --git a/src/core/ColvarAngle.cpp b/src/colvar/ColvarAngle.cpp
similarity index 100%
rename from src/core/ColvarAngle.cpp
rename to src/colvar/ColvarAngle.cpp
diff --git a/src/core/ColvarContactMap.cpp b/src/colvar/ColvarContactMap.cpp
similarity index 100%
rename from src/core/ColvarContactMap.cpp
rename to src/colvar/ColvarContactMap.cpp
diff --git a/src/core/ColvarCoordination.cpp b/src/colvar/ColvarCoordination.cpp
similarity index 100%
rename from src/core/ColvarCoordination.cpp
rename to src/colvar/ColvarCoordination.cpp
diff --git a/src/core/ColvarDRMSD.cpp b/src/colvar/ColvarDRMSD.cpp
similarity index 99%
rename from src/core/ColvarDRMSD.cpp
rename to src/colvar/ColvarDRMSD.cpp
index 577ef0c5b0e1c6e5be02fce8cb34809761ee12ce..8b08e17e953d48930ce77ce45f4c881f1c3880ca 100644
--- a/src/core/ColvarDRMSD.cpp
+++ b/src/colvar/ColvarDRMSD.cpp
@@ -20,11 +20,11 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Colvar.h"
-#include "PlumedMain.h"
+#include "core/PlumedMain.h"
 #include "ActionRegister.h"
 #include "tools/PDB.h"
 #include "tools/DRMSD.h"
-#include "Atoms.h"
+#include "core/Atoms.h"
 
 using namespace std;
 
diff --git a/src/core/ColvarDipole.cpp b/src/colvar/ColvarDipole.cpp
similarity index 100%
rename from src/core/ColvarDipole.cpp
rename to src/colvar/ColvarDipole.cpp
diff --git a/src/core/ColvarDistance.cpp b/src/colvar/ColvarDistance.cpp
similarity index 100%
rename from src/core/ColvarDistance.cpp
rename to src/colvar/ColvarDistance.cpp
diff --git a/src/core/ColvarEnergy.cpp b/src/colvar/ColvarEnergy.cpp
similarity index 97%
rename from src/core/ColvarEnergy.cpp
rename to src/colvar/ColvarEnergy.cpp
index 2b0b295e511b5e5ead6b6bf680bdef68c0575052..b07a314db2a5c36b3d58d87875fa7444bfc8256d 100644
--- a/src/core/ColvarEnergy.cpp
+++ b/src/colvar/ColvarEnergy.cpp
@@ -21,8 +21,8 @@
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Colvar.h"
 #include "ActionRegister.h"
-#include "PlumedMain.h"
-#include "Atoms.h"
+#include "core/PlumedMain.h"
+#include "core/Atoms.h"
 
 #include <string>
 #include <cmath>
diff --git a/src/core/ColvarGyration.cpp b/src/colvar/ColvarGyration.cpp
similarity index 99%
rename from src/core/ColvarGyration.cpp
rename to src/colvar/ColvarGyration.cpp
index dfa0a39ee4451f76aa78a4797547326b7aa9c695..566a5829beecfc19ed2e2071efe0f7998cf24802 100644
--- a/src/core/ColvarGyration.cpp
+++ b/src/colvar/ColvarGyration.cpp
@@ -21,7 +21,7 @@
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Colvar.h"
 #include "ActionRegister.h"
-#include "PlumedMain.h"
+#include "core/PlumedMain.h"
 #include "tools/Matrix.h"
 
 #include <string>
diff --git a/src/core/ColvarPathMSD.cpp b/src/colvar/ColvarPathMSD.cpp
similarity index 99%
rename from src/core/ColvarPathMSD.cpp
rename to src/colvar/ColvarPathMSD.cpp
index f057f0fd7aa4c9db04836a95e1999a1fdbbdf77a..4ca4bf0f0acbe5daece3a57f80aae72109321302 100644
--- a/src/core/ColvarPathMSD.cpp
+++ b/src/colvar/ColvarPathMSD.cpp
@@ -20,6 +20,7 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "ColvarPathMSDBase.h"
+#include "core/PlumedMain.h"
 
 using namespace std;
 
diff --git a/src/core/ColvarPathMSDBase.cpp b/src/colvar/ColvarPathMSDBase.cpp
similarity index 99%
rename from src/core/ColvarPathMSDBase.cpp
rename to src/colvar/ColvarPathMSDBase.cpp
index 38400d4cdf17805b059d23e99f47738e842620a8..7c291ddcaf138daa09e8a3c506ed876bc58f11c2 100644
--- a/src/core/ColvarPathMSDBase.cpp
+++ b/src/colvar/ColvarPathMSDBase.cpp
@@ -25,13 +25,15 @@
 #include "ColvarPathMSDBase.h"
 #include "ActionRegister.h"
 
+#include "core/PlumedMain.h"
+
 #include <string>
 #include <cstring>
 #include <cassert>
 #include <iostream>
 #include "tools/PDB.h"
 #include "tools/RMSD.h"
-#include "Atoms.h"
+#include "core/Atoms.h"
 #include "tools/Tools.h"
 
 using namespace std;
diff --git a/src/core/ColvarPathMSDBase.h b/src/colvar/ColvarPathMSDBase.h
similarity index 98%
rename from src/core/ColvarPathMSDBase.h
rename to src/colvar/ColvarPathMSDBase.h
index cb2764fc63583dd1e1fb3c34ba1bc4d148348ae5..eb514bda0d575ccf848689ea8ea9191e70a2d71b 100644
--- a/src/core/ColvarPathMSDBase.h
+++ b/src/colvar/ColvarPathMSDBase.h
@@ -25,7 +25,6 @@
 
 #include <cmath>
 
-#include "PlumedMain.h"
 #include "Colvar.h"
 #include "ActionRegister.h"
 
@@ -35,7 +34,6 @@
 #include <iostream>
 #include "tools/PDB.h"
 #include "tools/RMSD.h"
-#include "Atoms.h"
 #include "tools/Tools.h"
 
 using namespace std;
diff --git a/src/core/ColvarPropertyMap.cpp b/src/colvar/ColvarPropertyMap.cpp
similarity index 99%
rename from src/core/ColvarPropertyMap.cpp
rename to src/colvar/ColvarPropertyMap.cpp
index 8d3bebf9cea88ce3fb41bf946719d5798452786b..8007cd8ceca3735cb4562a34268cb981643d0f96 100644
--- a/src/core/ColvarPropertyMap.cpp
+++ b/src/colvar/ColvarPropertyMap.cpp
@@ -20,6 +20,7 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "ColvarPathMSDBase.h"
+#include "core/PlumedMain.h"
 
 using namespace std;
 
diff --git a/src/core/ColvarRMSD.cpp b/src/colvar/ColvarRMSD.cpp
similarity index 99%
rename from src/core/ColvarRMSD.cpp
rename to src/colvar/ColvarRMSD.cpp
index 28d5397e6ca77c6bdb37144f806a9d323362ff16..6b3b801cb277979bd6491a211f63434380b1e325 100644
--- a/src/core/ColvarRMSD.cpp
+++ b/src/colvar/ColvarRMSD.cpp
@@ -20,11 +20,11 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Colvar.h"
-#include "PlumedMain.h"
+#include "core/PlumedMain.h"
 #include "ActionRegister.h"
 #include "tools/PDB.h"
 #include "tools/RMSD.h"
-#include "Atoms.h"
+#include "core/Atoms.h"
 
 
 using namespace std;
diff --git a/src/core/ColvarTemplate.cpp b/src/colvar/ColvarTemplate.cpp
similarity index 100%
rename from src/core/ColvarTemplate.cpp
rename to src/colvar/ColvarTemplate.cpp
diff --git a/src/core/ColvarTorsion.cpp b/src/colvar/ColvarTorsion.cpp
similarity index 100%
rename from src/core/ColvarTorsion.cpp
rename to src/colvar/ColvarTorsion.cpp
diff --git a/src/core/ColvarVolume.cpp b/src/colvar/ColvarVolume.cpp
similarity index 100%
rename from src/core/ColvarVolume.cpp
rename to src/colvar/ColvarVolume.cpp
diff --git a/src/colvar/Makefile b/src/colvar/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..43a7e56203b0b338b423b8e9a2349e05c248c312
--- /dev/null
+++ b/src/colvar/Makefile
@@ -0,0 +1,5 @@
+USE=core tools
+BUILDAFTER=config
+
+#generic makefile
+include ../maketools/make.module
diff --git a/src/colvar/module.type b/src/colvar/module.type
new file mode 100644
index 0000000000000000000000000000000000000000..fc25731b66113b18d1a475c4aacc51104db7f883
--- /dev/null
+++ b/src/colvar/module.type
@@ -0,0 +1 @@
+default-on
diff --git a/src/function/ActionRegister.h b/src/function/ActionRegister.h
new file mode 100644
index 0000000000000000000000000000000000000000..732046c8f75a2263f6615ad8caf56ff2b5ef7de5
--- /dev/null
+++ b/src/function/ActionRegister.h
@@ -0,0 +1 @@
+#include "core/ActionRegister.h"
diff --git a/src/core/Function.cpp b/src/function/Function.cpp
similarity index 100%
rename from src/core/Function.cpp
rename to src/function/Function.cpp
diff --git a/src/core/Function.h b/src/function/Function.h
similarity index 96%
rename from src/core/Function.h
rename to src/function/Function.h
index 7af89b2f5dbd7d416e6da70cebd12293303b21d2..2ed50420af683e83a55f318c8cd2d61248a91bc0 100644
--- a/src/core/Function.h
+++ b/src/function/Function.h
@@ -22,8 +22,8 @@
 #ifndef __PLUMED_Function_h
 #define __PLUMED_Function_h
 
-#include "ActionWithValue.h"
-#include "ActionWithArguments.h"
+#include "core/ActionWithValue.h"
+#include "core/ActionWithArguments.h"
 
 namespace PLMD{
 
diff --git a/src/core/FunctionCombine.cpp b/src/function/FunctionCombine.cpp
similarity index 100%
rename from src/core/FunctionCombine.cpp
rename to src/function/FunctionCombine.cpp
index 4e4fb0f311f3a0c462aa6bf7a92830ea47380ee1..59eb6df3918b7b90f9027f3e05a5bcc9ec450952 100644
--- a/src/core/FunctionCombine.cpp
+++ b/src/function/FunctionCombine.cpp
@@ -19,8 +19,8 @@
    You should have received a copy of the GNU Lesser General Public License
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
-#include "ActionRegister.h"
 #include "Function.h"
+#include "ActionRegister.h"
 
 #include <cmath>
 #include <cassert>
diff --git a/src/core/FunctionFuncPathMSD.cpp b/src/function/FunctionFuncPathMSD.cpp
similarity index 100%
rename from src/core/FunctionFuncPathMSD.cpp
rename to src/function/FunctionFuncPathMSD.cpp
diff --git a/src/core/FunctionMatheval.cpp b/src/function/FunctionMatheval.cpp
similarity index 100%
rename from src/core/FunctionMatheval.cpp
rename to src/function/FunctionMatheval.cpp
diff --git a/src/core/FunctionPiecewise.cpp b/src/function/FunctionPiecewise.cpp
similarity index 99%
rename from src/core/FunctionPiecewise.cpp
rename to src/function/FunctionPiecewise.cpp
index 7006ab2e673c6f0454ee8174c1931686780ccf92..d054ab12a4759b19e22851ddca9358a7b6dcc1c5 100644
--- a/src/core/FunctionPiecewise.cpp
+++ b/src/function/FunctionPiecewise.cpp
@@ -19,7 +19,7 @@
    You should have received a copy of the GNU Lesser General Public License
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
-#include "ActionRegister.h"
+#include "core/ActionRegister.h"
 #include "Function.h"
 
 #include <cmath>
diff --git a/src/core/FunctionSort.cpp b/src/function/FunctionSort.cpp
similarity index 100%
rename from src/core/FunctionSort.cpp
rename to src/function/FunctionSort.cpp
diff --git a/src/core/FunctionTarget.cpp b/src/function/FunctionTarget.cpp
similarity index 97%
rename from src/core/FunctionTarget.cpp
rename to src/function/FunctionTarget.cpp
index 2a3f2dee70dbc969965d2901cdf9c5b55f3e0787..d8b085fcf9c4d080823399c009ca72b1e935ee31 100644
--- a/src/core/FunctionTarget.cpp
+++ b/src/function/FunctionTarget.cpp
@@ -20,11 +20,11 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "Function.h"
-#include "PlumedMain.h"
 #include "ActionRegister.h"
 #include "tools/PDB.h"
-#include "TargetDist.h"
-#include "Atoms.h"
+#include "core/TargetDist.h"
+#include "core/Atoms.h"
+#include "core/PlumedMain.h"
 
 using namespace std;
 
diff --git a/src/function/Makefile b/src/function/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..43a7e56203b0b338b423b8e9a2349e05c248c312
--- /dev/null
+++ b/src/function/Makefile
@@ -0,0 +1,5 @@
+USE=core tools
+BUILDAFTER=config
+
+#generic makefile
+include ../maketools/make.module
diff --git a/src/function/core b/src/function/core
new file mode 120000
index 0000000000000000000000000000000000000000..c73d9e17d5d3420a0d1beb35ff9f397abdc20713
--- /dev/null
+++ b/src/function/core
@@ -0,0 +1 @@
+../core
\ No newline at end of file
diff --git a/src/function/module.type b/src/function/module.type
new file mode 100644
index 0000000000000000000000000000000000000000..fc25731b66113b18d1a475c4aacc51104db7f883
--- /dev/null
+++ b/src/function/module.type
@@ -0,0 +1 @@
+default-on
diff --git a/src/function/tools b/src/function/tools
new file mode 120000
index 0000000000000000000000000000000000000000..4887d6e0c92bc54e60e1c3c13adfbc752f93a0dc
--- /dev/null
+++ b/src/function/tools
@@ -0,0 +1 @@
+../tools
\ No newline at end of file