diff --git a/regtest/analysis/rt-cube/Makefile b/regtest/analysis/rt-cube/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3703b27cea227aa053fb6d1d73f861e4384dbcee
--- /dev/null
+++ b/regtest/analysis/rt-cube/Makefile
@@ -0,0 +1 @@
+include ../../scripts/test.make
diff --git a/regtest/analysis/rt-cube/config b/regtest/analysis/rt-cube/config
new file mode 100644
index 0000000000000000000000000000000000000000..f93ec1a97465724691bf162d4735f5ea3648bbb4
--- /dev/null
+++ b/regtest/analysis/rt-cube/config
@@ -0,0 +1,3 @@
+type=driver
+# this is to test a different name
+arg="--plumed plumed.dat --ixyz trajectory.xyz"
diff --git a/regtest/analysis/rt-cube/fesA1.cube.reference b/regtest/analysis/rt-cube/fesA1.cube.reference
new file mode 100644
index 0000000000000000000000000000000000000000..2fb4d61fefdcfbcf8e97547c53b704eb7d197e79
--- /dev/null
+++ b/regtest/analysis/rt-cube/fesA1.cube.reference
@@ -0,0 +1,207 @@
+PLUMED CUBE FILE
+OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
+1   -1.650   -1.650   -1.650
+10    0.300    0.000    0.000
+10    0.000    0.300    0.000
+10    0.000    0.000    0.300
+1    0.000    0.000    0.000
+   16.849   15.812   14.995   14.398   14.021   13.862
+   13.921   14.197   14.690   15.399
+   15.812   14.771   13.949   13.347   12.964   12.798
+   12.850   13.119   13.603   14.302
+   14.995   13.949   13.123   12.515   12.125   11.952
+   11.996   12.256   12.731   13.419
+   14.398   13.347   12.515   11.901   11.503   11.323
+   11.358   11.608   12.072   12.750
+   14.021   12.964   12.125   11.503   11.098   10.909
+   10.935   11.174   11.627   12.293
+   13.862   12.798   11.952   11.323   10.909   10.710
+   10.725   10.954   11.395   12.048
+   13.921   12.850   11.996   11.358   10.935   10.725
+   10.730   10.946   11.375   12.015
+   14.197   13.119   12.256   11.608   11.174   10.954
+   10.946   11.150   11.566   12.192
+   14.690   13.603   12.731   12.072   11.627   11.395
+   11.375   11.566   11.968   12.581
+   15.399   14.302   13.419   12.750   12.293   12.048
+   12.015   12.192   12.581   13.179
+   15.812   14.771   13.949   13.347   12.964   12.798
+   12.850   13.119   13.603   14.302
+   14.771   13.725   12.898   12.290   11.901   11.728
+   11.772   12.032   12.506   13.195
+   13.949   12.898   12.066   11.451   11.054   10.874
+   10.909   11.159   11.623   12.301
+   13.347   12.290   11.451   10.830   10.425   10.236
+   10.261   10.501   10.954   11.620
+   12.964   11.901   11.054   10.425   10.011    9.812
+    9.827   10.056   10.497   11.150
+   12.798   11.728   10.874   10.236    9.812    9.603
+    9.607    9.824   10.252   10.892
+   12.850   11.772   10.909   10.261    9.827    9.607
+    9.599    9.803   10.219   10.845
+   13.119   12.032   11.159   10.501   10.056    9.824
+    9.803    9.994   10.396   11.009
+   13.603   12.506   11.623   10.954   10.497   10.252
+   10.219   10.396   10.785   11.383
+   14.302   13.195   12.301   11.620   11.150   10.892
+   10.845   11.009   11.383   11.968
+   14.995   13.949   13.123   12.515   12.125   11.952
+   11.996   12.256   12.731   13.419
+   13.949   12.898   12.066   11.451   11.054   10.874
+   10.909   11.159   11.623   12.301
+   13.123   12.066   11.227   10.605   10.200   10.011
+   10.037   10.276   10.730   11.395
+   12.515   11.451   10.605    9.976    9.562    9.363
+    9.379    9.607   10.048   10.701
+   12.125   11.054   10.200    9.562    9.139    8.930
+    8.934    9.150    9.579   10.219
+   11.952   10.874   10.011    9.363    8.930    8.709
+    8.701    8.905    9.321    9.947
+   11.996   10.909   10.037    9.379    8.934    8.701
+    8.681    8.872    9.274    9.887
+   12.256   11.159   10.276    9.607    9.150    8.905
+    8.872    9.049    9.438   10.036
+   12.731   11.623   10.730   10.048    9.579    9.321
+    9.274    9.438    9.812   10.396
+   13.419   12.301   11.395   10.701   10.219    9.947
+    9.887   10.036   10.396   10.967
+   14.398   13.347   12.515   11.901   11.503   11.323
+   11.358   11.608   12.072   12.750
+   13.347   12.290   11.451   10.830   10.425   10.236
+   10.261   10.501   10.954   11.620
+   12.515   11.451   10.605    9.976    9.562    9.363
+    9.379    9.607   10.048   10.701
+   11.901   10.830    9.976    9.338    8.914    8.705
+    8.709    8.926    9.354    9.994
+   11.503   10.425    9.562    8.914    8.481    8.260
+    8.252    8.456    8.872    9.498
+   11.323   10.236    9.363    8.705    8.260    8.028
+    8.007    8.198    8.600    9.213
+   11.358   10.261    9.379    8.709    8.252    8.007
+    7.974    8.151    8.540    9.138
+   11.608   10.501    9.607    8.926    8.456    8.198
+    8.151    8.315    8.689    9.274
+   12.072   10.954   10.048    9.354    8.872    8.600
+    8.540    8.689    9.049    9.620
+   12.750   11.620   10.701    9.994    9.498    9.213
+    9.138    9.274    9.620   10.178
+   14.021   12.964   12.125   11.503   11.098   10.909
+   10.935   11.174   11.627   12.293
+   12.964   11.901   11.054   10.425   10.011    9.812
+    9.827   10.056   10.497   11.150
+   12.125   11.054   10.200    9.562    9.139    8.930
+    8.934    9.150    9.579   10.219
+   11.503   10.425    9.562    8.914    8.481    8.260
+    8.252    8.456    8.872    9.498
+   11.098   10.011    9.139    8.481    8.036    7.803
+    7.783    7.974    8.376    8.989
+   10.909    9.812    8.930    8.260    7.803    7.558
+    7.525    7.703    8.091    8.689
+   10.935    9.827    8.934    8.252    7.783    7.525
+    7.478    7.642    8.016    8.600
+   11.174   10.056    9.150    8.456    7.974    7.703
+    7.642    7.791    8.152    8.722
+   11.627   10.497    9.579    8.872    8.376    8.091
+    8.016    8.152    8.498    9.055
+   12.293   11.150   10.219    9.498    8.989    8.689
+    8.600    8.722    9.055    9.599
+   13.862   12.798   11.952   11.323   10.909   10.710
+   10.725   10.954   11.395   12.048
+   12.798   11.728   10.874   10.236    9.812    9.603
+    9.607    9.824   10.252   10.892
+   11.952   10.874   10.011    9.363    8.930    8.709
+    8.701    8.905    9.321    9.947
+   11.323   10.236    9.363    8.705    8.260    8.028
+    8.007    8.198    8.600    9.213
+   10.909    9.812    8.930    8.260    7.803    7.558
+    7.525    7.703    8.091    8.689
+   10.710    9.603    8.709    8.028    7.558    7.301
+    7.254    7.417    7.791    8.376
+   10.725    9.607    8.701    8.007    7.525    7.254
+    7.193    7.342    7.703    8.273
+   10.954    9.824    8.905    8.198    7.703    7.417
+    7.342    7.478    7.824    8.382
+   11.395   10.252    9.321    8.600    8.091    7.791
+    7.703    7.824    8.157    8.701
+   12.048   10.892    9.947    9.213    8.689    8.376
+    8.273    8.382    8.701    9.233
+   13.921   12.850   11.996   11.358   10.935   10.725
+   10.730   10.946   11.375   12.015
+   12.850   11.772   10.909   10.261    9.827    9.607
+    9.599    9.803   10.219   10.845
+   11.996   10.909   10.037    9.379    8.934    8.701
+    8.681    8.872    9.274    9.887
+   11.358   10.261    9.379    8.709    8.252    8.007
+    7.974    8.151    8.540    9.138
+   10.935    9.827    8.934    8.252    7.783    7.525
+    7.478    7.642    8.016    8.600
+   10.725    9.607    8.701    8.007    7.525    7.254
+    7.193    7.342    7.703    8.273
+   10.730    9.599    8.681    7.974    7.478    7.193
+    7.118    7.254    7.600    8.157
+   10.946    9.803    8.872    8.151    7.642    7.342
+    7.254    7.375    7.708    8.252
+   11.375   10.219    9.274    8.540    8.016    7.703
+    7.600    7.708    8.028    8.559
+   12.015   10.845    9.887    9.138    8.600    8.273
+    8.157    8.252    8.559    9.079
+   14.197   13.119   12.256   11.608   11.174   10.954
+   10.946   11.150   11.566   12.192
+   13.119   12.032   11.159   10.501   10.056    9.824
+    9.803    9.994   10.396   11.009
+   12.256   11.159   10.276    9.607    9.150    8.905
+    8.872    9.049    9.438   10.036
+   11.608   10.501    9.607    8.926    8.456    8.198
+    8.151    8.315    8.689    9.274
+   11.174   10.056    9.150    8.456    7.974    7.703
+    7.642    7.791    8.152    8.722
+   10.954    9.824    8.905    8.198    7.703    7.417
+    7.342    7.478    7.824    8.382
+   10.946    9.803    8.872    8.151    7.642    7.342
+    7.254    7.375    7.708    8.252
+   11.150    9.994    9.049    8.315    7.791    7.478
+    7.375    7.484    7.803    8.335
+   11.566   10.396    9.438    8.689    8.152    7.824
+    7.708    7.803    8.110    8.630
+   12.192   11.009   10.036    9.274    8.722    8.382
+    8.252    8.335    8.630    9.139
+   14.690   13.603   12.731   12.072   11.627   11.395
+   11.375   11.566   11.968   12.581
+   13.603   12.506   11.623   10.954   10.497   10.252
+   10.219   10.396   10.785   11.383
+   12.731   11.623   10.730   10.048    9.579    9.321
+    9.274    9.438    9.812   10.396
+   12.072   10.954   10.048    9.354    8.872    8.600
+    8.540    8.689    9.049    9.620
+   11.627   10.497    9.579    8.872    8.376    8.091
+    8.016    8.152    8.498    9.055
+   11.395   10.252    9.321    8.600    8.091    7.791
+    7.703    7.824    8.157    8.701
+   11.375   10.219    9.274    8.540    8.016    7.703
+    7.600    7.708    8.028    8.559
+   11.566   10.396    9.438    8.689    8.152    7.824
+    7.708    7.803    8.110    8.630
+   11.968   10.785    9.812    9.049    8.498    8.157
+    8.028    8.110    8.406    8.914
+   12.581   11.383   10.396    9.620    9.055    8.701
+    8.559    8.630    8.914    9.412
+   15.399   14.302   13.419   12.750   12.293   12.048
+   12.015   12.192   12.581   13.179
+   14.302   13.195   12.301   11.620   11.150   10.892
+   10.845   11.009   11.383   11.968
+   13.419   12.301   11.395   10.701   10.219    9.947
+    9.887   10.036   10.396   10.967
+   12.750   11.620   10.701    9.994    9.498    9.213
+    9.138    9.274    9.620   10.178
+   12.293   11.150   10.219    9.498    8.989    8.689
+    8.600    8.722    9.055    9.599
+   12.048   10.892    9.947    9.213    8.689    8.376
+    8.273    8.382    8.701    9.233
+   12.015   10.845    9.887    9.138    8.600    8.273
+    8.157    8.252    8.559    9.079
+   12.192   11.009   10.036    9.274    8.722    8.382
+    8.252    8.335    8.630    9.139
+   12.581   11.383   10.396    9.620    9.055    8.701
+    8.559    8.630    8.914    9.412
+   13.179   11.968   10.967   10.178    9.599    9.233
+    9.079    9.139    9.412    9.901
diff --git a/regtest/analysis/rt-cube/fesA2.cube.reference b/regtest/analysis/rt-cube/fesA2.cube.reference
new file mode 100644
index 0000000000000000000000000000000000000000..e893cd16f76f1b972a04361530a571e6021ba59e
--- /dev/null
+++ b/regtest/analysis/rt-cube/fesA2.cube.reference
@@ -0,0 +1,207 @@
+PLUMED CUBE FILE
+OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
+1   -1.650   -1.650   -1.650
+10    0.300    0.000    0.000
+10    0.000    0.300    0.000
+10    0.000    0.000    0.300
+1    0.000    0.000    0.000
+   16.849   15.812   14.995   14.398   14.021   13.862
+   13.921   14.197   14.690   15.399
+   15.812   14.771   13.949   13.347   12.964   12.798
+   12.850   13.119   13.603   14.302
+   14.995   13.949   13.123   12.515   12.125   11.952
+   11.996   12.256   12.731   13.419
+   14.398   13.347   12.515   11.900   11.503   11.323
+   11.358   11.608   12.072   12.750
+   14.021   12.964   12.125   11.503   11.098   10.909
+   10.935   11.174   11.627   12.293
+   13.862   12.798   11.952   11.323   10.909   10.710
+   10.725   10.954   11.395   12.048
+   13.921   12.850   11.996   11.358   10.935   10.725
+   10.730   10.946   11.375   12.015
+   14.197   13.119   12.256   11.608   11.174   10.954
+   10.946   11.150   11.566   12.192
+   14.690   13.603   12.731   12.072   11.627   11.395
+   11.375   11.566   11.968   12.580
+   15.399   14.302   13.419   12.750   12.293   12.048
+   12.015   12.192   12.580   13.179
+   15.812   14.771   13.949   13.347   12.964   12.798
+   12.850   13.119   13.603   14.302
+   14.771   13.725   12.898   12.290   11.900   11.728
+   11.772   12.032   12.506   13.195
+   13.949   12.898   12.066   11.452   11.054   10.874
+   10.909   11.159   11.623   12.301
+   13.347   12.290   11.452   10.830   10.425   10.236
+   10.261   10.501   10.954   11.620
+   12.964   11.900   11.054   10.425   10.011    9.812
+    9.827   10.056   10.497   11.150
+   12.798   11.728   10.874   10.236    9.812    9.603
+    9.607    9.824   10.252   10.892
+   12.850   11.772   10.909   10.261    9.827    9.607
+    9.599    9.803   10.219   10.845
+   13.119   12.032   11.159   10.501   10.056    9.824
+    9.803    9.994   10.396   11.009
+   13.603   12.506   11.623   10.954   10.497   10.252
+   10.219   10.396   10.785   11.383
+   14.302   13.195   12.301   11.620   11.150   10.892
+   10.845   11.009   11.383   11.968
+   14.995   13.949   13.123   12.515   12.125   11.952
+   11.996   12.256   12.731   13.419
+   13.949   12.898   12.066   11.452   11.054   10.874
+   10.909   11.159   11.623   12.301
+   13.123   12.066   11.227   10.605   10.200   10.011
+   10.037   10.276   10.730   11.395
+   12.515   11.452   10.605    9.976    9.562    9.363
+    9.379    9.607   10.048   10.701
+   12.125   11.054   10.200    9.562    9.139    8.930
+    8.934    9.150    9.579   10.219
+   11.952   10.874   10.011    9.363    8.930    8.709
+    8.701    8.905    9.321    9.947
+   11.996   10.909   10.037    9.379    8.934    8.701
+    8.681    8.872    9.274    9.887
+   12.256   11.159   10.276    9.607    9.150    8.905
+    8.872    9.049    9.438   10.036
+   12.731   11.623   10.730   10.048    9.579    9.321
+    9.274    9.438    9.812   10.396
+   13.419   12.301   11.395   10.701   10.219    9.947
+    9.887   10.036   10.396   10.967
+   14.398   13.347   12.515   11.900   11.503   11.323
+   11.358   11.608   12.072   12.750
+   13.347   12.290   11.452   10.830   10.425   10.236
+   10.261   10.501   10.954   11.620
+   12.515   11.452   10.605    9.976    9.562    9.363
+    9.379    9.607   10.048   10.701
+   11.900   10.830    9.976    9.338    8.914    8.705
+    8.709    8.926    9.354    9.994
+   11.503   10.425    9.562    8.914    8.481    8.260
+    8.252    8.456    8.872    9.498
+   11.323   10.236    9.363    8.705    8.260    8.028
+    8.007    8.198    8.600    9.213
+   11.358   10.261    9.379    8.709    8.252    8.007
+    7.974    8.152    8.540    9.138
+   11.608   10.501    9.607    8.926    8.456    8.198
+    8.152    8.315    8.689    9.274
+   12.072   10.954   10.048    9.354    8.872    8.600
+    8.540    8.689    9.049    9.620
+   12.750   11.620   10.701    9.994    9.498    9.213
+    9.138    9.274    9.620   10.178
+   14.021   12.964   12.125   11.503   11.098   10.909
+   10.935   11.174   11.627   12.293
+   12.964   11.900   11.054   10.425   10.011    9.812
+    9.827   10.056   10.497   11.150
+   12.125   11.054   10.200    9.562    9.139    8.930
+    8.934    9.150    9.579   10.219
+   11.503   10.425    9.562    8.914    8.481    8.260
+    8.252    8.456    8.872    9.498
+   11.098   10.011    9.139    8.481    8.036    7.803
+    7.783    7.974    8.376    8.989
+   10.909    9.812    8.930    8.260    7.803    7.558
+    7.525    7.703    8.091    8.689
+   10.935    9.827    8.934    8.252    7.783    7.525
+    7.478    7.642    8.016    8.600
+   11.174   10.056    9.150    8.456    7.974    7.703
+    7.642    7.791    8.152    8.722
+   11.627   10.497    9.579    8.872    8.376    8.091
+    8.016    8.152    8.498    9.055
+   12.293   11.150   10.219    9.498    8.989    8.689
+    8.600    8.722    9.055    9.599
+   13.862   12.798   11.952   11.323   10.909   10.710
+   10.725   10.954   11.395   12.048
+   12.798   11.728   10.874   10.236    9.812    9.603
+    9.607    9.824   10.252   10.892
+   11.952   10.874   10.011    9.363    8.930    8.709
+    8.701    8.905    9.321    9.947
+   11.323   10.236    9.363    8.705    8.260    8.028
+    8.007    8.198    8.600    9.213
+   10.909    9.812    8.930    8.260    7.803    7.558
+    7.525    7.703    8.091    8.689
+   10.710    9.603    8.709    8.028    7.558    7.301
+    7.254    7.417    7.791    8.376
+   10.725    9.607    8.701    8.007    7.525    7.254
+    7.193    7.342    7.703    8.273
+   10.954    9.824    8.905    8.198    7.703    7.417
+    7.342    7.478    7.824    8.382
+   11.395   10.252    9.321    8.600    8.091    7.791
+    7.703    7.824    8.157    8.701
+   12.048   10.892    9.947    9.213    8.689    8.376
+    8.273    8.382    8.701    9.233
+   13.921   12.850   11.996   11.358   10.935   10.725
+   10.730   10.946   11.375   12.015
+   12.850   11.772   10.909   10.261    9.827    9.607
+    9.599    9.803   10.219   10.845
+   11.996   10.909   10.037    9.379    8.934    8.701
+    8.681    8.872    9.274    9.887
+   11.358   10.261    9.379    8.709    8.252    8.007
+    7.974    8.152    8.540    9.138
+   10.935    9.827    8.934    8.252    7.783    7.525
+    7.478    7.642    8.016    8.600
+   10.725    9.607    8.701    8.007    7.525    7.254
+    7.193    7.342    7.703    8.273
+   10.730    9.599    8.681    7.974    7.478    7.193
+    7.118    7.254    7.600    8.157
+   10.946    9.803    8.872    8.152    7.642    7.342
+    7.254    7.375    7.708    8.252
+   11.375   10.219    9.274    8.540    8.016    7.703
+    7.600    7.708    8.028    8.559
+   12.015   10.845    9.887    9.138    8.600    8.273
+    8.157    8.252    8.559    9.079
+   14.197   13.119   12.256   11.608   11.174   10.954
+   10.946   11.150   11.566   12.192
+   13.119   12.032   11.159   10.501   10.056    9.824
+    9.803    9.994   10.396   11.009
+   12.256   11.159   10.276    9.607    9.150    8.905
+    8.872    9.049    9.438   10.036
+   11.608   10.501    9.607    8.926    8.456    8.198
+    8.152    8.315    8.689    9.274
+   11.174   10.056    9.150    8.456    7.974    7.703
+    7.642    7.791    8.152    8.722
+   10.954    9.824    8.905    8.198    7.703    7.417
+    7.342    7.478    7.824    8.382
+   10.946    9.803    8.872    8.152    7.642    7.342
+    7.254    7.375    7.708    8.252
+   11.150    9.994    9.049    8.315    7.791    7.478
+    7.375    7.484    7.803    8.335
+   11.566   10.396    9.438    8.689    8.152    7.824
+    7.708    7.803    8.110    8.630
+   12.192   11.009   10.036    9.274    8.722    8.382
+    8.252    8.335    8.630    9.139
+   14.690   13.603   12.731   12.072   11.627   11.395
+   11.375   11.566   11.968   12.580
+   13.603   12.506   11.623   10.954   10.497   10.252
+   10.219   10.396   10.785   11.383
+   12.731   11.623   10.730   10.048    9.579    9.321
+    9.274    9.438    9.812   10.396
+   12.072   10.954   10.048    9.354    8.872    8.600
+    8.540    8.689    9.049    9.620
+   11.627   10.497    9.579    8.872    8.376    8.091
+    8.016    8.152    8.498    9.055
+   11.395   10.252    9.321    8.600    8.091    7.791
+    7.703    7.824    8.157    8.701
+   11.375   10.219    9.274    8.540    8.016    7.703
+    7.600    7.708    8.028    8.559
+   11.566   10.396    9.438    8.689    8.152    7.824
+    7.708    7.803    8.110    8.630
+   11.968   10.785    9.812    9.049    8.498    8.157
+    8.028    8.110    8.406    8.914
+   12.580   11.383   10.396    9.620    9.055    8.701
+    8.559    8.630    8.914    9.413
+   15.399   14.302   13.419   12.750   12.293   12.048
+   12.015   12.192   12.580   13.179
+   14.302   13.195   12.301   11.620   11.150   10.892
+   10.845   11.009   11.383   11.968
+   13.419   12.301   11.395   10.701   10.219    9.947
+    9.887   10.036   10.396   10.967
+   12.750   11.620   10.701    9.994    9.498    9.213
+    9.138    9.274    9.620   10.178
+   12.293   11.150   10.219    9.498    8.989    8.689
+    8.600    8.722    9.055    9.599
+   12.048   10.892    9.947    9.213    8.689    8.376
+    8.273    8.382    8.701    9.233
+   12.015   10.845    9.887    9.138    8.600    8.273
+    8.157    8.252    8.559    9.079
+   12.192   11.009   10.036    9.274    8.722    8.382
+    8.252    8.335    8.630    9.139
+   12.580   11.383   10.396    9.620    9.055    8.701
+    8.559    8.630    8.914    9.413
+   13.179   11.968   10.967   10.178    9.599    9.233
+    9.079    9.139    9.413    9.901
diff --git a/regtest/analysis/rt-cube/histoA1.cube.reference b/regtest/analysis/rt-cube/histoA1.cube.reference
new file mode 100644
index 0000000000000000000000000000000000000000..10c48d5b154ffecc6e9a966ae1b05d4272395448
--- /dev/null
+++ b/regtest/analysis/rt-cube/histoA1.cube.reference
@@ -0,0 +1,207 @@
+PLUMED CUBE FILE
+OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
+1  -1.6500  -1.6500  -1.6500
+10   0.3000   0.0000   0.0000
+10   0.0000   0.3000   0.0000
+10   0.0000   0.0000   0.3000
+1   0.0000   0.0000   0.0000
+   0.0012   0.0018   0.0025   0.0031   0.0036   0.0039
+   0.0038   0.0034   0.0028   0.0021
+   0.0018   0.0027   0.0037   0.0047   0.0055   0.0059
+   0.0058   0.0052   0.0043   0.0032
+   0.0025   0.0037   0.0052   0.0066   0.0077   0.0083
+   0.0082   0.0073   0.0061   0.0046
+   0.0031   0.0047   0.0066   0.0085   0.0099   0.0107
+   0.0105   0.0095   0.0079   0.0060
+   0.0036   0.0055   0.0077   0.0099   0.0117   0.0126
+   0.0125   0.0113   0.0095   0.0072
+   0.0039   0.0059   0.0083   0.0107   0.0126   0.0137
+   0.0136   0.0124   0.0104   0.0080
+   0.0038   0.0058   0.0082   0.0105   0.0125   0.0136
+   0.0135   0.0124   0.0105   0.0081
+   0.0034   0.0052   0.0073   0.0095   0.0113   0.0124
+   0.0124   0.0114   0.0097   0.0075
+   0.0028   0.0043   0.0061   0.0079   0.0095   0.0104
+   0.0105   0.0097   0.0082   0.0065
+   0.0021   0.0032   0.0046   0.0060   0.0072   0.0080
+   0.0081   0.0075   0.0065   0.0051
+   0.0018   0.0027   0.0037   0.0047   0.0055   0.0059
+   0.0058   0.0052   0.0043   0.0032
+   0.0027   0.0041   0.0057   0.0072   0.0085   0.0091
+   0.0089   0.0080   0.0066   0.0050
+   0.0037   0.0057   0.0079   0.0101   0.0119   0.0128
+   0.0126   0.0114   0.0095   0.0072
+   0.0047   0.0072   0.0101   0.0130   0.0153   0.0165
+   0.0163   0.0148   0.0124   0.0095
+   0.0055   0.0085   0.0119   0.0153   0.0181   0.0196
+   0.0195   0.0177   0.0149   0.0114
+   0.0059   0.0091   0.0128   0.0165   0.0196   0.0213
+   0.0212   0.0195   0.0164   0.0127
+   0.0058   0.0089   0.0126   0.0163   0.0195   0.0212
+   0.0213   0.0196   0.0166   0.0129
+   0.0052   0.0080   0.0114   0.0148   0.0177   0.0195
+   0.0196   0.0182   0.0155   0.0121
+   0.0043   0.0066   0.0095   0.0124   0.0149   0.0164
+   0.0166   0.0155   0.0133   0.0104
+   0.0032   0.0050   0.0072   0.0095   0.0114   0.0127
+   0.0129   0.0121   0.0104   0.0082
+   0.0025   0.0037   0.0052   0.0066   0.0077   0.0083
+   0.0082   0.0073   0.0061   0.0046
+   0.0037   0.0057   0.0079   0.0101   0.0119   0.0128
+   0.0126   0.0114   0.0095   0.0072
+   0.0052   0.0079   0.0111   0.0142   0.0167   0.0181
+   0.0179   0.0162   0.0135   0.0104
+   0.0066   0.0101   0.0142   0.0183   0.0216   0.0234
+   0.0233   0.0212   0.0178   0.0137
+   0.0077   0.0119   0.0167   0.0216   0.0256   0.0279
+   0.0278   0.0255   0.0215   0.0166
+   0.0083   0.0128   0.0181   0.0234   0.0279   0.0305
+   0.0305   0.0281   0.0238   0.0185
+   0.0082   0.0126   0.0179   0.0233   0.0278   0.0305
+   0.0308   0.0285   0.0243   0.0190
+   0.0073   0.0114   0.0162   0.0212   0.0255   0.0281
+   0.0285   0.0266   0.0227   0.0179
+   0.0061   0.0095   0.0135   0.0178   0.0215   0.0238
+   0.0243   0.0227   0.0196   0.0155
+   0.0046   0.0072   0.0104   0.0137   0.0166   0.0185
+   0.0190   0.0179   0.0155   0.0123
+   0.0031   0.0047   0.0066   0.0085   0.0099   0.0107
+   0.0105   0.0095   0.0079   0.0060
+   0.0047   0.0072   0.0101   0.0130   0.0153   0.0165
+   0.0163   0.0148   0.0124   0.0095
+   0.0066   0.0101   0.0142   0.0183   0.0216   0.0234
+   0.0233   0.0212   0.0178   0.0137
+   0.0085   0.0130   0.0183   0.0237   0.0280   0.0305
+   0.0305   0.0279   0.0235   0.0182
+   0.0099   0.0153   0.0216   0.0280   0.0334   0.0365
+   0.0366   0.0337   0.0285   0.0222
+   0.0107   0.0165   0.0234   0.0305   0.0365   0.0400
+   0.0403   0.0374   0.0318   0.0249
+   0.0105   0.0163   0.0233   0.0305   0.0366   0.0403
+   0.0409   0.0381   0.0326   0.0256
+   0.0095   0.0148   0.0212   0.0279   0.0337   0.0374
+   0.0381   0.0357   0.0307   0.0243
+   0.0079   0.0124   0.0178   0.0235   0.0285   0.0318
+   0.0326   0.0307   0.0266   0.0211
+   0.0060   0.0095   0.0137   0.0182   0.0222   0.0249
+   0.0256   0.0243   0.0211   0.0169
+   0.0036   0.0055   0.0077   0.0099   0.0117   0.0126
+   0.0125   0.0113   0.0095   0.0072
+   0.0055   0.0085   0.0119   0.0153   0.0181   0.0196
+   0.0195   0.0177   0.0149   0.0114
+   0.0077   0.0119   0.0167   0.0216   0.0256   0.0279
+   0.0278   0.0255   0.0215   0.0166
+   0.0099   0.0153   0.0216   0.0280   0.0334   0.0365
+   0.0366   0.0337   0.0285   0.0222
+   0.0117   0.0181   0.0256   0.0334   0.0399   0.0438
+   0.0441   0.0409   0.0348   0.0272
+   0.0126   0.0196   0.0279   0.0365   0.0438   0.0483
+   0.0490   0.0456   0.0390   0.0307
+   0.0125   0.0195   0.0278   0.0366   0.0441   0.0490
+   0.0499   0.0467   0.0402   0.0318
+   0.0113   0.0177   0.0255   0.0337   0.0409   0.0456
+   0.0467   0.0440   0.0381   0.0303
+   0.0095   0.0149   0.0215   0.0285   0.0348   0.0390
+   0.0402   0.0381   0.0331   0.0265
+   0.0072   0.0114   0.0166   0.0222   0.0272   0.0307
+   0.0318   0.0303   0.0265   0.0213
+   0.0039   0.0059   0.0083   0.0107   0.0126   0.0137
+   0.0136   0.0124   0.0104   0.0080
+   0.0059   0.0091   0.0128   0.0165   0.0196   0.0213
+   0.0212   0.0195   0.0164   0.0127
+   0.0083   0.0128   0.0181   0.0234   0.0279   0.0305
+   0.0305   0.0281   0.0238   0.0185
+   0.0107   0.0165   0.0234   0.0305   0.0365   0.0400
+   0.0403   0.0374   0.0318   0.0249
+   0.0126   0.0196   0.0279   0.0365   0.0438   0.0483
+   0.0490   0.0456   0.0390   0.0307
+   0.0137   0.0213   0.0305   0.0400   0.0483   0.0536
+   0.0546   0.0511   0.0440   0.0348
+   0.0136   0.0212   0.0305   0.0403   0.0490   0.0546
+   0.0559   0.0527   0.0456   0.0363
+   0.0124   0.0195   0.0281   0.0374   0.0456   0.0511
+   0.0527   0.0499   0.0434   0.0347
+   0.0104   0.0164   0.0238   0.0318   0.0390   0.0440
+   0.0456   0.0434   0.0380   0.0305
+   0.0080   0.0127   0.0185   0.0249   0.0307   0.0348
+   0.0363   0.0347   0.0305   0.0247
+   0.0038   0.0058   0.0082   0.0105   0.0125   0.0136
+   0.0135   0.0124   0.0105   0.0081
+   0.0058   0.0089   0.0126   0.0163   0.0195   0.0212
+   0.0213   0.0196   0.0166   0.0129
+   0.0082   0.0126   0.0179   0.0233   0.0278   0.0305
+   0.0308   0.0285   0.0243   0.0190
+   0.0105   0.0163   0.0233   0.0305   0.0366   0.0403
+   0.0409   0.0381   0.0326   0.0256
+   0.0125   0.0195   0.0278   0.0366   0.0441   0.0490
+   0.0499   0.0467   0.0402   0.0318
+   0.0136   0.0212   0.0305   0.0403   0.0490   0.0546
+   0.0559   0.0527   0.0456   0.0363
+   0.0135   0.0213   0.0308   0.0409   0.0499   0.0559
+   0.0576   0.0546   0.0475   0.0380
+   0.0124   0.0196   0.0285   0.0381   0.0467   0.0527
+   0.0546   0.0520   0.0455   0.0366
+   0.0105   0.0166   0.0243   0.0326   0.0402   0.0456
+   0.0475   0.0455   0.0400   0.0323
+   0.0081   0.0129   0.0190   0.0256   0.0318   0.0363
+   0.0380   0.0366   0.0323   0.0263
+   0.0034   0.0052   0.0073   0.0095   0.0113   0.0124
+   0.0124   0.0114   0.0097   0.0075
+   0.0052   0.0080   0.0114   0.0148   0.0177   0.0195
+   0.0196   0.0182   0.0155   0.0121
+   0.0073   0.0114   0.0162   0.0212   0.0255   0.0281
+   0.0285   0.0266   0.0227   0.0179
+   0.0095   0.0148   0.0212   0.0279   0.0337   0.0374
+   0.0381   0.0357   0.0307   0.0243
+   0.0113   0.0177   0.0255   0.0337   0.0409   0.0456
+   0.0467   0.0440   0.0381   0.0303
+   0.0124   0.0195   0.0281   0.0374   0.0456   0.0511
+   0.0527   0.0499   0.0434   0.0347
+   0.0124   0.0196   0.0285   0.0381   0.0467   0.0527
+   0.0546   0.0520   0.0455   0.0366
+   0.0114   0.0182   0.0266   0.0357   0.0440   0.0499
+   0.0520   0.0498   0.0438   0.0354
+   0.0097   0.0155   0.0227   0.0307   0.0381   0.0434
+   0.0455   0.0438   0.0387   0.0314
+   0.0075   0.0121   0.0179   0.0243   0.0303   0.0347
+   0.0366   0.0354   0.0314   0.0256
+   0.0028   0.0043   0.0061   0.0079   0.0095   0.0104
+   0.0105   0.0097   0.0082   0.0065
+   0.0043   0.0066   0.0095   0.0124   0.0149   0.0164
+   0.0166   0.0155   0.0133   0.0104
+   0.0061   0.0095   0.0135   0.0178   0.0215   0.0238
+   0.0243   0.0227   0.0196   0.0155
+   0.0079   0.0124   0.0178   0.0235   0.0285   0.0318
+   0.0326   0.0307   0.0266   0.0211
+   0.0095   0.0149   0.0215   0.0285   0.0348   0.0390
+   0.0402   0.0381   0.0331   0.0265
+   0.0104   0.0164   0.0238   0.0318   0.0390   0.0440
+   0.0456   0.0434   0.0380   0.0305
+   0.0105   0.0166   0.0243   0.0326   0.0402   0.0456
+   0.0475   0.0455   0.0400   0.0323
+   0.0097   0.0155   0.0227   0.0307   0.0381   0.0434
+   0.0455   0.0438   0.0387   0.0314
+   0.0082   0.0133   0.0196   0.0266   0.0331   0.0380
+   0.0400   0.0387   0.0344   0.0280
+   0.0065   0.0104   0.0155   0.0211   0.0265   0.0305
+   0.0323   0.0314   0.0280   0.0230
+   0.0021   0.0032   0.0046   0.0060   0.0072   0.0080
+   0.0081   0.0075   0.0065   0.0051
+   0.0032   0.0050   0.0072   0.0095   0.0114   0.0127
+   0.0129   0.0121   0.0104   0.0082
+   0.0046   0.0072   0.0104   0.0137   0.0166   0.0185
+   0.0190   0.0179   0.0155   0.0123
+   0.0060   0.0095   0.0137   0.0182   0.0222   0.0249
+   0.0256   0.0243   0.0211   0.0169
+   0.0072   0.0114   0.0166   0.0222   0.0272   0.0307
+   0.0318   0.0303   0.0265   0.0213
+   0.0080   0.0127   0.0185   0.0249   0.0307   0.0348
+   0.0363   0.0347   0.0305   0.0247
+   0.0081   0.0129   0.0190   0.0256   0.0318   0.0363
+   0.0380   0.0366   0.0323   0.0263
+   0.0075   0.0121   0.0179   0.0243   0.0303   0.0347
+   0.0366   0.0354   0.0314   0.0256
+   0.0065   0.0104   0.0155   0.0211   0.0265   0.0305
+   0.0323   0.0314   0.0280   0.0230
+   0.0051   0.0082   0.0123   0.0169   0.0213   0.0247
+   0.0263   0.0256   0.0230   0.0189
diff --git a/regtest/analysis/rt-cube/histoA2.cube.reference b/regtest/analysis/rt-cube/histoA2.cube.reference
new file mode 100644
index 0000000000000000000000000000000000000000..1fa84a79083ed3c49bc448ccdfbc67071c9b14ea
--- /dev/null
+++ b/regtest/analysis/rt-cube/histoA2.cube.reference
@@ -0,0 +1,207 @@
+PLUMED CUBE FILE
+OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
+1  -1.6500  -1.6500  -1.6500
+10   0.3000   0.0000   0.0000
+10   0.0000   0.3000   0.0000
+10   0.0000   0.0000   0.3000
+1   0.0000   0.0000   0.0000
+   0.0012   0.0018   0.0024   0.0031   0.0036   0.0039
+   0.0038   0.0034   0.0028   0.0021
+   0.0018   0.0027   0.0037   0.0047   0.0055   0.0059
+   0.0058   0.0052   0.0043   0.0032
+   0.0024   0.0037   0.0052   0.0066   0.0077   0.0083
+   0.0082   0.0073   0.0061   0.0046
+   0.0031   0.0047   0.0066   0.0085   0.0099   0.0107
+   0.0105   0.0095   0.0079   0.0060
+   0.0036   0.0055   0.0077   0.0099   0.0117   0.0126
+   0.0125   0.0113   0.0095   0.0072
+   0.0039   0.0059   0.0083   0.0107   0.0126   0.0137
+   0.0136   0.0124   0.0104   0.0080
+   0.0038   0.0058   0.0082   0.0105   0.0125   0.0136
+   0.0135   0.0124   0.0105   0.0081
+   0.0034   0.0052   0.0073   0.0095   0.0113   0.0124
+   0.0124   0.0114   0.0097   0.0075
+   0.0028   0.0043   0.0061   0.0079   0.0095   0.0104
+   0.0105   0.0097   0.0082   0.0065
+   0.0021   0.0032   0.0046   0.0060   0.0072   0.0080
+   0.0081   0.0075   0.0065   0.0051
+   0.0018   0.0027   0.0037   0.0047   0.0055   0.0059
+   0.0058   0.0052   0.0043   0.0032
+   0.0027   0.0041   0.0057   0.0072   0.0085   0.0091
+   0.0089   0.0080   0.0066   0.0050
+   0.0037   0.0057   0.0079   0.0101   0.0119   0.0128
+   0.0126   0.0114   0.0095   0.0072
+   0.0047   0.0072   0.0101   0.0130   0.0153   0.0165
+   0.0163   0.0148   0.0124   0.0095
+   0.0055   0.0085   0.0119   0.0153   0.0181   0.0196
+   0.0194   0.0177   0.0149   0.0114
+   0.0059   0.0091   0.0128   0.0165   0.0196   0.0213
+   0.0212   0.0195   0.0164   0.0127
+   0.0058   0.0089   0.0126   0.0163   0.0194   0.0212
+   0.0213   0.0196   0.0166   0.0129
+   0.0052   0.0080   0.0114   0.0148   0.0177   0.0195
+   0.0196   0.0182   0.0155   0.0121
+   0.0043   0.0066   0.0095   0.0124   0.0149   0.0164
+   0.0166   0.0155   0.0133   0.0104
+   0.0032   0.0050   0.0072   0.0095   0.0114   0.0127
+   0.0129   0.0121   0.0104   0.0082
+   0.0024   0.0037   0.0052   0.0066   0.0077   0.0083
+   0.0082   0.0073   0.0061   0.0046
+   0.0037   0.0057   0.0079   0.0101   0.0119   0.0128
+   0.0126   0.0114   0.0095   0.0072
+   0.0052   0.0079   0.0111   0.0142   0.0167   0.0181
+   0.0179   0.0162   0.0135   0.0104
+   0.0066   0.0101   0.0142   0.0183   0.0216   0.0234
+   0.0233   0.0212   0.0178   0.0137
+   0.0077   0.0119   0.0167   0.0216   0.0256   0.0279
+   0.0278   0.0255   0.0215   0.0166
+   0.0083   0.0128   0.0181   0.0234   0.0279   0.0305
+   0.0305   0.0281   0.0238   0.0185
+   0.0082   0.0126   0.0179   0.0233   0.0278   0.0305
+   0.0308   0.0285   0.0243   0.0190
+   0.0073   0.0114   0.0162   0.0212   0.0255   0.0281
+   0.0285   0.0266   0.0227   0.0179
+   0.0061   0.0095   0.0135   0.0178   0.0215   0.0238
+   0.0243   0.0227   0.0196   0.0155
+   0.0046   0.0072   0.0104   0.0137   0.0166   0.0185
+   0.0190   0.0179   0.0155   0.0123
+   0.0031   0.0047   0.0066   0.0085   0.0099   0.0107
+   0.0105   0.0095   0.0079   0.0060
+   0.0047   0.0072   0.0101   0.0130   0.0153   0.0165
+   0.0163   0.0148   0.0124   0.0095
+   0.0066   0.0101   0.0142   0.0183   0.0216   0.0234
+   0.0233   0.0212   0.0178   0.0137
+   0.0085   0.0130   0.0183   0.0237   0.0280   0.0305
+   0.0305   0.0279   0.0235   0.0182
+   0.0099   0.0153   0.0216   0.0280   0.0334   0.0365
+   0.0366   0.0337   0.0285   0.0222
+   0.0107   0.0165   0.0234   0.0305   0.0365   0.0400
+   0.0403   0.0374   0.0318   0.0249
+   0.0105   0.0163   0.0233   0.0305   0.0366   0.0403
+   0.0409   0.0381   0.0326   0.0256
+   0.0095   0.0148   0.0212   0.0279   0.0337   0.0374
+   0.0381   0.0357   0.0307   0.0243
+   0.0079   0.0124   0.0178   0.0235   0.0285   0.0318
+   0.0326   0.0307   0.0266   0.0211
+   0.0060   0.0095   0.0137   0.0182   0.0222   0.0249
+   0.0256   0.0243   0.0211   0.0169
+   0.0036   0.0055   0.0077   0.0099   0.0117   0.0126
+   0.0125   0.0113   0.0095   0.0072
+   0.0055   0.0085   0.0119   0.0153   0.0181   0.0196
+   0.0194   0.0177   0.0149   0.0114
+   0.0077   0.0119   0.0167   0.0216   0.0256   0.0279
+   0.0278   0.0255   0.0215   0.0166
+   0.0099   0.0153   0.0216   0.0280   0.0334   0.0365
+   0.0366   0.0337   0.0285   0.0222
+   0.0117   0.0181   0.0256   0.0334   0.0399   0.0438
+   0.0441   0.0409   0.0348   0.0272
+   0.0126   0.0196   0.0279   0.0365   0.0438   0.0483
+   0.0490   0.0456   0.0390   0.0307
+   0.0125   0.0194   0.0278   0.0366   0.0441   0.0490
+   0.0499   0.0467   0.0402   0.0318
+   0.0113   0.0177   0.0255   0.0337   0.0409   0.0456
+   0.0467   0.0440   0.0381   0.0303
+   0.0095   0.0149   0.0215   0.0285   0.0348   0.0390
+   0.0402   0.0381   0.0331   0.0265
+   0.0072   0.0114   0.0166   0.0222   0.0272   0.0307
+   0.0318   0.0303   0.0265   0.0213
+   0.0039   0.0059   0.0083   0.0107   0.0126   0.0137
+   0.0136   0.0124   0.0104   0.0080
+   0.0059   0.0091   0.0128   0.0165   0.0196   0.0213
+   0.0212   0.0195   0.0164   0.0127
+   0.0083   0.0128   0.0181   0.0234   0.0279   0.0305
+   0.0305   0.0281   0.0238   0.0185
+   0.0107   0.0165   0.0234   0.0305   0.0365   0.0400
+   0.0403   0.0374   0.0318   0.0249
+   0.0126   0.0196   0.0279   0.0365   0.0438   0.0483
+   0.0490   0.0456   0.0390   0.0307
+   0.0137   0.0213   0.0305   0.0400   0.0483   0.0536
+   0.0546   0.0511   0.0440   0.0348
+   0.0136   0.0212   0.0305   0.0403   0.0490   0.0546
+   0.0559   0.0527   0.0456   0.0363
+   0.0124   0.0195   0.0281   0.0374   0.0456   0.0511
+   0.0527   0.0499   0.0434   0.0347
+   0.0104   0.0164   0.0238   0.0318   0.0390   0.0440
+   0.0456   0.0434   0.0380   0.0305
+   0.0080   0.0127   0.0185   0.0249   0.0307   0.0348
+   0.0363   0.0347   0.0305   0.0247
+   0.0038   0.0058   0.0082   0.0105   0.0125   0.0136
+   0.0135   0.0124   0.0105   0.0081
+   0.0058   0.0089   0.0126   0.0163   0.0194   0.0212
+   0.0213   0.0196   0.0166   0.0129
+   0.0082   0.0126   0.0179   0.0233   0.0278   0.0305
+   0.0308   0.0285   0.0243   0.0190
+   0.0105   0.0163   0.0233   0.0305   0.0366   0.0403
+   0.0409   0.0381   0.0326   0.0256
+   0.0125   0.0194   0.0278   0.0366   0.0441   0.0490
+   0.0499   0.0467   0.0402   0.0318
+   0.0136   0.0212   0.0305   0.0403   0.0490   0.0546
+   0.0559   0.0527   0.0456   0.0363
+   0.0135   0.0213   0.0308   0.0409   0.0499   0.0559
+   0.0576   0.0546   0.0475   0.0380
+   0.0124   0.0196   0.0285   0.0381   0.0467   0.0527
+   0.0546   0.0520   0.0455   0.0366
+   0.0105   0.0166   0.0243   0.0326   0.0402   0.0456
+   0.0475   0.0455   0.0400   0.0323
+   0.0081   0.0129   0.0190   0.0256   0.0318   0.0363
+   0.0380   0.0366   0.0323   0.0263
+   0.0034   0.0052   0.0073   0.0095   0.0113   0.0124
+   0.0124   0.0114   0.0097   0.0075
+   0.0052   0.0080   0.0114   0.0148   0.0177   0.0195
+   0.0196   0.0182   0.0155   0.0121
+   0.0073   0.0114   0.0162   0.0212   0.0255   0.0281
+   0.0285   0.0266   0.0227   0.0179
+   0.0095   0.0148   0.0212   0.0279   0.0337   0.0374
+   0.0381   0.0357   0.0307   0.0243
+   0.0113   0.0177   0.0255   0.0337   0.0409   0.0456
+   0.0467   0.0440   0.0381   0.0303
+   0.0124   0.0195   0.0281   0.0374   0.0456   0.0511
+   0.0527   0.0499   0.0434   0.0347
+   0.0124   0.0196   0.0285   0.0381   0.0467   0.0527
+   0.0546   0.0520   0.0455   0.0366
+   0.0114   0.0182   0.0266   0.0357   0.0440   0.0499
+   0.0520   0.0498   0.0438   0.0354
+   0.0097   0.0155   0.0227   0.0307   0.0381   0.0434
+   0.0455   0.0438   0.0387   0.0314
+   0.0075   0.0121   0.0179   0.0243   0.0303   0.0347
+   0.0366   0.0354   0.0314   0.0256
+   0.0028   0.0043   0.0061   0.0079   0.0095   0.0104
+   0.0105   0.0097   0.0082   0.0065
+   0.0043   0.0066   0.0095   0.0124   0.0149   0.0164
+   0.0166   0.0155   0.0133   0.0104
+   0.0061   0.0095   0.0135   0.0178   0.0215   0.0238
+   0.0243   0.0227   0.0196   0.0155
+   0.0079   0.0124   0.0178   0.0235   0.0285   0.0318
+   0.0326   0.0307   0.0266   0.0211
+   0.0095   0.0149   0.0215   0.0285   0.0348   0.0390
+   0.0402   0.0381   0.0331   0.0265
+   0.0104   0.0164   0.0238   0.0318   0.0390   0.0440
+   0.0456   0.0434   0.0380   0.0305
+   0.0105   0.0166   0.0243   0.0326   0.0402   0.0456
+   0.0475   0.0455   0.0400   0.0323
+   0.0097   0.0155   0.0227   0.0307   0.0381   0.0434
+   0.0455   0.0438   0.0387   0.0314
+   0.0082   0.0133   0.0196   0.0266   0.0331   0.0380
+   0.0400   0.0387   0.0344   0.0280
+   0.0065   0.0104   0.0155   0.0211   0.0265   0.0305
+   0.0323   0.0314   0.0280   0.0230
+   0.0021   0.0032   0.0046   0.0060   0.0072   0.0080
+   0.0081   0.0075   0.0065   0.0051
+   0.0032   0.0050   0.0072   0.0095   0.0114   0.0127
+   0.0129   0.0121   0.0104   0.0082
+   0.0046   0.0072   0.0104   0.0137   0.0166   0.0185
+   0.0190   0.0179   0.0155   0.0123
+   0.0060   0.0095   0.0137   0.0182   0.0222   0.0249
+   0.0256   0.0243   0.0211   0.0169
+   0.0072   0.0114   0.0166   0.0222   0.0272   0.0307
+   0.0318   0.0303   0.0265   0.0213
+   0.0080   0.0127   0.0185   0.0249   0.0307   0.0348
+   0.0363   0.0347   0.0305   0.0247
+   0.0081   0.0129   0.0190   0.0256   0.0318   0.0363
+   0.0380   0.0366   0.0323   0.0263
+   0.0075   0.0121   0.0179   0.0243   0.0303   0.0347
+   0.0366   0.0354   0.0314   0.0256
+   0.0065   0.0104   0.0155   0.0211   0.0265   0.0305
+   0.0323   0.0314   0.0280   0.0230
+   0.0051   0.0082   0.0123   0.0169   0.0213   0.0247
+   0.0263   0.0256   0.0230   0.0189
diff --git a/regtest/analysis/rt-cube/plumed.dat b/regtest/analysis/rt-cube/plumed.dat
new file mode 100755
index 0000000000000000000000000000000000000000..f62456dd7877409758531206698dfab644d8bc45
--- /dev/null
+++ b/regtest/analysis/rt-cube/plumed.dat
@@ -0,0 +1,35 @@
+x1: DISTANCE ATOMS=1,2
+x2: DISTANCE ATOMS=1,2
+x3: DISTANCE ATOMS=1,2
+
+HISTOGRAM ...
+  ARG=x1,x2,x3
+  TEMP=300
+  GRID_MIN=0.0,0.0,0.0
+  GRID_MAX=3.0,3.0,3.0
+  GRID_BIN=10,10,10
+  BANDWIDTH=1.0,1.0,1.0 
+  LABEL=hA1
+... HISTOGRAM
+
+PRINT_GRID GRID=hA1 STRIDE=1 FILE=histoA1
+PRINT_CUBE GRID=hA1 STRIDE=1 FILE=histoA1.cube FMT=%8.4f
+
+CONVERT_TO_FES GRID=hA1 TEMP=300 LABEL=fA1
+PRINT_CUBE GRID=fA1 STRIDE=1 FILE=fesA1.cube FMT=%8.3f
+
+HISTOGRAM ...
+  ARG=x1,x2,x3
+  TEMP=300
+  GRID_MIN=0.0,0.0,0.0
+  GRID_MAX=3.0,3.0,3.0
+  GRID_BIN=10,10,10
+  BANDWIDTH=1.0,1.0,1.0 
+  NOMEMORY
+  LABEL=hA2
+... HISTOGRAM
+
+PRINT_CUBE GRID=hA2 STRIDE=2 FILE=histoA2.cube FMT=%8.4f
+
+CONVERT_TO_FES GRID=hA2 TEMP=300 LABEL=fA2
+PRINT_CUBE GRID=fA2 STRIDE=2 FILE=fesA2.cube FMT=%8.3f
diff --git a/regtest/analysis/rt-cube/trajectory.xyz b/regtest/analysis/rt-cube/trajectory.xyz
new file mode 100644
index 0000000000000000000000000000000000000000..c910ae5c6fda2241cfe5be857f9b8493db430ed3
--- /dev/null
+++ b/regtest/analysis/rt-cube/trajectory.xyz
@@ -0,0 +1,12 @@
+2
+0 0 0
+X 0 0 0
+X 0 0 1
+2
+0 0 0
+X 0 0 0
+X 0 0 1.5
+2
+0 0 0
+X 0 0 0
+X 0 0 2
diff --git a/regtest/analysis/rt-histo/Makefile b/regtest/analysis/rt-histo/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3703b27cea227aa053fb6d1d73f861e4384dbcee
--- /dev/null
+++ b/regtest/analysis/rt-histo/Makefile
@@ -0,0 +1 @@
+include ../../scripts/test.make
diff --git a/regtest/analysis/rt-histo/analysis.0.fesA1.reference b/regtest/analysis/rt-histo/analysis.0.fesA1.reference
new file mode 100644
index 0000000000000000000000000000000000000000..27fd0bbb32936bfd4c5b4343044469c28b883453
--- /dev/null
+++ b/regtest/analysis/rt-histo/analysis.0.fesA1.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA1 dfA1_x
+#! SET normalisation    1.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300      inf      nan
+   0.6600      inf      nan
+   0.6900      inf      nan
+   0.7200      inf      nan
+   0.7500      inf      nan
+   0.7800      inf      nan
+   0.8100      inf      nan
+   0.8400      inf      nan
+   0.8700      inf      nan
+   0.9000      inf      nan
+   0.9300      inf      nan
+   0.9600      inf      nan
+   0.9900      inf      nan
+   1.0200      inf      nan
+   1.0500      inf      nan
+   1.0800      inf      nan
+   1.1100      inf      nan
+   1.1400  12.7120 -89.7962
+   1.1700  10.1304 -82.3132
+   1.2000   7.7732 -74.8302
+   1.2300   5.6406 -67.3471
+   1.2600   3.7324 -59.8641
+   1.2900   2.0487 -52.3811
+   1.3200   0.5895 -44.8981
+   1.3500  -0.6452 -37.4151
+   1.3800  -1.6554 -29.9321
+   1.4100  -2.4411 -22.4490
+   1.4400  -3.0023 -14.9660
+   1.4700  -3.3390  -7.4830
+   1.5000  -3.4513   0.0000
+   1.5300  -3.3390   7.4830
+   1.5600  -3.0023  14.9660
+   1.5900  -2.4411  22.4490
+   1.6200  -1.6554  29.9321
+   1.6500  -0.6452  37.4151
+   1.6800   0.5895  44.8981
+   1.7100   2.0487  52.3811
+   1.7400   3.7324  59.8641
+   1.7700   5.6406  67.3471
+   1.8000   7.7732  74.8302
+   1.8300  10.1304  82.3132
+   1.8600  12.7120  89.7962
+   1.8900      inf      nan
+   1.9200      inf      nan
+   1.9500      inf      nan
+   1.9800      inf      nan
+   2.0100      inf      nan
+   2.0400      inf      nan
+   2.0700      inf      nan
+   2.1000      inf      nan
+   2.1300      inf      nan
+   2.1600      inf      nan
+   2.1900      inf      nan
+   2.2200      inf      nan
+   2.2500      inf      nan
+   2.2800      inf      nan
+   2.3100      inf      nan
+   2.3400      inf      nan
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/analysis.0.histoA1.reference b/regtest/analysis/rt-histo/analysis.0.histoA1.reference
new file mode 100644
index 0000000000000000000000000000000000000000..88a4336bed9ff8e1e8a939c7e49a27b91a97e583
--- /dev/null
+++ b/regtest/analysis/rt-histo/analysis.0.histoA1.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1 dhA1_x
+#! SET normalisation    1.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0061   0.2203
+   1.1700   0.0172   0.5684
+   1.2000   0.0443   1.3296
+   1.2300   0.1042   2.8137
+   1.2600   0.2239   5.3747
+   1.2900   0.4398   9.2366
+   1.3200   0.7895  14.2110
+   1.3500   1.2952  19.4276
+   1.3800   1.9419  23.3023
+   1.4100   2.6609  23.9477
+   1.4400   3.3322  19.9935
+   1.4700   3.8139  11.4416
+   1.5000   3.9894   0.0000
+   1.5300   3.8139 -11.4416
+   1.5600   3.3322 -19.9935
+   1.5900   2.6609 -23.9477
+   1.6200   1.9419 -23.3023
+   1.6500   1.2952 -19.4276
+   1.6800   0.7895 -14.2110
+   1.7100   0.4398  -9.2366
+   1.7400   0.2239  -5.3747
+   1.7700   0.1042  -2.8137
+   1.8000   0.0443  -1.3296
+   1.8300   0.0172  -0.5684
+   1.8600   0.0061  -0.2203
+   1.8900   0.0000   0.0000
+   1.9200   0.0000   0.0000
+   1.9500   0.0000   0.0000
+   1.9800   0.0000   0.0000
+   2.0100   0.0000   0.0000
+   2.0400   0.0000   0.0000
+   2.0700   0.0000   0.0000
+   2.1000   0.0000   0.0000
+   2.1300   0.0000   0.0000
+   2.1600   0.0000   0.0000
+   2.1900   0.0000   0.0000
+   2.2200   0.0000   0.0000
+   2.2500   0.0000   0.0000
+   2.2800   0.0000   0.0000
+   2.3100   0.0000   0.0000
+   2.3400   0.0000   0.0000
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/analysis.0.histoA1n.reference b/regtest/analysis/rt-histo/analysis.0.histoA1n.reference
new file mode 100644
index 0000000000000000000000000000000000000000..0f957405022c2e5d960bc28e8bd3c1a68d1087af
--- /dev/null
+++ b/regtest/analysis/rt-histo/analysis.0.histoA1n.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1n dhA1n_x
+#! SET normalisation    1.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0061   0.2203
+   1.1700   0.0172   0.5684
+   1.2000   0.0443   1.3296
+   1.2300   0.1042   2.8137
+   1.2600   0.2239   5.3747
+   1.2900   0.4398   9.2366
+   1.3200   0.7895  14.2110
+   1.3500   1.2952  19.4276
+   1.3800   1.9419  23.3023
+   1.4100   2.6609  23.9477
+   1.4400   3.3322  19.9935
+   1.4700   3.8139  11.4416
+   1.5000   3.9894   0.0000
+   1.5300   3.8139 -11.4416
+   1.5600   3.3322 -19.9935
+   1.5900   2.6609 -23.9477
+   1.6200   1.9419 -23.3023
+   1.6500   1.2952 -19.4276
+   1.6800   0.7895 -14.2110
+   1.7100   0.4398  -9.2366
+   1.7400   0.2239  -5.3747
+   1.7700   0.1042  -2.8137
+   1.8000   0.0443  -1.3296
+   1.8300   0.0172  -0.5684
+   1.8600   0.0061  -0.2203
+   1.8900   0.0000   0.0000
+   1.9200   0.0000   0.0000
+   1.9500   0.0000   0.0000
+   1.9800   0.0000   0.0000
+   2.0100   0.0000   0.0000
+   2.0400   0.0000   0.0000
+   2.0700   0.0000   0.0000
+   2.1000   0.0000   0.0000
+   2.1300   0.0000   0.0000
+   2.1600   0.0000   0.0000
+   2.1900   0.0000   0.0000
+   2.2200   0.0000   0.0000
+   2.2500   0.0000   0.0000
+   2.2800   0.0000   0.0000
+   2.3100   0.0000   0.0000
+   2.3400   0.0000   0.0000
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/config b/regtest/analysis/rt-histo/config
new file mode 100644
index 0000000000000000000000000000000000000000..f93ec1a97465724691bf162d4735f5ea3648bbb4
--- /dev/null
+++ b/regtest/analysis/rt-histo/config
@@ -0,0 +1,3 @@
+type=driver
+# this is to test a different name
+arg="--plumed plumed.dat --ixyz trajectory.xyz"
diff --git a/regtest/analysis/rt-histo/fesA1.reference b/regtest/analysis/rt-histo/fesA1.reference
new file mode 100644
index 0000000000000000000000000000000000000000..8d48222eceef025b1c15e859c47dddc10dba73ff
--- /dev/null
+++ b/regtest/analysis/rt-histo/fesA1.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA1 dfA1_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300      inf      nan
+   0.6600      inf      nan
+   0.6900      inf      nan
+   0.7200      inf      nan
+   0.7500      inf      nan
+   0.7800      inf      nan
+   0.8100      inf      nan
+   0.8400      inf      nan
+   0.8700      inf      nan
+   0.9000      inf      nan
+   0.9300      inf      nan
+   0.9600      inf      nan
+   0.9900      inf      nan
+   1.0200      inf      nan
+   1.0500      inf      nan
+   1.0800      inf      nan
+   1.1100      inf      nan
+   1.1400  14.4487 -90.0824
+   1.1700  11.8631 -82.4292
+   1.2000   9.5032 -74.8639
+   1.2300   7.3697 -67.3543
+   1.2600   5.4619 -59.8764
+   1.2900   3.7779 -52.3856
+   1.3200   2.3185 -44.8981
+   1.3500   1.0837 -37.4143
+   1.3800   0.0735 -29.9314
+   1.4100  -0.7122 -22.4487
+   1.4400  -1.2733 -14.9663
+   1.4700  -1.6101  -7.4830
+   1.5000  -1.7223   0.0000
+   1.5300  -1.6101   7.4830
+   1.5600  -1.2733  14.9663
+   1.5900  -0.7122  22.4487
+   1.6200   0.0698  29.7442
+   1.6500   1.0670  36.5796
+   1.6800   2.2443  41.2424
+   1.7100   3.4613  37.5174
+   1.7400   4.2792  12.7801
+   1.7700   4.0939 -23.8285
+   1.8000   3.0696 -40.4271
+   1.8300   1.8368 -40.1618
+   1.8600   0.7120 -34.4135
+   1.8900  -0.2133 -27.4377
+   1.9200  -0.9242 -19.9547
+   1.9500  -1.4105 -12.4717
+   1.9800  -1.6725  -4.9887
+   2.0100  -1.7099   2.4943
+   2.0400  -1.5228   9.9774
+   2.0700  -1.1112  17.4604
+   2.1000  -0.4752  24.9434
+   2.1300   0.3854  32.4264
+   2.1600   1.4704  39.9094
+   2.1900   2.7799  47.3924
+   2.2200   4.3140  54.8754
+   2.2500   6.0725  62.3585
+   2.2800   8.0555  69.8415
+   2.3100  10.2630  77.3245
+   2.3400  12.6949  84.8075
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/fesA1u.reference b/regtest/analysis/rt-histo/fesA1u.reference
new file mode 100644
index 0000000000000000000000000000000000000000..3dface3c882b88c4102913840f32450ec37b2333
--- /dev/null
+++ b/regtest/analysis/rt-histo/fesA1u.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA1u dfA1u_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300      inf      nan
+   0.6600      inf      nan
+   0.6900      inf      nan
+   0.7200      inf      nan
+   0.7500      inf      nan
+   0.7800      inf      nan
+   0.8100      inf      nan
+   0.8400      inf      nan
+   0.8700      inf      nan
+   0.9000      inf      nan
+   0.9300      inf      nan
+   0.9600      inf      nan
+   0.9900      inf      nan
+   1.0200      inf      nan
+   1.0500      inf      nan
+   1.0800      inf      nan
+   1.1100      inf      nan
+   1.1400  12.7198 -90.0824
+   1.1700  10.1341 -82.4292
+   1.2000   7.7743 -74.8639
+   1.2300   5.6408 -67.3543
+   1.2600   3.7329 -59.8764
+   1.2900   2.0489 -52.3856
+   1.3200   0.5896 -44.8981
+   1.3500  -0.6452 -37.4143
+   1.3800  -1.6554 -29.9314
+   1.4100  -2.4411 -22.4487
+   1.4400  -3.0023 -14.9663
+   1.4700  -3.3391  -7.4830
+   1.5000  -3.4513   0.0000
+   1.5300  -3.3391   7.4830
+   1.5600  -3.0023  14.9663
+   1.5900  -2.4411  22.4487
+   1.6200  -1.6592  29.7442
+   1.6500  -0.6619  36.5796
+   1.6800   0.5153  41.2424
+   1.7100   1.7323  37.5174
+   1.7400   2.5502  12.7801
+   1.7700   2.3649 -23.8285
+   1.8000   1.3407 -40.4271
+   1.8300   0.1078 -40.1618
+   1.8600  -1.0170 -34.4135
+   1.8900  -1.9422 -27.4377
+   1.9200  -2.6531 -19.9547
+   1.9500  -3.1395 -12.4717
+   1.9800  -3.4014  -4.9887
+   2.0100  -3.4388   2.4943
+   2.0400  -3.2517   9.9774
+   2.0700  -2.8402  17.4604
+   2.1000  -2.2041  24.9434
+   2.1300  -1.3436  32.4264
+   2.1600  -0.2585  39.9094
+   2.1900   1.0510  47.3924
+   2.2200   2.5850  54.8754
+   2.2500   4.3435  62.3585
+   2.2800   6.3265  69.8415
+   2.3100   8.5340  77.3245
+   2.3400  10.9660  84.8075
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/fesA2.reference b/regtest/analysis/rt-histo/fesA2.reference
new file mode 100644
index 0000000000000000000000000000000000000000..a844cd83b428ed5dd82d1565e7b39a85fb026006
--- /dev/null
+++ b/regtest/analysis/rt-histo/fesA2.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA2 dfA2_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300      inf      nan
+   0.6600      inf      nan
+   0.6900      inf      nan
+   0.7200      inf      nan
+   0.7500      inf      nan
+   0.7800      inf      nan
+   0.8100      inf      nan
+   0.8400      inf      nan
+   0.8700      inf      nan
+   0.9000      inf      nan
+   0.9300      inf      nan
+   0.9600      inf      nan
+   0.9900      inf      nan
+   1.0200      inf      nan
+   1.0500      inf      nan
+   1.0800      inf      nan
+   1.1100      inf      nan
+   1.1400  14.4410 -89.7962
+   1.1700  11.8593 -82.3132
+   1.2000   9.5022 -74.8302
+   1.2300   7.3695 -67.3471
+   1.2600   5.4614 -59.8641
+   1.2900   3.7777 -52.3811
+   1.3200   2.3185 -44.8981
+   1.3500   1.0838 -37.4151
+   1.3800   0.0736 -29.9321
+   1.4100  -0.7121 -22.4490
+   1.4400  -1.2734 -14.9660
+   1.4700  -1.6101  -7.4830
+   1.5000  -1.7223   0.0000
+   1.5300  -1.6101   7.4830
+   1.5600  -1.2734  14.9660
+   1.5900  -0.7121  22.4490
+   1.6200   0.0698  29.7448
+   1.6500   1.0670  36.5804
+   1.6800   2.2443  41.2424
+   1.7100   3.4611  37.5145
+   1.7400   4.2788  12.7784
+   1.7700   4.0938 -23.8282
+   1.8000   3.0696 -40.4260
+   1.8300   1.8367 -40.1606
+   1.8600   0.7119 -34.4131
+   1.8900  -0.2133 -27.4377
+   1.9200  -0.9242 -19.9547
+   1.9500  -1.4105 -12.4717
+   1.9800  -1.6725  -4.9887
+   2.0100  -1.7099   2.4943
+   2.0400  -1.5228   9.9774
+   2.0700  -1.1112  17.4604
+   2.1000  -0.4752  24.9434
+   2.1300   0.3854  32.4264
+   2.1600   1.4704  39.9094
+   2.1900   2.7799  47.3924
+   2.2200   4.3140  54.8754
+   2.2500   6.0725  62.3585
+   2.2800   8.0555  69.8415
+   2.3100  10.2630  77.3245
+   2.3400  12.6949  84.8075
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/fesA2u.reference b/regtest/analysis/rt-histo/fesA2u.reference
new file mode 100644
index 0000000000000000000000000000000000000000..2916194d6a5cdb8f6e8980e9941136f78af70cf3
--- /dev/null
+++ b/regtest/analysis/rt-histo/fesA2u.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA2u dfA2u_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300      inf      nan
+   0.6600      inf      nan
+   0.6900      inf      nan
+   0.7200      inf      nan
+   0.7500      inf      nan
+   0.7800      inf      nan
+   0.8100      inf      nan
+   0.8400      inf      nan
+   0.8700      inf      nan
+   0.9000      inf      nan
+   0.9300      inf      nan
+   0.9600      inf      nan
+   0.9900      inf      nan
+   1.0200      inf      nan
+   1.0500      inf      nan
+   1.0800      inf      nan
+   1.1100      inf      nan
+   1.1400  12.7120 -89.7962
+   1.1700  10.1304 -82.3132
+   1.2000   7.7732 -74.8302
+   1.2300   5.6406 -67.3471
+   1.2600   3.7324 -59.8641
+   1.2900   2.0487 -52.3811
+   1.3200   0.5895 -44.8981
+   1.3500  -0.6452 -37.4151
+   1.3800  -1.6554 -29.9321
+   1.4100  -2.4411 -22.4490
+   1.4400  -3.0023 -14.9660
+   1.4700  -3.3390  -7.4830
+   1.5000  -3.4513   0.0000
+   1.5300  -3.3390   7.4830
+   1.5600  -3.0023  14.9660
+   1.5900  -2.4411  22.4490
+   1.6200  -1.6591  29.7448
+   1.6500  -0.6619  36.5804
+   1.6800   0.5153  41.2424
+   1.7100   1.7321  37.5145
+   1.7400   2.5499  12.7784
+   1.7700   2.3649 -23.8282
+   1.8000   1.3406 -40.4260
+   1.8300   0.1078 -40.1606
+   1.8600  -1.0170 -34.4131
+   1.8900  -1.9422 -27.4377
+   1.9200  -2.6531 -19.9547
+   1.9500  -3.1395 -12.4717
+   1.9800  -3.4014  -4.9887
+   2.0100  -3.4388   2.4943
+   2.0400  -3.2517   9.9774
+   2.0700  -2.8402  17.4604
+   2.1000  -2.2041  24.9434
+   2.1300  -1.3436  32.4264
+   2.1600  -0.2585  39.9094
+   2.1900   1.0510  47.3924
+   2.2200   2.5850  54.8754
+   2.2500   4.3435  62.3585
+   2.2800   6.3265  69.8415
+   2.3100   8.5340  77.3245
+   2.3400  10.9660  84.8075
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/fesA3.reference b/regtest/analysis/rt-histo/fesA3.reference
new file mode 100644
index 0000000000000000000000000000000000000000..644466e0d1bd20d9ccf59082a6c8b8d84612c758
--- /dev/null
+++ b/regtest/analysis/rt-histo/fesA3.reference
@@ -0,0 +1,107 @@
+#! FIELDS x fA3 dfA3_x
+#! SET normalisation    3.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000      inf      nan
+   0.0300      inf      nan
+   0.0600      inf      nan
+   0.0900      inf      nan
+   0.1200      inf      nan
+   0.1500      inf      nan
+   0.1800      inf      nan
+   0.2100      inf      nan
+   0.2400      inf      nan
+   0.2700      inf      nan
+   0.3000      inf      nan
+   0.3300      inf      nan
+   0.3600      inf      nan
+   0.3900      inf      nan
+   0.4200      inf      nan
+   0.4500      inf      nan
+   0.4800      inf      nan
+   0.5100      inf      nan
+   0.5400      inf      nan
+   0.5700      inf      nan
+   0.6000      inf      nan
+   0.6300  16.3628 -92.2905
+   0.6600  13.7063 -84.8075
+   0.6900  11.2743 -77.3245
+   0.7200   9.0668 -69.8415
+   0.7500   7.0838 -62.3585
+   0.7800   5.3253 -54.8754
+   0.8100   3.7913 -47.3924
+   0.8400   2.4818 -39.9094
+   0.8700   1.3967 -32.4264
+   0.9000   0.5362 -24.9434
+   0.9300  -0.0999 -17.4604
+   0.9600  -0.5114  -9.9774
+   0.9900  -0.6985  -2.4943
+   1.0200  -0.6611   4.9887
+   1.0500  -0.3992  12.4717
+   1.0800   0.0872  19.9547
+   1.1100   0.7981  27.4377
+   1.1400   1.7233  34.4131
+   1.1700   2.8481  40.1606
+   1.2000   4.0809  40.4260
+   1.2300   5.1052  23.8282
+   1.2600   5.2902 -12.7784
+   1.2900   4.4724 -37.5145
+   1.3200   3.2556 -41.2424
+   1.3500   2.0784 -36.5804
+   1.3800   1.0850 -29.9321
+   1.4100   0.2992 -22.4490
+   1.4400  -0.2620 -14.9660
+   1.4700  -0.5987  -7.4830
+   1.5000  -0.7110   0.0000
+   1.5300  -0.5987   7.4830
+   1.5600  -0.2620  14.9660
+   1.5900   0.2992  22.4490
+   1.6200   1.0812  29.7448
+   1.6500   2.0784  36.5804
+   1.6800   3.2556  41.2424
+   1.7100   4.4724  37.5145
+   1.7400   5.2902  12.7784
+   1.7700   5.1052 -23.8282
+   1.8000   4.0809 -40.4260
+   1.8300   2.8481 -40.1606
+   1.8600   1.7233 -34.4131
+   1.8900   0.7981 -27.4377
+   1.9200   0.0872 -19.9547
+   1.9500  -0.3992 -12.4717
+   1.9800  -0.6611  -4.9887
+   2.0100  -0.6985   2.4943
+   2.0400  -0.5114   9.9774
+   2.0700  -0.0999  17.4604
+   2.1000   0.5362  24.9434
+   2.1300   1.3967  32.4264
+   2.1600   2.4818  39.9094
+   2.1900   3.7913  47.3924
+   2.2200   5.3253  54.8754
+   2.2500   7.0838  62.3585
+   2.2800   9.0668  69.8415
+   2.3100  11.2743  77.3245
+   2.3400  13.7063  84.8075
+   2.3700      inf      nan
+   2.4000      inf      nan
+   2.4300      inf      nan
+   2.4600      inf      nan
+   2.4900      inf      nan
+   2.5200      inf      nan
+   2.5500      inf      nan
+   2.5800      inf      nan
+   2.6100      inf      nan
+   2.6400      inf      nan
+   2.6700      inf      nan
+   2.7000      inf      nan
+   2.7300      inf      nan
+   2.7600      inf      nan
+   2.7900      inf      nan
+   2.8200      inf      nan
+   2.8500      inf      nan
+   2.8800      inf      nan
+   2.9100      inf      nan
+   2.9400      inf      nan
+   2.9700      inf      nan
+   3.0000      inf      nan
diff --git a/regtest/analysis/rt-histo/histoA1.reference b/regtest/analysis/rt-histo/histoA1.reference
new file mode 100644
index 0000000000000000000000000000000000000000..e193cda0e6f5b7d08bfcd45d402731bf60a872e9
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA1.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1 dhA1_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0031   0.1101
+   1.1700   0.0086   0.2842
+   1.2000   0.0221   0.6648
+   1.2300   0.0521   1.4068
+   1.2600   0.1119   2.6873
+   1.2900   0.2199   4.6183
+   1.3200   0.3947   7.1055
+   1.3500   0.6476   9.7138
+   1.3800   0.9709  11.6511
+   1.4100   1.3304  11.9739
+   1.4400   1.6661   9.9968
+   1.4700   1.9069   5.7208
+   1.5000   1.9947   0.0000
+   1.5300   1.9069  -5.7208
+   1.5600   1.6661  -9.9968
+   1.5900   1.3304 -11.9739
+   1.6200   0.9724 -11.5957
+   1.6500   0.6520  -9.5611
+   1.6800   0.4067  -6.7240
+   1.7100   0.2497  -3.7552
+   1.7400   0.1799  -0.9216
+   1.7700   0.1937   1.8508
+   1.8000   0.2921   4.7343
+   1.8300   0.4788   7.7100
+   1.8600   0.7517  10.3708
+   1.8900   1.0893  11.9819
+   1.9200   1.4485  11.5877
+   1.9500   1.7603   8.8016
+   1.9800   1.9552   3.9104
+   2.0100   1.9848  -1.9848
+   2.0400   1.8414  -7.3654
+   2.0700   1.5613 -10.9289
+   2.1000   1.2099 -12.0985
+   2.1300   0.8568 -11.1390
+   2.1600   0.5546  -8.8737
+   2.1900   0.3281  -6.2335
+   2.2200   0.1774  -3.9022
+   2.2500   0.0876  -2.1910
+   2.2800   0.0396  -1.1082
+   2.3100   0.0163  -0.5064
+   2.3400   0.0062  -0.2095
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/histoA1n.reference b/regtest/analysis/rt-histo/histoA1n.reference
new file mode 100644
index 0000000000000000000000000000000000000000..9f4035e1e0a0a9a8a3032c1baf0b4a347125fbc7
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA1n.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1n dhA1n_x
+#! SET normalisation    1.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0000   0.0000
+   1.1700   0.0000   0.0000
+   1.2000   0.0000   0.0000
+   1.2300   0.0000   0.0000
+   1.2600   0.0000   0.0000
+   1.2900   0.0000   0.0000
+   1.3200   0.0000   0.0000
+   1.3500   0.0000   0.0000
+   1.3800   0.0000   0.0000
+   1.4100   0.0000   0.0000
+   1.4400   0.0000   0.0000
+   1.4700   0.0000   0.0000
+   1.5000   0.0000   0.0000
+   1.5300   0.0000   0.0000
+   1.5600   0.0000   0.0000
+   1.5900   0.0000   0.0000
+   1.6200   0.0029   0.1109
+   1.6500   0.0087   0.3054
+   1.6800   0.0238   0.7629
+   1.7100   0.0595   1.7262
+   1.7400   0.1358   3.5316
+   1.7700   0.2833   6.5152
+   1.8000   0.5399  10.7982
+   1.8300   0.9405  15.9883
+   1.8600   1.4973  20.9618
+   1.8900   2.1785  23.9637
+   1.9200   2.8969  23.1753
+   1.9500   3.5207  17.6033
+   1.9800   3.9104   7.8209
+   2.0100   3.9695  -3.9695
+   2.0400   3.6827 -14.7308
+   2.0700   3.1225 -21.8578
+   2.1000   2.4197 -24.1971
+   2.1300   1.7137 -22.2779
+   2.1600   1.1092 -17.7473
+   2.1900   0.6562 -12.4670
+   2.2200   0.3547  -7.8044
+   2.2500   0.1753  -4.3821
+   2.2800   0.0792  -2.2163
+   2.3100   0.0327  -1.0127
+   2.3400   0.0123  -0.4190
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/histoA1u.reference b/regtest/analysis/rt-histo/histoA1u.reference
new file mode 100644
index 0000000000000000000000000000000000000000..7f8ee59be84197978643b795775fe1db9eb6690c
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA1u.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1u dhA1u_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0061   0.2203
+   1.1700   0.0172   0.5684
+   1.2000   0.0443   1.3296
+   1.2300   0.1042   2.8137
+   1.2600   0.2239   5.3747
+   1.2900   0.4398   9.2366
+   1.3200   0.7895  14.2110
+   1.3500   1.2952  19.4276
+   1.3800   1.9419  23.3023
+   1.4100   2.6609  23.9477
+   1.4400   3.3322  19.9935
+   1.4700   3.8139  11.4416
+   1.5000   3.9894   0.0000
+   1.5300   3.8139 -11.4416
+   1.5600   3.3322 -19.9935
+   1.5900   2.6609 -23.9477
+   1.6200   1.9448 -23.1914
+   1.6500   1.3039 -19.1222
+   1.6800   0.8133 -13.4481
+   1.7100   0.4993  -7.5104
+   1.7400   0.3597  -1.8431
+   1.7700   0.3875   3.7015
+   1.8000   0.5842   9.4686
+   1.8300   0.9577  15.4199
+   1.8600   1.5034  20.7415
+   1.8900   2.1785  23.9637
+   1.9200   2.8969  23.1753
+   1.9500   3.5207  17.6033
+   1.9800   3.9104   7.8209
+   2.0100   3.9695  -3.9695
+   2.0400   3.6827 -14.7308
+   2.0700   3.1225 -21.8578
+   2.1000   2.4197 -24.1971
+   2.1300   1.7137 -22.2779
+   2.1600   1.1092 -17.7473
+   2.1900   0.6562 -12.4670
+   2.2200   0.3547  -7.8044
+   2.2500   0.1753  -4.3821
+   2.2800   0.0792  -2.2163
+   2.3100   0.0327  -1.0127
+   2.3400   0.0123  -0.4190
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/histoA2.reference b/regtest/analysis/rt-histo/histoA2.reference
new file mode 100644
index 0000000000000000000000000000000000000000..028e7757fa61cb28fa30e22cd2b5b68acf12315e
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA2.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA2 dhA2_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0031   0.1101
+   1.1700   0.0086   0.2842
+   1.2000   0.0222   0.6648
+   1.2300   0.0521   1.4068
+   1.2600   0.1120   2.6873
+   1.2900   0.2199   4.6183
+   1.3200   0.3948   7.1055
+   1.3500   0.6476   9.7138
+   1.3800   0.9709  11.6512
+   1.4100   1.3304  11.9738
+   1.4400   1.6661   9.9967
+   1.4700   1.9069   5.7208
+   1.5000   1.9947   0.0000
+   1.5300   1.9069  -5.7208
+   1.5600   1.6661  -9.9967
+   1.5900   1.3304 -11.9738
+   1.6200   0.9724 -11.5957
+   1.6500   0.6520  -9.5611
+   1.6800   0.4067  -6.7241
+   1.7100   0.2497  -3.7552
+   1.7400   0.1799  -0.9216
+   1.7700   0.1937   1.8508
+   1.8000   0.2921   4.7343
+   1.8300   0.4789   7.7099
+   1.8600   0.7517  10.3708
+   1.8900   1.0893  11.9819
+   1.9200   1.4485  11.5877
+   1.9500   1.7603   8.8016
+   1.9800   1.9552   3.9104
+   2.0100   1.9848  -1.9848
+   2.0400   1.8414  -7.3654
+   2.0700   1.5613 -10.9289
+   2.1000   1.2099 -12.0985
+   2.1300   0.8568 -11.1390
+   2.1600   0.5546  -8.8737
+   2.1900   0.3281  -6.2335
+   2.2200   0.1774  -3.9022
+   2.2500   0.0876  -2.1910
+   2.2800   0.0396  -1.1082
+   2.3100   0.0163  -0.5064
+   2.3400   0.0062  -0.2095
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/histoA2u.reference b/regtest/analysis/rt-histo/histoA2u.reference
new file mode 100644
index 0000000000000000000000000000000000000000..1dd2347177ec2a3c25ae4adbaf0cc2dab7419489
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA2u.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA2u dhA2u_x
+#! SET normalisation    2.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0061   0.2203
+   1.1700   0.0172   0.5684
+   1.2000   0.0443   1.3296
+   1.2300   0.1042   2.8137
+   1.2600   0.2239   5.3747
+   1.2900   0.4398   9.2366
+   1.3200   0.7895  14.2110
+   1.3500   1.2952  19.4276
+   1.3800   1.9419  23.3023
+   1.4100   2.6609  23.9477
+   1.4400   3.3322  19.9935
+   1.4700   3.8139  11.4416
+   1.5000   3.9894   0.0000
+   1.5300   3.8139 -11.4416
+   1.5600   3.3322 -19.9935
+   1.5900   2.6609 -23.9477
+   1.6200   1.9448 -23.1914
+   1.6500   1.3039 -19.1222
+   1.6800   0.8133 -13.4481
+   1.7100   0.4994  -7.5103
+   1.7400   0.3598  -1.8431
+   1.7700   0.3875   3.7016
+   1.8000   0.5842   9.4686
+   1.8300   0.9577  15.4199
+   1.8600   1.5034  20.7416
+   1.8900   2.1785  23.9637
+   1.9200   2.8969  23.1753
+   1.9500   3.5207  17.6033
+   1.9800   3.9104   7.8209
+   2.0100   3.9695  -3.9695
+   2.0400   3.6827 -14.7308
+   2.0700   3.1225 -21.8578
+   2.1000   2.4197 -24.1971
+   2.1300   1.7137 -22.2779
+   2.1600   1.1092 -17.7473
+   2.1900   0.6562 -12.4670
+   2.2200   0.3547  -7.8044
+   2.2500   0.1753  -4.3821
+   2.2800   0.0792  -2.2163
+   2.3100   0.0327  -1.0127
+   2.3400   0.0123  -0.4190
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/histoA3.reference b/regtest/analysis/rt-histo/histoA3.reference
new file mode 100644
index 0000000000000000000000000000000000000000..4e8c24c835b878bc037001e37fe35491b723b3aa
--- /dev/null
+++ b/regtest/analysis/rt-histo/histoA3.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA3 dhA3_x
+#! SET normalisation    3.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0014   0.0524
+   0.6600   0.0041   0.1397
+   0.6900   0.0109   0.3376
+   0.7200   0.0264   0.7388
+   0.7500   0.0584   1.4607
+   0.7800   0.1182   2.6015
+   0.8100   0.2187   4.1557
+   0.8400   0.3697   5.9158
+   0.8700   0.5712   7.4260
+   0.9000   0.8066   8.0657
+   0.9300   1.0408   7.2859
+   0.9600   1.2276   4.9103
+   0.9900   1.3232   1.3232
+   1.0200   1.3035  -2.6070
+   1.0500   1.1736  -5.8678
+   1.0800   0.9656  -7.7251
+   1.1100   0.7262  -7.9879
+   1.1400   0.5011  -6.9139
+   1.1700   0.3192  -5.1400
+   1.2000   0.1947  -3.1562
+   1.2300   0.1292  -1.2339
+   1.2600   0.1199   0.6144
+   1.2900   0.1665   2.5034
+   1.3200   0.2711   4.4827
+   1.3500   0.4346   6.3741
+   1.3800   0.6473   7.7674
+   1.4100   0.8870   7.9826
+   1.4400   1.1107   6.6645
+   1.4700   1.2713   3.8139
+   1.5000   1.3298   0.0000
+   1.5300   1.2713  -3.8139
+   1.5600   1.1107  -6.6645
+   1.5900   0.8870  -7.9826
+   1.6200   0.6483  -7.7305
+   1.6500   0.4346  -6.3741
+   1.6800   0.2711  -4.4827
+   1.7100   0.1665  -2.5034
+   1.7400   0.1199  -0.6144
+   1.7700   0.1292   1.2339
+   1.8000   0.1947   3.1562
+   1.8300   0.3192   5.1400
+   1.8600   0.5011   6.9139
+   1.8900   0.7262   7.9879
+   1.9200   0.9656   7.7251
+   1.9500   1.1736   5.8678
+   1.9800   1.3035   2.6070
+   2.0100   1.3232  -1.3232
+   2.0400   1.2276  -4.9103
+   2.0700   1.0408  -7.2859
+   2.1000   0.8066  -8.0657
+   2.1300   0.5712  -7.4260
+   2.1600   0.3697  -5.9158
+   2.1900   0.2187  -4.1557
+   2.2200   0.1182  -2.6015
+   2.2500   0.0584  -1.4607
+   2.2800   0.0264  -0.7388
+   2.3100   0.0109  -0.3376
+   2.3400   0.0041  -0.1397
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt-histo/plumed.dat b/regtest/analysis/rt-histo/plumed.dat
new file mode 100755
index 0000000000000000000000000000000000000000..d1b86eef2d2d6f90b74d7f33394682aa6e39a224
--- /dev/null
+++ b/regtest/analysis/rt-histo/plumed.dat
@@ -0,0 +1,86 @@
+x: DISTANCE ATOMS=1,2
+
+HISTOGRAM ...
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  LABEL=hA1
+... HISTOGRAM
+
+HISTOGRAM ... 
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  LABEL=hA2
+... HISTOGRAM
+
+HISTOGRAM ...
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  LABEL=hA3
+... HISTOGRAM
+
+HISTOGRAM ...
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  NOMEMORY
+  LABEL=hA1n
+... HISTOGRAM
+
+PRINT_GRID GRID=hA1 FILE=histoA1 STRIDE=1 FMT=%8.4f
+PRINT_GRID GRID=hA1n FILE=histoA1n STRIDE=1 FMT=%8.4f
+PRINT_GRID GRID=hA2 FILE=histoA2 STRIDE=2 FMT=%8.4f
+PRINT_GRID GRID=hA3 FILE=histoA3 USE_ALL_DATA FMT=%8.4f
+
+HISTOGRAM ...
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  UNORMALIZED
+  LABEL=hA1u
+... HISTOGRAM
+
+HISTOGRAM ...
+  ARG=x
+  TEMP=300
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  BANDWIDTH=0.1
+  UNORMALIZED
+  LABEL=hA2u
+... HISTOGRAM
+
+PRINT_GRID GRID=hA1u FILE=histoA1u STRIDE=1 FMT=%8.4f 
+PRINT_GRID GRID=hA2u FILE=histoA2u STRIDE=2 FMT=%8.4f
+ 
+CONVERT_TO_FES GRID=hA1 TEMP=300 LABEL=fA1
+CONVERT_TO_FES GRID=hA2 TEMP=300 LABEL=fA2
+CONVERT_TO_FES GRID=hA3 TEMP=300 LABEL=fA3
+
+PRINT_GRID GRID=fA1 FILE=fesA1 STRIDE=1 FMT=%8.4f
+PRINT_GRID GRID=fA2 FILE=fesA2 STRIDE=2 FMT=%8.4f
+PRINT_GRID GRID=fA3 FILE=fesA3 USE_ALL_DATA FMT=%8.4f
+
+CONVERT_TO_FES GRID=hA1u TEMP=300 LABEL=fA1u
+CONVERT_TO_FES GRID=hA2u TEMP=300 LABEL=fA2u
+
+PRINT_GRID GRID=fA1u FILE=fesA1u STRIDE=1 FMT=%8.4f 
+PRINT_GRID GRID=fA2u FILE=fesA2u STRIDE=2 FMT=%8.4f
diff --git a/regtest/analysis/rt-histo/trajectory.xyz b/regtest/analysis/rt-histo/trajectory.xyz
new file mode 100644
index 0000000000000000000000000000000000000000..c910ae5c6fda2241cfe5be857f9b8493db430ed3
--- /dev/null
+++ b/regtest/analysis/rt-histo/trajectory.xyz
@@ -0,0 +1,12 @@
+2
+0 0 0
+X 0 0 0
+X 0 0 1
+2
+0 0 0
+X 0 0 0
+X 0 0 1.5
+2
+0 0 0
+X 0 0 0
+X 0 0 2
diff --git a/regtest/analysis/rt0/histoA.reference b/regtest/analysis/rt0/histoA.reference
index 11425019a9f1aa584941f61388daf5301c3fbaac..a9c66815b9bdb363075a5c1aa7825ca422297301 100644
--- a/regtest/analysis/rt0/histoA.reference
+++ b/regtest/analysis/rt0/histoA.reference
@@ -1,106 +1,107 @@
-#! FIELDS x probs
+#! FIELDS x hA dhA_x
+#! SET normalisation    2.0000
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
-   0.0000   0.0000
-   0.0300   0.0000
-   0.0600   0.0000
-   0.0900   0.0000
-   0.1200   0.0000
-   0.1500   0.0000
-   0.1800   0.0000
-   0.2100   0.0000
-   0.2400   0.0000
-   0.2700   0.0000
-   0.3000   0.0000
-   0.3300   0.0000
-   0.3600   0.0000
-   0.3900   0.0000
-   0.4200   0.0000
-   0.4500   0.0000
-   0.4800   0.0000
-   0.5100   0.0000
-   0.5400   0.0000
-   0.5700   0.0000
-   0.6000   0.0000
-   0.6300   0.0000
-   0.6600   0.0000
-   0.6900   0.0000
-   0.7200   0.0000
-   0.7500   0.0000
-   0.7800   0.0000
-   0.8100   0.0000
-   0.8400   0.0000
-   0.8700   0.0000
-   0.9000   0.0000
-   0.9300   0.0000
-   0.9600   0.0000
-   0.9900   0.0000
-   1.0200   0.0000
-   1.0500   0.0000
-   1.0800   0.0000
-   1.1100   0.0000
-   1.1400   0.0031
-   1.1700   0.0086
-   1.2000   0.0221
-   1.2300   0.0521
-   1.2600   0.1119
-   1.2900   0.2199
-   1.3200   0.3947
-   1.3500   0.6476
-   1.3800   0.9709
-   1.4100   1.3304
-   1.4400   1.6661
-   1.4700   1.9069
-   1.5000   1.9947
-   1.5300   1.9069
-   1.5600   1.6661
-   1.5900   1.3304
-   1.6200   0.9724
-   1.6500   0.6520
-   1.6800   0.4067
-   1.7100   0.2497
-   1.7400   0.1799
-   1.7700   0.1937
-   1.8000   0.2921
-   1.8300   0.4788
-   1.8600   0.7517
-   1.8900   1.0893
-   1.9200   1.4485
-   1.9500   1.7603
-   1.9800   1.9552
-   2.0100   1.9848
-   2.0400   1.8414
-   2.0700   1.5613
-   2.1000   1.2099
-   2.1300   0.8568
-   2.1600   0.5546
-   2.1900   0.3281
-   2.2200   0.1774
-   2.2500   0.0876
-   2.2800   0.0396
-   2.3100   0.0163
-   2.3400   0.0062
-   2.3700   0.0000
-   2.4000   0.0000
-   2.4300   0.0000
-   2.4600   0.0000
-   2.4900   0.0000
-   2.5200   0.0000
-   2.5500   0.0000
-   2.5800   0.0000
-   2.6100   0.0000
-   2.6400   0.0000
-   2.6700   0.0000
-   2.7000   0.0000
-   2.7300   0.0000
-   2.7600   0.0000
-   2.7900   0.0000
-   2.8200   0.0000
-   2.8500   0.0000
-   2.8800   0.0000
-   2.9100   0.0000
-   2.9400   0.0000
-   2.9700   0.0000
-   3.0000   0.0000
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0031   0.1101
+   1.1700   0.0086   0.2842
+   1.2000   0.0221   0.6648
+   1.2300   0.0521   1.4068
+   1.2600   0.1119   2.6873
+   1.2900   0.2199   4.6183
+   1.3200   0.3947   7.1055
+   1.3500   0.6476   9.7138
+   1.3800   0.9709  11.6511
+   1.4100   1.3304  11.9739
+   1.4400   1.6661   9.9968
+   1.4700   1.9069   5.7208
+   1.5000   1.9947   0.0000
+   1.5300   1.9069  -5.7208
+   1.5600   1.6661  -9.9968
+   1.5900   1.3304 -11.9739
+   1.6200   0.9724 -11.5957
+   1.6500   0.6520  -9.5611
+   1.6800   0.4067  -6.7240
+   1.7100   0.2497  -3.7552
+   1.7400   0.1799  -0.9216
+   1.7700   0.1937   1.8508
+   1.8000   0.2921   4.7343
+   1.8300   0.4788   7.7100
+   1.8600   0.7517  10.3708
+   1.8900   1.0893  11.9819
+   1.9200   1.4485  11.5877
+   1.9500   1.7603   8.8016
+   1.9800   1.9552   3.9104
+   2.0100   1.9848  -1.9848
+   2.0400   1.8414  -7.3654
+   2.0700   1.5613 -10.9289
+   2.1000   1.2099 -12.0985
+   2.1300   0.8568 -11.1390
+   2.1600   0.5546  -8.8737
+   2.1900   0.3281  -6.2335
+   2.2200   0.1774  -3.9022
+   2.2500   0.0876  -2.1910
+   2.2800   0.0396  -1.1082
+   2.3100   0.0163  -0.5064
+   2.3400   0.0062  -0.2095
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt0/histoB.reference b/regtest/analysis/rt0/histoB.reference
index 0facce1f608dbfad4d6f637ce120bf88ab7d1794..292e70eff32ddd97ae7e58bacfc7148fd21583d3 100644
--- a/regtest/analysis/rt0/histoB.reference
+++ b/regtest/analysis/rt0/histoB.reference
@@ -1,106 +1,107 @@
-#! FIELDS x probs
+#! FIELDS x hB dhB_x
+#! SET normalisation    2.2220
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
-   0.0000   0.0000
-   0.0300   0.0000
-   0.0600   0.0000
-   0.0900   0.0000
-   0.1200   0.0000
-   0.1500   0.0000
-   0.1800   0.0000
-   0.2100   0.0000
-   0.2400   0.0000
-   0.2700   0.0000
-   0.3000   0.0000
-   0.3300   0.0000
-   0.3600   0.0000
-   0.3900   0.0000
-   0.4200   0.0000
-   0.4500   0.0000
-   0.4800   0.0000
-   0.5100   0.0000
-   0.5400   0.0000
-   0.5700   0.0000
-   0.6000   0.0000
-   0.6300   0.0000
-   0.6600   0.0000
-   0.6900   0.0000
-   0.7200   0.0000
-   0.7500   0.0000
-   0.7800   0.0000
-   0.8100   0.0000
-   0.8400   0.0000
-   0.8700   0.0000
-   0.9000   0.0000
-   0.9300   0.0000
-   0.9600   0.0000
-   0.9900   0.0000
-   1.0200   0.0000
-   1.0500   0.0000
-   1.0800   0.0000
-   1.1100   0.0000
-   1.1400   0.0027
-   1.1700   0.0077
-   1.2000   0.0199
-   1.2300   0.0469
-   1.2600   0.1008
-   1.2900   0.1979
-   1.3200   0.3553
-   1.3500   0.5829
-   1.3800   0.8740
-   1.4100   1.1975
-   1.4400   1.4997
-   1.4700   1.7165
-   1.5000   1.7954
-   1.5300   1.7165
-   1.5600   1.4997
-   1.5900   1.1975
-   1.6200   0.8756
-   1.6500   0.5877
-   1.6800   0.3684
-   1.7100   0.2307
-   1.7400   0.1755
-   1.7700   0.2027
-   1.8000   0.3169
-   1.8300   0.5250
-   1.8600   0.8262
-   1.8900   1.1981
-   1.9200   1.5931
-   1.9500   1.9362
-   1.9800   2.1505
-   2.0100   2.1830
-   2.0400   2.0253
-   2.0700   1.7172
-   2.1000   1.3307
-   2.1300   0.9424
-   2.1600   0.6100
-   2.1900   0.3609
-   2.2200   0.1951
-   2.2500   0.0964
-   2.2800   0.0435
-   2.3100   0.0180
-   2.3400   0.0068
-   2.3700   0.0000
-   2.4000   0.0000
-   2.4300   0.0000
-   2.4600   0.0000
-   2.4900   0.0000
-   2.5200   0.0000
-   2.5500   0.0000
-   2.5800   0.0000
-   2.6100   0.0000
-   2.6400   0.0000
-   2.6700   0.0000
-   2.7000   0.0000
-   2.7300   0.0000
-   2.7600   0.0000
-   2.7900   0.0000
-   2.8200   0.0000
-   2.8500   0.0000
-   2.8800   0.0000
-   2.9100   0.0000
-   2.9400   0.0000
-   2.9700   0.0000
-   3.0000   0.0000
+   0.0000   0.0000   0.0000
+   0.0300   0.0000   0.0000
+   0.0600   0.0000   0.0000
+   0.0900   0.0000   0.0000
+   0.1200   0.0000   0.0000
+   0.1500   0.0000   0.0000
+   0.1800   0.0000   0.0000
+   0.2100   0.0000   0.0000
+   0.2400   0.0000   0.0000
+   0.2700   0.0000   0.0000
+   0.3000   0.0000   0.0000
+   0.3300   0.0000   0.0000
+   0.3600   0.0000   0.0000
+   0.3900   0.0000   0.0000
+   0.4200   0.0000   0.0000
+   0.4500   0.0000   0.0000
+   0.4800   0.0000   0.0000
+   0.5100   0.0000   0.0000
+   0.5400   0.0000   0.0000
+   0.5700   0.0000   0.0000
+   0.6000   0.0000   0.0000
+   0.6300   0.0000   0.0000
+   0.6600   0.0000   0.0000
+   0.6900   0.0000   0.0000
+   0.7200   0.0000   0.0000
+   0.7500   0.0000   0.0000
+   0.7800   0.0000   0.0000
+   0.8100   0.0000   0.0000
+   0.8400   0.0000   0.0000
+   0.8700   0.0000   0.0000
+   0.9000   0.0000   0.0000
+   0.9300   0.0000   0.0000
+   0.9600   0.0000   0.0000
+   0.9900   0.0000   0.0000
+   1.0200   0.0000   0.0000
+   1.0500   0.0000   0.0000
+   1.0800   0.0000   0.0000
+   1.1100   0.0000   0.0000
+   1.1400   0.0027   0.0991
+   1.1700   0.0077   0.2558
+   1.2000   0.0199   0.5984
+   1.2300   0.0469   1.2663
+   1.2600   0.1008   2.4189
+   1.2900   0.1979   4.1570
+   1.3200   0.3553   6.3957
+   1.3500   0.5829   8.7435
+   1.3800   0.8740  10.4873
+   1.4100   1.1975  10.7777
+   1.4400   1.4997   8.9981
+   1.4700   1.7165   5.1493
+   1.5000   1.7954   0.0000
+   1.5300   1.7165  -5.1493
+   1.5600   1.4997  -8.9981
+   1.5900   1.1975 -10.7777
+   1.6200   0.8756 -10.4263
+   1.6500   0.5877  -8.5755
+   1.6800   0.3684  -5.9762
+   1.7100   0.2307  -3.2076
+   1.7400   0.1755  -0.4767
+   1.7700   0.2027   2.3167
+   1.8000   0.3169   5.3400
+   1.8300   0.5250   8.5369
+   1.8600   0.8262  11.4287
+   1.8900   1.1981  13.1788
+   1.9200   1.5931  12.7452
+   1.9500   1.9362   9.6809
+   1.9800   2.1505   4.3011
+   2.0100   2.1830  -2.1830
+   2.0400   2.0253  -8.1012
+   2.0700   1.7172 -12.0206
+   2.1000   1.3307 -13.3071
+   2.1300   0.9424 -12.2517
+   2.1600   0.6100  -9.7601
+   2.1900   0.3609  -6.8562
+   2.2200   0.1951  -4.2920
+   2.2500   0.0964  -2.4099
+   2.2800   0.0435  -1.2189
+   2.3100   0.0180  -0.5569
+   2.3400   0.0068  -0.2304
+   2.3700   0.0000   0.0000
+   2.4000   0.0000   0.0000
+   2.4300   0.0000   0.0000
+   2.4600   0.0000   0.0000
+   2.4900   0.0000   0.0000
+   2.5200   0.0000   0.0000
+   2.5500   0.0000   0.0000
+   2.5800   0.0000   0.0000
+   2.6100   0.0000   0.0000
+   2.6400   0.0000   0.0000
+   2.6700   0.0000   0.0000
+   2.7000   0.0000   0.0000
+   2.7300   0.0000   0.0000
+   2.7600   0.0000   0.0000
+   2.7900   0.0000   0.0000
+   2.8200   0.0000   0.0000
+   2.8500   0.0000   0.0000
+   2.8800   0.0000   0.0000
+   2.9100   0.0000   0.0000
+   2.9400   0.0000   0.0000
+   2.9700   0.0000   0.0000
+   3.0000   0.0000   0.0000
diff --git a/regtest/analysis/rt0/histoD.reference b/regtest/analysis/rt0/histoD.reference
index 7a451957c6d1e1f59d1bd0a90188f404090e6059..c2827416c9d5a8a190f694c7894805489a1bc6d2 100644
--- a/regtest/analysis/rt0/histoD.reference
+++ b/regtest/analysis/rt0/histoD.reference
@@ -1,7 +1,8 @@
-#! FIELDS x probs
+#! FIELDS x hD
+#! SET normalisation    5.5474
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
    0.0000   0.0000
    0.0300   0.0000
