pyscf.pbc.lib package#

Submodules#

pyscf.pbc.lib.arnoldi module#

Extension to scipy.linalg module developed for PBC branch.

class pyscf.pbc.lib.arnoldi.Arnoldi(matr_multiply, xStart, inPreCon, nroots=1, tol=1e-06)[source]#

Bases: object

allocateVecs()[source]#
checkConvergence()[source]#
checkDeflate()[source]#
computeResidual()[source]#
constructAllSolV()[source]#
constructDeflatedSub()[source]#
constructSol()[source]#
constructSolAv()[source]#
constructSolV()[source]#
constructSubspace()[source]#
gramSchmidtCurrentVec(northo)[source]#
guessInitial()[source]#
hMult()[source]#
push_Av()[source]#
solve()[source]#
solveSubspace()[source]#
updateVecs()[source]#
pyscf.pbc.lib.arnoldi.davidson_nosymm(matvec, size, nroots, Adiag=None)[source]#

Davidson diagonalization method to solve A c = E c when A is not Hermitian.

pyscf.pbc.lib.chkfile module#

pyscf.pbc.lib.chkfile.load_cell(chkfile)[source]#

Load Cell object from chkfile.

Args:
chkfilestr

Name of chkfile.

Returns:

An (initialized/built) Cell object

Examples:

>>> from pyscf.pbc import gto, scf
>>> cell = gto.Cell()
>>> cell.build(atom='He 0 0 0')
>>> scf.chkfile.save_cell(cell, 'He.chk')
>>> scf.chkfile.load_cell('He.chk')
<pyscf.pbc.gto.cell.Cell object at 0x7fdcd94d7f50>

pyscf.pbc.lib.kpts module#

class pyscf.pbc.lib.kpts.KPoints(cell=None, kpts=array([[0., 0., 0.]]))[source]#

Bases: Symmetry, StreamObject

A symmetry object which handles k-point symmetry.

Parameters#

cellCell instance

Unit cell information.

kpts(nkpts,3) ndarray

K-points in full BZ.

Examples#

>>> cell = gto.M(
...     atom = '''He 0. 0. 0.''',
...     a = numpy.eye(3)*2.0).build()
>>> kpts = KPoints(cell, numpy.array([[0.,0.,0.],[0.5,0.,0.],[0.,0.5,0.],[0.,0.,0.5]]))
>>> kpts.build(space_group_symmetry=True)
>>> print(kpts.kpts_ibz)
[[0.  0.  0. ]
 [0.  0.  0.5]]

Attributes#

cellCell instance

Unit cell information.

verboseint

Print level. Default value is cell.verbose.

time_reversalbool

Whether to consider time-reversal symmetry. For systems with inversion symmetry, time-reversal symmetry is not considered unless spin-orbit coupling is present.

kpts(nkpts,3) ndarray

K-points in full BZ.

kpts_scaled(nkpts,3) ndarray

Scaled k-points in full BZ.

weights(nkpts,) ndarray

Weights of k-points in full BZ.

bz2ibz(nkpts,) ndarray of int

Mapping table from full BZ to IBZ.

kpts_ibz(nkpts_ibz,3) ndarray

K-points in IBZ.

kpts_scaled_ibz(nkpts_ibz,3) ndarray

Scaled k-points in IBZ.

weights_ibz(nkpts_ibz,) ndarray

Weights of k-points in IBZ.

ibz2bz(nkpts_ibz,) ndarray of int

Mapping table from IBZ to full BZ.

k2opk (bz2bz_ks)(nkpts, nop*(time_reversal+1)) ndarray of int

Mapping table between kpts and ops.rot * kpts.

starslist of (nk,) ndarrays of int

Stars of k-points in full BZ with len(stars) = nkpts_ibz and nk is the number of symmetry-related k-points for each k-point in IBZ.

stars_opssame as stars

Indices of rotation operators connecting k points in full BZ and in IBZ.

stars_ops_bz(nkpts,) ndarray of int

Same as stars_ops but arranged in the sequence of k-points in full BZ.

time_reversal_symm_bz(nkpts,) ndarray of int

Whether k-points in BZ and IBZ are related in addition by time-reversal symmetry.

property addition_table#
build(space_group_symmetry=False, time_reversal_symmetry=False, *args, **kwargs)[source]#
check_mo_occ_symmetry(mo_occ, tol=1e-05)#

