Friday, 27 November 2009

TwirlyMol (2)

It looks like I cannot show more than two molecules on one page. Here is the third one I wanted to show (you may have to click the header of this post to see it):

For molecules that are not in their data base I can enter the molecule as InChI (which I can create through open babel).

This is the molecule of my Master's thesis [2,2'-bipyridyl]-3,3'-diol with the InChI 'InChI=1/C10H8N2O2/c13-7-3-1-5-11-9(7)10-8(14)4-2-6-12-10/h1-6,13-14H'.

[To correctly translate it into a form that the browser interprets correctly, I can convert it on their homepage (I enter the InChI and take the converted one from the link it produces). Then it looks like this: 'InChI%3D1/C10H8N2O2/c13-7-3-1-5-11-9%287%2910-8%2814%294-2-6-12-10/h1-6%2C13-14H']
[Edit:] The problem was that I did not put the 'InChI=' prefix and it is not necessary to do this conversion.




In fact the molecule should be all in one plane and have intramolecular hydrogen bonds but it is still cool that the tool can create the structure from just one line.

TwirlyMol

The Chemical Identifier Resolver-TwirlyMol tool (for more information: Noel's post) is pretty cool. All I have to do is enter two lines of code to get an interactive look at my molecule.

For example this would be 'adenine' (the tool recognizes the word and produces the correct structure)


Or 'acetylcholine':



So far I have been using jmol for these things. jmol is more powerful but it also takes much longer to load and it has some problems when several applets are open on the same page. And for me there is the problem right now that all my applets will stop working when they delete my account at my old university (and I don't know if I feel like setting it up somewhere else and rewriting the links). Check them out a last time at the images label. On a bad day firefox may freeze if you do so ... but it is still worth it.

Monday, 16 November 2009

Density (2)

For a long time I did not understand the connection between density matrices as shown in my other post and density matrices as they are used in quantum chemical programs. On first sight it is not quite apparent that you can get the matrix representation of the 1-particle density matrix in an orbital basis in the following way:



The operators in the second expression are the creation and annihilation operators from second quantization. The expression means: you take an electron out of orbital j, put it in orbital i, and overlap this wave function with the original wave function. Note that the first scalar product is in 1-particle space, the second one in n-particle space.

To reach this conclusion you just have to write it out explicitely and rotate the integrals a little bit. With the definition from the other post, it looks like this.



As a next step you also write out the n-1 integrations that are involved in the density matrix definition.



You rearrange it a little bit:



The crucial point is the interpretation of the terms in the parentheses. To do this, we expand our wave function in Slater determinants constructed from an orthonormal orbital set including φi and φj. Formally we can construct any wave function in this way in a complete CI expansion.

The question reduces to: How does multiplying with an orbital and integration change one such n-particle determinant? - If the determinant contains the orbital, one obtains the (n-1)-particle determinant where this orbital is taken out. If it does not contain the orbital (and therefore only orthonormal orbitals) one obtains 0. This operator is usually called annihilation operator and written as ai.



We may rewrite this equation with the adjoint operator.[1]



This offers an expression that can be efficiently evaluated. In a determinant basis all you would have to do is check whether the orbitals are present for every pair of determinants - no explicit integrations or things of that sort are needed.



[1] The adjoint operator is usually called creation operator. It adds an orbital to a determinant or makes it 0 if the orbital is already there. The explicit definition would be something like multiplying with the orbital and antisymmetrizing the expression.

Another interesting point here is that we have scalar products (= matrix elements) with different numbers of particles. For every k, the k-particle space is constructed as a Hilbert space, i.e. you can form scalar products. It is not possible to have a scalar product between wavefunctions of different particle numbers. Therefore the direct sum of all k-particle spaces (called Fock space) is indeed a vector space but not a Hilbert space.

Monday, 26 October 2009

Hellmann-Feynman theorem

If the Hamiltonian of a system changes, the change in energy should be related to both the change in the Hamiltonian and the response of the wave function. The Hellmann-Feynman theorem states that for an exact eigenfunction, only the derivative of the Hamiltonian is decisive. This statement can be generalized to any kind of variational wave function. And since I finally kind of understand the math behind it, I will put up some formulas. The derivation is similar to this Ref. [1].

We start with some parameters describing our wave function, (e.g. orbital coefficients and expansion coefficients ).



And we need some kind of a rule to make an n-electron wave function from λ at a geometry R [2].



We can compute the energy of this wave function in the usual way



We may formally view this as a function of λ (not any more a bilinear function) and rewrite it according to



This way all geometry dependence is in the Hamiltonian - the actual geometry dependence that comes from the motion of the nuclear charges and the geometry dependence that arises from the wave function expansion (e.g. motion of atom centered basis sets).

The above expression gives you the energy for any kind of expansion λ at any geometry R. Now in practice we will have some kind of a rule (or mapping) on how to create the wave function (e.g. MCSCF) at every geometry.



Now, the geometry dependent energy with respect to this rule is given according to:



Next we can compute the derivative of this expression with respect to a coordinate x in R (derivatives will be denoted with a superscript (x) or (λ)). This requires the use of the chain rule [3]



or with the definition from above



The first term evaluates the change in the Hamiltonian with the reference wave function. The second term is the gradient of the energy with respect to the expansion parameters multiplied with the change in expansion parameters.

If λ was determined in a completely variational way, then


The corresponding second term cancels and we arrive at the Hellmann-Feynman theorem.

The significance is that with a completely variational method, we do not have to worry about the response of the wave function to the geometrical perturbation and the formulas simplify. In real life MCSCF (and the special case SCF) is the expansion where this holds. For such a wave function the gradient comes directly from combining the density matrix (from last post) with the atomic derivative integrals. CI gradients are more complex because the orbitals are not optimal with respect to the CI expansion coefficients. And in coupled cluster not even the amplitudes are variational.



[1] R. Shepard. The Analytic Gradient Method for Configuration Interaction Wave Functions. in Modern electronic structure theory. 1995 ed. D.R. Yarkony

[2] Note that there are three types of coordinates: wave function coordinates λ, coordinates of the Hamiltonian R (I am thinking here mostly about the nuclear geometry but it could be anything else as well) and implicit electronic coordinates that I am not writing out.
- The λ in the wikipedia article corresponds to my R actually (I hope it is still understandable).
- A slightly tricky thing in this context is that in general the same λ can give a different wave function at a different geometry. This happens because atom centered basis sets move around in space with the atoms.

[3] The notation is kind of difficult with all these different types of coordinates (maybe not written in the optimal way here) but in principle this is a straight forward application of the chain rule. You could also do it with Taylor expansions truncated to first order - but chain rule is prettier ...

Tuesday, 20 October 2009

Density

Density matrices are not only nice for mathematical reasons, they also offer a stringent physical definition of orbitals. The point of this post is to show how you can create what is called "natural orbitals" from any kind of wave function. These things are also interesting with respect to orbital imaging (as introduced here and discussed for example here).

In order not to make any prior assumptions, I have to use general wave functions. In real life you would usually look at these things from the perspective of an orbital basis. And then the expressions would be simpler (maybe I will show that, too).

The one particle density matrix γ1 of an n-particle wave function Ψ is defined as:



This quantity is a "convenient partial sum". It lets you evaluate all the properties of 1-particle operators without the need of the whole wave function. This operation (in a finite orbital basis) is carried out in many quantum chemical codes.

Because the particles are interchangable you only need one such density matrix. (An n-particle density matrix which is analogously defined, lets you evaluate the matrix element of any n-particle operator.)

First we have to define what a one particle operator is. I think the most straight forward (and hopefully correct) definition ist the following:
An operator A is said to act only on r1 if


The idea is that you can do all the integrations with respect to the other variables ahead. You need some variable renaming to make sure that the operator only acts on the second function.

This contains already the density matrix



From the density matrix we can construct, what is called "natural orbitals" without the need of any a priory definition of an orbital basis.

Maybe it would be easier to understand it in the matrix representation but in the general case we can also define an operator of the following form.



We may also symmetrize it (again easier in cartesian coordinates; edit: the 1-particle density of a wave function is already symmetric). This symmetrized operator has clearly defined orthogonal 1-particle eigenfunctions, the so called "natural orbitals" (and occupation numbers as eigenvalues). The natural orbitals represent the 1-particle density matrix. And this one particle density matrix contains all the information needed for 1-particle operators (like e.g. the dipole). So natural orbitals are something kind of physcial in my opinion.

The eigenvalues of the density matrix are the occupations. In a Hartree-Fock wave function the natural orbitals correspond to the usual HF orbitals and the eigenvalue of occupied orbitals is one (zero for virtuals). The density matrix is idempotent (or equivalently a projection). In the general case there is no clear distinction between occupied and virtual orbitals and there is strictly spoken no such thing as a HOMO or LUMO. But then we notice that HF represents most wave functions quite well in "well behaved" cases. So you may still think about HOMOs and LUMOs even in a more strict sense.