You're right: the tutorials don't see to explain this bit at all...
You need to use the "graph" program which comes with cp2k. When you do a metadynamics run, the resulting *.restart file will contain a record of all of the HILLS added during the metadynamics simulation. Note that if you do a multiple-walker run, the *.restart file in any one of the walker directories will also have all the hills from all the other walkers. Let's assume you did a metadynamics simulation with 2 COLVARS and this generated a restart file named "mysim.restart". To turn that record of HILLS in the restart file into a one-dimensional free-energy surface with respect to the first COLVAR, you run the program graph.psmp using the following syntax:
graph.psmp -cp2k -ndim 2 -ndw 1 -file mysim.restart
If you want a one-dimensional free energy surface with respect to the second COLVAR, you run
graph.psmp -cp2k -ndim 2 -ndw 2 -file mysim.restart
(Note: BE VERY CAREFUL HERE! Even though you only want a one dimensional fes, the argument to -ndim MUST be the actual number of COLVARS that were used in the metadynamics run. The argument to -ndw is which COLVAR(S) you want to generate the free-energy surface with respect to. If you accidently use -ndim 1, you will get what looks like a perfectly sensible fes, but it will be completely erroneous).
Running the graph program will generate a file called fes.dat that you can plot with gnuplot to see the free energy surface. Here's an example of a gnuplot script to
generate the plot (note: I'm converting my Cl coordination number COLVAR into a sensible number by multiplying it by the number of Cl atoms in the cell and converting the free energy from AU to kJ/mole).
set xlabel "Cl CN"
#set terminal svg
set xrange[-1:4]
set yrange[-230:-120]
plot "fes.dat" using ($1*4):($2*2625.5) with lines
pause -1 "Hit any key to continue"
Now, if you want a 2-dimensional plot of the the free energy surface (i.e., over both
COLVARS) then you run:
graph.psmp -cp2k -ndim 2 -ndw 1 2 -file mysim.restart
and plot that using gnuplot. Here's a gnuplot input script to generate a contour map:
set view map
unset surface
set contour
set cntrparam levels 30
set dgrid3d 100,100,1
set xlabel "Cl CN"
set ylabel "O CN"
set style line 1 lc rgb "black" lw 1
set style increment user
#set terminal svg
splot [-1:4] [-1:5] "fes.dat" using ($1*4.):($2*55):($3*2625.5) with lines
pause -1 "Hit any key to continue"
Have fun!