0
# AO2MO Transformations
1
2
Atomic orbital to molecular orbital integral transformations essential for post-SCF methods, providing both in-core and out-of-core algorithms for different system sizes and memory requirements.
3
4
## Capabilities
5
6
### General Transformations
7
8
Core functions for transforming 2-electron integrals from atomic orbital to molecular orbital basis.
9
10
```python { .api }
11
def kernel(eri_or_mol, mo_coeffs, erifile=None, dataname='eri_mo', intor='int2e', **kwargs):
12
"""
13
General AO→MO integral transformation.
14
15
Parameters:
16
- eri_or_mol: ndarray or Mole, AO integrals or molecule object
17
- mo_coeffs: ndarray or tuple, MO coefficients for transformation
18
- erifile: str, output file for transformed integrals
19
- dataname: str, dataset name in output file
20
- intor: str, integral type ('int2e', 'int2e_spinor', etc.)
21
22
Returns:
23
ndarray or str, transformed integrals or filename
24
"""
25
26
def full(eri_or_mol, mo_coeff, erifile=None, dataname='eri_mo', intor='int2e', **kwargs):
27
"""
28
Full 4-index (ij|kl) integral transformation.
29
30
Transform all four indices using the same MO coefficients.
31
Most common transformation for post-SCF methods.
32
"""
33
34
def general(eri_or_mol, mo_coeffs, erifile=None, dataname='eri_mo', intor='int2e', **kwargs):
35
"""
36
General transformation with different orbital sets.
37
38
Parameters:
39
- mo_coeffs: tuple of 4 arrays, MO coefficients for each index
40
41
Allows different orbital spaces for each integral index,
42
useful for excited states and response properties.
43
"""
44
```
45
46
### Specialized Transformations
47
48
```python { .api }
49
def get_ao_eri(mol, aosym='s1', **kwargs):
50
"""
51
Get atomic orbital 2-electron repulsion integrals.
52
53
Parameters:
54
- mol: Mole object
55
- aosym: str, symmetry ('s1', 's4', 's8')
56
57
Returns:
58
ndarray, AO 2-electron integrals
59
"""
60
61
def restore(eri_mo, norb, tao):
62
"""
63
Restore packed integral arrays to full format.
64
65
Parameters:
66
- eri_mo: ndarray, packed MO integrals
67
- norb: int, number of orbitals
68
- tao: ndarray, transformation coefficients
69
70
Returns:
71
ndarray, restored integrals
72
"""
73
```
74
75
## Usage Examples
76
77
### Basic Transformations
78
79
```python
80
import pyscf
81
82
# Full transformation for post-SCF
83
mol = pyscf.M(atom='H2O', basis='6-31g')
84
mf = mol.RHF().run()
85
86
# Transform all integrals to MO basis
87
eri_mo = pyscf.ao2mo.full(mol, mf.mo_coeff)
88
print(f"MO integrals shape: {eri_mo.shape}")
89
90
# For large systems, use out-of-core
91
eri_file = pyscf.ao2mo.full(mol, mf.mo_coeff, erifile='h2o_mo.h5')
92
```
93
94
### Different Orbital Spaces
95
96
```python
97
# Separate occupied and virtual orbitals
98
nocc = mol.nelectron // 2
99
mo_occ = mf.mo_coeff[:, :nocc]
100
mo_vir = mf.mo_coeff[:, nocc:]
101
102
# (ov|ov) integrals for MP2
103
eri_ovov = pyscf.ao2mo.general(mol, [mo_occ, mo_vir, mo_occ, mo_vir])
104
105
# Mixed transformations for excited states
106
eri_mixed = pyscf.ao2mo.general(mol, [mo_occ, mo_occ, mo_vir, mo_vir])
107
```
108
109
## Types
110
111
```python { .api }
112
from typing import Union, Tuple
113
from typing_extensions import Literal
114
import numpy as np
115
ndarray = np.ndarray
116
117
# Orbital coefficient specifications
118
MOCoeffs = Union[ndarray, Tuple[ndarray, ...]]
119
120
# Symmetry specifications
121
AOSymmetry = Literal['s1', 's4', 's8']
122
```