Exporting data from expval.dat

General discussion of the Cambridge quantum Monte Carlo code CASINO; how to install and setup; how to use it; what it does; applications.
Post Reply
Lean_Peria
Posts: 3
Joined: Mon Mar 09, 2015 7:55 am

Exporting data from expval.dat

Post by Lean_Peria »

Hi there!

I am having a bit of a problem using the plot_2D utility. With all due respect, I think the plotting capability is limited for 3D expectation values, since gnuplot can only generate 2D graphs. It is too tiresome if we have to generate multiple 2D slices of the 3D graph just to get an idea of the 3D expectation value. I wonder, is it possible to extract the raw expectation values data from expval.dat to be used with 3D plotting utilities such as matplotlib in python?

Thank you in advance for your help!
Dmitry_Zvezhinsky
Posts: 8
Joined: Sat May 03, 2014 12:38 pm

Re: Exporting data from expval.dat

Post by Dmitry_Zvezhinsky »

Hi!

expval.data is a flat text file, i believe you can import it with every programming language.
For example in Matlab I do:
fid = fopen(['./expval.data'],'r');
indata = textscan(fid, '%f', 'HeaderLines',10055);
fclose(fid);

Here 'indata' is a cell array which can be subsequently converted into matrix.
Lean_Peria
Posts: 3
Joined: Mon Mar 09, 2015 7:55 am

Re: Exporting data from expval.dat

Post by Lean_Peria »

Hi! Thank you for pointing that out. Can I ask for a specific example? I'm still new and I'm not sure how to use the data from the expval.dat to create plots.

For example, I accumulated density expectation values for helium, which is a finite system. The expval.dat file contained the following:

Code: Select all

START HEADER
 No header text
END HEADER

START EXPVAL
Title
 No title given
File version
 1
Number of particle types (e.g. 2=electrons, 4=electrons+holes)
 2
Number of each type of particle
 1 1
Dimensionality
 3
Periodicity
 0
Primitive translation vectors (au)
 Finite system
Size of simulation cell
 Finite system
Number of available G-vector sets
 0

START FINITE DENSITY
Accumulation carried out using
 VMC
Basis functions
 step                
Expansion order
 10000
Cutoff
   20.000000000000000     
Nstep, Total weight, Total weight^2
   4000.0000000000000        4000.0000000000000        4000.0000000000000     
START e-e SET 1
n_ij,(n_ij)**2
.........
END e-nucleus SET 2
END FINITE DENSITY

END EXPVAL
Unlike other density expval.dat files that I generated, this one didn't provide the G-vectors, so I got stuck. I believe there is something I just don't know, or missed in the manual. Can you point out how the data is to be plotted? Please and thanks!
Dmitry_Zvezhinsky
Posts: 8
Joined: Sat May 03, 2014 12:38 pm

Re: Exporting data from expval.dat

Post by Dmitry_Zvezhinsky »

I have never used this particular expectation value, but I can suggest two points:
1. You should rather use the built-in routine that processes this file, it is called plot_expval . Just change current directory in your shell to the one containing 'expval.data' and run plot_expval. Use this until you have any reasons to write your own routine for postprocessing.
2. The file 'expval.data' may be regarded by casino as both input and output. I guess that the listing in your message is an output. Thus: check your input file or remove it at all (if the first run was successful and all subsequent were not).
Mike Towler
Posts: 239
Joined: Thu May 30, 2013 11:03 pm
Location: Florence
Contact:

Re: Exporting data from expval.dat

Post by Mike Towler »

Hi Lean,
Unlike other density expval.dat files that I generated, this one didn't provide the G-vectors, so I got stuck. I believe there is something I just don't know, or missed in the manual.
Just to add one quick thing: for finite systems the density is accumulated in real space not reciprocal space - hence no G-vectors. All this means is that space is divided into 'bins' and CASINO effectively counts how many times electrons land in each bin during the random walk.

More information is given in section 34.2.2 of the manual.. (click the link top left of the forum site..)

Mike
Lean_Peria
Posts: 3
Joined: Mon Mar 09, 2015 7:55 am

Re: Exporting data from expval.dat

Post by Lean_Peria »

Oh, so that's why. Thank you for pointing that out, Professor Towler! I'll check them out in the manual.
Post Reply