diff --git a/regtest/analysis/rt0/histoD1.reference b/regtest/analysis/rt0/histoD1.reference
index c21f52ccfd3c72e262aa1a21ea6f5e5b69d1fb9d..7a6242f4ed92381dca7a3ff17e8db8ac6929560d 100644
--- a/regtest/analysis/rt0/histoD1.reference
+++ b/regtest/analysis/rt0/histoD1.reference
@@ -1,7 +1,8 @@
-#! FIELDS x probs
+#! FIELDS x hD1
+#! SET normalisation    1.4932
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
    0.0000   0.0000
    0.0300   0.0000
diff --git a/regtest/analysis/rt0/histoD2.reference b/regtest/analysis/rt0/histoD2.reference
index c30dbc322bd8396ac3bd9b1de94c8bee39a7f259..fbdf557840a378a257ea4a6d4ba3c4cc9be52118 100644
--- a/regtest/analysis/rt0/histoD2.reference
+++ b/regtest/analysis/rt0/histoD2.reference
@@ -1,7 +1,8 @@
-#! FIELDS x probs
+#! FIELDS x hD2
+#! SET normalisation    1.8246
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
    0.0000   0.0000
    0.0300   0.0000
diff --git a/regtest/analysis/rt0/histoE.reference b/regtest/analysis/rt0/histoE.reference
index d4e388b3a0edd623cdc5f0eb3d7044a5d825829d..b36b2558f2211d383cbb60cddb29fe689871f6d6 100644
--- a/regtest/analysis/rt0/histoE.reference
+++ b/regtest/analysis/rt0/histoE.reference
@@ -1,7 +1,8 @@
-#! FIELDS x probs
+#! FIELDS x fE
+#! SET normalisation    3.0547
 #! SET min_x 0.0
 #! SET max_x 3.0
