CamCASP/Programming/1

From CUC3
Jump to navigation Jump to search

CamCASP => Programming => Basis functions

Basis Functions

When interfacing with a program (DALTON, CADPAC, etc.), we need to know the normalization and the order of the symmetry components used for Cartesian and spherical GTOs. Additionally, CamCASP has its own convention for the basis functions. These conventions are described in this article.

Basics

  • Fully normalized Cartesian GTOs

<math> G_{ijk}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2i-1)!!(2j-1)!!(2k-1)!!}
          }
    x_A^i y_A^j z_A^k e^{-\alpha r_A^2}

</math>

where <math>l = i+j+k</math> and <math>r_A = r - A</math>.

  • Fully normalized spherical GTOs

<math> G_{lm}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
          }
    S_{lm}(r_A) e^{-\alpha r_A^2}

</math>

where <math>S_{lm}</math> are the real spherical harmonics (see Anthony's book). These can be written in terms of the Cartesian triplets as

<math> S_{lm}(r_A) = \sum_{ijk} C_{lm;ijk} x_A^i y_A^j z_A^k </math>

Therefore, we see that the relation between the two forms of the GTOs is

<math> G_{lm}(r,\alpha,A) = \sum_{ijk} C_{lm;ijk}

 \sqrt{
    \frac{(2i-1)!!(2j-1)!!(2k-1)!!}{(2l-1)!!}
       }
  \times G_{ijk}(r,\alpha,A)

</math>

So, once the <math>C_{lm;ijk}</math> are known, we can easily convert between the two forms. NOTE: the order of the symmetry components within each symmetry (<math>l</math> value) is contained in this matrix.

The only problem is that SCF programs use various normalization and orders of the symmetry components, so the above transformation does not usually hold. Let's have a look at the normalization issue first.

DALTON

DALTON uses Cartesian GTOs of the form

<math> G^D_{ijk}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{(4\alpha)^l}
    x_A^i y_A^j z_A^k e^{-\alpha r_A^2}

</math>

But it uses spherical GTOs as defined above. So the transformation between the two is given by

<math> G_{lm}(r,\alpha,A) = \sum_{ijk} C_{lm;ijk}

 \sqrt{
    \frac{1}{(2l-1)!!}
       }
  \times G^D_{ijk}(r,\alpha,A)

</math>

GAMESS(US)

I'm not sure what Cartesian GTOs GAMESS(US) uses, but they must be similar to those we get from GAMINT as this integral module is a modified version of GAMESS(US). The order is certainly the same as that used by GAMINT, but the normalization could be different.

GAMESS(US) uses Spherical GTOs in a slightly different way from other codes. The MO coefficients of its spherical GTOs are not supplied as standing in front of the components of the spherical GTOs, but rather they stand in front of the Cartesian components. To make this concrete, rather than supply 5 sets of 5 MO coefficients for a spherical d-function (each set of 5 would correspond to an MO), GAMESS(US) will supply 5 sets of 6 coefficients. Each of these 6 would stand in front of Cartesian GTOs. This is OK, but the normalization of these Cartesian GTOs is rather awkward. I have worked out the transformation matrices from these Cartesian GTOs to an equivalent spherical set. I won't put any details here as I still don't understand exactly what's going on. See details in the Interfaces section.

NWChem

All we've used NWChem with are spherical GTOs. It supplied MO coefficients as standing in front of fully normalized spherical GTOs (like any sensible code should!). But the sign of some of these is different:

d1+ ==> - d1+
f1+ ==> - f1+
f3+ ==> - f3+
g1+ ==> - g1+
g3+ ==> - g3+

GAMINT

This is the GAMESS(US) integral routine that we use to calculate 2-electron 2 to 4-index coulomb integrals using Cartesian GTOs. This code assumes the Cartesian GTOs are of the form

<math> G^G_{ijk}(r,\alpha,A) =

    \sqrt{
       \frac{(2l-1)!!}{(2i-1)!!(2j-1)!!(2k-1)!!}
          }
    x_A^i y_A^j z_A^k e^{-\alpha r_A^2}

</math>

Therefore the transformation from these to spherical GTOs is given by

<math> G_{lm}(r,\alpha,A) = \sum_{ijk} \frac{C_{lm;ijk}}{\sqrt{(2l-1)!!}}

 \sqrt{(2i-1)!!(2j-1)!!(2k-1)!!}
 \times \left( \frac{2\alpha}{\pi}\right)^{3/4}
    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
 \times G^G_{ijk}(r,\alpha,A)

</math>

The first term defines the Cartesian to Spherical transformation matrices (we haven't yet discussed the order). These are defined in module basis_trans_mats. The second term is needed to remove the extra (double) factorials included by GAMINT. This is taken into account by subroutines norm_integral1. norm_integral2 and calculate_factorial_factors all in module gamint_frontend. And the last term is included in the contraction coefficients by subroutine norm_contraction_coeffs which is also in module gamint_frontend.

And to transform the Cartesian GTOs into the form used by DALTON we need to use the transformation

<math> G^D_{ijk}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
    \times \sqrt{(2i-1)!!(2j-1)!!(2k-1)!!}
    \times G^G_{ijk}(r,\alpha,A)

</math>

This can be achieved using norm_contraction_coeffs to obtain the first term and norm_integral1 or norm_integral2 for the second term.

Remember, we haven't talked about the order of the symmetry components yet. These are different in DALTON and GAMINT. More on this later.

GAUSSINT

This integral code is from the geminal program Robert Bukowski was co-author of. It is slow, but useful as it can calculate a number of integrals. GAUSSINT uses Cartesian GTOs that are completely unnormalized. But you have to supply the order of the symmetry components to GAUSSINT. More on this later.

Cartesian GTOs used by GAUSSINT:

<math> G^{\rm GAU}_{ijk}(r,\alpha,A) =

    x_A^i y_A^j z_A^k e^{-\alpha r_A^2}

</math>

Therefore the transformation from these to spherical GTOs is given by

<math> G_{lm}(r,\alpha,A) = \sum_{ijk} C_{lm;ijk}

 \times \left( \frac{2\alpha}{\pi}\right)^{3/4}
    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
 \times G^{\rm GAU}_{ijk}(r,\alpha,A)

</math>

The first term defines the Cartesian to Spherical transformation matrices (we haven't yet discussed the order) BUT these are different from those used to go from GAMINT to DALTON: There is no factor of <math>1/\sqrt{(2l-1)!!}</math> present here. So the transformation matrices defined in module basis_trans_mats are not correct as they include this factor.

To avoid this sort of complication, we use function norm_gaussint (in integrals.F90) to include the following normalization to integrals calculated with GAUSSINT:

  • Spherical GTOs: <math>\sqrt{(2l-1)!!}</math>
  • Cartesian GTOs: <math>\sqrt{\frac{(2l-1)!!}{(2j-1)!!(2j-1)!!(2k-1)!!}}</math>

For spherical GTOs, this means that the Cartesian to Spherical transformation matrices with the factor <math>1/\sqrt{(2l-1)!!}</math> can be used as our new transformation to spherical GTOs is

<math> G_{lm}(r,\alpha,A) = \sum_{ijk} \frac{C_{lm;ijk}}{\sqrt{(2l-1)!!}}

 \times \left( \frac{2\alpha}{\pi}\right)^{3/4}
    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
 \times \sqrt{(2l-1)!!}
 \times G^{\rm GAU}_{ijk}(r,\alpha,A)

</math>

So, the first term is the standard spherical to Cartesian transformation matrix. The second term is included in the contraction coefficients by subroutine norm_contraction_coeffs which is in module gamint_frontend. And the last term is included using function norm_gaussint.

For Cartesian GTOs, the normalization included using function norm_gaussint results in GTOs of the form:

<math> G_{ijk}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
    \times \sqrt{\frac{(2l-1)!!}{(2j-1)!!(2j-1)!!(2k-1)!!}}
    \times G^{\rm GAU}_{ijk}(r,\alpha,A)

</math>

These are fully normalized Cartesian GTOs and are therefore in the correct form for internal use (see below).


But these are not the correct form for DALTON which uses Cartesian GTOs with a strange normalization. I still have to modify the code to get this correct. However, it is rarely going to be used, so this is not a high priority.


CamCASP

This is the important one. CamCASP uses GAMINT to calculate the integrals (GAUSSINT doesn't matter as it is flexible). We have an internal and external normalization and ordering: The SCF code determines the external choice. This is fixed. All molecular orbital coefficients are obtained from the SCF code, and these will assume GTOs of a certain symmetry, normalization and symmetry order. We could transform these MOs into an internal order, but this is still not possible as we use some integrals (those needed for the LRDFT calculations) from the SCF (DALTON or CADPAC) code and that means we must have the MOs consistent with these integrals. That leaves us to choose the internal order.

CamCASP uses density-fitting everywhere. Consequently, the only basis functions used internally (at least, at present) are the auxiliary basis functions. The internal order/normalization applies to these basis functions.

CamCASP internal basis functions

  1. Cartesian GTOs

Fully normalized with the GAMINT ordering. This is the natural choice. Since GAMINT calculates integrals assuming Cartesian GTOs that are not fully normalized, we must perform the transformation:

<math> G^C_{ijk}(r,\alpha,A) = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
    \times G^G_{ijk}(r,\alpha,A)

</math>

Rather than multiply each integral by such a factor, the multplicative factor, which is a constant for each component in a symmetry, is absorbed in the contraction coefficients of the auxiliary basis set (a similar thing is done for the main basis set). This is done using subroutine norm_contraction_coeffs. This subroutine also normalized the contraction blocks. See the notes in the code for details. Contrary to its name, the contraction blocks cannot be denormalized. Obviously!

When integrals are calculated using GAUSSINT, we need to tell GAUSSINT the order of the symmetry components (GAMINT ordering) and set the correct normalization (fully normalized). The order is set by subroutine may_symm_to_powers using order=0 which is the default. The normalization is calculated using subroutine norm_gamint. See examples in integrals.f90 for usage.

  1. Spherical GTOs

Fully normalized spherical GTOs in the DALTON order. This too is quite natural as we have the GAMINT-DALTON transformation matrices in the code. This transformation has been described in the GAMINT section above.


Subroutines

Normalization is handled by a few subroutines:

Subroutine norm_contraction_coeffs

This subroutine is called as soon as the basis is read (in the molecule_parser in molecule_operations.F90). It does two things:

  • Include the normalization for the spherical GTOs in the contraction coefficients.
  • Normalize the contraction blocks.

Inclusion of normalization of spherical GTOs

Include the normalization coefficients of spherical GTOs in the contraction coefficients by defining the new contraction coefficients of each symmetry <math>l</math> to be

<math> C'_l = \left( \frac{2\alpha}{\pi}\right)^{3/4}

    \sqrt{
       \frac{(4\alpha)^l}{(2l-1)!!}
         }
    \times C_l

</math>

What this means now is that any integrals using spherical GTOs will need to be calculated using spherical GTOs defined as

<math> G_{lm}(r,\alpha,A) = S_{lm}(r_A) e^{-\alpha r_A^2}. </math>

It's a little more tricky with Cartesian GTOs because different codes seem to use different normalizations for these.

Normalization of the contraction blocks

If we have a basis function defined as a contraction: <math> Q = \sum_m C_m p_m </math> where <math>p_m</math> is a primitive GTO and <math>C_m</math> are the contraction coefficients, and the norm of this contraction is <math>k = <Q|Q></math>, then defined the contraction coefficients of the normalized contraction blocks as <math>

 C'_m = C_m / \sqrt(k).

</math>

Subroutines norm_integrals1 & norm_integrals2

The integrals from GAMINT use Cartesian GTOs with the normalization:

<math> G^G_{ijk}(r,\alpha,A) =

    \sqrt{
       \frac{(2l-1)!!}{(2i-1)!!(2j-1)!!(2k-1)!!}
          }
    x_A^i y_A^j z_A^k e^{-\alpha r_A^2}

</math>

These two subroutines remove the factor <math>\sqrt{(2i-1)!!(2j-1)!!(2k-1)!!}</math> from integrals calculated by GAMINT. The algorithm for norm_integrals2 is:

 Loop over all cartesian components m in the shell l_m
    let powers of x,y,z in this component be i,j,k
    Loop over all cartesian components n in the shell l_n
      let powers of x,y,z in this component be p,q,r
      I(m,n) = I(m,n) * sqrt[(2i-1)!!(2j-1)!!(2k-1)!!] *
                        sqrt[(2p-1)!!(2q-1)!!(2r-1)!!]
    End loop
 End loop
  • These routines are needed if spherical GTOs are used as these factors are not present in spherical GTOs.
  • Cartesian GTOs from DALTON: Because DALTON uses Cartesian GTOs without the above factor, integrals from GAMINT must be processed using one of these subroutines to remove this factor before transforming from the atomic orbital space to the molecular orbital space. See the example in subroutine make_T_AO_mono in module df_Tmat.