10.33. x2c — exact-two-component approach

An example to apply scalar relativistic effects by decorating the scf object with module x2c is shown as following:

from pyscf import gto
from pyscf import scf
mol = gto.M(
    verbose = 0,
    atom = '''8  0  0.     0
              1  0  -0.757 0.587
              1  0  0.757  0.587''',
    basis = 'ccpvdz',
)
mf = scf.RHF(mol).x2c().run()
mol.spin = 1
mol.charge = 1
mol.build(0, 0)
mf = scf.UKS(mol).x2c1e()
energy = mf.kernel()

More examples can be find here:

10.33.1. Examples

Relevant examples examples/x2c/01-spin_free_x2c.py examples/x2c/02-basis_for_x.py examples/x2c/10-picture_change.py

10.33.2. Program reference

10.33.2.1. X2C

pyscf.x2c.x2c.RHF

alias of pyscf.x2c.x2c.X2C_RHF

pyscf.x2c.x2c.RKS

alias of pyscf.x2c.x2c.X2C_RKS

pyscf.x2c.x2c.UHF

alias of pyscf.x2c.x2c.X2C_UHF

pyscf.x2c.x2c.UKS

alias of pyscf.x2c.x2c.X2C_UKS

class pyscf.x2c.x2c.X2C(mol)[source]

2-component X2c (including spin-free and spin-dependent terms) in the j-adapted spinor basis.

get_hcore(mol=None)[source]

2-component X2c Foldy-Wouthuysen (FW) Hamiltonian (including spin-free and spin-dependent terms) in the j-adapted spinor basis.

picture_change(even_operator=(None, None), odd_operator=None)[source]

Picture change for even_operator + odd_operator

even_operator has two terms at diagonal blocks [ v 0 ] [ 0 w ]

odd_operator has the term at off-diagonal blocks [ 0 p ] [ p^T 0 ]

v, w, and p can be strings (integral name) or matrices.

reset(mol)[source]

Reset mol and clean up relevant attributes for scanner mode

class pyscf.x2c.x2c.X2C_RHF(mol)[source]
class pyscf.x2c.x2c.X2C_RKS(mol)[source]
class pyscf.x2c.x2c.X2C_UHF(mol)[source]
analyze(verbose=None)[source]

Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.

dip_moment(mol=None, dm=None, unit='Debye', verbose=3, picture_change=True, **kwargs)[source]

Dipole moment calculation with picture change correction

Args:

mol: an instance of Mole dm : a 2D ndarrays density matrices

Kwarg:

picture_change (bool) : Whether to compute the dipole moment with picture change correction.

Return:

A list: the dipole moment on x, y and z component

get_jk(mol=None, dm=None, hermi=1, with_j=True, with_k=True, omega=None)[source]

Compute J, K matrices for all input density matrices

Args:

mol : an instance of Mole

dmndarray or list of ndarrays

A density matrix or a list of density matrices

Kwargs:
hermiint

Whether J, K matrix is hermitian

0 : not hermitian and not symmetric
1 : hermitian or symmetric
2 : anti-hermitian
vhfopt :

A class which holds precomputed quantities to optimize the computation of J, K matrices

with_jboolean

Whether to compute J matrices

with_kboolean

Whether to compute K matrices

omegafloat

Parameter of range-seperated Coulomb operator: erf( omega * r12 ) / r12. If specified, integration are evaluated based on the long-range part of the range-seperated Coulomb operator.

Returns:

Depending on the given dm, the function returns one J and one K matrix, or a list of J matrices and a list of K matrices, corresponding to the input density matrices.

Examples:

>>> from pyscf import gto, scf
>>> from pyscf.scf import _vhf
>>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1')
>>> dms = numpy.random.random((3,mol.nao_nr(),mol.nao_nr()))
>>> j, k = scf.hf.get_jk(mol, dms, hermi=0)
>>> print(j.shape)
(3, 2, 2)
get_occ(mo_energy=None, mo_coeff=None)[source]

Label the occupancies for each orbital

Kwargs:
mo_energy1D ndarray

Obital energies

mo_coeff2D ndarray

Obital coefficients

Examples:

>>> from pyscf import gto, scf
>>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1')
>>> mf = scf.hf.SCF(mol)
>>> energy = numpy.array([-10., -1., 1, -2., 0, -3])
>>> mf.get_occ(energy)
array([2, 2, 0, 2, 2, 2])
get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1)[source]

Dirac-Coulomb

init_guess_by_atom(mol=None)[source]

Generate initial guess density matrix from superposition of atomic HF density matrix. The atomic HF is occupancy averaged RHF

Returns:

Density matrix, 2D ndarray