-#! SET nbins_x  101
+#! SET nbins_x  100
 #! SET periodic_x false
    0.0000      inf
    0.0300      inf
diff --git a/regtest/analysis/rt0/plumed.dat b/regtest/analysis/rt0/plumed.dat
index 22ba7aca7f82bca2173987a7de2e8ed4e983eade..b5ff3b6cde0b363efc2fcc1b5c19d27aae080357 100755
--- a/regtest/analysis/rt0/plumed.dat
+++ b/regtest/analysis/rt0/plumed.dat
@@ -46,10 +46,11 @@ HISTOGRAM ...
   GRID_BIN=100
   KERNEL=DISCRETE
   REWEIGHT_BIAS
+  UNORMALIZED
   LABEL=hD
 ... HISTOGRAM
 
-PRINT_GRID GRID=hD FILE=histoD FMT=%8.4f UNNORMALIZED USE_ALL_DATA
+PRINT_GRID GRID=hD FILE=histoD FMT=%8.4f USE_ALL_DATA
 
 HISTOGRAM ...
   ARG=x
@@ -59,10 +60,11 @@ HISTOGRAM ...
   GRID_BIN=100
   KERNEL=DISCRETE
   REWEIGHT_BIAS
+  UNORMALIZED
   LABEL=hE
 ... HISTOGRAM
 
