diff --git a/src/colvar/Dimer.cpp b/src/colvar/Dimer.cpp
index cb547a2f3046d642301f57b378fd8ebc58c10557..bbf18c510924c3c4228cb5270e78127076155225 100644
--- a/src/colvar/Dimer.cpp
+++ b/src/colvar/Dimer.cpp
@@ -113,6 +113,7 @@ like in the previous examples, and each replica will read its own DSIGMA value.
 a unique plumed.dat is given, DSIGMA has to be a list containing a value for each replica.
 For 4 replicas:
 \plumedfile
+#SETTINGS NREPLICAS=4
 dim: DIMER TEMP=300 Q=0.5 ATOMS1=1,5,7 ATOMS2=23,27,29 DSIGMA=0.002,0.002,0.004,0.01
 \endplumedfile
 
diff --git a/src/generic/Include.cpp b/src/generic/Include.cpp
index 84bec5cb2cce4e19af97114527d187bfbaa22e22..950d6ef7e7d979ac8e7df861fb6492ea4c4adf3f 100644
--- a/src/generic/Include.cpp
+++ b/src/generic/Include.cpp
@@ -121,12 +121,12 @@ a file for reading it looks for a file with the replica suffix first.
 This is true also for files opened by INCLUDE!
 
 As an example, the same result of the inputs above could have been obtained using
-`plumed.dat`:
-\plumedmultireplicafile{2}
-# this is plumed.dat
+the following `plumed.dat` file:
+\plumedfile
+#SETTINGS NREPLICAS=2
 t: TORSION ATOMS=1,2,3,4
 INCLUDE FILE=other.inc
-\endplumedmultireplicafile
+\endplumedfile
 Then `other.0.inc`:
 \plumedincludefile
 # this is other.0.inc
diff --git a/src/ves/Opt_BachAveragedSGD.cpp b/src/ves/Opt_BachAveragedSGD.cpp
index 34151444fdbe3fafd9ed49bced4113e9ac530308..5c44decbf434580ef81af1e442801a95ed1a6256 100644
--- a/src/ves/Opt_BachAveragedSGD.cpp
+++ b/src/ves/Opt_BachAveragedSGD.cpp
@@ -138,7 +138,8 @@ is updated every 500 iterations (e.g. every 1000 ps). The target distribution is
 also output to a file every 2000 iterations (the TARGETDIST_OUTPUT keyword).
 Here we also employ MULTIPLE_WALKERS flag to enable the usage of
 multiple walkers.
-\plumedmultireplicafile{2}
+\plumedfile
+#SETTINGS NREPLICAS=2
 phi:   TORSION ATOMS=5,7,9,15
 psi:   TORSION ATOMS=7,9,15,17
 
@@ -172,7 +173,7 @@ OPT_AVERAGED_SGD ...
   TARGETDIST_STRIDE=500
   TARGETDIST_OUTPUT=2000
 ... OPT_AVERAGED_SGD
-\endplumedmultireplicafile
+\endplumedfile
 
 
 
diff --git a/user-doc/Doxyfile b/user-doc/Doxyfile
index 7844b91fb905f8b38a2401261097deacab0a7f10..571e3ad3b2d0754e28d81bafef988651c6a9aff6 100644
--- a/user-doc/Doxyfile
+++ b/user-doc/Doxyfile
@@ -238,8 +238,6 @@ ALIASES                = \
                          "tarball{1}=\htmlonly<span style=\"background-color:yellow\">\endhtmlonly<a href=\"tutorial-resources/\1.tar.gz\" style=\"font-weight:bold\" style=\"color:green\" download=\"\1.tar.gz\"> TARBALL </a>\htmlonly</span>\endhtmlonly" \
                          "plumedfile=\verbatim BEGIN_PLUMED_FILE" \
                          "endplumedfile=\endverbatim" \
