pyscf.x2c package

Submodules

pyscf.x2c.sfx2c1e module

1-electron Spin-free X2C approximation

class pyscf.x2c.sfx2c1e.SpinFreeX2C(mol)

Bases: pyscf.x2c.x2c.X2C

1-component X2c (spin-free part only)

get_hcore(mol=None)

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

get_xmat(mol=None)
hcore_deriv_generator(mol=None, deriv=1)
picture_change(even_operator=(None, None), odd_operator=None)

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)

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_grad module

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

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

pyscf.x2c.sfx2c1e_grad.gen_sf_hfw(mol, approx='1E')
pyscf.x2c.sfx2c1e_grad.hcore_grad_generator(x2cobj, mol=None)

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

pyscf.x2c.sfx2c1e_hess module

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.gen_sf_hfw(mol, approx='1E')
pyscf.x2c.sfx2c1e_hess.hcore_hess_generator(x2cobj, mol=None)

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

pyscf.x2c.x2c module

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)

Bases: pyscf.lib.misc.StreamObject

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

approx = '1e'
basis = None
dump_flags(verbose=None)
get_hcore(mol=None)

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

get_xmat(mol=None)
get_xmol(mol=None)
picture_change(even_operator=(None, None), odd_operator=None)

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)

Reset mol and clean up relevant attributes for scanner mode

xuncontract = True
class pyscf.x2c.x2c.X2C_RHF(mol)

Bases: pyscf.x2c.x2c.X2C_UHF

class pyscf.x2c.x2c.X2C_RKS(mol)

Bases: pyscf.x2c.x2c.X2C_UKS

class pyscf.x2c.x2c.X2C_UHF(mol)

Bases: pyscf.scf.hf.SCF

analyze(verbose=None)

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

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

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

dump_flags(verbose=None)
get_hcore(mol=None)
get_jk(mol=None, dm=None, hermi=1, with_j=True, with_k=True, omega=None)

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)

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_ovlp(mol=None)
get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1)

Dirac-Coulomb

init_direct_scf(mol=None)
init_guess_by_atom(mol=None)

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)

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)

Initial guess in terms of the overlap to minimal basis.

make_rdm1(mo_coeff=None, mo_occ=None, **kwargs)

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)

Bases: pyscf.x2c.x2c.X2C_UHF, pyscf.dft.rks.KohnShamDFT

dump_flags(verbose=None)
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)

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

pyscf.x2c.x2c.get_init_guess(mol, key='minao')
pyscf.x2c.x2c.get_jk(mol, dm, hermi=1, mf_opt=None, with_j=True, with_k=True, omega=None)

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

pyscf.x2c.x2c.init_guess_by_1e(mol)

Initial guess from one electron system.

pyscf.x2c.x2c.init_guess_by_atom(mol)

Initial guess from atom calculation.

pyscf.x2c.x2c.init_guess_by_chkfile(mol, chkfile_name, project=None)
pyscf.x2c.x2c.init_guess_by_minao(mol)

Initial guess in terms of the overlap to minimal basis.

pyscf.x2c.x2c.make_rdm1(mo_coeff, mo_occ, **kwargs)

Module contents