-fE: CONVERT_TO_FES GRID=hE TEMP=10000 UNNORMALIZED
+fE: CONVERT_TO_FES GRID=hE TEMP=10000 
 PRINT_GRID GRID=fE FMT=%8.4f USE_ALL_DATA FILE=histoE 
 
 HISTOGRAM ...
@@ -75,10 +77,11 @@ HISTOGRAM ...
   REWEIGHT_BIAS
   UPDATE_FROM=0
   UPDATE_UNTIL=1
+  UNORMALIZED
   LABEL=hD1
 ... HISTOGRAM
 
-PRINT_GRID GRID=hD1 FILE=histoD1 FMT=%8.4f UNNORMALIZED USE_ALL_DATA
+PRINT_GRID GRID=hD1 FILE=histoD1 FMT=%8.4f USE_ALL_DATA
 
 HISTOGRAM ...
   ARG=x
@@ -90,10 +93,11 @@ HISTOGRAM ...
   REWEIGHT_BIAS
   UPDATE_FROM=1
   UPDATE_UNTIL=2
+  UNORMALIZED
   LABEL=hD2
 ... HISTOGRAM
 
-PRINT_GRID GRID=hD2 FILE=histoD2 FMT=%8.4f UNNORMALIZED USE_ALL_DATA
+PRINT_GRID GRID=hD2 FILE=histoD2 FMT=%8.4f USE_ALL_DATA
 
 
 