Check if MO occupations in full BZ have the correct symmetry. If not, raise error; else, return MO occupations in IBZ.

Parameters#

kpts : KPoints object mo_occ : list of (nmo,) ndarray

MO occupations for k-points in full BZ. len(mo_occ) = nkpts

tolfloat

Occupations differ less than tol are considered as the same. Default is 1e-5.

Returns#

mo_occ_ibzlist of (nmo,) ndarray

MO occupations for k-points in IBZ. len(mo_occ_ibz) = nkpts_ibz

Raises#

RuntimeError

If symmetry is broken.

dm_at_ref_cell(dm_ibz)#

Given the density matrices in IBZ, compute the reference cell density matrix.

Parameters#

kpts : KPoints object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Density matrices for k-points in IBZ.

Returns#

dm0([2,] nao, nao) ndarray

Density matrix at reference cell.

dump_info()[source]#
get_kconserv()[source]#

Equivalent to kpts_helper.get_kconserv, but with better performance.

get_rotation_mat_for_mos(mo_coeff, ovlp, k1, k2, ops_id=None)#

Rotation matrices for rotating MO[k1] to MO[k2].

Args:
kptsKPoints instance

K-point object.

mo_coeffarray

MO coefficients.

ovlparray

Overlap matrix in AOs.

k1array like

Indices of the original k-points in the BZ.

k2array like

Indices of the target k-points in the BZ.

ops_idlist, optional

Indices of space group operations. If not given, all the rotations are considered.

Returns:
outlist

Rotation matrices.

index_to_ktuple(k, ntuple)[source]#
property inverse_table#
ktuple_to_index(kk)[source]#
little_cogroup_rep(ki, ir)[source]#
little_cogroups(return_indices=True)[source]#
loop_ktuples(ibz2bz, ntuple)[source]#
make_gdf_kptij_lst_jk()[source]#

Build GDF k-point-pair list for get_jk All combinations:

k_ibz != k_bz k_bz == k_bz

make_k4_ibz(sym='s1', return_ops=False)#
make_kpts_ibz(tol=1e-06)#

Locate k-points in IBZ.

Parameters#

kpts : KPoints object

Notes#

This function modifies the kpts object.

make_ktuples_ibz(kpts_scaled=None, ntuple=2, tol=1e-06)#

Constructe k-point tuples in IBZ.

Parameters#

kpts : KPoints object kpts_scaled : (nkpts, ntuple, 3) ndarray

Input k-points among which symmetry relations are seeked. Default is None, meaning all the k-points in kpts are considered.

ntupleint

Dimension of the tuples. Default is 2.

tolfloat

K-points differ by tol are considered as different. Default is 1e-6.

Returns#

ibz2bz(nibz,) ndarray of int

Mapping table from IBZ to full BZ.

weight_ibz(nibz,) ndarray of int

Weights of each k-point tuple in the IBZ.

bz2ibz(nkpts**ntuple,) ndarray of int

Mapping table from full BZ to IBZ.

starslist of (nibz,) ndarrays of int

Similar as stars.

stars_opslist of (nibz,) ndarrays of int

Similar as stars_ops.

stars_ops_bz(nkpts**ntuple,) ndarray of int

Similar as stars_ops_bz.

property nkpts#
property nkpts_ibz#
symmetrize_density(rhoR_k, ibz_k_idx, mesh)#

Transform real-space densities from IBZ to full BZ

symmetrize_wavefunction(psiR_k, mesh)#

transform real-space wavefunctions from IBZ to full BZ

transform_1e_operator(fock_ibz)#

Transform 1-electron operator from IBZ to full BZ.

Parameters#

kpts : KPoints object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Fock-like matrices for k-points in IBZ.

Returns#

fock_bz([2,] nkpts, nao, nao) ndarray

Fock-like matrices for k-points in full BZ.

transform_dm(dm_ibz)#

Transform density matrices from IBZ to full BZ.

Parameters#

kpts : KPoints object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Density matrices for k-points in IBZ.

Returns#

dm_bz([2,] nkpts, nao, nao) ndarray

Density matrices for k-points in full BZ.

transform_fock(fock_ibz)#

Transform 1-electron operator from IBZ to full BZ.

