Diamond with k-point (twist) averaging using a Jastrow–Slater single-determinant ansatz via VMC and LRDMC with ECPs
00 Introduction
In this tutorial, you will perform k-point (twist) averaging using a Monkhorst–Pack grid within a VMC/LRDMC workflow for diamond. This reduces the so-called one-body finite-size effects in QMC. Calculations start from PySCF with ccECPs under PBCs. All input and output files for this tutorial can be downloaded here
.
01 DFT
The first step of this tutorial is to generate a JDFT ansatz using PySCF. A Python script will be presented later. The procedure is as follows:
Run the PySCF calculation:
cd 01_trial_wavefunction python3 pyscf_Diamond_k_average.py
Convert the generated PySCF checkpoint file to a TREXIO file:
trexio convert-from -t pyscf -i Diamond_k_average.chk -b hdf5 Diamond_k_average.hdf5
The wavefunction at each k point is saved in a separate file k*_Diamond_k_average.hdf5.
Convert the TREXIO file to a TurboRVB wavefunction file:
trexio-to-turborvb Diamond_k_twist.hdf5 -jasbasis cc-pVDZ -jascutbasis --twist_average
Note that the --twist_average
option is specified.
Then, you will have the TurboRVB wavefunction file fort.10
as well as the pseudopotential file pseudo.dat
.
Note
When the PySCF calculation fails:
Check if the basis set is available,
Ensure that the sufficient memory allocation is available.
02 Jastrow optimization
The second step is to optimize the Jastrow factor at the VMC level using vmcopt module of TurboGenius. One should refer to the Hydrogen dimer tutorial for the details.
Copy the wavefunction file and the pseudopotential file. It is noted that
turborvb.scratch
directory should also be copied:
cd ../02_optimization/ cp ../01_trial_wavefunction/fort.10 . cp ../01_trial_wavefunction/pseudo.dat . cp -r ../01_trial_wavefunction/turborvb.scratch turborvb.scratch
Generate an input file for the optimization:
turbogenius vmcopt -g -opt_onebody -opt_twobody -opt_jas_mat -optimizer lr -vmcoptsteps 200 -steps 200 -twist -kpts 1 1 1 0 0 0 -nw 128
Run the optimization:
TURBOVMC_RUN_COMMAND="mpirun -np 16 turborvb-mpi.x" turbogenius vmcopt -r
Perform the postprocess and plot the results.
turbogenius vmcopt -post -optwarmup 50 -plot
Check plot_energy_and_devmax.png and files in the parameters_graphs directory to see if the convergence criterion is satisfied.
03 JDFT ansatz - VMC
The next step is to run a single-shot VMC calculation.
This is done using the vmc
module of TurboGenius.
First prepare the wavefunction and related files. Note that you also need to copy turborvb.scratch directory.
cd ../03_vmc/
cp ../02_optimization/fort.10 .
cp ../02_optimization/pseudo.dat .
cp -r ../02_optimization/turborvb.scratch turborvb.scratch
Next, generate an input file datasvmc.input by typing:
turbogenius vmc -g -twist -kpts 1 1 1 0 0 0 -nw 128
Note
You may specify -maxtime
option for the maximum duration of computation in seconds.
Then, run the VMC calculation:
TURBOVMC_RUN_COMMAND="mpirun -np 16 turborvb-mpi.x"
turbogenius vmc -r
Finally, run the postprocess:
turbogenius vmc -post -bin 10 -warmup 5
Check the reblocked total energy and error in the file pip0.d.
04 JDFT ansatz - LRDMC
Now we proceed to the lattice regularized diffusion Monte Carlo calculation that can improve a trial wavefunction obtained by a DFT calculation or a VMC optimization. One should refer to the Hydrogen tutorial for the details.
In this section, we will perform the calculation at the lattice constant alat=0.20. First, copy the prepared wavefunction and the pseudopotential files:
cd ../04_lrdmc
cp ../03_vmc/fort.10 .
cp ../03_vmc/pseudo.dat .
cp -r ../03_vmc/turborvb.scratch .
Next, generate an input file datasfn.input for the LRDMC calculation. Note that -twist
option should be specified:
turbogenius lrdmc -g -etry -45.0 -alat -0.20 -twist -steps 1000
Then, run the calculation by typing:
TURBOVMC_RUN_COMMAND="mpirun -np 16 turborvb-mpi.x"
turbogenius lrdmc -r
Finally, run the postprocess:
turbogenius lrdmc -post -bin 10 -corr 3 -warmup 5
We wil get E at a=0.20 bohr in pip0_fn.d.
One then follows the above procedure for several choices of alat, and extrapolates the energy value at \(a \to 0\). See the Hydrogen tutorial for the concrete steps.