diff --git a/src/analysis/Analysis.cpp b/src/analysis/Analysis.cpp
index d4b1f573e7be0d6a619195d89c1d14f9b82ee2eb..fb539218ce322ae201f0e0a7c06a5e5fb8849bfc 100644
--- a/src/analysis/Analysis.cpp
+++ b/src/analysis/Analysis.cpp
@@ -89,7 +89,7 @@ ActionPilot(ao),
 ActionAtomistic(ao),
 ActionWithArguments(ao),
 ActionWithVessel(ao),
-single_run(false),
+single_run(true),
 nomemory(true),
 write_chq(false),
 reusing_data(false),
@@ -176,7 +176,6 @@ argument_names(getNumberOfArguments())
          if(simtemp==0) error("The MD engine does not pass the temperature to plumed so you have to specify it using TEMP");
       }
 
-      single_run=true;
       if( keywords.exists("USE_ALL_DATA") ){
           parseFlag("USE_ALL_DATA",single_run); 
           if( !single_run ){
@@ -219,8 +218,8 @@ argument_names(getNumberOfArguments())
 }
 
 void Analysis::setAnalysisStride( const bool& use_all, const unsigned& astride ){
-  if( freq>0 && astride!=freq ) error("frequency for output does not match frequency for run"); 
-  else if( freq>0 || use_all ) return;
+  if( freq>0 && astride!=freq ) error("each histogram can only be output with one stride"); 
+  else if( use_all ) return;  
 
   freq=astride; single_run=false;
   if( astride%getStride()!= 0 ) error("Frequncy of running is not a multiple of the stride");
@@ -407,7 +406,7 @@ void Analysis::runAnalysis(){
      norm=mydatastash->retrieveNorm();
   }
   // This ensures everything is set up to run the calculation
-  setAnalysisStride( single_run, freq );
+  if( single_run ) setAnalysisStride( single_run, freq );
   // And run the analysis
   performAnalysis(); idata=0;
   // Update total normalization constant
diff --git a/src/analysis/Histogram.cpp b/src/analysis/Histogram.cpp
index 73fde2065fadce288298156a25d0b2d46ec22c32..72a4f66da67dbc5a1ecbc07c8c744b80cb198aef 100644
--- a/src/analysis/Histogram.cpp
+++ b/src/analysis/Histogram.cpp
@@ -145,7 +145,7 @@ void Histogram::registerKeywords( Keywords& keys ){
   keys.add("compulsory","KERNEL","gaussian","the kernel function you are using. Use discrete/DISCRETE if you want to accumulate a discrete histogram. \
                                              More details on the kernels available in plumed can be found in \\ref kernelfunctions.");
   keys.add("optional","BANDWIDTH","the bandwdith for kernel density estimation");
-  keys.addFlag("UNNORMALIZED",false,"Set to TRUE if you don't want histogram to be normalized or free energy to be shifted.");
+  keys.addFlag("UNORMALIZED",false,"Set to TRUE if you don't want histogram to be normalized or free energy to be shifted.");
   keys.use("NOMEMORY");
 }
 
@@ -168,7 +168,12 @@ unnormalized(false)
      if( getPeriodicityInformation(i, dmin, dmax) ) vstring+=",T";
      else vstring+=",F";
   }
-  vstring += " STORE_NORMED COMPONENTS=" + getLabel();
+  bool unorm=false; parseFlag("UNORMALIZED",unorm);
+  if( unorm ){
+     log.printf("  working with unormalised grid \n");
+     vstring += " UNORMALIZED";
+  }
+  vstring += " COMPONENTS=" + getLabel();
   vstring += " COORDINATES=" + getPntrToArgument(0)->getName();
   for(unsigned i=1;i<getNumberOfArguments();++i) vstring += "," + getPntrToArgument(i)->getName(); 
   if( !usingMemory() ) vstring += " NOMEMORY";
@@ -190,9 +195,13 @@ unnormalized(false)
 }
 
 void Histogram::setAnalysisStride( const bool& use_all, const unsigned& astride ){
-  if( getFullNumberOfTasks()>0 && getFullNumberOfTasks()==getNumberOfDataPoints() ) return;
-  Analysis::setAnalysisStride( use_all, astride ); plumed_assert( getFullNumberOfTasks()==0 );
+  Analysis::setAnalysisStride( use_all, astride ); 
+  if( getNumberOfDataPoints()==getFullNumberOfTasks() ) return ;
+  plumed_assert( getFullNumberOfTasks()==0 );
   for(unsigned i=0;i<getNumberOfDataPoints();++i) addTaskToList( i );
+  deactivateAllTasks(); 
+  for(unsigned i=0;i<getNumberOfDataPoints();++i) taskFlags[i]=1;
+  lockContributors();
 }
 
 unsigned Histogram::getNumberOfQuantities() const {
@@ -209,7 +218,7 @@ void Histogram::performTask( const unsigned& task_index, const unsigned& current
 
 void Histogram::performAnalysis(){
   if( mygrid->wasreset() ) mygrid->clear();
-  runAllTasks(); mygrid->setNorm( getNormalization() );
+  mygrid->setNorm( getNormalization() ); runAllTasks();
 }
 
 }
diff --git a/src/gridtools/ActionWithInputGrid.cpp b/src/gridtools/ActionWithInputGrid.cpp
index d29153c4c7278cc2d00e177f57fb23c289c645f0..a4b363727ccb3e1a508d0ccc6bf35d3b507f0042 100644
--- a/src/gridtools/ActionWithInputGrid.cpp
+++ b/src/gridtools/ActionWithInputGrid.cpp
@@ -33,24 +33,23 @@ void ActionWithInputGrid::registerKeywords( Keywords& keys ){
   keys.add("compulsory","GRID","the action that creates the input grid you would like to use");
   keys.add("optional","STRIDE","the frequency with which to output the grid");
   keys.addFlag("USE_ALL_DATA",false,"use the data from the entire trajectory to perform the analysis");
-  keys.addFlag("UNNORMALIZED",false,"output an unormalised grid"); 
 }
 
 ActionWithInputGrid::ActionWithInputGrid(const ActionOptions&ao):
 Action(ao),
 ActionPilot(ao),
 ActionWithVessel(ao),
-norm(0.0),
+single_run(true),
 mygrid(NULL)
 {
   std::string mlab; parse("GRID",mlab);
-  vesselbase::ActionWithVessel* mves= plumed.getActionSet().selectWithLabel<vesselbase::ActionWithVessel*>(mlab);
+  mves= plumed.getActionSet().selectWithLabel<vesselbase::ActionWithVessel*>(mlab);
   if(!mves) error("action labelled " +  mlab + " does not exist or does not have vessels");
   addDependency(mves);
 
   ActionPilot* ap=dynamic_cast<ActionPilot*>( mves );
   if( ap ){
-     if( getStride()!=ap->getStride() ) error("mismatch between strides in " + ap->getLabel() + " and " +  getLabel() );
+     if( getStride()%ap->getStride()!=0 ) error("mismatch between strides in " + ap->getLabel() + " and " +  getLabel() );
   }
 
   log.printf("  using grid calculated by action %s \n",mves->getLabel().c_str() );
@@ -60,29 +59,29 @@ mygrid(NULL)
   }
   if( !mygrid ) error("input action does not calculate a grid");
 
-  parseFlag("UNNORMALIZED",unormalised);
-  if( unormalised ){
-     log.printf("  working with unormalised grid \n");
-     mygrid->switchOffNormalisation(); 
-  }
-
   if( keywords.exists("USE_ALL_DATA") ){
      parseFlag("USE_ALL_DATA",single_run);
      if( !single_run ){
         mves->setAnalysisStride( false, getStride() ); 
         log.printf("  outputting every %u steps \n", getStride() );
-     } else log.printf("  outputting at end of calculation\n");
+     } else {
+        log.printf("  outputting at end of calculation\n");
+     }
   }
 }
 
 void ActionWithInputGrid::setAnalysisStride( const bool& use_all, const unsigned& astride ){
   single_run=use_all;
-  if( !single_run ) setStride( astride );
+  if( !single_run ){
+     setStride( astride ); mves->setAnalysisStride( false, getStride() );
+  }
 }
 
 void ActionWithInputGrid::update(){
-  if( unormalised ) norm = 1.0;
-  else norm=1.0/mygrid->getNorm();
+  // Don't analyse the first frame in the trajectory
+  if( single_run || getStep()==0 ) return;
+  // Now check that all stuff for restarting is done correctly
+  if( !mygrid->foundprint ) error("an additional PRINT_GRID action is required before this action so grid is restarted correctly");
 
   if( checkAllActive() ){
      for(unsigned i=0;i<mygrid->getNumberOfPoints();++i){
@@ -94,11 +93,13 @@ void ActionWithInputGrid::update(){
 
 void ActionWithInputGrid::runFinalJobs(){
   if( !single_run ) return ;
-  if( unormalised ) norm = 1.0;
-  else norm=1.0/mygrid->getNorm();
   performOperationsWithGrid( false );
 }
 
+void ActionWithInputGrid::invertTask( const std::vector<double>& indata, std::vector<double>& outdata ){
+  plumed_merror("Shouldn't appear here");
+}
+
 }
 }
 
diff --git a/src/gridtools/ActionWithInputGrid.h b/src/gridtools/ActionWithInputGrid.h
index 0246be6ae0acd477ed3cf3c0556dfce242783b19..83ff5fd024267963da3a25ef44963e5617235ff8 100644
--- a/src/gridtools/ActionWithInputGrid.h
+++ b/src/gridtools/ActionWithInputGrid.h
@@ -32,14 +32,13 @@ class ActionWithInputGrid :
 public ActionPilot,
 public vesselbase::ActionWithVessel
 {
+friend class GridFunction;
 private:
-  double norm;
-  bool unormalised;
+  vesselbase::ActionWithVessel* mves;
 protected:
   bool single_run;
   GridVessel* mygrid;
-  double getGridElement( const std::vector<unsigned>& pp, const unsigned& ind ) const ;
-  double getGridElement( const unsigned& ind, const unsigned& jind ) const ;
+  double getGridElementAndDerivatives( const std::vector<double>& x, std::vector<double>& der ) const ;
 public:
   static void registerKeywords( Keywords& keys );
   explicit ActionWithInputGrid(const ActionOptions&ao);
@@ -50,18 +49,10 @@ public:
   virtual bool checkAllActive() const { return true; }
   virtual void performOperationsWithGrid( const bool& from_update )=0;
   void setAnalysisStride( const bool& use_all, const unsigned& astride );
+  virtual bool isGridPrint() const { return false; }
+  virtual void invertTask( const std::vector<double>& indata, std::vector<double>& outdata );
 };
 
-inline
-double ActionWithInputGrid::getGridElement( const std::vector<unsigned>& pp, const unsigned& ind ) const {
-  return norm*mygrid->getGridElement( pp, ind );
-}
-
-inline
-double ActionWithInputGrid::getGridElement( const unsigned& ind, const unsigned& jind ) const {
-  return norm*mygrid->getGridElement( ind, jind );
-}
-
 }
 }
 #endif