Parameters#

kpts : KPoints object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Fock-like matrices for k-points in IBZ.

Returns#

fock_bz([2,] nkpts, nao, nao) ndarray

Fock-like matrices for k-points in full BZ.

transform_mo_coeff(mo_coeff_ibz)#

Transform MO coefficients from IBZ to full BZ.

Parameters#

kpts : KPoints object mo_coeff_ibz : ([2,] nkpts_ibz, nao, nmo) ndarray

MO coefficients for k-points in IBZ.

Returns#

mo_coeff_bz([2,] nkpts, nao, nmo) ndarray

MO coefficients for k-points in full BZ.

transform_mo_energy(mo_energy_ibz)#

Transform MO energies from IBZ to full BZ

transform_mo_occ(mo_occ_ibz)#

Transform MO occupations from IBZ to full BZ

transform_single_mo_coeff(mo_coeff_ibz, k)#

Get MO coefficients for a single k-point in full BZ.

Parameters#

kpts : KPoints object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarray

MO coefficients for k-points in IBZ.

kint

Index of the k-point in full BZ.

Returns#

mo_coeff_bz(nao, nmo) ndarray

MO coefficients for the k-th k-point in full BZ.

class pyscf.pbc.lib.kpts.KQuartets(kpts)[source]#

Bases: object

The class holding the symmetry relations between k-quartets.

build()[source]#
cache_stabilizer()[source]#
loop_stabilizer(index)[source]#
class pyscf.pbc.lib.kpts.MORotationMatrix(kpts, mo_coeff, ovlp, nocc, nmo)[source]#

Bases: object

The class holding the rotation matrices that transform MOs from one k-point to another.

build()[source]#
pyscf.pbc.lib.kpts.check_mo_occ_symmetry(kpts, mo_occ, tol=1e-05)[source]#

Check if MO occupations in full BZ have the correct symmetry. If not, raise error; else, return MO occupations in IBZ.

Parameters#

kpts : KPoints object mo_occ : list of (nmo,) ndarray

MO occupations for k-points in full BZ. len(mo_occ) = nkpts

tolfloat

Occupations differ less than tol are considered as the same. Default is 1e-5.

Returns#

mo_occ_ibzlist of (nmo,) ndarray

MO occupations for k-points in IBZ. len(mo_occ_ibz) = nkpts_ibz

Raises#

RuntimeError

If symmetry is broken.

pyscf.pbc.lib.kpts.dm_at_ref_cell(kpts, dm_ibz)[source]#

Given the density matrices in IBZ, compute the reference cell density matrix.

Parameters#

kpts : KPoints object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Density matrices for k-points in IBZ.

Returns#

dm0([2,] nao, nao) ndarray

Density matrix at reference cell.

pyscf.pbc.lib.kpts.get_rotation_mat_for_mos(kpts, mo_coeff, ovlp, k1, k2, ops_id=None)[source]#

Rotation matrices for rotating MO[k1] to MO[k2].

Args:
kptsKPoints instance

K-point object.

mo_coeffarray

MO coefficients.

ovlparray

Overlap matrix in AOs.

k1array like

Indices of the original k-points in the BZ.

k2array like

Indices of the target k-points in the BZ.

ops_idlist, optional

Indices of space group operations. If not given, all the rotations are considered.

Returns:
outlist

Rotation matrices.

pyscf.pbc.lib.kpts.make_k4_ibz(kpts, sym='s1', return_ops=False)[source]#
pyscf.pbc.lib.kpts.make_kpts(cell, kpts=array([[0., 0., 0.]]), space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)[source]#

A wrapper function to build the KPoints object.

Parameters#

cellCell instance

Unit cell information.

kpts(nkpts,3) ndarray

K-points in full BZ.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

time_reversal_symmetrybool

Whether to consider time reversal symmetry. Default is False.

Examples#

>>> cell = gto.M(
...     atom = '''He 0. 0. 0.''',
...     a = numpy.eye(3)*2.0).build()
>>> kpts = make_kpts(cell,
...                  numpy.array([[0.,0.,0.],
...                               [0.5,0.,0.],
...                               [0.,0.5,0.],
...                               [0.,0.,0.5]]),
...                  space_group_symmetry=True)
>>> print(kpts.kpts_ibz)
[[0.  0.  0. ]
 [0.  0.  0.5]]
