# Assign Hartree-Fock coefficients to corresponding atoms

Hello Psi4 Communnity,

I was running a Hartree-Fock calculation and was returning the alpha and beta coefficients at the end.

What I am trying to do now is to find out which coefficients belong to which atom and basically create a list for each atom with its coefficients. Is there a way to assign the coefficients to each atom they correspond to, since I am struggling to find a pattern by simply investigating the values?

Kind Regards,
Natu

Do you need to be able to do this in a script, or to do this by hand?

Oh, I want to do this for larger molecules and thousands of them so I will have to do it with a script. I was just looking at the matrices to try and understand how rows and columns could correlate to atoms…
Sorry if I posed the question unclearly.

Best,
Natu

For example for a molcule (C3H6O), using cc-pvdz, I get a (86,86) array. So 86 arrays with 86 values. Is there a way to findout how psi4 assigns coefficients to the corresponding atoms or how this (86,86) array is ordered?

Best

Thanks for waiting. I haven’t been active on forums over the Thanksgiving holiday.

Let’s say you have some Molecule object called `mol`. You first need to get a BasisSet object.

``````wfn = psi4.core.Wavefunction.build(mol, "cc-pvdz")
basisset = wfn.basisset()
``````

Once you have that, call `basisset.function_to_center(i)` to find the atom number of basis function `i`. The total number of basis functions is given by `basisset.nbf()`.

Some additional complications can arise if you’re crossing Cartesian and Spherical basis functions. I’ll spare you those details unless you need them.

Hey sure! Hope you enjoyed the holidays!

Worked perfectly, that will help a lot thank you so much!

Regarding the spherical basis functions, at least consciously I dont think I am crossing them… does this has to do something with spherical harmonics being True or False? Seems like True is a deafault.

Best

In this case, Psi4 will handle them for you so these additional complications never appear.

If you’re manually using `psi4.core.BasisSet.build`, then this is something you need to worry about. It’s a non-issue otherwise. With `wfn.basisset`, you don’t need to worry about it.

Thanks again you helped me out a lot!

I have another questions I hope its ok to pose it here since I think it is related to this topic.
I was wondering what the values in each basisfunction are?

For example using cc-pVDZ I have 14 basis functions for a Carbon atom. Each are lists of 62 numbers, which I am trying to figure out what they mean. I am assuming this has something to do with the number of electrons in the molecule?

Best

I don’t know exactly what you mean by “values in each basisfunction”.

If you mean the numbers here, then your question is how to interpret a basis set file. This isn’t a Psi4 specific question, and there are many introductory resources on this. Please do some more independent investigating on basis sets in electronic structure theory before asking again - I don’t want to get into a habit of answering every question you have.

If that is not what you mean, please be more specific as to what “values” you’re talking about.

Oh Im sorry, what I meant was the following:

Mol1: CCOHHHH (62 basisfunctions) Mol2: OCCCHHHHHH (86 basisfunctions)
Both calculated with cc-pVDZ, in both cases I have 14 basisfunctions for the first carbon atom. Now each of this basisfunctions is a list of some python float values (I had expected one coefficient per basisfunction). In case of Mol1 all 14 basisfunctions are lists of 62 float numbers. In case of Mol2 all 14 basisfunctions are lists of 86 float numbers.
This difference surely has something to do with Mol2 having more atoms (electrons).
I was just wondering what these values are and (maybe this is PSI4 specific) in what way they are ordered in the basisfunction lists?
Thanks for helping and I will make sure to check out some slides on basisfunctions and coefficients!

If I can ask, how much background do you have with electronic structure theory and Hartree-Fock? I’m struggling to understand your last post, and you sound confused on the difference between molecular orbitals and basis functions. Those are very different things.

Tell me exactly what you did to get a “basis function” as a list of numbers.

Sorry for my late reply. I had to further my understanding of what I am trying to find so I hope the following is more clearly than my previous post. Thanks for helping me out!

Using basisset.function_to_center(i) I can get a list of numbers, which tell me, which row i corresponds to which atom in my xyz file.

This leaves me with the columns. Since the columns represent the MO’s I was wondering if there is a similar way of determining to which bond between which atoms the entries in each row belong. I assumed this is something that is PSI4 specific.

For example assuming the first atom in my xyz file is a carbon atom, if it has 4 binding partners then the first 4 MO’s (column 1-4 of the coefficient matrix) are those created from carbon with those 4 binding partners I assume (?), but in which order are those 4 MO’s given in the coefficient matrix?

No, your assumptions are far off.

You cannot necessarily assign an occupied MO to a particular bonding interaction. The canonical Hartree-Fock MOs are determined by requiring that they diagonalize the Fock matrix. This does not guarantee an MO localized on a particular bond. For example, look at the 1b2 orbital of water.

For systems without symmetry, MOs are ordered from lowest to highest energy. For systems with symmetry, MOs are ordered first by irrep and then by energy.

There are several tools to generate orbitals that are localized on specific bonding interactions. NBO methods come to mind and are what I’m most familiar with. Whether another method would serve you better depends on your application.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.