diff --git a/src/gridtools/AverageOnGrid.cpp b/src/gridtools/AverageOnGrid.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..51f6acb71329a1816b02bbf04a24410703583f04
--- /dev/null
+++ b/src/gridtools/AverageOnGrid.cpp
@@ -0,0 +1,61 @@
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+   Copyright (c) 2012-2015 The plumed team
+   (see the PEOPLE file at the root of the distribution for a list of names)
+
+   See http://www.plumed-code.org for more information.
+
+   This file is part of plumed, version 2.
+
+   plumed is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   plumed is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   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 "AverageOnGrid.h"
+
+namespace PLMD {
+namespace gridtools {
+
+void AverageOnGrid::registerKeywords( Keywords& keys ){
+  HistogramOnGrid::registerKeywords( keys );
+}
+
+AverageOnGrid::AverageOnGrid( const vesselbase::VesselOptions& da ):
+HistogramOnGrid(da)
+{
+  plumed_assert( nper==(dimension+1) );
+  arg_names.push_back( "density" );
+  if( !discrete ){
+    for(unsigned i=0;i<dimension;++i) arg_names.push_back( "ddensity_" + arg_names[i] );
+    nper = 2*(dimension+1);
+  } else {
+    nper = 2;
+  }
+}
+
+void AverageOnGrid::accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const {
+  buffer[bufstart+nper*ipoint] += weight*dens; buffer[bufstart+nper*ipoint+1+dimension] += dens;
+  if( der.size()>0 ){
+    for(unsigned j=0;j<dimension;++j) buffer[bufstart+nper*ipoint+ 1 + j] += weight*der[j];
+    for(unsigned j=0;j<dimension;++j) buffer[bufstart+nper*ipoint + 1 + dimension + 1 + j] += der[j];
+  }
+}
+
+double AverageOnGrid::getGridElement( const unsigned& ipoint, const unsigned& jelement ) const {
+  if( unormalised ) return data[nper*ipoint + jelement];  
+  if( jelement==0 ) return data[nper*ipoint] / data[nper*ipoint + 1 + dimension]; 
+  double rdenom = 1.0;
+  if( fabs(data[nper*ipoint+1+dimension])>epsilon ) rdenom = 1. / data[nper*ipoint + 1 + dimension];
+  return rdenom*data[nper*ipoint+1+jelement] - rdenom*rdenom*data[nper*ipoint]*data[nper*ipoint+1+dimension+1+jelement]; 
+} 
+
+}
+}
diff --git a/src/gridtools/AverageOnGrid.h b/src/gridtools/AverageOnGrid.h
new file mode 100644
index 0000000000000000000000000000000000000000..2506b78fafa331a04c5448d632d277fa0c1049c2
--- /dev/null
+++ b/src/gridtools/AverageOnGrid.h
@@ -0,0 +1,40 @@
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+   Copyright (c) 2012 The plumed team
+   (see the PEOPLE file at the root of the distribution for a list of names)
+
+   See http://www.plumed-code.org for more information.
+
+   This file is part of plumed, version 2.0.
+
+   plumed is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   plumed is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with plumed.  If not, see <http://www.gnu.org/licenses/>.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+#ifndef __PLUMED_gridtools_AverageOnGrid_h
+#define __PLUMED_gridtools_AverageOnGrid_h
+
+#include "HistogramOnGrid.h"
+
+namespace PLMD {
+namespace gridtools {
+
+class AverageOnGrid : public HistogramOnGrid {
+public:
+  static void registerKeywords( Keywords& keys );
+  explicit AverageOnGrid( const vesselbase::VesselOptions& da );
+  void accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const ;
+  double getGridElement( const unsigned& ipoint, const unsigned& jelement ) const ;
+};
+
+}
+}
+#endif
diff --git a/src/gridtools/ConvertToFES.cpp b/src/gridtools/ConvertToFES.cpp
index 0d7ce6d8ba6b8f189e0bce2ee3c60f8246a3ba03..1ec285003915f05ee7b5b6f8602593d0a6b88199 100644
--- a/src/gridtools/ConvertToFES.cpp
+++ b/src/gridtools/ConvertToFES.cpp
@@ -39,6 +39,7 @@ public:
   unsigned getNumberOfDerivatives(){ return 0; }
   unsigned getNumberOfQuantities() const ;
   void performTask( const unsigned& task_index, const unsigned& current, MultiValue& myvals ) const ;