pyscf.pbc.lib.kpts.make_kpts_ibz(kpts, tol=1e-06)[source]#

Locate k-points in IBZ.

Parameters#

kpts : KPoints object

Notes#

This function modifies the kpts object.

pyscf.pbc.lib.kpts.make_ktuples_ibz(kpts, kpts_scaled=None, ntuple=2, tol=1e-06)[source]#

Constructe k-point tuples in IBZ.

Parameters#

kpts : KPoints object kpts_scaled : (nkpts, ntuple, 3) ndarray

Input k-points among which symmetry relations are seeked. Default is None, meaning all the k-points in kpts are considered.

ntupleint

Dimension of the tuples. Default is 2.

tolfloat

K-points differ by tol are considered as different. Default is 1e-6.

Returns#

ibz2bz(nibz,) ndarray of int

Mapping table from IBZ to full BZ.

weight_ibz(nibz,) ndarray of int

Weights of each k-point tuple in the IBZ.

bz2ibz(nkpts**ntuple,) ndarray of int

Mapping table from full BZ to IBZ.

starslist of (nibz,) ndarrays of int

Similar as stars.

stars_opslist of (nibz,) ndarrays of int

Similar as stars_ops.

stars_ops_bz(nkpts**ntuple,) ndarray of int

Similar as stars_ops_bz.

pyscf.pbc.lib.kpts.map_k_points_fast(kpts_scaled, ops, tol=1e-06)[source]#

Find symmetry-related k-points.

Parameters#

kpts_scaled(nkpts, 3) ndarray

Scaled k-points.

ops(nop, 3, 3) ndarray of int

Rotation operators.

tolfloat

K-points differ by tol are considered as different. Default is 1e-6.

Returns#

bz2bz_ks(nkpts, nop) ndarray of int

mapping table between k and op*k. bz2bz_ks[k1,s] = k2 if ops[s] * kpts_scaled[k1] = kpts_scaled[k2] + K, where K is a reciprocal lattice vector.

pyscf.pbc.lib.kpts.map_kpts_tuples(kpts_scaled, ops, ntuple=2, tol=1e-06)[source]#

Find symmetry-related k-point tuples.

Parameters#

kpts_scaled(nkpts, ntuple, 3) ndarray

Scaled k-point tuples.

ops(nop, 3, 3) ndarray of int

Rotation operators.

ntupleint

Dimension of tuples. Default is 2.

tolfloat

K-points differ less than tol are considered as the same. Default is 1e-6.

Returns#

bz2bz_ks(nkpts, nop) ndarray of int

mapping table between k and op*k. bz2bz_ks[k1,s] = k2 if ops[s] * kpts_scaled[k1] = kpts_scaled[k2] + K, where K is a reciprocal lattice vector.

pyscf.pbc.lib.kpts.symmetrize_density(kpts, rhoR_k, ibz_k_idx, mesh)[source]#

Transform real-space densities from IBZ to full BZ

pyscf.pbc.lib.kpts.symmetrize_wavefunction(kpts, psiR_k, mesh)[source]#

transform real-space wavefunctions from IBZ to full BZ

pyscf.pbc.lib.kpts.transform_1e_operator(kpts, fock_ibz)[source]#

Transform 1-electron operator from IBZ to full BZ.

Parameters#

kpts : KPoints object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Fock-like matrices for k-points in IBZ.

Returns#

fock_bz([2,] nkpts, nao, nao) ndarray

Fock-like matrices for k-points in full BZ.

pyscf.pbc.lib.kpts.transform_dm(kpts, dm_ibz)[source]#

Transform density matrices from IBZ to full BZ.

Parameters#

kpts : KPoints object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Density matrices for k-points in IBZ.

Returns#

dm_bz([2,] nkpts, nao, nao) ndarray

Density matrices for k-points in full BZ.

pyscf.pbc.lib.kpts.transform_fock(kpts, fock_ibz)#

Transform 1-electron operator from IBZ to full BZ.

Parameters#

kpts : KPoints object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarray

Fock-like matrices for k-points in IBZ.

Returns#

fock_bz([2,] nkpts, nao, nao) ndarray

Fock-like matrices for k-points in full BZ.

pyscf.pbc.lib.kpts.transform_mo_coeff(kpts, mo_coeff_ibz)[source]#

