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

class pyscf.pbc.lib.kpts_helper.KptsHelper(cell, kpts)[source]

Bases: pyscf.lib.misc.StreamObject

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.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 satifies 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.is_zero(kpt)[source]
pyscf.pbc.lib.kpts_helper.loop_kkk(nkpts)[source]
pyscf.pbc.lib.kpts_helper.member(kpt, kpts)[source]
pyscf.pbc.lib.kpts_helper.unique(kpts)[source]

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