I’ll try to describe here briefly another project I have on GitHub1. There will not be much except links, but hopefully those will be useful.
The project is far from being perfect, the simple averaging used there for example could be improved, as there are autocorrelations that one should be aware of, but I’ll do that maybe later. Also the way the Gaussian orbitals are combined could be improved, too.
Nevertheless, the program appears to work, although one should be careful of what parameters are used. A big number of steps is necessary to obtain a reliable result.
Program in action
As usual, here is a record of a run:
It doesn’t show much, but with some patience the program could be extended to supply more info.
As for the last posts, I’ll provide here only links, as currently I lack motivation to describe the theory in more detail. It’s very well described elsewhere, anyway.
Some starts can be provided by Wikipedia: Quantum Monte Carlo, Variational Quantum Monte Carlo. There are some links there worth visiting.
One book that provides a good start is already mentioned several times on this blog: Computational Physics book by Jos Thijssen2.
A very good lecture by Morten Hjorth-Jensen is found on GitHub: Computational Physics3. In doc/Literature you’ll find lectures2015.pdf. The formulae in there are mentioned in the code, using the numbering from there, so this is the main reference you should consult. Another link to look over from that repository is here: Computational Physics 2: Variational Monte Carlo methods.
A GitHub repository where are posted a lot of Master Thesis and PhD Thesis is here: CompPhysics\ThesisProjects4. I will point you in there this: Quantum Monte Carlo Simulation of Atoms and Molecules by Roger Kjøde, because it presents a project similar with what I describe here and also has some results you could use for comparison.
The code reuses a part of the code from the Hartree-Fock project. Most of the classes are in the same namespaces as in the Hartree-Fock project, but there are changes and additions. Since Gaussian Orbitals are used, the code for loading them and representing them as classes is borrowed as is from that project. There are some additions, though, for example the
Orbitals::VQMCOrbital class is new. It implements a linear combination of two contracted Gaussian Orbitals, to be used as a ‘molecular orbital’ by combining atomic orbitals from the last shell of the atoms in the case of a diatomic molecule. Another change is that I needed the gradient and laplacian in this project, so I added them to the orbitals implementation. This addition is also added to the Hartree-Fock project, although it’s not used there.
The place to start looking over the project is in
VQMCMolecule::Compute. The most important classes are
The used libraries are, as in other projects described on this blog: wxWidgets5 and Eigen6.
Here are some results for the ground state energy in Hartrees, computed with STO3G and STO6G, compared with results obtained with the DFTAtom project (for atoms) and the Hartree-Fock one. The DFTAtom results are very similar with the results from NIST and the Hartree-Fock results are very close to other projects that use the same basis set. For Hartree-Fock I used the restricted method for He and unrestricted for the other atoms. If you would check the above mentioned master thesis, you would notice that the results are typically quite close with the results from the above thesis (where STO3G was used).
For now I’ll add here some atoms and molecules with a small number of electrons, I might add later some more complex ones. Of course, the lower values are better, as the variational principle is used.
|Atom||VQMC STO3G||VQMC STO6G||HF STO3G||HF STO6G||DFTAtom|
For molecules, I used the restricted Hartree-Fock method, as the electrons are paired for the chosen molecules.
|Molecule||Distance||VQMC STO3G||VQMC STO6G||HF STO3G||HF STO6G|
An improvement that should be done and I’m probably going to do in the future is to implement better statistics. The current simple averaging suffers due of autocorrelations.
Also the way the Gaussian Orbitals are picked and combined could probably improved as well. Currently the ones from the valence shell are paired in order. Hartree-Fock for example uses all of them in computation, filling them up in order of their energy. If the shell is not filled, in this project case not all orbitals from the basis set are used.
To improve the results, probably all of them could be used by using a linear combination of Slater determinants, each of them having a different combination of those orbitals from the last shell. This method would work in general, not only on diatomic molecules, too. This would require a lot of variational parameters, instead of a single one as it’s currently in the program, and gradient descent algorithms should be used to find the minimum (in a similar way as for the DFT Quantum Dot project). Of course, not all ‘tricks’ for speeding up used in this project would work anymore and besides, having so many Slater determinants and variational parameters would slow the speed a lot, so I’m not going to consider such an implementation for such a project.
The Variational Quantum Monte Carlo can be a start for Diffusion Quantum Monte Carlo, which is in principle exact, so the program could be extended to improve results using that method.
If you find any bugs and/or have suggestions for improvements, please point them out here or on GitHub.
- VQMCMolecule The project on GitHub ↩
- Computational Physics book by Jos Thijssen ↩
- Computational Physics by Morten Hjorth-Jensen ↩
- CompPhysics\ThesisProjects PhD and Master Thesis papers, some of them being about Quantum Monte Carlo ↩
- wxWidgets Cross-platform GUI library ↩
- Eigen The matrix library ↩