Transform MO coefficients from IBZ to full BZ.

Parameters#

kpts : KPoints object mo_coeff_ibz : ([2,] nkpts_ibz, nao, nmo) ndarray

MO coefficients for k-points in IBZ.

Returns#

mo_coeff_bz([2,] nkpts, nao, nmo) ndarray

MO coefficients for k-points in full BZ.

pyscf.pbc.lib.kpts.transform_mo_coeff_k(kpts, mo_coeff_ibz, k)[source]#

Get MO coefficients for a single k-point in full BZ.

Parameters#

kpts : KPoints object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarray

MO coefficients for k-points in IBZ.

kint

Index of the k-point in full BZ.

Returns#

mo_coeff_bz(nao, nmo) ndarray

MO coefficients for the k-th k-point in full BZ.

pyscf.pbc.lib.kpts.transform_mo_energy(kpts, mo_energy_ibz)[source]#

Transform MO energies from IBZ to full BZ

pyscf.pbc.lib.kpts.transform_mo_occ(kpts, mo_occ_ibz)[source]#

Transform MO occupations from IBZ to full BZ

pyscf.pbc.lib.kpts.transform_single_mo_coeff(kpts, mo_coeff_ibz, k)#

Get MO coefficients for a single k-point in full BZ.

Parameters#

kpts : KPoints object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarray

MO coefficients for k-points in IBZ.

kint

Index of the k-point in full BZ.

Returns#

mo_coeff_bz(nao, nmo) ndarray

MO coefficients for the k-th k-point in full BZ.

pyscf.pbc.lib.kpts_helper module#

exception pyscf.pbc.lib.kpts_helper.KPointSymmetryError[source]#

Bases: RuntimeError

class pyscf.pbc.lib.kpts_helper.KptsHelper(cell, kpts, init_symm_map=True)[source]#

Bases: StreamObject

build_symm_map(kptlist=None)[source]#
transform_symm(eri_kpt, kp, kq, kr)[source]#

Return the symmetry-related ERI at any set of k-points.

Args:
eri_kpt(nmo,nmo,nmo,nmo) ndarray

An in-cell ERI calculated with a set of symmetry-unique k-points.

kp, kq, krint

The indices of the k-points at which the ERI is desired.

class pyscf.pbc.lib.kpts_helper.VectorComposer(dtype)[source]#

Bases: object

flush()[source]#

Composes the vector. Returns:

The composed vector.

put(a)[source]#

Puts array into vector. Args:

a (ndarray): array to put;

class pyscf.pbc.lib.kpts_helper.VectorSplitter(vector)[source]#

Bases: object

get(destination, slc=None)[source]#

Retrieves the next array. Args:

destination: the shape of the destination array or the destination array itself; slc: an optional slice;

Returns:

The array.

truncate()[source]#

Truncates the data vector.

pyscf.pbc.lib.kpts_helper.check_kpt_antiperm_symmetry(array, idx1, idx2, tolerance=1e-08)[source]#

Checks antipermutational symmetry for k-point array.

Checks whether an array with k-point symmetry has antipermutational symmetry with respect to switching the particle indices idx1, idx2. The particle indices switches both the orbital index and k-point index associated with the two indices.

Note:

One common reason for not obeying antipermutational symmetry in a calculation involving FFTs is that the grid to perform the FFT may be too coarse. This symmetry is present in operators in spin-orbital form and ‘spin-free’ operators.

array (ndarray): array to test permutational symmetry, where for

an n-particle array, the first (2n-1) array elements are kpoint indices while the final 2n array elements are orbital indices.

idx1 (int): first index idx2 (int): second index

Examples:
For a 3-particle array, such as the T3 amplitude

t3[ki, kj, kk, ka, kb, i, j, a, b, c],

setting idx1 = 0 and idx2 = 1 would switch the orbital indices i, j as well as the kpoint indices ki, kj.

>>> nkpts, nocc, nvir = 3, 4, 5
>>> t2 = numpy.random.random_sample((nkpts, nkpts, nkpts, nocc, nocc, nvir, nvir))
>>> t2 = t2 + t2.transpose(1,0,2,4,3,5,6)
>>> check_kpt_antiperm_symmetry(t2, 0, 1)
True
pyscf.pbc.lib.kpts_helper.conj_mapping(cell, kpts)[source]#

