• No results found

4.2 ERI Evaluation: the PRISM algorithm

4.2.1 Two-Electron Repulsion Integrals

As detailed in Chapter 2 the evaluation of two-electron repulsion integrals (ERIs) lies at the core of nearly all calculations performed using the Gaussian code. A two electron integral

(φµ φνjφλφσ)is given by, (φµφνjφλφσ)= ZZ χµ(r1)χν(r1) 1 jr1 r2j χλ(r2)χσ(r2)dr1dr2 (4.2)

wherer1andr2are the coordinates for two electrons (e1ande2);χµ,χνandχλ,χσare pairs of

basis functions used to represente1ande2. ERIs describe the various interactions between and

among the electrons and nuclei in the system being studied. Since many electronic structure methods are iterative, and the number of integrals too numerous to store in memory, they are usually re-computed several times during the course of a typical calculation [132]. For this reason algorithms that compute electronic structure integrals fast and on-demand are extremely important to the computational chemistry community.

Gaussian uses an efficient implementation of the PRISM algorithm [85, 95, 96, 136] to compute ERIs. For clarity, the following terms are re-referenced from Chapter 2,

GTOGaussian type orbital. Ref: Eqn 2.12. • PGTOPrimitive GTO:Gnl(α;A). Ref: Eqn 2.14.

CGTOContracted GTO:φCGT O

κ (A). Ref: Eqn 2.15.

Primitive/Contracted Shell For a given PGTO or CGTO, a shell contains all func- tions of that PGTO or CGTO that have the same total angular momentum.

Shell-pairA pair of shells.

Shell-quartetAll ERIs that are defined by four shells.

The PRISM ERI algorithm tailors the evaluation of ERIs according to the shell-quartet type being computed; essentially it dynamically chooses the most optimal way to compute and contract the constituent PGTOs [92]. PRISM computes ERIs in batches, where a batch is a set of shell-quartets having the same four angular momentum values as well as the same degree of contraction for each of the two shell-pairs in the quartet.

Using the example from Gill [92], the formation of batches from (ssjss) quartets starts

with all four s functions having a contraction length of one. When this has been computed, the batch of (ssjss) quartets for which the first function on the left has a contraction length of

2 and all others are singly contracted is computed. This process continues until all possible contractions for (ssjss) integrals complete, wherein the set of (psjss) integrals are considered

for evaluation and so on.

ERI evaluation using GTOs requires the use of recursive relationships that build up the target angular momentum using ERI values of lower angular momentum [34, 243]. This process inherently leads to intermediates and other quantities that are shared amongst the ERIs [106, 161]. Similar shell quartets are often evaluated using the same ERI evaluation algorithm. The use of batching within PRISM aids the reuse of shared intermediate quantities but more importantly it is able to use the same evaluation logic across a batch of integrals in the form of vector operations that facilitate pipelining of memory requests and floating-point operations. The size of these batches can rapidly become very large as the same basis set is generally applied to all atoms of the same type within the system being studied, e.g. all oxygen atoms in a large water cluster system will have the same basis set. Computing in- tegrals in batches leads to large inner-loop lengths in PRISM, as numerous integrals of the same type are evaluated. While this gives rise to good on-chip pipelining of operations and ex- poses opportunities to exploit Instruction Level Parallelism (ILP), the number and size of data quantities required to compute a given batch can exceed the total amount of available on-chip cache memory, resulting in expensive cache misses and poor performance. To address this the implementation of PRISM in Gaussian, imposes cache blocking of these data quantities. This ensures data references are serviced from the on-chip cache, but at the cost of recomputing some shared intermediate data quantities.

To illustrate the composition of functionsχ used in ERI evaluation, Table 4.1 presents a detailed break-down of basis functions on each atom of a water molecule, for a 6-31G* basis set. The table has three columns which are ‘Atomic Center’, ‘Atomic Orbital’ and ‘Gaussian Functions’ respectively. The first column gives the atom and its Cartesian coordinates; the second describes the name of the atomic orbital and the number of GTOs associated with it; and the third column gives the composition of the GTOs that make up the atomic orbital.

For clarity Equations 2.14 and 2.15 from Chapter 2 are reproduced,