+  void invertTask( const std::vector<double>& indata, std::vector<double>& outdata );
   bool isPeriodic(){ return false; }
 };
 
@@ -70,9 +71,14 @@ ActionWithInputGrid(ao)
   simtemp=0.; parse("TEMP",simtemp);
   if(simtemp>0) simtemp*=plumed.getAtoms().getKBoltzmann();
   else simtemp=plumed.getAtoms().getKbT();
+  if( simtemp==0 ) error("TEMP not set - use keyword TEMP");
 
   // Now create task list
   for(unsigned i=0;i<mygrid->getNumberOfPoints();++i) addTaskToList(i);
+  // And activate all tasks
+  deactivateAllTasks(); 
+  for(unsigned i=0;i<mygrid->getNumberOfPoints();++i) taskFlags[i]=1;
+  lockContributors();
 }
 
 unsigned ConvertToFES::getNumberOfQuantities() const {
@@ -81,19 +87,22 @@ unsigned ConvertToFES::getNumberOfQuantities() const {
 }
 
 void ConvertToFES::performOperationsWithGrid( const bool& from_update ){
-  outgrid->clear(); runAllTasks(); outgrid->reset();
+  outgrid->clear(); outgrid->setNorm( mygrid->getNorm() ); 
+  runAllTasks(); outgrid->reset();
 }
 
 void ConvertToFES::performTask( const unsigned& task_index, const unsigned& current, MultiValue& myvals ) const {
-  double val=getGridElement(current, 0);
+  double val=mygrid->getGridElement(current, 0);
   myvals.setValue( 0, 1.0 ); myvals.setValue(1, -simtemp*std::log(val) );
   if( !mygrid->noDerivatives() ){
-     for(unsigned i=0;i<mygrid->getDimension();++i) myvals.setValue( 2+i, -(simtemp/val)*getGridElement(current,i+1) );
+     for(unsigned i=0;i<mygrid->getDimension();++i) myvals.setValue( 2+i, -(simtemp/val)*mygrid->getGridElement(current,i+1) );
   }
 }
 
-
-
+void ConvertToFES::invertTask( const std::vector<double>& indata, std::vector<double>& outdata ){
+  outdata[0] = exp( -indata[0]/simtemp );
+  for(unsigned i=0;i<mygrid->getDimension();++i) outdata[1+i] = -(indata[0]/simtemp)*indata[1+i];  
+}
 
 }
 }
diff --git a/src/gridtools/FindContour.cpp b/src/gridtools/FindContour.cpp
index 2aff20ad28ad57a0f19f6ee3ab31e0c6b018cdf2..8e9e107352594775401358496f55f74b868d38b0 100644
--- a/src/gridtools/FindContour.cpp
+++ b/src/gridtools/FindContour.cpp
@@ -138,7 +138,7 @@ outgrid(NULL)
       Keywords keys; GridFunction::registerKeywords( keys );
       vesselbase::VesselOptions dar( da, keys );
       outgrid = new GridFunction(dar); addVessel( outgrid ); 
-      if( mygrid->noDerivatives() ) outgrid->setNoDerivatives();
+      outgrid->setNoDerivatives();
   }
 
   // START OF BIT TO IMPROVE
