We use a program called gnuplot to quickly visualize much numerical data. The benefit of gnuplot is that it is quick; even if your simulation was carried out on a remote machine (i.e., a cluster), you can quickly grep relevant data from its output file and view a plot of it without having to copy/paste data, transfer files to a local machine, etc. With its power comes a bit of a steep learning curve though.

I highly recommend following an online tutorial to learn the gnuplot basics (see the end of this page). What follows here is an extremely short introduction to plotting.

Plotting Data Files

Assuming you followed the instructions on Extracting Data from Output with grep, you should have a file called avgtemp.300 which contains the average temperature over each iprint interval and looks something like this:

temperature 0.32738174E+03 std dev 0.18819916E+03
temperature 0.30001813E+03 std dev 0.44833240E+01
temperature 0.29998880E+03 std dev 0.38058309E+01
...
temperature 0.34382206E+03 std dev 0.51213221E+01
temperature 0.34646638E+03 std dev 0.49272970E+01

Ensure that your ssh connection to the cluster has X11 forwarding enabled. You can check this by issuing

$ echo $DISPLAY

If you see nothing, close the ssh connection and reconnect using ssh -X instead of just ssh. For example,

ssh -X glock@nanopac2

To plot up the data contained in a file like avgtemp.300, start up gnuplot. After some copyright info, you will be left at the gnuplot prompt:

$ gnuplot

        G N U P L O T
        Version 4.2 patchlevel 6
        last modified Sep 2009
        System: Linux 2.6.32-32-server

        Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009

...

Terminal type set to 'wxt'
gnuplot>

From the gnuplot prompt, issue the command

gnuplot> plot 'avgtemp.300' using 2 with line

The plot command is, at its core, quite simple. The aforementioned example tells gnuplot to plot all the data found in the second column of avgtemp.300.

If you want to plot x and y values (such as those found in the rgr file generated by rdfshg.x), you can do

gnuplot> plot 'rgr' using 1:2 with line

which will take x values from column 1 and y values from column 2 and generate an x-y plot. You can also abbreviate many aspects of gnuplot's input commands:

gnuplot> plot 'rgr' u 1:2 w l

which is identical to the more verbose form indicated previously.

You can also plot multiple data sets simultaneously. If you generated avgtemp files from every step in the melt-quench procedure, you would be able to do something like

gnuplot> plot 'avgtemp.2000' u 2 w l, 'avgtemp.1000' u 2 w l, 'avgtemp.300' u 2 w l

Resources