Gnl(α;A)G PGT O nl (α;A) = (x Ax) ax (y Ay) ay (z Az) az e αjr Aj 2 φCGT O κ (A) = L

p=1 dpκGnlppκ;A) (4.3)

Table 4.1: Decomposition of 6-31G* basis functions on a Water molecule

Atomic Center Atomic Orbital Gaussian Functions

Atom X Y Z Shell Function Exponent Coefficient (dpκ) Type Number (α) S P D O 0.00 0.22 0.00 S 1 0.55D+04 0.18D-02 0.00 0.00 0.83D+03 0.14D-01 0.00 0.00 0.19D+03 0.69D-01 0.00 0.00 0.53D+02 0.23D+00 0.00 0.00 0.17D+02 0.47D+00 0.00 0.00 0.58D+01 0.36D+00 0.00 0.00 SP 2–5 0.16D+02 -0.11D+00 0.71D-01 0.00 0.36D+01 -0.15D+00 0.34D+00 0.00 0.10D+01 0.11D+01 0.73D+00 0.00 SP 6–9 0.27D+00 0.10D+01 0.10D+01 0.00 D 10–15 0.80D+00 0.00D+00 0.00 0.10D+01 H 1.43 -0.89 0.00 S 16 0.19D+02 0.33D-01 0.00 0.00 0.28D+01 0.24D+00 0.00 0.00 0.64D+00 0.81D+00 0.00 0.00 S 17 0.16D+00 0.10D+01 0.00 0.00 H -1.43 -0.89 0.00 S 18 0.19D+02 0.33D-01 0.00 0.00 0.28D+01 0.24D+00 0.00 0.00 0.64D+00 0.81D+00 0.00 0.00 S 19 0.16D+00 0.10D+01 0.00 0.00

a CGTO is described by its center A, its contraction length ‘L’, the contraction coefficients ‘dpκ’ and the constituent PGTO exponents. The ‘Exponent’ column in Table 4.1 corresponds

to individual values of ‘α’ for each PGTO (cf. Equation 4.3) and the ‘Coefficient’ column corresponds todpκ for the CGTO.

The oxygen atom in Table 4.1 is located at Cartesian coordinates (0.00, 0.22, 0.00). It has a total of 15 functions defined at this center. There are 6 PGTOs that are contracted together to describe the inner ‘core’ orbital (Table 4.1 – Function Number: 1, Shell Type: S). The outer ‘valence’ orbitals are described by two groups of functions: a CGTO containing a linear com- bination of 3 PGTOs (Function Numbers: 2-5) and a single uncontracted PGTO (Functions: 6-9). In the previous two cases the functions are of type SP, which is defined as a combination of both an s function and three p functions where the exponents are the same but the contraction coefficients can be different. SP functions are used as its combined treatment is computation-

ally advantageous for ERI computation. The last function is a D function (Function Numbers: 10-15, Shell Type: D) that is termed a polarization function. The use of polarized functions affords flexibility in describing electron density, during the SCF optimization, as it effectively allows molecular orbitals to be more asymmetric about a given nuclear center.

The ‘s’ functions are spherically symmetric around their centers [169], ‘p’ functions are axially symmetric about the x, y or z axis and are labelled ‘px’, ‘py’ and ‘pz’ accordingly. Higher order angular momentum functions have other symmetry properties, such as ‘d’ func- tions which have 6 Cartesian symmetries – ‘dxy’, ‘dyz’, ‘dxz’, ‘dx2’, ‘dy2’ and ‘dz2’. Due to these

symmetry components, the SP function has a total of 4 entries in Table 4.1 while the D function has 6 entries.

The 6-31G* basis set [110, 205] is referred to as a split-valence basis set, reflecting the fact one CGTO is used to describe core electrons while pairs of CGTOs are used for valence electrons. Furthermore the core CGTO comprises of 6 PGTOs, while the one of the two valence CGTOs has 3 PGTOs. The second valence CGTO is a singly contracted PGTO. This composition is reflected in the 6-31G name. The asterisk in 6-31G* denotes the presence of polarization functions.

Having considered an example of basis set composition, the next section looks at the PRISM algorithm for evaluating ERIs and its use of cache blocking.