@@ -228,7 +228,7 @@ void FindContour::performOperationsWithGrid( const bool& from_update ){
      if( cycle ) continue;
 
      // Get the value of a point on the grid
-     double val1=getGridElement( i, mycomp*(mygrid->getDimension()+1) ) - contour;
+     double val1=mygrid->getGridElement( i, mycomp*(mygrid->getDimension()+1) ) - contour;
 
      bool edge=false;
      for(unsigned j=0;j<mygrid->getDimension();++j){
@@ -237,7 +237,7 @@ void FindContour::performOperationsWithGrid( const bool& from_update ){
          if( !mygrid->isPeriodic(j) && (ind[j]+1)==nbin[j] ) continue;
          else if( (ind[j]+1)==nbin[j] ){ edge=true; ind[j]=0; }
          else ind[j]+=1; 
-         double val2=getGridElement(ind,mycomp*(mygrid->getDimension()+1)) - contour;
+         double val2=mygrid->getGridElement(ind,mycomp*(mygrid->getDimension()+1)) - contour;
          if( val1*val2<0 ){
              // Use initial point location as first guess for search
              contour_points[npoints].resize( mygrid->getDimension() );  
diff --git a/src/gridtools/GridFunction.cpp b/src/gridtools/GridFunction.cpp
index b4b5a1bd2d9338da9d4ba5af3fe01cc8300c24c5..1e719474bccf4502a8dbb89ae4843e268d9c0b05 100644
--- a/src/gridtools/GridFunction.cpp
+++ b/src/gridtools/GridFunction.cpp
@@ -20,6 +20,7 @@
    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "GridFunction.h"
+#include "ActionWithInputGrid.h"
 
 namespace PLMD {
 namespace gridtools {
@@ -44,5 +45,16 @@ void GridFunction::finish( const std::vector<double>& buffer ){
   for(unsigned i=0;i<data.size();++i) data[i]+=buffer[bufstart + i];
 }
 
+void GridFunction::incorporateRestartDataIntoGrid( const double& old_norm, std::vector<double>& indata ){
+  ActionWithInputGrid* myfunc = dynamic_cast<ActionWithInputGrid*>( getAction() );
+  std::vector<double> pin( nper ), pout( nper ); 
+  for(unsigned i=0;i<getNumberOfPoints();++i){
+      for(unsigned j=0;j<nper;++j) pin[j]=indata[i*nper+j];
+      myfunc->invertTask( pin, pout ); 
+      for(unsigned j=0;j<nper;++j) indata[i*nper+j]=pout[j]; 
+  } 
+  (myfunc->mygrid)->incorporateRestartDataIntoGrid( old_norm, indata );
+}
+
 }
 }
diff --git a/src/gridtools/GridFunction.h b/src/gridtools/GridFunction.h
index 202edf836417ec800c8e9ffaa44e760c19821bb3..308d60cc3b0348c1b8867c5ade9b78e768d7bfbd 100644
--- a/src/gridtools/GridFunction.h
+++ b/src/gridtools/GridFunction.h
@@ -34,6 +34,7 @@ public:
   void calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const ;
   void finish( const std::vector<double>& );
   bool applyForce(  std::vector<double>& forces ){ return false; }
+  void incorporateRestartDataIntoGrid( const double& old_norm, std::vector<double>& indata );
 };
 
 }
diff --git a/src/gridtools/GridVessel.cpp b/src/gridtools/GridVessel.cpp
index d90fe8650c5605d3fd0b8ecda553a052fad0d557..091c0feed7286b9bd8328af755290bab57ff5d3b 100644
--- a/src/gridtools/GridVessel.cpp
+++ b/src/gridtools/GridVessel.cpp
@@ -32,6 +32,7 @@ void GridVessel::registerKeywords( Keywords& keys ){
   keys.add("compulsory","COORDINATES","the names of the coordinates of the grid");
   keys.add("compulsory","PBC","is the grid periodic in each direction or not");
   keys.addFlag("NOMEMORY",false,"should the data in the grid be deleted after print/analysis");
+  keys.addFlag("UNORMALIZED",false,"don't normalise grid");
 }
 
 GridVessel::GridVessel( const vesselbase::VesselOptions& da ):
@@ -40,14 +41,15 @@ noderiv(false),
 wascleared(true), 
 bounds_set(false),
 cube_units(1.0),
-naccumulate_grids(1)
+norm(1)
 {
   std::vector<std::string> compnames; parseVector("COMPONENTS",compnames);
   std::vector<std::string> coordnames; parseVector("COORDINATES",coordnames);
   dimension=coordnames.size();
   std::vector<std::string> spbc( dimension ); parseVector("PBC",spbc); 
   str_min.resize( dimension);  str_max.resize( dimension ); 
-  parseFlag("NOMEMORY",nomemory);
+  parseFlag("NOMEMORY",nomemory); parseFlag("UNORMALIZED",unormalised);
+  foundprint=nomemory;
 
   unsigned n=0; nper=compnames.size()*( 1 + coordnames.size() );
   arg_names.resize( coordnames.size() + compnames.size()*( 1 + coordnames.size() ) );
@@ -121,7 +123,7 @@ std::string GridVessel::description(){
 
 void GridVessel::resize(){
   plumed_massert( nper>0, "Number of datapoints at each grid point has not been set");
-  resizeBuffer( naccumulate_grids*npoints*nper ); 
+  resizeBuffer( npoints*nper ); 
   if( data.size()!=npoints*nper ){ 
       data.resize( npoints*nper, 0 ); 
       active.resize( npoints, true );
@@ -281,7 +283,7 @@ void GridVessel::getNeighbors( const std::vector<unsigned>& indices, const std::
 
 void GridVessel::reset(){
   if( !nomemory ) return ;
-  wascleared=true;
+  wascleared=true; 
 }
 
 void GridVessel::clear(){
diff --git a/src/gridtools/GridVessel.h b/src/gridtools/GridVessel.h
index e3e3fc82a2e8ad3c0ffd6c9c2d45b0b396c04716..58ee3dfc603b7201f52b373687fa3697a0b8ed52 100644
--- a/src/gridtools/GridVessel.h
+++ b/src/gridtools/GridVessel.h
@@ -31,6 +31,8 @@ namespace PLMD {
 namespace gridtools {
 
 class GridVessel : public vesselbase::Vessel {
+friend class ActionWithInputGrid;
+friend class PrintGrid;
 private:
 /// Do we have derivatives
  bool noderiv;
@@ -42,8 +44,8 @@ private:
  unsigned npoints;
 /// Units for Gaussian Cube file
  double cube_units;
-/// The names of the various columns in the grid file
- std::vector<std::string> arg_names;
+/// This flag is used to check if the user has created a valid input 
+ bool foundprint;
 /// The minimum and maximum of the grid stored as doubles
  std::vector<double> min, max;
 /// The numerical distance between adjacent grid points
@@ -53,13 +55,17 @@ private:
 /// The grid point that was requested last by getGridPointCoordinates
  unsigned currentGridPoint;
 protected:
+/// The names of the various columns in the grid file
+ std::vector<std::string> arg_names; 
+/// The normalisation constant to use
+ double norm;
 /// Are we deleting the data after print
  bool nomemory;
+/// Are we outputting unormalised data
+ bool unormalised;
 /// The number of pieces of information we are storing for each 
 /// point in the grid
  unsigned nper;
-/// Number of grids we are accumulating
- unsigned naccumulate_grids;
 /// Is this direction periodic
  std::vector<bool> pbc;
 /// The minimum and maximum in the grid stored as strings 
@@ -127,7 +133,7 @@ public:
 /// Return the volume of one of the grid cells
  double getCellVolume() const ;
 /// Get the value of the ith grid element 
- double getGridElement( const unsigned&, const unsigned& ) const ;
+ virtual double getGridElement( const unsigned&, const unsigned& ) const ;
 /// Get the set of points neighouring a particular location in space
  void getNeighbors( const std::vector<double>& pp, const std::vector<unsigned>& nneigh,
                     unsigned& num_neighbours, std::vector<unsigned>& neighbors ) const ;
@@ -148,8 +154,6 @@ public:
  void setCubeUnits( const double& units );
 /// This ensures that Gaussian cube files are in correct units
  double getCubeUnits() const ;
-/// This gives the normalisation of histograms
- virtual double getNorm() const ;
  virtual void switchOffNormalisation(){}
 /// Return a string containing the input to the grid so we can clone it
  std::string getInputString() const ;
@@ -163,6 +167,11 @@ public:
  void activateThesePoints( const std::vector<bool>& to_activate );
 /// Is this point active
  bool inactive( const unsigned& ip ) const ;
+///
+ virtual void incorporateRestartDataIntoGrid( const double& old_norm, std::vector<double>& indata ) = 0;
+/// Functions for dealing with normalisation constant
+ void setNorm( const double& snorm );
+ double getNorm() const ;
 };
 
 inline
@@ -212,11 +221,6 @@ double GridVessel::getGridExtent( const unsigned& i ) const {
   return max[i] - min[i];
 }
 
-inline
-double GridVessel::getNorm() const {
-  return 1.0;
-}
-
 inline
 bool GridVessel::noDerivatives() const {
   return noderiv;
@@ -233,6 +237,16 @@ bool GridVessel::inactive( const unsigned& ip ) const {
   return !active[ip];
 }
 
+inline
+void GridVessel::setNorm( const double& snorm ){
+  norm=snorm;
+}
+
+inline
+double GridVessel::getNorm() const {
+  return norm;
+}
+
 }
 }
 #endif
diff --git a/src/gridtools/HistogramOnGrid.cpp b/src/gridtools/HistogramOnGrid.cpp
index b50527175086d7418f810db85546889809275bd5..1f4473ca44233d2cb94a88438fc1d698c8bde5b7 100644
--- a/src/gridtools/HistogramOnGrid.cpp
+++ b/src/gridtools/HistogramOnGrid.cpp
@@ -30,20 +30,16 @@ void HistogramOnGrid::registerKeywords( Keywords& keys ){
   keys.add("compulsory","KERNEL","the type of kernel to use");
   keys.add("compulsory","BANDWIDTH","the bandwidths");
   keys.addFlag("AVERAGE",false,"are we computed a weighted average over the grid");
-  keys.addFlag("STORE_NORMED",false,"are we to store the data normalised");
 }
 
 HistogramOnGrid::HistogramOnGrid( const vesselbase::VesselOptions& da ):
 GridVessel(da),
-norm(0),
-store_normed(false),
 bandwidths(dimension),
 discrete(false)
 {
-  naccumulate_grids=2;
   parseFlag("AVERAGE",average);
 
-  parseFlag("STORE_NORMED",store_normed); parse("KERNEL",kerneltype); 
+  parse("KERNEL",kerneltype); 
   if( kerneltype=="discrete" || kerneltype=="DISCRETE" ){
       discrete=true; setNoDerivatives();
   } else {
@@ -51,10 +47,6 @@ discrete(false)
   }
 }
 
-void HistogramOnGrid::switchOffNormalisation(){
-  store_normed=false;
-}
-
 void HistogramOnGrid::setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
                                  const std::vector<unsigned>& nbins, const std::vector<double>& spacing ){
   GridVessel::setBounds( smin, smax, nbins, spacing );
@@ -73,12 +65,11 @@ void HistogramOnGrid::calculate( const unsigned& current, MultiValue& myvals, st
   // Create a kernel function at the point of interest
   std::vector<double> point( dimension ); double weight=myvals.get(0)*myvals.get( 1+dimension );
   for(unsigned i=0;i<dimension;++i) point[i]=myvals.get( 1+i );
-  
+
   if( discrete ){
       for(unsigned i=0;i<dimension;++i) point[i] += 0.5*dx[i];
-      unsigned ipoint = getIndex( point );
-      buffer[bufstart + nper*ipoint] += weight;
-      buffer[bufstart+nper*(nper+ipoint)] += 1.0;
+      unsigned ipoint = getIndex( point ); std::vector<double> fake_der;
+      accumulate( ipoint, weight, 1.0, fake_der, buffer );
   } else {
       KernelFunctions kernel( point, bandwidths, kerneltype, false, 1.0, true );
 
@@ -99,41 +90,31 @@ void HistogramOnGrid::calculate( const unsigned& current, MultiValue& myvals, st
           getGridPointCoordinates( ineigh, xx );
           for(unsigned j=0;j<dimension;++j) vv[j]->set(xx[j]);
           newval = kernel.evaluate( vv, der, true );
-          buffer[bufstart+nper*ineigh] += weight*newval;
-          for(unsigned j=0;j<dimension;++j) buffer[bufstart+nper*ineigh + 1 + j] += weight*der[j];  
-          buffer[bufstart+ntot+nper*ineigh] += newval; 
-          for(unsigned j=0;j<dimension;++j) buffer[bufstart+ntot+nper*ineigh + 1 + j] += newval;
+          accumulate( ineigh, weight, newval, der, buffer );
       }
       for(unsigned i=0;i<dimension;++i) delete vv[i];
   }
   return;
 }
 
+void HistogramOnGrid::accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const {
+  buffer[bufstart+nper*ipoint] += weight*dens; 
+  if( der.size()>0 ) for(unsigned j=0;j<dimension;++j) buffer[bufstart+nper*ipoint + 1 + j] += weight*der[j]; 
+}
+
+double HistogramOnGrid::getGridElement( const unsigned& ipoint, const unsigned& jelement ) const {
+  if( unormalised ) return GridVessel::getGridElement( ipoint, jelement );
+  return GridVessel::getGridElement( ipoint, jelement ) / norm;
+} 
+
 void HistogramOnGrid::finish( const std::vector<double>& buffer ){
-  if( average ){
-     unsigned ntot=nper*getNumberOfPoints();
-     for(unsigned i=0;i<getNumberOfPoints();++i){
-         double rdenom;
-         if( fabs(buffer[bufstart+ntot+nper*i])>epsilon ) rdenom = 1. / buffer[bufstart+ntot+nper*i];
-         else rdenom = 1.0; 
-         data[i*nper] = rdenom * buffer[bufstart+nper*i];
-         for(unsigned j=0;j<dimension;++j){
-             data[i*nper + 1 + j] += rdenom*buffer[bufstart+nper*i+1+j] - rdenom*rdenom*buffer[bufstart+nper*i]*buffer[bufstart+ntot+nper*i+1+j];  
-         }
-     }
-  } else {
-     for(unsigned i=0;i<data.size();++i) data[i]+=buffer[bufstart + i];
-  }
+  for(unsigned i=0;i<data.size();++i) data[i]+=buffer[bufstart + i];
 }
 
-void HistogramOnGrid::clear(){
-  if( !nomemory && !store_normed ) return ;
-  if( nomemory ){
-     norm = 0.; GridVessel::clear(); return;
-  }
-  if( norm>0 && store_normed ){
-     for(unsigned i=0;i<data.size();++i) data[i] /= norm;
-  }
+void HistogramOnGrid::incorporateRestartDataIntoGrid( const double& old_norm, std::vector<double>& indata ){
+  plumed_assert( data.size()==indata.size() ); 
+  if( unormalised ) for(unsigned i=0;i<data.size();++i) data[i] = old_norm*data[i] + indata[i]; 
+  else for(unsigned i=0;i<data.size();++i) data[i] += indata[i]; 
 }
 
 }
diff --git a/src/gridtools/HistogramOnGrid.h b/src/gridtools/HistogramOnGrid.h
index a3fa8d913de83bfe2fe5f211a5a434a0ef35e436..af66f50249203d84da9ff20eefbc5d8288d6f633 100644
--- a/src/gridtools/HistogramOnGrid.h
+++ b/src/gridtools/HistogramOnGrid.h
@@ -29,43 +29,25 @@ namespace gridtools {
 
 class HistogramOnGrid : public GridVessel {
 private:
-  double norm;
   bool average;
-  bool store_normed;
   std::string kerneltype;
   std::vector<double> bandwidths;
-  bool discrete;
   std::vector<unsigned> nneigh;
+protected:
+  bool discrete;
 public:
   static void registerKeywords( Keywords& keys );
   explicit HistogramOnGrid( const vesselbase::VesselOptions& da );
   void setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
                   const std::vector<unsigned>& nbins, const std::vector<double>& spacing );
   void calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const ;
-  void finish( const std::vector<double>& );
+  virtual void accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const ;
+  virtual void finish( const std::vector<double>& );
+  virtual double getGridElement( const unsigned& ipoint, const unsigned& jelement ) const ;
   bool applyForce(  std::vector<double>& forces ){ return false; }
-  void addToNorm( const double& anorm );
-  void setNorm( const double& snorm );
-  double getNorm() const ;
-  void switchOffNormalisation();
-  void clear();
+  void incorporateRestartDataIntoGrid( const double& old_norm, std::vector<double>& indata );
 };
 
-inline
-void HistogramOnGrid::addToNorm( const double& anorm ){
-  norm+=anorm;
-}
-
-inline
-void HistogramOnGrid::setNorm( const double& snorm ){
-  norm=snorm;
-}
-
-inline
-double HistogramOnGrid::getNorm() const {
-  return norm;
-}
-
 }
 }
 #endif
diff --git a/src/gridtools/PrintCube.cpp b/src/gridtools/PrintCube.cpp
index 09b216818b265f55dd943ff46257f948eb279c75..c268c970b03a0265dbe9315ba4f4f531e4ac829f 100644
--- a/src/gridtools/PrintCube.cpp
+++ b/src/gridtools/PrintCube.cpp
@@ -72,16 +72,17 @@ void PrintCube::performOperationsWithGrid( const bool& from_update ){
   ofile.printf("PLUMED CUBE FILE\n");
   ofile.printf("OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z\n");
   // Number of atoms followed by position of origin (origin set so that center of grid is in center of cell)
-  ofile.printf("%d %f %f %f\n",1,-0.5*lunit*mygrid->getGridExtent(0),-0.5*lunit*mygrid->getGridExtent(1),-0.5*lunit*mygrid->getGridExtent(2));
-  ofile.printf("%u %f %f %f\n",mygrid->getNbin()[0],lunit*mygrid->getGridSpacing()[0],0.0,0.0);  // Number of bins in each direction followed by 
-  ofile.printf("%u %f %f %f\n",mygrid->getNbin()[1],0.0,lunit*mygrid->getGridSpacing()[1],0.0);  // shape of voxel
-  ofile.printf("%u %f %f %f\n",mygrid->getNbin()[2],0.0,0.0,lunit*mygrid->getGridSpacing()[2]);
-  ofile.printf("%u %f %f %f\n",1,0.0,0.0,0.0); // Fake atom otherwise VMD doesn't work
+  std::string ostr = "%d" + fmt + fmt + fmt + "\n";
+  ofile.printf(ostr.c_str(),1,-0.5*lunit*mygrid->getGridExtent(0),-0.5*lunit*mygrid->getGridExtent(1),-0.5*lunit*mygrid->getGridExtent(2));
+  ofile.printf(ostr.c_str(),mygrid->getNbin()[0],lunit*mygrid->getGridSpacing()[0],0.0,0.0);  // Number of bins in each direction followed by 
+  ofile.printf(ostr.c_str(),mygrid->getNbin()[1],0.0,lunit*mygrid->getGridSpacing()[1],0.0);  // shape of voxel
+  ofile.printf(ostr.c_str(),mygrid->getNbin()[2],0.0,0.0,lunit*mygrid->getGridSpacing()[2]);
+  ofile.printf(ostr.c_str(),1,0.0,0.0,0.0); // Fake atom otherwise VMD doesn't work
   std::vector<unsigned> pp(3); std::vector<unsigned> nbin( mygrid->getNbin() );
   for(pp[0]=0;pp[0]<nbin[0];++pp[0]){
       for(pp[1]=0;pp[1]<nbin[1];++pp[1]){
           for(pp[2]=0;pp[2]<nbin[2];++pp[2]){
-              ofile.printf("%f ",getGridElement( pp, 0 ) );
+              ofile.printf(fmt.c_str(),mygrid->getGridElement( pp, 0 ) );
               if(pp[2]%6==5) ofile.printf("\n");
           }
           ofile.printf("\n");
diff --git a/src/gridtools/PrintGrid.cpp b/src/gridtools/PrintGrid.cpp
index 5be56b1a6e51272323cc10fabbb3029e808de288..861e45879a0fe3b6c517845acdbd3a0b95dc96ac 100644
--- a/src/gridtools/PrintGrid.cpp
+++ b/src/gridtools/PrintGrid.cpp
@@ -21,6 +21,7 @@
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "ActionWithInputGrid.h"
 #include "core/ActionRegister.h"
+#include "tools/IFile.h"
 #include "tools/OFile.h"
 
 namespace PLMD {
@@ -36,6 +37,8 @@ public:
   unsigned getNumberOfDerivatives(){ return 0; }
   void performTask( const unsigned& , const unsigned& , MultiValue& ) const {}
   bool isPeriodic(){ return false; }
+  bool isGridPrint() const { return true; }
+  void readGridFile( IFile& ifile );
 };
 
 PLUMED_REGISTER_ACTION(PrintGrid,"PRINT_GRID")
@@ -51,6 +54,8 @@ Action(ao),
 ActionWithInputGrid(ao),
 fmt("%f")
 {
+  // This ensures that restarting of grids works with NOMEMORY
+  mygrid->foundprint=true;
   parse("FMT",fmt); fmt=" "+fmt; parse("FILE",filename); 
   if(filename.length()==0) error("name out output file was not specified");
   log.printf("  outputting grid to file named %s with format %s \n",filename.c_str(), fmt.c_str() );
@@ -60,8 +65,19 @@ fmt("%f")
 
 void PrintGrid::performOperationsWithGrid( const bool& from_update ){
   if( !from_update && !single_run ) return ;
+
+  // Read in the old grid and ensure that it is considered
+  if( from_update && !mygrid->nomemory ){
+     IFile oldf; oldf.link(*this);
+     if( oldf.FileExist(filename) ){
+         oldf.open(filename);
+         readGridFile( oldf );
+         oldf.close();
+     }
+  }
+
   OFile ofile; ofile.link(*this);
-  if( from_update ) ofile.setBackupString("analysis");
+  if ( from_update ) ofile.setBackupString("analysis");
   ofile.open( filename );
 
   ofile.addConstantField("normalisation");
@@ -72,13 +88,12 @@ void PrintGrid::performOperationsWithGrid( const bool& from_update ){
      ofile.addConstantField("periodic_" + mygrid->getComponentName(i) );
   }
 
-  double norm = mygrid->getNorm();
   std::vector<double> xx( mygrid->getDimension() );
   std::vector<unsigned> ind( mygrid->getDimension() );
   for(unsigned i=0;i<mygrid->getNumberOfPoints();++i){
      mygrid->getIndices( i, ind );
      if(i>0 && mygrid->getDimension()==2 && ind[mygrid->getDimension()-2]==0) ofile.printf("\n");
-     ofile.fmtField(fmt); ofile.printField("normalisation", norm );
+     ofile.fmtField(fmt); ofile.printField("normalisation", mygrid->norm );
      for(unsigned j=0;j<mygrid->getDimension();++j){
          ofile.printField("min_" + mygrid->getComponentName(j), mygrid->getMin()[j] );
          ofile.printField("max_" + mygrid->getComponentName(j), mygrid->getMax()[j] );
@@ -90,7 +105,7 @@ void PrintGrid::performOperationsWithGrid( const bool& from_update ){
      mygrid->getGridPointCoordinates(i, xx ); 
      for(unsigned j=0;j<mygrid->getDimension();++j){ ofile.fmtField(fmt); ofile.printField(mygrid->getComponentName(j),xx[j]); }
      for(unsigned j=0;j<mygrid->getNumberOfQuantities();++j){ 
-        ofile.fmtField(fmt); ofile.printField(mygrid->getComponentName(mygrid->getDimension()+j), getGridElement( i, j ) ); 
+        ofile.fmtField(fmt); ofile.printField(mygrid->arg_names[mygrid->dimension+j], mygrid->getGridElement( i, j ) );  
      }
      ofile.printField();
   }
@@ -100,5 +115,49 @@ void PrintGrid::performOperationsWithGrid( const bool& from_update ){
   if( from_update ) mygrid->reset();
 }
 
+void PrintGrid::readGridFile( IFile& ifile ){
+  // First check that everything in the file is as expected
+  std::string min; int nb; std::vector<std::string> fieldnames; ifile.scanFieldList( fieldnames );
+  for(unsigned i=0;i<mygrid->dimension;++i){
+      ifile.scanField("min_" + mygrid->arg_names[i], min );
+      if( min!=mygrid->str_min[i] ) error("minimum of grid in restart file does not match stored minimum");
+      ifile.scanField("max_" + mygrid->arg_names[i], min );
+      if( min!=mygrid->str_max[i] ) error("maximum of grid in restart file does not match stored minimum");
+      ifile.scanField("periodic_" + mygrid->arg_names[i], min );
+      if( mygrid->pbc[i] && min!="true" ) error("periodicity of grid in restart file does not match stored periodicity");
+      else if( mygrid->pbc[i] && min!="false" ) error("periodicity of grid in restart file does not match stored periodicity");
+      ifile.scanField("nbins_" + mygrid->arg_names[i], nb );
+      if( mygrid->pbc[i] && nb!=mygrid->nbin[i] ) error("number of bins in restart file does not match stored number of bins");
+      else if( !mygrid->pbc[i] && (nb+1)!=mygrid->nbin[i] ) error("number of bins in restart file does not match stored number of bins");
+      bool found_field=false;
+      for(unsigned j=0;j<fieldnames.size();++j){
+         if( fieldnames[j]==mygrid->arg_names[i] ){ found_field=true; break; }
+      }
+      if( !found_field ) error("missing field " + mygrid->arg_names[i] + " in restart file");
+  }
+  // Check if all the fields we need are there
+  for(unsigned i=0;i<mygrid->arg_names.size();++i){
+      if( !ifile.FieldExist( mygrid->arg_names[i] ) ) error("an expected field is missing from the input grid");
+  }
+  // Now we read in the grid
+  unsigned np=0; std::vector<double> indata( mygrid->npoints*mygrid->nper ); double f, old_norm;
+  while( ifile.scanField(mygrid->arg_names[0],f) ){
+     // Read in coordinates
+     for(unsigned i=1;i<mygrid->dimension;++i) ifile.scanField(mygrid->arg_names[i],f);
+     // Read header 
+     ifile.scanField("normalisation", old_norm );
+     for(unsigned i=0;i<mygrid->dimension;++i){
+        ifile.scanField("min_" + mygrid->arg_names[i], min );
+        ifile.scanField("max_" + mygrid->arg_names[i], min );
+        ifile.scanField("periodic_" + mygrid->arg_names[i], min );
+        ifile.scanField("nbins_" + mygrid->arg_names[i], nb );
+     }
+     // Now read data of interest
+     for(unsigned i=mygrid->dimension;i<mygrid->arg_names.size();++i){ ifile.scanField(mygrid->arg_names[i],indata[np]); np++; }
+     ifile.scanField();
+  }
+  mygrid->incorporateRestartDataIntoGrid( old_norm, indata );
+}
+
 }
 }
diff --git a/src/multicolvar/MultiColvarDensity.cpp b/src/multicolvar/MultiColvarDensity.cpp
index 502dba9388173bfa257c5368f739cb74129b7eec..91a6839d81052052072b98077c706658219417ea 100644
--- a/src/multicolvar/MultiColvarDensity.cpp
+++ b/src/multicolvar/MultiColvarDensity.cpp
@@ -318,7 +318,7 @@ void MultiColvarDensity::update(){
   lockContributors();
   // Now perform All Tasks
   origin = getPosition(0);
-  runAllTasks(); mygrid->addToNorm( 1.0 ); 
+  runAllTasks();  
 }
 
 void MultiColvarDensity::performTask( const unsigned& tindex, const unsigned& current, MultiValue& myvals ) const {