Find the mapping index: -kpts = kpts[index]

pyscf.pbc.lib.kpts_helper.gamma_point(kpt)#
pyscf.pbc.lib.kpts_helper.get_kconserv(cell, kpts)[source]#

Get the momentum conservation array for a set of k-points.

Given k-point indices (k, l, m) the array kconserv[k,l,m] returns the index n that satisfies momentum conservation,

(k(k) - k(l) + k(m) - k(n)) dot a = 2npi

This is used for symmetry e.g. integrals of the form

[phi*[k](1) phi[l](1) | phi*[m](2) phi[n](2)]

are zero unless n satisfies the above.

pyscf.pbc.lib.kpts_helper.get_kconserv3(cell, kpts, kijkab)[source]#

Get the momentum conservation array for a set of k-points.

This function is similar to get_kconserv, but instead finds the ‘kc’ that satisfies momentum conservation for 5 k-points,

(ki + kj + kk - ka - kb - kc) dot a = 2npi

where these kpoints are stored in kijkab[ki, kj, kk, ka, kb].

pyscf.pbc.lib.kpts_helper.get_kconserv_ria(cell, kpts)[source]#

Get the momentum conservation array for single excitation amplitudes for a set of k-points with appropriate k-shift.

Given k-point indices m the array kconserv[kshift,m] returns the index n that satisfies a shifted momentum conservation,

(k(m) - k(n) - k(kshift)) dot a = 2npi

This is used in CIS/EOM-CCSD where the single excitation amplitudes

r_{i k(m)}^{a k(n)}

are zero unless n satisfies the above.

pyscf.pbc.lib.kpts_helper.group_by_conj_pairs(cell, kpts, wrap_around=True, return_kpts_pairs=True)[source]#

Find all conjugation k-point pairs in the input kpts. This function lables three types of conjugation. 1. self-conjugated. The two index in idx_pairs have the same value. 2. conjugated to the k-point within the input kpts. The indices of conjugated k-points are held in idx_pairs. 3. conjugated to the k-point not inside the input kpts. The record is (index, None).

pyscf.pbc.lib.kpts_helper.intersection(kpts1, kpts2)[source]#

Return the indices of the common k-points in kpts1

pyscf.pbc.lib.kpts_helper.is_gamma_point(kpt)#
pyscf.pbc.lib.kpts_helper.is_zero(kpt)[source]#
pyscf.pbc.lib.kpts_helper.kk_adapted_iter(cell, kpts, kk_idx=None, time_reversal_symmetry=True)[source]#

Generates kpt which is adapted to the kpt_p in (ij|p)

pyscf.pbc.lib.kpts_helper.loop_kkk(nkpts)[source]#
pyscf.pbc.lib.kpts_helper.member(kpt, kpts)[source]#

Return the indices of the common k-points in kpts

pyscf.pbc.lib.kpts_helper.members_with_wrap_around(cell, kpts, test_kpts)[source]#

Search the indices of kpts in first Brillouin zone. [where(k==test_kpts) for k in kpts]

kptsarray_like

kpts to index

test_kptsarray_like

The values against which to index each value of kpts.

pyscf.pbc.lib.kpts_helper.round_to_fbz(kpts, wrap_around=False, tol=1e-06)[source]#

Round scaled k-points to the first Brillouin zone.

Args:
kpts(…,3) ndarray

Scaled k-points.

wrap_aroundbool

If set to True, k-points are rounded to [-0.5, 0.5), otherwise [0.0, 1.0). Default value is False.

tolfloat

K-points differ less than tol are considered as the same. Default value is 1e-6.

pyscf.pbc.lib.kpts_helper.unique(kpts)[source]#

Find the unique k-points

Returns the sorted unique k-points, the indices of the input that give the unique elements, and the indices of the unique k-points that reconstruct the input.

pyscf.pbc.lib.kpts_helper.unique_with_wrap_around(cell, kpts)[source]#

Search unique kpts in first Brillouin zone.

pyscf.pbc.lib.ktensor module#

class pyscf.pbc.lib.ktensor.KsymmArray(subarray_shape, dtype=<class 'float'>, subarray_order='C', metadata={}, init_with_zeros=False)[source]#

Bases: NDArrayOperatorsMixin

