vayesta.misc

Subpackages

Submodules

vayesta.misc.brueckner

vayesta.misc.brueckner.update_mo_coeff(mo_coeff, t1, ovlp=None, damping=0.0, diis=None)[source]
vayesta.misc.brueckner.update_mf(mf, t1, mo_coeff=None, inplace=False, canonicalize=True, damping=0.0, diis=None)[source]

Update occupied MOs based on T1 amplitudes, to converge to Brueckner MOs.

Parameters:
  • mf (pyscf.scf.SCF) – Mean-field object.

  • t1 ((n(Occ), n(Vir)) array) – T1 amplitudes (i.e. C1 in intermediate normalization).

  • mo_coeff ((n(AO), n(MO)) array, optional) – Molecular orbital coefficients. If None, mf.mo_coeff is used. Default: None.

  • inplace (bool, optional) – If True, the mf object is updated inplace and the previous MO coefficients are overwritten. Default: False.

  • canonicalize (bool or str, optional) – Diagonalize the Fock matrix within the new occupied and virtual space, to obtain quasi-canonical orbitals. Default: False.

Returns:

mf – Mean-field object with updated mf.mo_coeff and mf.e_tot

Return type:

pyscf.scf.SCF

vayesta.misc.corrfunc

Correlation function

vayesta.misc.corrfunc.chargecharge(dm1, dm2, proj1=None, proj2=None, subtract_indep=True)[source]
vayesta.misc.corrfunc.spin_z(dm1, proj=None)[source]
vayesta.misc.corrfunc.spin_z_unrestricted(dm1, proj=None)[source]
vayesta.misc.corrfunc.spinspin_z(dm1, dm2, proj1=None, proj2=None)[source]
vayesta.misc.corrfunc.spinspin_z_unrestricted(dm1, dm2, proj1=None, proj2=None)[source]
vayesta.misc.corrfunc.chargecharge_mf(dm1, proj1=None, proj2=None, subtract_indep=True)[source]
vayesta.misc.corrfunc.spinspin_z_mf(dm1, proj1=None, proj2=None)[source]
vayesta.misc.corrfunc.spinspin_z_mf_unrestricted(dm1, proj1=None, proj2=None)[source]

vayesta.misc.counterpoise

vayesta.misc.counterpoise.make_cp_mol(mol, atom, rmax, nimages=1, unit='A', **kwargs)[source]

Make molecule object for counterposise calculation.

WARNING: This has only been tested for periodic systems so far!

Parameters:
  • mol (pyscf.gto.Mole or pyscf.pbc.gto.Cell object) – PySCF molecule or cell object.

  • atom (int) – Atom index for which the counterpoise correction should be calculated. TODO: allow list of atoms.

  • rmax (float) – All atom centers within range rmax are added as ghost-atoms in the counterpoise correction.

  • nimages (int, optional) – Number of neighboring unit cell in each spatial direction. Has no effect in open boundary calculations. Default: 1.

  • unit (['A', 'B', 'a1', 'a2', 'a3']) – Unit for rmax, either Angstrom (A), Bohr (B), or a lattice vector (‘a1’, ‘a2’, ‘a3’).

  • **kwargs – Additional keyword arguments for returned PySCF Mole/Cell object.

Returns:

mol_cp – Mole or Cell object with periodic boundary conditions removed and with ghost atoms added depending on rmax and nimages.

Return type:

pyscf.gto.Mole or pyscf.pbc.gto.Cell

vayesta.misc.cptbisect

class vayesta.misc.cptbisect.ChempotBisection(func, cpt_init=0.0, tol=1e-08, maxiter=30, robust=False, log=None)[source]

Bases: object

kernel(*args, **kwargs)[source]

vayesta.misc.cubefile

Modified from PySCF - at the moment only for PBC systems

class vayesta.misc.cubefile.CubeFile(cell, filename=None, gridsize=(100, 100, 100), resolution=None, title=None, comment=None, fmt='%13.5E', crop=None)[source]

Bases: object

property has_pbc
get_box_and_origin()[source]
get_coords()[source]
property ncoords

Number of grod points.

property nfields

Number of datasets (orbitals + density matrices).

save_state(filename)[source]
classmethod load_state(filename, cell=None)[source]
add_orbital(coeff, dset_idx=None)[source]

Add one or more orbitals to the cube file.

Parameters:
  • coeff – AO coefficients of orbitals. Supports adding a single orbitals, where coeff is a one-dimensional array, or multiple orbitals, in which case the second dimension of coeff labels the orbitals.

  • dset_idx (int, optional) – Dataset index of orbital(s). In the application, the orbitals will be labelled as ‘Orbital <dset_idx>’ or similar. If set to None, the smallest unused, positive integer will be used. Default: None.

add_density(dm, dset_idx=None)[source]

Add one or more densities to the cube file.

Parameters:
  • dm ((N,N) or (M,N,N) array) – Density-matrix in AO-representation. Supports adding a single density-matrix, where dm is a two-dimensional array, or multiple density-matrices, in which case the first dimension of dm labels the matrices.

  • dset_idx (int, optional) – Dataset index of density-matrix. In the application, the density-matrix will be labelled as ‘Orbital <dset_idx>’ or similar. If set to None, the smallest unused, positive integer will be used. Default: None.

add_mep(dm, dset_idx=None)[source]
write(filename=None)[source]
write_header(filename, dset_ids=None)[source]

Write header of cube-file.

write_fields(filename)[source]

Write voxel data of registered fields in self.fields to cube-file.

vayesta.misc.gto_helper

vayesta.misc.gto_helper.loop_neighbor_cells(lattice_vectors=None, dimension=3)[source]
vayesta.misc.gto_helper.get_atom_distances(mol, point, dimension=None)[source]

Get array containing the distances of all atoms to the specified point.

Parameters:
  • mol (PySCF Mole or Cell object) –

  • point (Array(3)) –

Returns:

Distances

Return type:

Array(n(atom))

vayesta.misc.gto_helper.get_atom_shells(mol, point, dimension=None, decimals=5)[source]
vayesta.misc.gto_helper.make_counterpoise_fragments(mol, fragments, full_basis=True, add_rest_fragment=True, dump_input=True)[source]

Make mol objects for counterpoise calculations.

Parameters:
  • fragments (iterable) –

  • full_basis (bool, optional) –

  • add_rest_fragment (bool, optional) –

Returns:

fmols

Return type:

list

vayesta.misc.pcdiis

class vayesta.misc.pcdiis.PCDIIS(pref, *args, **kwargs)[source]

Bases: DIIS

https://doi.org/10.1021/acs.jctc.7b00892

update(x)[source]

Extrapolate vector

  • If xerr the error vector is given, this function will push the target

vector and error vector in the DIIS subspace, and use the error vector to extrapolate the vector and return the extrapolated vector. * If xerr is None, this function will take the difference between the current given vector and the last given vector as the error vector to extrapolate the vector.

extrapolate(nd=None)
get_err_vec(idx)
get_num_vec()
get_vec(idx)
push_err_vec(xerr)
push_vec(x)
restore(filename, inplace=True)

Read diis contents from a diis file and replace the attributes of current diis object if needed, then construct the vector.

to_gpu(out=None)

Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.

Module contents