From 9cb867664b83725abdc0ceb12dd523e2cbfedde4 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Mon, 6 Jul 2015 19:51:01 +0200
Subject: [PATCH] Added doc for --enable-modules

---
 user-doc/Modules.txt | 39 +++++++++++++++++++++++++++++++++++----
 user-doc/extract     |  2 +-
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/user-doc/Modules.txt b/user-doc/Modules.txt
index e817fb596..e6ec3e095 100644
--- a/user-doc/Modules.txt
+++ b/user-doc/Modules.txt
@@ -8,11 +8,35 @@ code while others may wish to use some of PLUMED's more complicated features.
 For this reason the plumed source code is divided into modules, which users can
 activate or deactivate to their hearts content.  
 
-- To activate a module add a file called modulename.on to the plumed2/src directory  
-- To deactivate a module add a file called modulename.off to the plumed2/src directory
+You can activate a module at configure time using the keyword `--enable-modules`.
+For example:
+\verbatim
+./configure --enable-modules=modulename
+\endverbatim
+will enable module called modulename. A module that is on by default can be disabled
+using the following syntax
+\verbatim
+./configure --enable-modules=-modulename
+\endverbatim
+To enable or disable multiple modules one should provide them as a comma separated
+list. Notice that `+modulename` and `modulename` both activate the module, whereas
+`-modulename` deactivate it. E.g.
+\verbatim
+./configure --enable-modules=+crystallization,-colvar
+\endverbatim
+will disable the colvar module and enable the crystallization module.
+If you repeat the `--enable-modules` keyword only the last one will be used. Thus
+`./configure --enable-modules=crystallization --enable-modules=-colvar` will _not_ do what you expect!
 
-Obviously, in the above instructions modulename should be replaced by the name of the
-module that you would like to activate or deactivate.
+There are also some shortcuts available:
+- `./configure --enable-modules=all` to enable all optional modules. This includes the maximum number of features in PLUMED,
+including modules that might not be properly functional.
+- `./configure --enable-modules=none` or `./configure --disable-modules` to disable all optional modules. This produces a minimalistic
+PLUMED which can be used as a library but has no command line tools and no collective variables or biasing methods.
+- `./configure --enable-modules=reset` or `./configure --enable-modules` to enable the default modules.
+
+The two kinds of syntax can be combined and, fox example, `./configure --enable-modules=none,colvar` will result
+in a PLUMED with all the modules disabled with the exception of the colvar module.
 
 Some modules are active by default in the version of PLUMED 2 that you download from 
 the website while others are inactive.  The following lists all of the modules that
@@ -20,4 +44,11 @@ are available in plumed and tells you whether or not they are active by default.
 
 @MODULES@
 
+Until PLUMED 2.1, the you could only switch on or off modules by adding files
+in the plumed2/src directory:
+- To activate a module add a file called modulename.on to the plumed2/src directory  
+- To deactivate a module add a file called modulename.off to the plumed2/src directory
+Obviously, in the above instructions modulename should be replaced by the name of the
+module that you would like to activate or deactivate.
+
 */
diff --git a/user-doc/extract b/user-doc/extract
index f1b81225f..6029129c4 100755
--- a/user-doc/extract
+++ b/user-doc/extract
@@ -198,7 +198,7 @@ do
                 print "<b> This is part of the '$file' \\link mymodules module \\endlink</b>"
                 print "</td> </tr>"
                 print "<tr> <td width=60%%> </td> <td>"
-                print "<b> It is only available if you add a file called '$file'.on to the plumed2/src directory prior to compilation. "
+                print "<b> It is only available if you configure PLUMED with ./configure --enable-modules='$file'. "
                 print "Furthermore, this feature is still being developed so take care when using it and report any problems on the mailing list.</b>"
                 print "</td> </tr>"
                 print "</table>"
-- 
GitLab