Writing wave functions "by hand"

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
Dmitry_Zvezhinsky
Posts: 8
Joined: Sat May 03, 2014 12:38 pm

Writing wave functions "by hand"

Post by Dmitry_Zvezhinsky »

Dear "CASINO" users,
I will be grateful for any ideas or references (examples) about my simple (or even silly) question.
I started to get into the program from the example of atomic hydrogen (namely ..examples/atom/hydrogen) supplied with the code.
In my opinion it's done in an exceptionally complicated way - it uses the wave function written (generated) in gaussian basis
instead of its exact wave function (~exp(-r/a)).
Thus as a start test I would like to:
1. write down this function (~exp(-r/a)) "by hand". I believe it will match to the first function of slater type orbitals basis set, but if there is a possibility of using arbitrary w.f. with introduced parameters for subsequent optimization - that's exactly what I would learn about.
2. Do the VMC of this wave function with "casino".
3. Observe a=0.529 angstroms (or so) as a result of energy minimization.
I've found in the users guide the only note about the generation of trial wave functions, the abstract starting with: "Generating trial wave functions currently requires you to have access to one of the codes listed in Sec.8". If I correctly understood the terminology, the wave function above will be a trial one (for both VMC and DMC methods).
So, is it absolutely impossible to make it somehow "by hand"?
May be someone can hint me some other code/program/framework in which it is possible in some more simple way.
Thank you in advance.
Dmitry.
Mike Towler
Posts: 239
Joined: Thu May 30, 2013 11:03 pm
Location: Florence
Contact:

Re: Writing wave functions "by hand"

Post by Mike Towler »

Dear Dmitry,

Thanks for your question. First of all, one of the reasons I found it useful to have a Gaussian-expanded H in the examples is that I used it to produce a standard picture that we use in the summer school. You define the local energy as E_L(r) = H Psi(r) / Psi(r), and point out that if the wave function is exact, then the local energy will always be -0.5 no matter what the position r of the electron. With an approximate wave function (such as the one expanded in Gaussian functions that you found in the examples) the local energy is no longer constant and will oscillate around the true value as the electron is moved around, like this:

Image

As you improve the wave function, the amplitude of the oscillations will decrease ('Variance minimization'! - the clues in the name ;) ).

Note that Gaussian basis functions for all-electron calculations with CASINO are not as approximate as you might think because the bit very near the nucleus is chopped out and replaced by a function that doesn't have zero gradient at the nucleus, obeys the correct cusp condition, and joins on to the Gaussian nicely.

Anyway, to actually answer your question, if you look a bit more carefully through the examples, you can find a few other relevant things:

(1) in examples/atoms a bunch of directories called e.g. helium_n - where the highly accurate wave function is represented as a table of values on a grid. There is no such example for a hydrogen atom but it's easy enough to generate one using the supplied utility and an external code (see utils/wfn_converters/a2sp2k/Extractdet/README), and this could also be a numerical representation of the exact wave function if you like.

(2) examples/TEST/Input/h_exact

This example is a hydrogen atom with both the proton and the electron are treated as quantum particles, using the wave function

Psi_T = Phi_0 + a Psi_1 ,

or similar forms, where Phi_0 is the exact ground-state orbital and Psi_1 is a rather poor orbital. This example was supposed to demonstrate the ability of energy minimization to optimize linear parameters exactly in one go, as well as to detect problems in VMC and emin calculations where the VMC variance is (nearly) zero.

(3) Type 'casinohelp atom_basis_type'. This is the input keyword with which you define 'what basis set you're using' and as you can see it includes some 'special wave function types' that are basically just people writing down a formula in the way you describe:

Code: Select all

24x64:brutus% casinohelp atom_basis_type
 CASINO HELP SYSTEM
 ==================

 Keyword : atom_basis_type
 Title   : Basis set type
 Type    : String
 Level   : Basic

 DESCRIPTION
 -----------
 ATOM_BASIS_TYPE selects the basis set in which the atom-centred orbitals are
 expanded (thus choosing which file to read the orbitals from), or more
 generally, the 'type of orbital' to be used.  Possible values are:
 
 * 'none'       : [default] no atoms are present, and therefore no atomic
 orbitals are read in;
 
 * 'plane-wave' : use a plane-wave basis set; the orbitals are read in from
 pwfn.data;
 
 * 'gaussian'   : use a Gaussian basis set; the orbitals are read in from
 gwfn.data;
 
 * 'slater-type': use a Slater-type orbital basis set; the orbitals are read
 in from stowfn.data;
 
 * 'numerical'  : use orbitals tabulated on a grid (atomic systems only); the
 orbitals are read in from awfn.data;
 
 * 'dimer    '  : use orbitals tabulated on a grid (molecular dimers only);
 the orbitals are read in from dwfn.data;
 
 * 'blip'       : use a blip basis set; the orbitals are read in from
 bwfn.data;
 
 Some special wave function types are also available:
 
 * 'nonint_he'  : use exact orbitals for a non-interacting Helium atom.
 
 * 'h2' : wave function for the H2 molecule where each orbital is the sum
 over hydrogen nuclei of a parameter-less exponential centred at each nucleus.
 
 * 'h3plus' : wave function for the H3+ molecular ion where each orbital is
 the sum over hydrogen nuclei of a parameter-less exponential centred at each
 nucleus.
 
 For free-particle and external-potential-related orbitals, set
 ATOM_BASIS_TYPE to 'none' and use the input block FREE_PARTICLES.
These special wave functions are coded up on an ad hoc basis as and when people feel the need. So currently there is an exact non-interacting He atom, and wave functions for H2 and H3+. Coding up any particular formula and adding it to the code would probably take about ten minutes.. it's really not difficult, and parameters could be included. However, it does involve coding so you wouldn't expect your average user to do this. However, if you want CASINO to evaluate arbitrary analytic expressions for the orbitals, then I don't see how you can avoid coding.

You are right of course when you point out that the phrase "Generating trial wave functions currently requires you to have access to one of the codes listed in Sec.8" is not - strictly speaking - correct (I'll change currently to usually if you insist!) but this is clearly just where our priorities lie. CASINO is a code designed to do research in areas where no-one else can go: highly accurate calculations for big systems, which it can because of its very favourable scaling with system size, its ability to use as many processors as you like, and its very weak dependence on the basis set (the DMC wave function is not actually represented by a basis set, of course..). So, knowing what we're good at, noodling around with exact calculations of atoms and small molecules is something that other people and other techniques can do just as well, and we generally let them get on with it.

Now if you mean you're interested in this sort of thing just for educating yourself about how the program or the method works, then that's fine, but I think if you look closely we've provided enough examples for you to do that - and if you think otherwise you're just being awkward. Not Russian are you, by any chance? :D

Cheers,
Mike
Dmitry_Zvezhinsky
Posts: 8
Joined: Sat May 03, 2014 12:38 pm

Re: Writing wave functions "by hand"

Post by Dmitry_Zvezhinsky »

Hello Mike,
many thanks for the detailed answer, I think it's enough for me for now.
Not Russian are you, by any chance?
How did you guess? :o
Post Reply