property dtype#
static fromdense(arr, shape, dtype=None, order=None, metadata=None)[source]#
static fromraw(arr, shape, dtype=None, order=None, metadata=None)[source]#
property ndim#
property shape#
property subarray_ndim#
property subarray_order#
property subarray_shape#
todense()[source]#
static zeros(shape, dtype=<class 'float'>, order='C', metadata=None)[source]#
pyscf.pbc.lib.ktensor.empty(shape, dtype=<class 'float'>, order='C', metadata=None)[source]#
pyscf.pbc.lib.ktensor.empty_like(a, *args, **kwargs)[source]#
pyscf.pbc.lib.ktensor.fromdense(arr, shape, dtype=None, order=None, metadata=None)#
pyscf.pbc.lib.ktensor.fromraw(arr, shape, dtype=None, order=None, metadata=None)#
pyscf.pbc.lib.ktensor.index_to_coords(key, shape)[source]#
pyscf.pbc.lib.ktensor.set_2d(arr, value, kpts, ki)[source]#
pyscf.pbc.lib.ktensor.set_4d(arr, value, kpts, kqrts, klc)[source]#
pyscf.pbc.lib.ktensor.slice_to_coords(k, n)[source]#
pyscf.pbc.lib.ktensor.transform_2d(arr, kpts, ki, rmat, label, trans)[source]#
pyscf.pbc.lib.ktensor.transform_4d(arr, kpts, kqrts, klc, rmat, label, trans)[source]#
pyscf.pbc.lib.ktensor.zeros(shape, dtype=<class 'float'>, order='C', metadata=None)#

pyscf.pbc.lib.linalg_helper module#

Extension to scipy.linalg module developed for PBC branch.

class pyscf.pbc.lib.linalg_helper.Arnoldi(matr_multiply, xStart, inPreCon, nroots=1, tol=1e-10)[source]#

Bases: object

allocateVecs()[source]#
checkConvergence()[source]#
checkDeflate()[source]#
computeResidual()[source]#
constructAllSolV()[source]#
constructDeflatedSub()[source]#
constructSol()[source]#
constructSolAv()[source]#
constructSolV()[source]#
constructSubspace()[source]#
gramSchmidtCurrentVec(northo)[source]#
guessInitial()[source]#
hMult()[source]#
push_Av()[source]#
solve()[source]#
solveSubspace()[source]#
updateVecs()[source]#
class pyscf.pbc.lib.linalg_helper.DavidsonZL[source]#

Bases: object

genMatrix()[source]#
genV0()[source]#
matvecs(vlst)[source]#
solve_full()[source]#
solve_iter()[source]#
pyscf.pbc.lib.linalg_helper.davidson(mult_by_A, N, neig, x0=None, Adiag=None, verbose=4)[source]#

Diagonalize a matrix via non-symmetric Davidson algorithm.

mult_by_A() is a function which takes a vector of length N

and returns a vector of length N.

neig is the number of eigenvalues requested

pyscf.pbc.lib.linalg_helper.davidson_guess(mult_by_A, N, neig, Adiag=None)[source]#

Diagonalize a matrix via non-symmetric Davidson algorithm.

mult_by_A() is a function which takes a vector of length N

and returns a vector of length N.

neig is the number of eigenvalues requested

Targets the first nroots closest in amplitude to the first nroots of the basis. This is useful for the QP peaks in IP/EA.

pyscf.pbc.lib.linalg_helper.diagonalize_asymm(H)[source]#

Diagonalize a real, asymmetric matrix and return sorted results.

Return the eigenvalues and eigenvectors (column matrix) sorted from lowest to highest eigenvalue.

pyscf.pbc.lib.linalg_helper.eigGeneral(Hmat)[source]#
pyscf.pbc.lib.linalg_helper.eigs(matvec, size, nroots, x0=None, Adiag=None, guess=False, verbose=4)[source]#

Davidson diagonalization method to solve A c = E c when A is not Hermitian.

pyscf.pbc.lib.linalg_helper.mgs_ortho(vlst, rlst, crit_indp, iop=0)[source]#
pyscf.pbc.lib.linalg_helper.realRepresentation(vl, vr, nred)[source]#
pyscf.pbc.lib.linalg_helper.svd_cut(mat, thresh)[source]#

Module contents#