Giter Site home page Giter Site logo

aromanro / hartreefock Goto Github PK

View Code? Open in Web Editor NEW
52.0 7.0 16.0 708 KB

A program implementing the Hartree–Fock (also post-HF: MP2, CCSD(T), CIS and TDHF/RPA)/self-consistent field method (also DIIS) with Gaussian orbitals

Home Page: https://compphys.go.ro/the-hartree-fock-program/

License: GNU General Public License v3.0

C++ 98.42% C 1.58%
physics computational-physics hartree-fock atom molecule orbital gaussian eigen self-constent-field mfc

hartreefock's Introduction

HartreeFock

A program implementing the Hartree–Fock/self-consistent field method (and more, see the README at the end)

Codacy Badge CodeFactor

Description is available here: http://compphys.go.ro/the-hartree-fock-program/

Some Hartree-Fock theory here: http://compphys.go.ro/the-hartree-fock-method/

Some things more general (Schrödinger equation, Born-Oppenheimer approximation, variational principle), here: http://compphys.go.ro/how-to-solve-a-quantum-many-body-problem/

PROGRAM IN ACTION

Program video

HOW TO COMPUTE

Here are some things about usage:

Using the classes should be easy. Here is how to grab some atoms from the 'basis':

	Systems::AtomWithShells H1, H2, O, N, C, He, Li, Ne, Ar;

	for (auto &atom : basis.atoms)
	{
		if (atom.Z == 1) H1 = H2 = atom;
		else if (atom.Z == 2) He = atom;
		else if (atom.Z == 3) Li = atom;
		else if (atom.Z == 8) O = atom;
		else if (atom.Z == 6) C = atom;
		else if (atom.Z == 7) N = atom;
		else if (atom.Z == 10) Ne = atom;
		else if (atom.Z == 18) Ar = atom;
	}

Here is how to set the H2O molecule with the coordinates from the 'Mathematica Journal' (referenced in the code):

	H1.position.X = H2.position.X = O.position.X = 0;

	H1.position.Y = 1.43233673;
	H1.position.Z = -0.96104039;
	H2.position.Y = -1.43233673;
	H2.position.Z = -0.96104039;

	O.position.Y = 0;
	O.position.Z = 0.24026010;

	Systems::Molecule H2O;

	H2O.atoms.push_back(H1);
	H2O.atoms.push_back(H2);
	H2O.atoms.push_back(O);

	H2O.Init();

And here is how you calculate:

HartreeFock::RestrictedHartreeFock HartreeFockAlgorithm;
HartreeFockAlgorithm.alpha = 0.5;
HartreeFockAlgorithm.initGuess = 0;

HartreeFockAlgorithm.Init(&H2O);
double result = HartreeFockAlgorithm.Calculate();

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:

  Systems::Molecule Heatom;
  Heatom.atoms.push_back(He);
  Heatom.Init();

LATEST ADDITIONS

I added more basis sets, it's not limited to STO-nG. While doing that, I found and fixed a bug in the integrals repository that manifested for orbitals having L > 1. Now it seems to work fine.

Basis sets added:

  • Split valence orbitals: 3-21G, 6-21G, 6-31G
  • Besides 'split valence', polarization on heavy atoms: 6-31G*
  • 'Split valence', polarization on heavy atoms and hydrogen and diffusion functions on heavy atoms: 6-31+G**

You may add more of them, the parsed format is nwchem.

Tutorials from Crawford Group

Most of those are already implemented:

https://github.com/CrawfordGroup/ProgrammingProjects

Projects for MP2, DIIS, CCSD(T), CIS and TDHF/RPA are implemented. DIIS and MP2 are implemented for both the restricted and unrestricted methods.

Projects 1 and 2 are not implemented here, maybe I'll add a python workbook for those in the python repository, 3 was already implemented obviously before finding this. Project 7 is also not implemented, also 9 and 13.

hartreefock's People

Contributors

aromanro avatar codacy-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hartreefock's Issues

Vibrational spectra

Having this #16 implemented, vibrational modes and frequencies could be computed.

It could even go further, computing line intensities.

Results are wrong if orbitals with L>1 are involved

First I noticed the wrong results by testing some * basis sets, but it turned out that the results are wrong even for STOnG if a D orbital is involved. As results come lower than the Hartree Fock limit, this is very probably a bug in integrals computation.

Compute gradient, Hessian matrix

The derivatives could be computed numerically (central difference would be my choice).
In fact, they could be computed 'analytically', but I don't think I would use that method for this project, I suppose the post-HF things would complicate things even more.

They could be used for optimizations computations, that is, computation of molecular structure.
Also vibrational modes & frequencies could be computed.
Ideally, also the lines intensity...

Add more basis sets

In principle the program should be able to use a different number of Gaussians in the inner shell than in the valence shell, so it could work with orbital sets like 3-21G or 6-21G. Maybe the parsing code should be changed for that, but it should be possible to use them.

Implement CISD or CID

For now CIS for restricted method is implemented, to be used in TDHF/RPA.

Maybe I'll also implement at least CID.

Add electric field term to the Hamiltonian

Only the 'core' part needs to be changed, it's not so hard.

The advantage would be to be able to calculate the electric dipole moment using the derivative of energy with respect to the electric field.

For details, see 6.101 and the explanation before it from Szabo & Ostlund, Modern Quantum Chemistry. Introduction to Advanced Electronic Structure Theory.

Add DFT

Another thing that probably won't happen soon - but it's something that is possible - is to add DFT to the project.

Add * orbitals

Add unoccupied/polarization orbitals to the basis set (as in STO-3G* or 3-21G*).

Structural computations

Having this #16 implemented, it's just an optimization problem.

The code could compute the molecule structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.