1#!/usr/bin/env python 2 3''' 4SCF module currently does not apply SO-ECP automatically. SO-ECP contributions 5can be added to GHF/GKS core Hamiltonian by overwriding the method get_hcore. 6Since pyscf-2.0 setting attribte with_soc in GHF object can include the 7ECP-SOC integrals in core Hamiltonian. 8 9See also examples/gto/20-soc_ecp.py 10''' 11 12import numpy 13from pyscf import gto, lib 14 15mol = gto.M( 16 verbose = 4, 17 atom = 'C 0 0 0; O 0 0 1.5', 18 basis = {'C': 'crenbl', 'O': 'ccpvdz'}, 19 ecp = {'C': 'crenbl'} 20) 21 22# 23# Adding ECP-SOC contribution to GHF Hamiltonian 24# 25mf = mol.GHF() 26s = .5 * lib.PauliMatrices 27# ECPso evaluates SO-ECP integrals 28# <i| 1j * l U(r)|j> 29# Note to the phase factor -1j to remove the phase 1j above when adding to 30# core Hamiltonian 31ecpso = -1j * lib.einsum('sxy,spq->xpyq', s, mol.intor('ECPso')) 32hcore = mf.get_hcore() + ecpso.reshape(hcore.shape) 33mf.get_hcore = lambda *args: hcore 34mf.kernel() 35 36# 37# Since pyscf-2.0 ECP-SOC can be enabled in GHF object 38# 39mf = mol.GHF() 40mf.with_soc = True 41mf.kernel() 42