Question from kindergarten – electron in a potential well

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

Question from kindergarten – electron in a potential well

Post by Dmitry_Zvezhinsky »

Dear experienced Casino users!
Could you help me to reproduce the problem from quantum mechanics textbook by means of QMC and Casino?
I attach two files for Casino: Input and expot.data
The last file contains the finite “square” potential well of 1 a.u. depth and 3 a.u. width. The shift is made to get zero energy at r=0.
The input file should define a system containing a free electron in this external potential without any nuclei.
I believe that I missed something because I did not get the correct answer after DMC equilibration. According to known formulae (attached as a file for matlab or octave, and which seem to be correct to me) I should get about 0.35 a.u., while I get 0.85 a.u. from Casino.
So, where am I wrong?
Thanks for any ideas.
P.S. Can't attach any files to this message, here they are:
input:

Code: Select all

#-------------------#
# CASINO input file #
#-------------------#

# free e- in potential well

# SYSTEM
neu               : 0              #*! Number of up-spin electrons (Integer)
ned               : 0              #*! Number of down-spin electrons (Integer)
nhu               : 0              #*! Number of up-spin holes (Integer)
nhd               : 0              #*! Number of down-spin holes (Integer)
atom_basis_type   : none      #*! Basis set type (Text)
periodic          : T              #*! Periodic boundary conditions (Boolean)
psi_s             : none         #*! Type of [anti]symmetrizing wfn (Text)
complex_wf        : F              #*! Wave function real or complex (Boolean)
%block free_particles
dimensionality 3
r_s 100
cell_geometry 
1 0 0
0 1 0
0 0 1 
particle 1 det 1 : 1 orbitals free expot 1
%endblock free_particles
%block initial_config
1 1 0 0 0
%endblock initial_config

# RUN
runtype           : dmc_dmc            #*! Type of calculation (Text)
newrun            : T              #*! New run or continue old (Boolean)
testrun           : F              #*! Test run flag (Boolean)
block_time        : 0.0 s          #*! VMC/DMC block time (Physical)

# VMC
vmc_equil_nstep   : 500          #*! Number of equilibration steps (Integer)
vmc_nstep         : 5000          #*! Number of steps (Integer)
vmc_nblock        : 10             #*! Number of checkpoints (Integer)
vmc_nconfig_write : 1000              #*! Number of configs to write (Integer)
vmc_decorr_period : 3              #*! Decorrelation loop length (Integer)
vmc_ave_period    : 1              #*! vmc.hist reduction factor (Integer)
dtvmc             : 0.1d0          #*! VMC time step (Real)

# DMC
dmc_equil_nstep   : 10000          #*! Number of equil steps (Integer)
dmc_equil_nblock  : 10              #*! Number of checkpoints (Integer)
dmc_stats_nstep   : 10000          #*! Number of stats accum steps (Integer)
dmc_stats_nblock  : 10              #*! Number of checkpoints (Integer)
dmc_target_weight : 1000
dtdmc             : 0.01d0         #*! DMC time step (Real)
dmc_ave_period    : 1              #*! dmc.hist reduction factor (Integer)
dmc_decorr_period : 1              #*! DMC correlation period (Integer)

# OPTIMIZATION
opt_method        : varmin         #*! Opt method (varmin/varmin_linjas/emin)
opt_jastrow       : F              #*! Optimize Jastrow factor (Boolean)
opt_cycles        : 1              #*! Number of optimization cycles (Integer)
opt_maxeval       : 200            #*! VM max evaluations (Integer)
opt_maxiter       : 10             #*! VM max iterations (Integer)

# GENERAL PARAMETERS
interaction       : none       #*! Interaction type (Text)
use_jastrow       : F              #*! Use a Jastrow function (Boolean)
use_gjastrow      : F              #*! Use General Jastrow function (Boolean)
expot             : T              #*! Use external potential (Boolean)


# EXPECTATION VALUES
density           : F              #*! Accumulate density (Boolean)
expval_cutoff     : 30.d0 hartree  #*! G vector cutoff for expval (Physical)
# BLOCK INPUT

expot.data:

Code: Select all

START HEADER
This is an example expot.data file
END HEADER

START VERSION
 1
END VERSION

START EXPOT
Title
 1 square well for e-
Number of sets
 2
START SET 1
Periodicity
 APERIODIC
Type of representation
 SQUARE
Direction
 ISOTROPIC
Number of such potentials to add
 1
Origin(s)
 0.0 0.0 0.0
Potential
 Width (au)
  3d0
 Height (au)
  -1.0d0
END SET 1
START SET 2
Periodicity
 APERIODIC
Type of representation
 ANALYTIC
Direction
 ISOTROPIC
Number of such potentials to add
 1
Origin(s)
 0.0 0.0 0.0
Potential
 Function type and defining parameters [(choose one; extra types definable)]
  HARMONIC 0.0d1 1.0d0
END SET 2
END EXPOT
.m file to calculate the ground state energy:

Code: Select all

clear all;
U=1;
R=3;
f=@(E) tan(sqrt(2*E)*R)+sqrt(E/(U-E));
x = fzero(f,(pi^2/(8*R^2)  + pi^2/(2*R^2))/2);
Em=-0:0.01:1;
Xm=f(Em);
plot(Em,Xm,'b-',x,0,'r.',[pi^2/(8*R^2) pi^2/(2*R^2)],[0 0],'g*');
x
%approximation
U0=(pi^2/(8*R^2));
E=U0*(2-sqrt(U0/U))^2;
E
% infinite well, R->infty
pi^2/(2*R^2)
% for R=3 U=1: x =
%
%    0.3497
%
%
%E =
%
%    0.3641
Dmitry_Zvezhinsky
Posts: 8
Joined: Sat May 03, 2014 12:38 pm

Re: Question from kindergarten – electron in a potential wel

Post by Dmitry_Zvezhinsky »

I see...
but the question seems to be interesting (at least for me!).
Here are some of my mistakes:

1. Firstly, the term “width” in my first message was wrong. The size of a square well in Casino is defined by diameter, which is indeed a “width”, then it is divided by two to get a radius. I initially missed that divisor in the code of expot.f90.

2. The trial wave function. I did not completely realize what it was in my first input file (I tried to plot it – it seems it was a constant).
Anyway, it is a bad guess. Now I've chosen the wave function from the hydrogen example (expanded in gaussian basis). At least it should have no nodes.
It seems there is a way to switch off the coulomb interaction with nucleus by setting zeros in “Atomic numbers for each atom:” and “Valence charges for each atom:” parameters of gwfn.data file.

3. Periodicity. Should switch it off.

So after all I got the ground state energy = 0.378 (1) a.u. (precise value should be 0.3497 a.u.)

I didn't think yet on how to improve the accuracy. May be someone could give me a valuable advice?

Furthermore it may be interesting to get the energy of some excited state. I believe there is no any simple way for this but to to generate (or “write down” by hands) the proper trial wave function (for the excited state of a particle in a well).

The archive with all necessary files is attached to this message.

PS. Mike, if you read this, don't care about my previous questions on Casino. Thanks to debugger (and its interface called “ddd”) I've found out almost all of them.

Dmitry.
Attachments
e_well.tar.gz
(17.35 KiB) Downloaded 713 times
Post Reply