-                         "plumedmultireplicafile{1}=\verbatim BEGIN_PLUMED_FILE" \
-                         "endplumedmultireplicafile=\endverbatim" \
                          "plumedincludefile=\verbatim BEGIN_PLUMED_FILE" \
                          "endplumedincludefile=\endverbatim" \
                          "auxfile{1}=\verbatim" \
diff --git a/user-doc/Miscelaneous.md b/user-doc/Miscelaneous.md
index 9978e59f129208f60bf1a761cc9a4765395cdb90..30f8557d811b1143585f5e8bc95629f60d6c4170 100644
--- a/user-doc/Miscelaneous.md
+++ b/user-doc/Miscelaneous.md
@@ -530,7 +530,8 @@ file with common definitions and specific input files with replica-dependent key
 However, as of PLUMED 2.4, we introduced a simpler manner to manipulate multiple replica
 inputs with tiny differences. Look at the following example:
 
-\plumedmultireplicafile{3}
+\plumedfile 
+#SETTINGS NREPLICAS=3
 # Compute a distance
 d: DISTANCE ATOMS=1,2
 
@@ -542,7 +543,7 @@ RESTRAINT ARG=d AT=@replicas:1.0,1.1,1.2 KAPPA=1.0
 #   RESTRAINT ARG=d AT=1.1 KAPPA=1.0
 # On replica 2, this means:
 #   RESTRAINT ARG=d AT=1.2 KAPPA=1.0
-\endplumedmultireplicafile
+\endplumedfile
 
 If you prepare a single `plumed.dat` file like this one and feeds it to PLUMED while using 3 replicas,
 the 3 replicas will see the very same input except for the `AT` keyword, that sets the position of the restraint.
@@ -550,7 +551,8 @@ Replica 0 will see a restraint centered at 1.0, replica 1 centered at 1.1, and r
 
 The `@replicas:` keyword is not special for \ref RESTRAINT or for the `AT` keyword. Any keyword in PLUMED can accept that syntax.
 For instance, the following single input file can be used to setup a bias exchange metadynamics \cite piana simulations:
-\plumedmultireplicafile{2}
+\plumedfile
+#SETTINGS NREPLICAS=2
 # Compute distance between atoms 1 and 2
 d: DISTANCE ATOMS=1,2
 
@@ -570,7 +572,7 @@ METAD ...
 #  METAD ARG=d HEIGHT=1.0 PACE=100 SIGMA=0.1 GRID_MIN=0.0 GRID_MAX=2.0
 # On replica 1, this means:
 #  METAD ARG=t HEIGHT=1.0 PACE=100 SIGMA=0.3 GRID_MIN=-pi GRID_MAX=+pi
-\endplumedmultireplicafile
+\endplumedfile
 
 This would be a typical setup for a bias exchange simulation.
 Notice that even though variables `d` and `t` are both read in both replicas,
@@ -580,7 +582,8 @@ This is because variables that are defined but not used are never actually calcu
 If the value that should be provided for each replica is a vector, you should use curly braces as delimiters.
 For instance, if the restraint acts on two variables, you can use the following input:
 
-\plumedmultireplicafile{3}
+\plumedfile
+#SETTINGS NREPLICAS=3
 # Compute distance between atoms 1 and 2
 d: DISTANCE ATOMS=10,20
 
@@ -599,13 +602,14 @@ RESTRAINT ...
 #  RESTRAINT ARG=d AT=3.0,4.0 KAPPA=1.0,3.0
 # On replica 2 this means:
 #  RESTRAINT ARG=d AT=5.0,6.0 KAPPA=1.0,3.0
-\endplumedmultireplicafile
+\endplumedfile
 
 Notice the double curly braces. The outer ones are used by PLUMED to know there the argument of the `AT` keyword ends,
 whereas the inner ones are used to group the values corresponding to each replica.
 Also notice that the last example can be split in multiple lines exploiting the fact that
 within multi-line statements (enclosed by pairs of `...`) newlines are replaced with simple spaces:
-\plumedmultireplicafile{3}
+\plumedfile
+#SETTINGS NREPLICAS=3
 d: DISTANCE ATOMS=10,20
 t: TORSION ATOMS=30,31,32,33
 RESTRAINT ...
@@ -619,7 +623,7 @@ RESTRAINT ...
   }
   KAPPA=1.0,3.0
 ...
-\endplumedmultireplicafile
+\endplumedfile
 
 In short, whenever there are keywords that should vary across replicas, you should set them using the `@replicas:` keyword.
 As mentioned above, you can always use the old syntax with separate input file, and this is recommended when the
diff --git a/user-doc/go-example-check b/user-doc/go-example-check
index 5fd360d9b13461fa610d003d63e92d687bedc6c4..f4d44a76fdc15cfa1ee786ecdf85a1993e5e521e 100755
--- a/user-doc/go-example-check
+++ b/user-doc/go-example-check
@@ -16,16 +16,6 @@ for file in *PP.md automatic/*.txt ../CHANGES/*.md tutorials/*.txt tutorials/*.s
            else if( $1=="\\plumedfile" ){ inp=1; }
            else if( inp==1 ){ print $0; }  
          }' > example-check/$fname.dat
-    # Multiple replica examples
-    splits=`echo $file | sed -e 's/\// /g'`
-    nf=`echo $splits | awk '{print NF}'`
-    fname=`echo $splits | awk -v n=$nf '{print $n}'`
-    cat $file |
-    awk 'BEGIN{inp=0;}{
-           if( $1=="\\endplumedmultireplicafile" ){ print ">>END OF EXAMPLE>>"; inp=0; }
-           else if( match($1,"plumedmultireplicafile") ){ inp=1; print "# " $0 }
-           else if( inp==1 ){ print $0; }  
-         }' >> example-check/$fname.dat
     # Count the number of examples found in the input
     neg=`grep ">>END OF EXAMPLE>>" example-check/$fname.dat | wc -l | awk '{print $1}'`
     if [ $neg -gt 0 ] ; then
@@ -143,9 +133,13 @@ for dir in * ; do
         # Want to get rid of these
         ntarget=`grep "TARGET=" $file | wc -l | awk '{print $1}'`
         if [ $nsnip -eq 0 ] &&  [ $nload -eq 0 ] && [ $nfill -eq 0 ] ; then
-            hasrep=`grep plumedmultireplicafile $file | wc -l | awk '{print $1}'`
+            hasrep=0
+            settings=`grep "#SETTINGS" $file | wc -l | awk '{print $1}'`
+            if [ $settings -gt 0 ] ; then
+                 hasrep=`grep "#SETTINGS" $file | grep "NREPLICAS=" | wc -l | awk '{print $1}'`
+            fi
             if [ $hasrep -gt 0 ] ; then
-                nrep=`grep plumedmultireplicafile $file | awk '{print $2}' | sed -e 's/\\\plumedmultireplicafile{//' | sed -e 's/}//'`
+                nrep=`grep "#SETTINGS" $file | awk '{for(i=1;i<=NF;++i){if(match($i,"NREPLICAS=")){print $i}}}' | sed -e 's/NREPLICAS=//'`
                 mpirun -np $nrep ../../../src/lib/plumed driver --natoms 100000 --parse-only --kt 2.49 --plumed $file --multi $nrep > check.log 
             else 
                 ../../../src/lib/plumed driver --natoms 100000 --parse-only --kt 2.49 --plumed $file > check.log
diff --git a/user-doc/tutorials/a-trieste-5.txt b/user-doc/tutorials/a-trieste-5.txt
index 17d39dec961813ba945b081963d587e3e0f50c2b..6989f02dc7a19cb8f117004eb91a0a09b598452f 100644
--- a/user-doc/tutorials/a-trieste-5.txt
+++ b/user-doc/tutorials/a-trieste-5.txt
@@ -103,7 +103,8 @@ file with common definitions and specific input files with replica-dependent key
 However, as of PLUMED 2.4, we introduced a simpler manner to manipulate multiple replica
 inputs with tiny differences. Look at the following example:
 
-\plumedmultireplicafile{3}
+\plumedfile
+#SETTINGS NREPLICAS=3
 # Compute a distance
 d: DISTANCE ATOMS=1,2
 
@@ -115,7 +116,7 @@ RESTRAINT ARG=d AT=@replicas:1.0,1.1,1.2 KAPPA=1.0
 #   RESTRAINT ARG=d AT=1.1 KAPPA=1.0
 # On replica 2, this means:
 #   RESTRAINT ARG=d AT=1.2 KAPPA=1.0
-\endplumedmultireplicafile
+\endplumedfile
 
 If you prepare a single `plumed.dat` file like this one and feeds it to PLUMED while using 3 replicas,
 the 3 replicas will see the very same input except for the `AT` keyword, that sets the position of the restraint.
@@ -123,7 +124,8 @@ Replica 0 will see a restraint centered at 1.0, replica 1 centered at 1.1, and r
 
 The `@replicas:` keyword is not special for \ref RESTRAINT or for the `AT` keyword. Any keyword in PLUMED can accept that syntax.
 For instance, the following single input file can be used to setup a bias exchange metadynamics \cite piana simulations:
-\plumedmultireplicafile{2}
+\plumedfile
+#SETTINGS NREPLICAS=2
 # Compute distance between atoms 1 and 2
 d: DISTANCE ATOMS=1,2
 
@@ -143,7 +145,7 @@ METAD ...
 #  METAD ARG=d HEIGHT=1.0 PACE=100 SIGMA=0.1 GRID_MIN=0.0 GRID_MAX=2.0
 # On replica 1, this means:
 #  METAD ARG=t HEIGHT=1.0 PACE=100 SIGMA=0.3 GRID_MIN=-pi GRID_MAX=+pi
-\endplumedmultireplicafile
+\endplumedfile
 
 This would be a typical setup for a bias exchange simulation.
 Notice that even though variables `d` and `t` are both read in both replicas,
@@ -153,7 +155,8 @@ This is because variables that are defined but not used are never actually calcu
 If the value that should be provided for each replica is a vector, you should use curly braces as delimiters.
 For instance, if the restraint acts on two variables, you can use the following input:
 
-\plumedmultireplicafile{3}
+\plumedfile
+#SETTINGS NREPLICAS=3
 # Compute distance between atoms 1 and 2
 d: DISTANCE ATOMS=10,20
 
@@ -172,13 +175,14 @@ RESTRAINT ...
 #  RESTRAINT ARG=d AT=3.0,4.0 KAPPA=1.0,3.0
 # On replica 2 this means:
 #  RESTRAINT ARG=d AT=5.0,6.0 KAPPA=1.0,3.0
-\endplumedmultireplicafile
+\endplumedfile
 
 Notice the double curly braces. The outer ones are used by PLUMED to know there the argument of the `AT` keyword ends,
 whereas the inner ones are used to group the values corresponding to each replica.
 Also notice that the last example can be split in multiple lines exploiting the fact that
 within multi-line statements (enclosed by pairs of `...`) newlines are replaced with simple spaces:
-\plumedmultireplicafile{3}
+\plumedfile
+#SETTINGS NREPLICAS=3
 d: DISTANCE ATOMS=10,20
 t: TORSION ATOMS=30,31,32,33
 RESTRAINT ...
@@ -192,7 +196,7 @@ RESTRAINT ...
   }
   KAPPA=1.0
 ...
-\endplumedmultireplicafile
+\endplumedfile
 
 In short, whenever there are keywords that should vary across replicas, you should set them using the `@replicas:` keyword.
 As mentioned above, you can always use the old syntax with separate input file, and this is recommended when the