Hartree fock program c
Fundamentals of Molecular Integrals Evaluation 7 already given last time should also help. The implementation is in GaussianIntegrals namespace. The Hartree-Fock method is implemented in the HartreeFock namespace.
The code 1 is available, if interested you should check it out. The restricted method is implemented into two classes, a base class, HartreeFockAlgorithm also a base class for the unrestricted implementation and the RestrictedHartreeFock class. This is how the self consistent field iteration is implemented:. With the help of the comments and the theory from the last post , it should not be hard to understand. The NormalizeC call is not really necessary, the code should converge without it, but it might converge faster with normalization.
In some implementations it is present, in others it is not. Physically, it makes sense to have the density matrix normalized. Probabilities should add up to 1. It should converge to such a density matrix anyway, but it makes sense to enforce a physical density matrix along the iterations, too. For the theory please visit the previous post. The most important classes that do not deal with user interface are in namespaces.
Since the chart is composed from points which represent different computations, one can use several threads for computation. Anyway, even a single thread would make sense, to avoid locking the UI a long time. Vector3D is the same class seen in other projects on this blog, Chart is taken from another project that uses it on this blog, the other classes that are not in a namespace are quite similar with the ones in other projects, for details you could visit another post.
The namespaces and classes in them were already briefly described above, except the Tensors namespace. I needed tensors for electron-electron calculation and although Eigen has some unsupported tensor implementation, I preferred to implement the classes myself. I might need them in a future project, too. The program deals with matrices using Eigen 9 library. You can do computation for a single atom, too, for now by putting it into a dummy molecule with a single atom in it.
For example for He:. I tested the program with various molecules, the initial test was on the H2O molecule, but I also tested it with many more, comparing with Hartree-Fock limits and results from other programs. I checked the intermediate results against the Mathematica Journal results, then I used other programs for tests especially for electron-electron integrals.
While doing that I found bugs in another program, too: bug 1 and bug 2 , so I actually did more than implementing this project, I also helped identifying and fixing bugs in other project as well. So here it is the main paper the implementation is based on, including the most complex integrals, the electron-electron ones: HSERILib: Gaussian integral evaluation 6.
Fundamentals of Molecular Integrals Evaluation 7 already given last time should also help. The implementation is in GaussianIntegrals namespace. The Hartree-Fock method is implemented in the HartreeFock namespace. The code 1 is available, if interested you should check it out. The restricted method is implemented into two classes, a base class, HartreeFockAlgorithm also a base class for the unrestricted implementation and the RestrictedHartreeFock class. This is how the self consistent field iteration is implemented:.
With the help of the comments and the theory from the last post , it should not be hard to understand. The NormalizeC call is not really necessary, the code should converge without it, but it might converge faster with normalization. In some implementations it is present, in others it is not. Physically, it makes sense to have the density matrix normalized. Probabilities should add up to 1. It should converge to such a density matrix anyway, but it makes sense to enforce a physical density matrix along the iterations, too.
For the theory please visit the previous post. The most important classes that do not deal with user interface are in namespaces. Since the chart is composed from points which represent different computations, one can use several threads for computation. Anyway, even a single thread would make sense, to avoid locking the UI a long time. Vector3D is the same class seen in other projects on this blog, Chart is taken from another project that uses it on this blog, the other classes that are not in a namespace are quite similar with the ones in other projects, for details you could visit another post.
The namespaces and classes in them were already briefly described above, except the Tensors namespace. I needed tensors for electron-electron calculation and although Eigen has some unsupported tensor implementation, I preferred to implement the classes myself. I might need them in a future project, too.
The program deals with matrices using Eigen 9 library. You can do computation for a single atom, too, for now by putting it into a dummy molecule with a single atom in it. For example for He:. I tested the program with various molecules, the initial test was on the H2O molecule, but I also tested it with many more, comparing with Hartree-Fock limits and results from other programs. I checked the intermediate results against the Mathematica Journal results, then I used other programs for tests especially for electron-electron integrals.
While doing that I found bugs in another program, too: bug 1 and bug 2 , so I actually did more than implementing this project, I also helped identifying and fixing bugs in other project as well.
This post ends the posts about Hartree-Fock. I might add a Post-Hartree-Fock method in the future, but certainly not this year. Can it be used with cc-pVXZ basis sets? This site uses Akismet to reduce spam. Learn how your comment data is processed. No special trick is used all through the program - the only complicated thing should be the linked list, which should be a must to learn in C.
In principle there will be comments at each line, which enables the program to be demonstrated by 'debugging', in other words you can use simple debugging programs like gdb or lldb to directly show the whole trace of the program in the source code level.
Currently it can use either the simplest mixing method - NO MIXING method, namely the coefficient matrix obtained in each iteration is directly used in the next iteration, and the Anderson's mixing method. The output functions still seem to be disordered and scattered in the whole program, which may cause problem in trying to configure the output format and the total amount of information in it.
The program can also be fetched from release, containing a static program and corresponding basis sets. To be honest, any postfix would work, in current version, but it is still suggested not to do so. Obara, Shigeru, and A.
Molecular electronic-structure theory. May, Andrew James. Density fitting in explicitly correlated electronic structure theory. University of Bristol,
0コメント