0
# Specialized Methods
1
2
Advanced techniques including relativistic methods, solvation models, QM/MM interfaces, and computational acceleration methods for specialized quantum chemistry applications.
3
4
## Capabilities
5
6
### Relativistic Methods
7
8
Methods for treating relativistic effects in heavy element systems including scalar and spin-orbit coupling.
9
10
```python { .api }
11
class X2C:
12
"""
13
Exact two-component relativistic method.
14
15
Provides scalar relativistic effects through exact decoupling
16
of positive/negative energy states with 2-component efficiency.
17
"""
18
19
def __init__(self, mol):
20
"""Initialize X2C method."""
21
22
def RHF(self):
23
"""X2C enhanced restricted Hartree-Fock."""
24
25
def sfx2c1e(mf):
26
"""
27
Spin-free X2C with 1-electron X-matrix approximation.
28
29
Efficient scalar relativistic treatment including effects
30
only in 1-electron integrals.
31
"""
32
```
33
34
### Solvation Models
35
36
Implicit solvation methods for modeling solvent effects on molecular properties and reactions.
37
38
```python { .api }
39
class PCM:
40
"""
41
Polarizable Continuum Model.
42
43
Treats solvent as continuous dielectric medium with
44
molecular-shaped cavity for solute.
45
46
Attributes:
47
- eps: float, solvent dielectric constant
48
- method: str, PCM variant ('IEF-PCM', 'SS(V)PE', 'C-PCM')
49
"""
50
51
class COSMO:
52
"""
53
Conductor-like Screening Model.
54
55
Approximates solvent as conductor with dielectric scaling
56
for realistic solvent response.
57
"""
58
59
class ddCOSMO:
60
"""
61
Domain decomposition COSMO with linear scaling.
62
63
Efficient COSMO implementation with linear scaling
64
for large molecular systems.
65
"""
66
```
67
68
### QM/MM Interface
69
70
Quantum mechanics/molecular mechanics methods for treating large systems with multi-scale approaches.
71
72
```python { .api }
73
class QMMMole:
74
"""
75
QM/MM molecule combining quantum and classical regions.
76
77
Partitions system into QM (high accuracy) and MM (efficiency)
78
regions with proper boundary treatment.
79
80
Attributes:
81
- qm_atoms: list, atoms in QM region
82
- mm_atoms: list, atoms in MM region
83
- qm_charge: float, total charge of QM region
84
"""
85
86
class QMMM:
87
"""
88
QM/MM method interface.
89
90
Handles coupling between quantum mechanical and molecular
91
mechanical descriptions including electrostatic embedding.
92
"""
93
```
94
95
### Density Fitting Acceleration
96
97
Computational acceleration through resolution of identity approximations for large molecule calculations.
98
99
```python { .api }
100
def density_fit(mf, auxbasis=None, with_df=None, only_dfj=False):
101
"""
102
Add density fitting acceleration to SCF method.
103
104
Parameters:
105
- mf: SCF object to enhance
106
- auxbasis: str, auxiliary basis set name
107
- with_df: DF object for custom fitting
108
- only_dfj: bool, fit only Coulomb integrals
109
110
Returns:
111
density-fitted SCF object with reduced computational scaling
112
"""
113
114
class DF:
115
"""
116
Density fitting base class.
117
118
Implements 3-center integral approximation (μν|P) for
119
efficient 4-center integral evaluation.
120
"""
121
122
class GDF:
123
"""
124
Gaussian density fitting.
125
126
Specialized DF implementation for Gaussian basis sets
127
with optimal auxiliary basis selection.
128
"""
129
```
130
131
### Semi-numerical Methods
132
133
Semi-numerical techniques for computational efficiency in large molecular systems.
134
135
```python { .api }
136
def sgx_fit(mol, auxbasis=None):
137
"""
138
Semi-numerical exchange fitting procedure.
139
140
Reduces computational cost of exact exchange evaluation
141
through numerical fitting techniques.
142
"""
143
144
def make_sgx(mf):
145
"""
146
Create semi-numerical exchange object.
147
148
Transforms SCF method to use semi-numerical exchange
149
for improved efficiency in large systems.
150
"""
151
```
152
153
### Advanced Green's Function Methods
154
155
Sophisticated correlation methods using Green's function techniques.
156
157
```python { .api }
158
class GW:
159
"""
160
GW approximation for quasi-particle energies.
161
162
Calculates ionization potentials and electron affinities
163
through self-energy corrections to mean-field results.
164
"""
165
166
class AGF2:
167
"""
168
Auxiliary second-order Green's function method.
169
170
Efficient implementation of self-consistent GF(2)
171
for accurate ionization and excitation energies.
172
"""
173
174
class ADC:
175
"""
176
Algebraic Diagrammatic Construction.
177
178
Systematic approach to excited states through
179
Green's function pole analysis.
180
"""
181
```
182
183
## Usage Examples
184
185
### Relativistic Calculations
186
187
```python
188
import pyscf
189
190
# X2C for heavy elements
191
mol_au = pyscf.M(atom='Au 0 0 0; H 0 0 1.5', basis='cc-pvdz-pp')
192
mf_x2c = pyscf.scf.X2C(mol_au).RHF()
193
mf_x2c.run()
194
print(f"X2C energy: {mf_x2c.e_tot}")
195
196
# Spin-free X2C approximation
197
mf_sfx2c = pyscf.scf.sfx2c1e(mol_au.RHF())
198
mf_sfx2c.run()
199
```
200
201
### Solvation Models
202
203
```python
204
# PCM solvation in water
205
mol = pyscf.M(atom='H2CO', basis='6-31g')
206
mf = mol.RHF()
207
208
# Add PCM solvent
209
mf_pcm = pyscf.solvent.PCM(mf)
210
mf_pcm.eps = 78.4 # water dielectric constant
211
mf_pcm.run()
212
print(f"Solvation energy: {mf_pcm.e_tot - mf.run().e_tot}")
213
214
# ddCOSMO for large systems
215
mf_cosmo = pyscf.solvent.ddCOSMO(mf)
216
mf_cosmo.run()
217
```
218
219
### Density Fitting
220
221
```python
222
# Density fitting for large molecules
223
mol_big = pyscf.M(atom='protein.xyz', basis='6-31g')
224
mf = mol_big.RHF()
225
226
# Add density fitting
227
mf_df = pyscf.scf.density_fit(mf, auxbasis='cc-pvdz-jkfit')
228
mf_df.run()
229
230
# DF for post-SCF methods
231
mp2_df = pyscf.mp.DFMP2(mf_df)
232
mp2_df.run()
233
```
234
235
### QM/MM Calculations
236
237
```python
238
# QM/MM setup
239
mol_system = pyscf.M(atom='large_system.xyz', basis='6-31g')
240
241
# Define QM region (first 10 atoms)
242
qmmm = pyscf.qmmm.QMMM(mol_system, qm_atoms=list(range(10)))
243
mf_qmmm = qmmm.RHF()
244
mf_qmmm.run()
245
```
246
247
## Types
248
249
```python { .api }
250
from typing import List, TypedDict
251
from typing_extensions import Literal
252
253
# Relativistic method types
254
RelativisticMethod = Literal['X2C', 'DKH', 'ZORA']
255
256
# Solvation parameters
257
SolvationParams = TypedDict('SolvationParams', {
258
'eps': float,
259
'eps_inf': float,
260
'method': str
261
})
262
263
# QM/MM region specification
264
QMRegion = List[int] # atom indices
265
MMRegion = List[int] # atom indices
266
```