init_guess_by_chkfile(chkfile=None, project=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

init_guess_by_minao(mol=None)[source]

Initial guess in terms of the overlap to minimal basis.

make_rdm1(mo_coeff=None, mo_occ=None, **kwargs)[source]

One-particle density matrix in AO representation

Args:
mo_coeff2D ndarray

Orbital coefficients. Each column is one orbital.

mo_occ1D ndarray

Occupancy

class pyscf.x2c.x2c.X2C_UKS(mol)[source]
energy_elec(dm=None, h1e=None, vhf=None)

Electronic part of RKS energy.

Note this function has side effects which cause mf.scf_summary updated.

Args:

ks : an instance of DFT class

dm2D ndarray

one-partical density matrix

h1e2D ndarray

Core hamiltonian

Returns:

RKS electronic energy and the 2-electron contribution

get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1)

Coulomb + XC functional

Note

This function will change the ks object.

Args:
ksan instance of RKS

XC functional are controlled by ks.xc attribute. Attribute ks.grids might be initialized.

dmndarray or list of ndarrays

A density matrix or a list of density matrices

Kwargs:
dm_lastndarray or a list of ndarrays or 0

The density matrix baseline. If not 0, this function computes the increment of HF potential w.r.t. the reference HF potential matrix.

vhf_lastndarray or a list of ndarrays or 0

The reference Vxc potential matrix.

hermiint

Whether J, K matrix is hermitian

0 : no hermitian or symmetric
1 : hermitian
2 : anti-hermitian
Returns:

matrix Veff = J + Vxc. Veff can be a list matrices, if the input dm is a list of density matrices.

pyscf.x2c.x2c.get_hcore(mol)[source]

2-component X2c hcore Hamiltonian (including spin-free and spin-dependent terms) in the j-adapted spinor basis.

pyscf.x2c.x2c.get_jk(mol, dm, hermi=1, mf_opt=None, with_j=True, with_k=True, omega=None)[source]

non-relativistic J/K matrices (without SSO,SOO etc) in the j-adapted spinor basis.

pyscf.x2c.x2c.init_guess_by_1e(mol)[source]

Initial guess from one electron system.

pyscf.x2c.x2c.init_guess_by_atom(mol)[source]

Initial guess from atom calculation.

pyscf.x2c.x2c.init_guess_by_minao(mol)[source]

Initial guess in terms of the overlap to minimal basis.

10.33.2.2. 1e spin-free x2c

1-electron Spin-free X2C approximation

class pyscf.x2c.sfx2c1e.SpinFreeX2C(mol)[source]

1-component X2c (spin-free part only)

get_hcore(mol=None)[source]

1-component X2c Foldy-Wouthuysen (FW Hamiltonian (spin-free part only)

picture_change(even_operator=(None, None), odd_operator=None)[source]

Picture change for even_operator + odd_operator

even_operator has two terms at diagonal blocks [ v 0 ] [ 0 w ]

odd_operator has the term at off-diagonal blocks [ 0 p ] [ p^T 0 ]

v, w, and p can be strings (integral name) or matrices.

pyscf.x2c.sfx2c1e.sfx2c(mf)

Spin-free X2C. For the given SCF object, it updates the hcore constructor. All integrals are computed in the real spherical GTO basis.

Args:

mf : an SCF object

Returns:

An SCF object

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = scf.RHF(mol).sfx2c1e()
>>> mf.scf()
>>> import pyscf.x2c.sfx2c1e
>>> mol.symmetry = 1
>>> mol.build(0, 0)
>>> mf = pyscf.x2c.sfx2c1e.sfx2c1e(scf.UHF(mol))
>>> mf.scf()
pyscf.x2c.sfx2c1e.sfx2c1e(mf)[source]

Spin-free X2C. For the given SCF object, it updates the hcore constructor. All integrals are computed in the real spherical GTO basis.

Args:

mf : an SCF object

Returns:

An SCF object

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = scf.RHF(mol).sfx2c1e()
>>> mf.scf()
>>> import pyscf.x2c.sfx2c1e
>>> mol.symmetry = 1
>>> mol.build(0, 0)
>>> mf = pyscf.x2c.sfx2c1e.sfx2c1e(scf.UHF(mol))
>>> mf.scf()

10.33.2.3. 1e spin-free x2c gradient

Analytical nuclear gradients for 1-electron spin-free x2c method

Ref. JCP 135, 084114 (2011); DOI:10.1063/1.3624397

pyscf.x2c.sfx2c1e_grad.hcore_grad_generator(x2cobj, mol=None)[source]

nuclear gradients of 1-component X2c hcore Hamiltonian (spin-free part only)

10.33.2.4. 1e spin-free x2c hessian

Analytical nuclear hessian for 1-electron spin-free x2c method

Ref. JCP 135, 244104 (2011); DOI:10.1063/1.3667202 JCTC 8, 2617 (2012); DOI:10.1021/ct300127e

pyscf.x2c.sfx2c1e_hess.hcore_hess_generator(x2cobj, mol=None)[source]

nuclear gradients of 1-component X2c hcore Hamiltonian (spin-free part only)