## Plotting charge density isosurface

General discussion of the Cambridge quantum Monte Carlo code CASINO; how to install and setup; how to use it; what it does; applications.

### Plotting charge density isosurface

Hi CASINO users,

Is there a way to plot isosurface charge density in CASINO? How can we manipulate expval.data to have that plot? According to read me file of plot_2D, in 3D what we get is only the last 2D layer from 3D plot.

Besides, how many steps would generally be required to be sure that we have the converged charge density plot?

Thank you,
Kayahan
Kayahan

Posts: 22
Joined: Fri Jun 07, 2013 5:56 pm

### Re: Plotting charge density isosurface

Hi Kayahan,

Is there a way to plot isosurface charge density in CASINO? How can we manipulate expval.data to have that plot? According to read me file of plot_2D, in 3D what we get is only the last 2D layer from 3D plot.

Yep. Use the 'plot_expval' utility. To quote the manual:

"At the end of the calculation, the data in expval.data can usually be visualized using the plot_expval utility. The use of this program is fairly self-explanatory. Type 'plot_expval' in any directory containing an expval.data file, and the utility will read the data then ask you a series of questions designed to elicit information about exactly what kind of plot you want. It will then write out the data in a file readable by standard plotting programs such as xmgrace (for 1D data) or gnuplot (for 2D/3D data). A CASINO shell-script---plot_2D---is available which will call gnuplot with appropriate arguments."

You may also define a 'plot_expval' block in the input file to specify the geometry. Quoting the output of 'casinohelp plot_expval':

Code: Select all
`CASINO HELP SYSTEM ================== Keyword : plot_expval Title   : Plot exp values in line/plane/volume Type    : Block Level   : Intermediate DESCRIPTION ----------- The utility 'plot_expval' allows you to plot expectation values calculated by CASINO and stored in the file 'expval.data'.  It takes its instructions from this block in input which tells it about the geometrical region over which the data will be plotted.  Where the geometry is clear, this input block is not required (e.g. spherical PCF/structure factor).  The geometrical region may be a line AB / plane AB-AC / volume AB-AC-AD. The data will be plotted in a format suitable for xmgr/grace in the file 'lineplot.dat' or in a format suitable for gnuplot in '2Dplot.dat' or '3Dplot.dat'.  These latter two files can be quickly visualized with the 'plot_2D' utility.  The block, which is ignored by CASINO itself, has the following format: LINE 1: dimensionality of plot ndim 1/2/3, OR EQUIVALENTLY, line/plane/volume; LINE 2: No. of points along each of the ndim directions; LINES 3-: xyz coords of point A ; of point B ; of point C (if reqd.) ; of point D (if reqd.).`

Besides, how many steps would generally be required to be sure that we have the converged charge density plot?

Depends on the system. If the energy has a low enough error bar the density is likely to be good enough.
Mike Towler

Posts: 233
Joined: Thu May 30, 2013 11:03 pm
Location: Florence

### Re: Plotting charge density isosurface

Dear Mike,

I have been trying to plot 3D charge density using 'plot_expval' utility but I am quite confused on how to specify the plot region. It stated in the casinohelp document that the block is ignored by CASINO. So how should I specify the plotting grid? This is what I tried for the expectation value section in the input file (I am using the newest stable version, freshly downloaded last week):

========================

# EXPECTATION VALUES
density : T
%block plot_expval
3 # for 3-dimension
30 20 10 # 30 points along x, 20 points along y, 10 points along z
10 10 10; 0 0 0; # max coordinate A = (10, 10, 10), min coordinate B = (0, 0, 0)
%endblock plot_expval
expval_cutoff : 30.d0 hartree
#(all others are false)

========================

However, it did not work. The grid setup in the generated expval.data files is the default value (A=(5, 5, 5), B=(-5, -5, -5) and points in three directions are 20 20 20), which is wrong for me. I use espresso the generate blip wave function so the molecule is not centered. It is therefore necessary to specify the grid. Please let me know where did I do wrong.

THANKS!
Samuel
Samkchang

Posts: 1
Joined: Fri Jun 17, 2016 2:17 pm