vayesta.lattmod

Submodules

vayesta.lattmod.bethe

vayesta.lattmod.bethe.hubbard1d_bethe_energy(t, u, interval=(1e-14, 96.60397409788614), **kwargs)[source]

Exact total energy per site for the 1D Hubbard model in the thermodynamic limit.

from DOI: 10.1103/PhysRevB.77.045133.

vayesta.lattmod.bethe.hubbard1d_bethe_docc(t, u, interval=(1e-14, 96.60397409788614), **kwargs)[source]

Exact on-site double occupancy for the 1D Hubbard model in the thermodynamic limit.

vayesta.lattmod.bethe.hubbard1d_bethe_docc_numdiff(t, u, du=1e-10, order=2, **kwargs)[source]

Exact on-site double occupancy for the 1D Hubbard model in the thermodynamic limit.

Calculated from the numerical differentiation of the exact Bethe ansatz energy.

vayesta.lattmod.bethe.hubbard1d_bethe_gap(t, u, interval=(1, 100), **kwargs)[source]

Exact band gap for the 1D Hubbard model at half filling in the thermodynamic limit.

from DOI: 10.1103/PhysRevB.106.045123

vayesta.lattmod.latt

class vayesta.lattmod.latt.LatticeMole(nsite, nelectron=None, spin=0, order=None, incore_anyway=True, verbose=0, output=None)[source]

Bases: Cell

For PySCF compatibility

Needs to implement: a copy() build() intor_cross() intor_symmetric() pbc_intor() basis

? atom_coord unit

property nelectron
spin = 0
incore_anyway = False
property natm
nao_nr()[source]

Total number of contracted GTOs for the given Mole object

ao_labels(fmt=True)[source]

Labels of AO basis functions

Kwargs:
fmtstr or bool

if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-AO-notation)] or formatted strings based on the argument “fmt”

atom_symbol(site)[source]

For the given atom id, return the input symbol (without striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H^2
atom_pure_symbol(site)[source]

For the given atom id, return the standard symbol (striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H
search_ao_label()[source]

Find the index of the AO basis function based on the given ao_label

Parameters:

ao_label – string or a list of strings The regular expression pattern to match the orbital labels returned by mol.ao_labels()

Returns:

A list of index for the AOs that matches the given ao_label RE pattern

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='ccpvtz')
>>> mol.search_ao_label('Cl.*p')
[19 20 21 22 23 24 25 26 27 28 29 30]
>>> mol.search_ao_label('Cl 2p')
[19 20 21]
>>> mol.search_ao_label(['Cl.*d', 'Cl 4p'])
[25 26 27 31 32 33 34 35 36 37 38 39 40]
property Gv
property ao_loc

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_loc_2c()

Offset of every shell in the spinor basis function spectrum

Returns:

list, each entry is the corresponding start id of spinor function

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_2c(mol)
[0, 2, 4, 6, 12, 18, 20, 22, 24, 30, 36]
ao_loc_nr(cart=None)

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_rotation_matrix(orientation)

Matrix u to rotate AO basis to a new orientation.

atom_new_coords = mol.atom_coords().dot(orientation.T) new_AO = u * mol.AO new_orbitals_coef = u.dot(orbitals_coef)

aoslice_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

aoslice_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

aoslice_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

apply(fn, *args, **kwargs)

Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

atom_charge(atm_id)

Nuclear effective charge of the given atom id Note “atom_charge /= charge(atom_symbol)” when ECP is enabled. Number of electrons screened by ECP can be obtained by charge(atom_symbol)-atom_charge

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_charge(1)
17
atom_charges()

np.asarray([mol.atom_charge(i) for i in range(mol.natm)])

atom_coord(atm_id, unit='Bohr')

Coordinates (ndarray) of the given atom id

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_coord(1)
[ 0.          0.          2.07869874]
atom_coords(unit='Bohr')

np.asarray([mol.atom_coord(i) for i in range(mol.natm)])

atom_mass_list(isotope_avg=False)

A list of mass for all atoms in the molecule

Kwargs:
isotope_avgboolean

Whether to use the isotope average mass as the atomic mass

atom_nelec_core(atm_id)

Number of core electrons for pseudo potential.

atom_nshells(atm_id)

Number of basis/shells of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_nshells(1)
5
atom_shell_ids(atm_id)

A list of the shell-ids of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.atom_shell_ids(1)
[3, 4, 5, 6, 7]
bas_angular(bas_id)

The angular momentum associated with the given basis

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
2
bas_atom(bas_id)

The atom (0-based id) that the given basis sits on

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
1
bas_coord(bas_id)

Coordinates (ndarray) associated with the given basis id

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.bas_coord(1)
[ 0.          0.          2.07869874]
bas_ctr_coeff(bas_id)

Contract coefficients (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.M(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_ctr_coeff(0)
[[ 10.03400444]
 [  4.1188704 ]
 [  1.53971186]]
bas_exp(bas_id)

exponents (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(0)
[ 13.01     1.962    0.4446]
bas_exps()

exponents of all basis return [mol.bas_exp(i) for i in range(self.nbas)]

bas_kappa(bas_id)

Kappa (if l < j, -l-1, else l) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(3)
0
bas_len_cart(bas_id)

The number of Cartesian function associated with given basis

bas_len_spinor(bas_id)

The number of spinor associated with given basis If kappa is 0, return 4l+2

bas_nctr(bas_id)

The number of contracted GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
3
bas_nprim(bas_id)

The number of primitive GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
11
bas_rcut(bas_id, precision=None)

Estimate the largest distance between the function and its image to reach the precision in overlap

precision ~ int g(r-0) g(r-Rcut)

build(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

build_lattice_symmetry(check_mesh_symmetry=True)

Build cell.lattice_symmetry object.

Kwargs:
check_mesh_symmetrybool

For nonsymmorphic symmetry groups, cell.mesh may have lower symmetry than the lattice. In this case, if check_mesh_symmetry is True, the lower symmetry group will be used. Otherwise, if check_mesh_symmetry is False, the mesh grid will be modified to satisfy the higher symmetry. Default value is True.

Note

This function modifies the attributes of cell.

cart = False
cart2sph_coeff(normalized='sp')

Transformation matrix that transforms Cartesian GTOs to spherical GTOs for all basis functions

Kwargs:
normalizedstring or boolean

How the Cartesian GTOs are normalized. Except s and p functions, Cartesian GTOs do not have the universal normalization coefficients for the different components of the same shell. The value of this argument can be one of ‘sp’, ‘all’, None. ‘sp’ means the Cartesian s and p basis are normalized. ‘all’ means all Cartesian functions are normalized. None means none of the Cartesian functions are normalized. The default value ‘sp’ is the convention used by libcint library.

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> c = mol.cart2sph_coeff()
>>> s0 = mol.intor('int1e_ovlp_sph')
>>> s1 = c.T.dot(mol.intor('int1e_ovlp_cart')).dot(c)
>>> print(abs(s1-s0).sum())
>>> 4.58676826646e-15
cart_labels(fmt=True, base=0)

Labels of Cartesian GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-xyz-notation)] or formatted strings based on the argument “fmt”

charge = 0
check_sanity()

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

condense_to_shell(mat, compressor='max')

The given matrix is first partitioned to blocks, based on AO shell as delimiter. Then call compressor function to abstract each block.

Parameters:

compressor – string or function if compressor is a string, its value can be sum, max, min, abssum, absmax, absmin, norm

copy(deep=True)

Deepcopy of the given Mole object

Some attributes are shared between the original and copied objects. Deepcopy is utilized here to ensure that operations on the copied object do not affect the original object.

cutoff_to_mesh(ke_cutoff)

Convert KE cutoff to FFT-mesh

Parameters:

ke_cutoff – float KE energy cutoff in a.u.

Returns:

(3,) array

Return type:

mesh

decontract_basis(atoms=None, to_cart=False, aggregate=False)

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with the uncontracted basis environment and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Kwargs:
atoms: list or str

Atoms on which the basis to be decontracted. By default, all basis are decontracted

to_cart: bool

Decontract basis and transfer to Cartesian basis

aggregate: bool

Whether to aggregate the transformation coefficients into a giant transformation matrix

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.decontract_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
property drop_exponent
dump_input()
dumps()

Serialize Cell object to a JSON formatted str.

property elements

A list of elements in the molecule

energy_nuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

property enuc

nuclear repulsion energy

static etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
property ew_cut
property ew_eta
ewald(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

exp_to_discard = None
static expand_etb(l, n, alpha, beta)

Generate the exponents of even tempered basis for Mole.basis. .. math:

e = e^{-\alpha * \beta^{i-1}} for i = 1 .. n
Parameters:
  • l – int Angular momentum

  • n – int Number of GTOs

Returns:

Formatted basis

Examples:

>>> gto.expand_etb(1, 3, 1.5, 2)
[[1, [6.0, 1]], [1, [3.0, 1]], [1, [1.5, 1]]]
static expand_etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
format_atom(atoms, origin=0, axes=None, unit='angstrom')

Convert the input Mole.atom to the internal data format. Including, changing the nuclear charge to atom symbol, converting the coordinates to AU, rotate and shift the molecule. If the atom is a string, it takes “;” and “n” for the mark to separate atoms; “,” and arbitrary length of blank space to separate the individual terms for an atom. Blank line will be ignored.

Parameters:

atoms – list or str the same to Mole.atom

Kwargs:
originndarray

new axis origin.

axesndarray

(new_x, new_y, new_z), new coordinates

unitstr or number

If unit is one of strings (B, b, Bohr, bohr, AU, au), the coordinates of the input atoms are the atomic unit; If unit is one of strings (A, a, Angstrom, angstrom, Ang, ang), the coordinates are in the unit of angstrom; If a number is given, the number are considered as the Bohr value (in angstrom), which should be around 0.53. Set unit=1 if wishing to preserve the unit of the coordinates.

Returns:

“atoms” in the internal format. The internal format is
atom = [[atom1, (x, y, z)],
[atom2, (x, y, z)],
[atomN, (x, y, z)]]

Examples:

>>> gto.format_atom('9,0,0,0; h@1 0 0 1', origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H@1', [-1.0, -1.0, 0.0]]]
>>> gto.format_atom(['9,0,0,0', (1, (0, 0, 1))], origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H', [-1, -1, 0]]]
static format_basis(basis_tab, sort_basis=True)

Convert the input Mole.basis to the internal data format.

``{ atom: [(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..))),

(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..)))], … }``

Parameters:

basis_tab – dict Similar to Mole.basis, it cannot be a str

Returns:

Formatted basis

Examples:

>>> gto.format_basis({'H':'sto-3g', 'H^2': '3-21g'})
{'H': [[0,
    [3.4252509099999999, 0.15432897000000001],
    [0.62391373000000006, 0.53532813999999995],
    [0.16885539999999999, 0.44463454000000002]]],
 'H^2': [[0,
    [5.4471780000000001, 0.15628500000000001],
    [0.82454700000000003, 0.90469100000000002]],
    [0, [0.18319199999999999, 1.0]]]}
>>> gto.format_basis({'H':'gth-szv'})
{'H': [[0,
    (8.3744350009, -0.0283380461),
    (1.8058681460, -0.1333810052),
    (0.4852528328, -0.3995676063),
    (0.1658236932, -0.5531027541)]]}
static format_ecp(ecp_tab)

Convert the input ecp (dict) to the internal data format:

{ atom: (nelec,  # core electrons
((l, # l=-1 for UL, l>=0 for Ul to indicate |l><l|
(((exp_1, c_1), # for r^0

(exp_2, c_2), …),

((exp_1, c_1), # for r^1

(exp_2, c_2), …),

((exp_1, c_1), # for r^2

…))))),

…}

static format_pseudo(pseudo_tab)

Convert the input pseudo (dict) to the internal data format:

{ atom: ( (nelec_s, nele_p, nelec_d, ...),
         rloc, nexp, (cexp_1, cexp_2, ..., cexp_nexp),
         nproj_types,
         (r1, nproj1, ( (hproj1[1,1], hproj1[1,2], ..., hproj1[1,nproj1]),
                        (hproj1[2,1], hproj1[2,2], ..., hproj1[2,nproj1]),
                        ...
                        (hproj1[nproj1,1], hproj1[nproj1,2], ...        ) )),
         (r2, nproj2, ( (hproj2[1,1], hproj2[1,2], ..., hproj2[1,nproj1]),
         ... ) )
         )
 ... }
Parameters:

pseudo_tab – dict Similar to pseudo (a dict), it cannot be a str

Returns:

Formatted pseudo

Examples:

>>> pbc.format_pseudo({'H':'gth-blyp', 'He': 'gth-pade'})
{'H': [[1],
    0.2, 2, [-4.19596147, 0.73049821], 0],
 'He': [[2],
    0.2, 2, [-9.1120234, 1.69836797], 0]}
from_ase(ase_atom)

Update cell based on given ase atom object

Examples:

>>> from ase.lattice import bulk
>>> cell.from_ase(bulk('C', 'diamond', a=LATTICE_CONST))
fromfile(filename, format=None)

Update the Cell object based on the input geometry file

fromstring(string, format='poscar')

Update the Cell object based on the input geometry string

gen_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

get_Gv(mesh=None, **kwargs)

Calculate three-dimensional G-vectors for the cell; see MH (3.8).

Indices along each direction go as [0…N-1, -N…-1] to follow FFT convention.

Parameters:

cell – instance of Cell

Returns:

(ngrids, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_Gv_weights(mesh=None, **kwargs)

Calculate G-vectors and weights.

Returns:

(ngris, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_SI(Gv=None, mesh=None, atmlst=None)

Calculate the structure factor (0D, 1D, 2D, 3D) for all atoms; see MH (3.34).

Parameters:
  • cell – instance of Cell

  • Gv – (N,3) array G vectors

  • atmlst – list of ints, optional Indices of atoms for which the structure factors are computed.

Returns:

(natm, ngrids) ndarray, dtype=np.complex128

The structure factor for each atom at each G-vector.

Return type:

SI

get_abs_kpts(scaled_kpts)

Get absolute k-points (in 1/Bohr), given “scaled” k-points in fractions of lattice vectors.

Parameters:

scaled_kpts – (nkpts, 3) ndarray of floats

Returns:

(nkpts, 3) ndarray of floats

Return type:

abs_kpts

get_ao_indices(bas_list, ao_loc=None)

Generate (dis-continued) AO indices for basis specified in bas_list

get_bounding_sphere(rcut)

Finds all the lattice points within a sphere of radius rcut.

Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3] See Martin p. 85

Parameters:

rcut – number real space cut-off for interaction

Returns:

ndarray of 3 ints defining N_x

Return type:

cut

get_enuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

get_ewald_params(precision=None, mesh=None)

Choose a reasonable value of Ewald ‘eta’ and ‘cut’ parameters. eta^2 is the exponent coefficient of the model Gaussian charge for nucleus at R: frac{eta^3}{pi^1.5} e^{-eta^2 (r-R)^2}

Choice is based on largest G vector and desired relative precision.

The relative error in the G-space sum is given by

precision ~ 4pi Gmax^2 e^{(-Gmax^2)/(4 eta^2)}

which determines eta. Then, real-space cutoff is determined by (exp. factors only)

precision ~ erfc(eta*rcut) / rcut ~ e^{(-eta**2 rcut*2)}

Returns:

float

The Ewald ‘eta’ and ‘cut’ parameters.

Return type:

ew_eta, ew_cut

get_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
get_lattice_Ls(nimgs=None, rcut=None, dimension=None, discard=True)

Get the (Cartesian, unitful) lattice translation vectors for nearby images. The translation vectors can be used for the lattice summation.

Kwargs:
discard:

Drop less important Ls based on AO values on grid

get_nimgs(precision=None)

Choose number of basis function images in lattice sums to include for given precision in overlap, using

precision ~ int r^l e^{-alpha r^2} (r-rcut)^l e^{-alpha (r-rcut)^2} ~ (rcut^2/(2alpha))^l e^{alpha/2 rcut^2}

where alpha is the smallest exponent in the basis. Note that assumes an isolated exponent in the middle of the box, so it adds one additional lattice vector to be safe.

get_overlap_cond(shls_slice=None)

Overlap magnitudes measured by -log(overlap) between two shells

Parameters:

mol – an instance of Mole

Returns:

2D mask array of shape (nbas,nbas)

get_scaled_atom_coords(a=None)

Get scaled atomic coordinates.

get_scaled_kpts(abs_kpts, kpts_in_ibz=True)

Get scaled k-points, given absolute k-points in 1/Bohr.

Parameters:
  • abs_kpts – (nkpts, 3) ndarray of floats or KPoints object

  • kpts_in_ibz – bool If True, return k-points in IBZ; otherwise, return k-points in BZ. Default value is True. This has effects only if abs_kpts is a KPoints object

Returns:

(nkpts, 3) ndarray of floats

Return type:

scaled_kpts

get_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

property gs
gto_norm(l, expnt)

Normalized factor for GTO radial part \(g=r^l e^{-\alpha r^2}\)

\[\frac{1}{\sqrt{\int g^2 r^2 dr}} = \sqrt{\frac{2^{2l+3} (l+1)! (2a)^{l+1.5}}{(2l+2)!\sqrt{\pi}}}\]

Ref: H. B. Schlegel and M. J. Frisch, Int. J. Quant. Chem., 54(1995), 83-87.

Parameters:
  • l (int) – angular momentum

  • expnt – exponent \(\alpha\)

Returns:

normalization factor

Examples:

>>> print(gto_norm(0, 1))
2.5264751109842591
property h
has_ecp()

Whether pseudo potential is used in the system.

has_ecp_soc()

Whether spin-orbit coupling is enabled in ECP.

intor(intor, comp=None, hermi=0, aosym='s1', out=None, shls_slice=None, grids=None)

Integral generator.

Parameters:

intor – str Name of the 1e or 2e AO integrals. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

hermiint

Symmetry of the integrals

0 : no symmetry assumed (default)
1 : hermitian
2 : anti-hermitian
shls_slice4-element, 6-element or 8-element tuple

Label the start-stop shells for each index in the integral. For example, the 8-element tuple for the 2-electron integral tensor (ij|kl) = intor(‘int2e’) are specified as (ish_start, ish_end, jsh_start, jsh_end, ksh_start, ksh_end, lsh_start, lsh_end)

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor('int1e_ipnuc_sph', comp=3) # <nabla i | V_nuc | j>
[[[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.10289944  0.48176097]
  [-0.48176097 -0.10289944]]]
>>> mol.intor('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_asymmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be anti-hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_asymmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j  0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j  0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_by_shell(intor, shells, comp=None, grids=None)

For given 2, 3 or 4 shells, interface for libcint to get 1e, 2e, 2-center-2e or 3-center-2e integrals

Parameters:
  • intor_name – str See also getints() for the supported intor_name

  • shls – list of int The AO shell-ids of the integrals

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

Returns:

ndarray of 2-dim to 5-dim, depending on the integral type (1e, 2e, 3c-2e, 2c2e) and the value of comp

Examples

The gradients of the spherical 2e integrals

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> gto.getints_by_shell('int2e_ip1_sph', (0,1,0,1), mol._atm, mol._bas, mol._env, comp=3)
[[[[[-0.        ]]]]
  [[[[-0.        ]]]]
  [[[[-0.08760462]]]]]
intor_symmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_symmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
kernel(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

lattice_vectors()

Convert the primitive lattice vectors.

Return 3x3 array in which each row represents one direction of the lattice vectors (unit in Bohr)

classmethod loads(molstr)

Deserialize a str containing a JSON document to a Cell object.

loads_(molstr)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

make_atm_env(atom, ptr=0, nucmod=1, nucprop=None)

Convert the internal format Mole._atom to the format required by libcint integrals

make_bas_env(basis_add, atom_id=0, ptr=0)

Convert Mole.basis to the argument bas for libcint integrals

make_ecp_env(_atm, _ecp, pre_env=[])

Generate the input arguments _ecpbas for ECP integrals

make_env(atoms, basis, pre_env=[], nucmod={}, nucprop=None)

Generate the input arguments for libcint library based on internal format Mole._atom and Mole._basis

make_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
max_memory = 4000
property mesh
property ms

Spin quantum number. multiplicity = ms*2+1

property multiplicity
property nao
nao_2c()

Total number of contracted spinor GTOs for the given Mole object

nao_2c_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spinor basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id, 0-based

  • bas_id1 – int stop shell id, 0-based

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_2c_range(mol, 2, 4)
(4, 12)
nao_cart()

Total number of contracted cartesian GTOs for the given Mole object

nao_nr_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spherical basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id

  • bas_id1 – int stop shell id

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_nr_range(mol, 2, 4)
(2, 6)
property nbas
property nelec
property nimgs
npgto_nr(cart=None)

Total number of primitive spherical GTOs for the given Mole object

offset_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_ao_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

property omega
output = None
pack()

Pack the input args of Cell to a dict, which can be serialized with pickle

pbc_eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_intor(intor, comp=None, hermi=0, kpts=None, kpt=None, shls_slice=None, **kwargs)

One-electron integrals with PBC.

\[\sum_T \int \mu(r) * [intor] * \nu (r-T) dr\]

See also Mole.intor

post_kernel(envs)

A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.

pre_kernel(envs)

A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.

precision = 1e-08
property rcut
rcut_by_shells(precision=None, rcut=0, return_pgf_radius=False)

Compute shell and primitive gaussian function radii.

reciprocal_vectors(norm_to=6.283185307179586)
\[\begin{split}\begin{align} \mathbf{b_1} &= 2\pi \frac{\mathbf{a_2} \times \mathbf{a_3}}{\mathbf{a_1} \cdot (\mathbf{a_2} \times \mathbf{a_3})} \\ \mathbf{b_2} &= 2\pi \frac{\mathbf{a_3} \times \mathbf{a_1}}{\mathbf{a_2} \cdot (\mathbf{a_3} \times \mathbf{a_1})} \\ \mathbf{b_3} &= 2\pi \frac{\mathbf{a_1} \times \mathbf{a_2}}{\mathbf{a_3} \cdot (\mathbf{a_1} \times \mathbf{a_2})} \end{align}\end{split}\]
run(*args, **kwargs)

Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.

search_ao_nr(atm_id, l, m, atmshell)

Search the first basis function id (not the shell id) which matches the given atom-id, angular momentum magnetic angular momentum, principal shell.

Parameters:
  • atm_id – int atom id, 0-based

  • l – int angular momentum

  • m – int magnetic angular momentum

  • atmshell – int principal quantum number

Returns:

basis function id, 0-based. If not found, return None

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> mol.search_ao_nr(1, 1, -1, 3) # Cl 3px
7
search_ao_r(atm_id, l, j, m, atmshell)
search_shell_id(atm_id, l)
set(*args, **kwargs)

Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

set_common_orig(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_orig_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_f12_zeta(zeta)

Set zeta for YP exp(-zeta r12)/r12 or STG exp(-zeta r12) type integrals

set_geom_(atoms_or_coords, unit=None, symmetry=None, inplace=True)

Update geometry

set_nuc_mod(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_nuc_mod_(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_range_coulomb(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_range_coulomb_(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_rinv_orig(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_orig_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_zeta(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

set_rinv_zeta_(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

sph2spinor_coeff()

Transformation matrix that transforms real-spherical GTOs to spinor GTOs for all basis functions

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> ca, cb = mol.sph2spinor_coeff()
>>> s0 = mol.intor('int1e_ovlp_spinor')
>>> s1 = ca.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(ca)
>>> s1+= cb.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(cb)
>>> print(abs(s1-s0).max())
>>> 6.66133814775e-16
sph_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spheric_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spinor_labels(fmt=True, base=0)

Labels of spinor GTO functions

stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
symmetrize_mesh(mesh=None)
symmetry = False
symmetry_subgroup = None
time_reversal_map()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

tmap()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

to_mol()

Return a Mole object using the same atoms and basis functions as the Cell object.

to_uncontracted_cartesian_basis()

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with uncontracted Cartesian basis and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.to_uncontracted_cartesian_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
tofile(filename, format=None)
tostring(format='poscar')

Convert cell geometry to a string of the required format.

Supported output formats:
poscar: VASP POSCAR
xyz: Extended XYZ with Lattice information
tot_electrons(nkpts=1)

Total number of electrons

unit = 'angstrom'
classmethod unpack(moldic)

Convert the packed dict to a Cell object, to generate the input arguments for Cell object.

unpack_(moldic)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

update(chkfile)
update_from_chk(chkfile)
verbose = 3
view(cls)

New view of object with the same attributes.

property vol
with_common_orig(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_common_origin(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_integral_screen(threshold)

Return a temporary mol context which has the required integral screen threshold

with_long_range_coulomb(omega)

Return a temporary mol context for long-range part of range-separated Coulomb operator.

with_range_coulomb(omega)

Return a temporary mol context which sets the required parameter omega for range-separated Coulomb operator. If omega = None, return the context for regular Coulomb integrals. See also mol.set_range_coulomb()

Examples:

>>> with mol.with_range_coulomb(omega=1.5):
...     mol.intor('int2e')
with_rinv_as_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_at_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_orig(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_origin(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_zeta(zeta)

Return a temporary mol context which has the rquired Gaussian charge distribution placed at “rinv_origin”: rho(r) = Norm * exp(-zeta * r^2). See also mol.set_rinv_zeta()

Examples:

>>> with mol.with_rinv_zeta(zeta=1.5), mol.with_rinv_origin((1.,0,0)):
...     mol.intor('int1e_rinv')
with_short_range_coulomb(omega)

Return a temporary mol context for short-range part of range-separated Coulomb operator.

class vayesta.lattmod.latt.Hubbard(nsite, nelectron=None, spin=0, hubbard_t=1.0, hubbard_u=0.0, v_nn=0.0, **kwargs)[source]

Bases: LatticeMole

Abstract Hubbard model class.

aoslice_by_atom()[source]

One basis function per site (“atom”).

ao2mo(mo_coeffs, compact=False)[source]
property Gv
ao_labels(fmt=True)

Labels of AO basis functions

Kwargs:
fmtstr or bool

if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-AO-notation)] or formatted strings based on the argument “fmt”

property ao_loc

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_loc_2c()

Offset of every shell in the spinor basis function spectrum

Returns:

list, each entry is the corresponding start id of spinor function

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_2c(mol)
[0, 2, 4, 6, 12, 18, 20, 22, 24, 30, 36]
ao_loc_nr(cart=None)

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_rotation_matrix(orientation)

Matrix u to rotate AO basis to a new orientation.

atom_new_coords = mol.atom_coords().dot(orientation.T) new_AO = u * mol.AO new_orbitals_coef = u.dot(orbitals_coef)

aoslice_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

aoslice_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

apply(fn, *args, **kwargs)

Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

atom_charge(atm_id)

Nuclear effective charge of the given atom id Note “atom_charge /= charge(atom_symbol)” when ECP is enabled. Number of electrons screened by ECP can be obtained by charge(atom_symbol)-atom_charge

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_charge(1)
17
atom_charges()

np.asarray([mol.atom_charge(i) for i in range(mol.natm)])

atom_coord(atm_id, unit='Bohr')

Coordinates (ndarray) of the given atom id

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_coord(1)
[ 0.          0.          2.07869874]
atom_coords(unit='Bohr')

np.asarray([mol.atom_coord(i) for i in range(mol.natm)])

atom_mass_list(isotope_avg=False)

A list of mass for all atoms in the molecule

Kwargs:
isotope_avgboolean

Whether to use the isotope average mass as the atomic mass

atom_nelec_core(atm_id)

Number of core electrons for pseudo potential.

atom_nshells(atm_id)

Number of basis/shells of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_nshells(1)
5
atom_pure_symbol(site)

For the given atom id, return the standard symbol (striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H
atom_shell_ids(atm_id)

A list of the shell-ids of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.atom_shell_ids(1)
[3, 4, 5, 6, 7]
atom_symbol(site)

For the given atom id, return the input symbol (without striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H^2
bas_angular(bas_id)

The angular momentum associated with the given basis

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
2
bas_atom(bas_id)

The atom (0-based id) that the given basis sits on

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
1
bas_coord(bas_id)

Coordinates (ndarray) associated with the given basis id

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.bas_coord(1)
[ 0.          0.          2.07869874]
bas_ctr_coeff(bas_id)

Contract coefficients (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.M(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_ctr_coeff(0)
[[ 10.03400444]
 [  4.1188704 ]
 [  1.53971186]]
bas_exp(bas_id)

exponents (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(0)
[ 13.01     1.962    0.4446]
bas_exps()

exponents of all basis return [mol.bas_exp(i) for i in range(self.nbas)]

bas_kappa(bas_id)

Kappa (if l < j, -l-1, else l) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(3)
0
bas_len_cart(bas_id)

The number of Cartesian function associated with given basis

bas_len_spinor(bas_id)

The number of spinor associated with given basis If kappa is 0, return 4l+2

bas_nctr(bas_id)

The number of contracted GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
3
bas_nprim(bas_id)

The number of primitive GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
11
bas_rcut(bas_id, precision=None)

Estimate the largest distance between the function and its image to reach the precision in overlap

precision ~ int g(r-0) g(r-Rcut)

build(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

build_lattice_symmetry(check_mesh_symmetry=True)

Build cell.lattice_symmetry object.

Kwargs:
check_mesh_symmetrybool

For nonsymmorphic symmetry groups, cell.mesh may have lower symmetry than the lattice. In this case, if check_mesh_symmetry is True, the lower symmetry group will be used. Otherwise, if check_mesh_symmetry is False, the mesh grid will be modified to satisfy the higher symmetry. Default value is True.

Note

This function modifies the attributes of cell.

cart = False
cart2sph_coeff(normalized='sp')

Transformation matrix that transforms Cartesian GTOs to spherical GTOs for all basis functions

Kwargs:
normalizedstring or boolean

How the Cartesian GTOs are normalized. Except s and p functions, Cartesian GTOs do not have the universal normalization coefficients for the different components of the same shell. The value of this argument can be one of ‘sp’, ‘all’, None. ‘sp’ means the Cartesian s and p basis are normalized. ‘all’ means all Cartesian functions are normalized. None means none of the Cartesian functions are normalized. The default value ‘sp’ is the convention used by libcint library.

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> c = mol.cart2sph_coeff()
>>> s0 = mol.intor('int1e_ovlp_sph')
>>> s1 = c.T.dot(mol.intor('int1e_ovlp_cart')).dot(c)
>>> print(abs(s1-s0).sum())
>>> 4.58676826646e-15
cart_labels(fmt=True, base=0)

Labels of Cartesian GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-xyz-notation)] or formatted strings based on the argument “fmt”

charge = 0
check_sanity()

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

condense_to_shell(mat, compressor='max')

The given matrix is first partitioned to blocks, based on AO shell as delimiter. Then call compressor function to abstract each block.

Parameters:

compressor – string or function if compressor is a string, its value can be sum, max, min, abssum, absmax, absmin, norm

copy(deep=True)

Deepcopy of the given Mole object

Some attributes are shared between the original and copied objects. Deepcopy is utilized here to ensure that operations on the copied object do not affect the original object.

cutoff_to_mesh(ke_cutoff)

Convert KE cutoff to FFT-mesh

Parameters:

ke_cutoff – float KE energy cutoff in a.u.

Returns:

(3,) array

Return type:

mesh

decontract_basis(atoms=None, to_cart=False, aggregate=False)

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with the uncontracted basis environment and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Kwargs:
atoms: list or str

Atoms on which the basis to be decontracted. By default, all basis are decontracted

to_cart: bool

Decontract basis and transfer to Cartesian basis

aggregate: bool

Whether to aggregate the transformation coefficients into a giant transformation matrix

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.decontract_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
property drop_exponent
dump_input()
dumps()

Serialize Cell object to a JSON formatted str.

property elements

A list of elements in the molecule

energy_nuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

property enuc

nuclear repulsion energy

static etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
property ew_cut
property ew_eta
ewald(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

exp_to_discard = None
static expand_etb(l, n, alpha, beta)

Generate the exponents of even tempered basis for Mole.basis. .. math:

e = e^{-\alpha * \beta^{i-1}} for i = 1 .. n
Parameters:
  • l – int Angular momentum

  • n – int Number of GTOs

Returns:

Formatted basis

Examples:

>>> gto.expand_etb(1, 3, 1.5, 2)
[[1, [6.0, 1]], [1, [3.0, 1]], [1, [1.5, 1]]]
static expand_etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
format_atom(atoms, origin=0, axes=None, unit='angstrom')

Convert the input Mole.atom to the internal data format. Including, changing the nuclear charge to atom symbol, converting the coordinates to AU, rotate and shift the molecule. If the atom is a string, it takes “;” and “n” for the mark to separate atoms; “,” and arbitrary length of blank space to separate the individual terms for an atom. Blank line will be ignored.

Parameters:

atoms – list or str the same to Mole.atom

Kwargs:
originndarray

new axis origin.

axesndarray

(new_x, new_y, new_z), new coordinates

unitstr or number

If unit is one of strings (B, b, Bohr, bohr, AU, au), the coordinates of the input atoms are the atomic unit; If unit is one of strings (A, a, Angstrom, angstrom, Ang, ang), the coordinates are in the unit of angstrom; If a number is given, the number are considered as the Bohr value (in angstrom), which should be around 0.53. Set unit=1 if wishing to preserve the unit of the coordinates.

Returns:

“atoms” in the internal format. The internal format is
atom = [[atom1, (x, y, z)],
[atom2, (x, y, z)],
[atomN, (x, y, z)]]

Examples:

>>> gto.format_atom('9,0,0,0; h@1 0 0 1', origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H@1', [-1.0, -1.0, 0.0]]]
>>> gto.format_atom(['9,0,0,0', (1, (0, 0, 1))], origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H', [-1, -1, 0]]]
static format_basis(basis_tab, sort_basis=True)

Convert the input Mole.basis to the internal data format.

``{ atom: [(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..))),

(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..)))], … }``

Parameters:

basis_tab – dict Similar to Mole.basis, it cannot be a str

Returns:

Formatted basis

Examples:

>>> gto.format_basis({'H':'sto-3g', 'H^2': '3-21g'})
{'H': [[0,
    [3.4252509099999999, 0.15432897000000001],
    [0.62391373000000006, 0.53532813999999995],
    [0.16885539999999999, 0.44463454000000002]]],
 'H^2': [[0,
    [5.4471780000000001, 0.15628500000000001],
    [0.82454700000000003, 0.90469100000000002]],
    [0, [0.18319199999999999, 1.0]]]}
>>> gto.format_basis({'H':'gth-szv'})
{'H': [[0,
    (8.3744350009, -0.0283380461),
    (1.8058681460, -0.1333810052),
    (0.4852528328, -0.3995676063),
    (0.1658236932, -0.5531027541)]]}
static format_ecp(ecp_tab)

Convert the input ecp (dict) to the internal data format:

{ atom: (nelec,  # core electrons
((l, # l=-1 for UL, l>=0 for Ul to indicate |l><l|
(((exp_1, c_1), # for r^0

(exp_2, c_2), …),

((exp_1, c_1), # for r^1

(exp_2, c_2), …),

((exp_1, c_1), # for r^2

…))))),

…}

static format_pseudo(pseudo_tab)

Convert the input pseudo (dict) to the internal data format:

{ atom: ( (nelec_s, nele_p, nelec_d, ...),
         rloc, nexp, (cexp_1, cexp_2, ..., cexp_nexp),
         nproj_types,
         (r1, nproj1, ( (hproj1[1,1], hproj1[1,2], ..., hproj1[1,nproj1]),
                        (hproj1[2,1], hproj1[2,2], ..., hproj1[2,nproj1]),
                        ...
                        (hproj1[nproj1,1], hproj1[nproj1,2], ...        ) )),
         (r2, nproj2, ( (hproj2[1,1], hproj2[1,2], ..., hproj2[1,nproj1]),
         ... ) )
         )
 ... }
Parameters:

pseudo_tab – dict Similar to pseudo (a dict), it cannot be a str

Returns:

Formatted pseudo

Examples:

>>> pbc.format_pseudo({'H':'gth-blyp', 'He': 'gth-pade'})
{'H': [[1],
    0.2, 2, [-4.19596147, 0.73049821], 0],
 'He': [[2],
    0.2, 2, [-9.1120234, 1.69836797], 0]}
from_ase(ase_atom)

Update cell based on given ase atom object

Examples:

>>> from ase.lattice import bulk
>>> cell.from_ase(bulk('C', 'diamond', a=LATTICE_CONST))
fromfile(filename, format=None)

Update the Cell object based on the input geometry file

fromstring(string, format='poscar')

Update the Cell object based on the input geometry string

gen_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

get_Gv(mesh=None, **kwargs)

Calculate three-dimensional G-vectors for the cell; see MH (3.8).

Indices along each direction go as [0…N-1, -N…-1] to follow FFT convention.

Parameters:

cell – instance of Cell

Returns:

(ngrids, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_Gv_weights(mesh=None, **kwargs)

Calculate G-vectors and weights.

Returns:

(ngris, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_SI(Gv=None, mesh=None, atmlst=None)

Calculate the structure factor (0D, 1D, 2D, 3D) for all atoms; see MH (3.34).

Parameters:
  • cell – instance of Cell

  • Gv – (N,3) array G vectors

  • atmlst – list of ints, optional Indices of atoms for which the structure factors are computed.

Returns:

(natm, ngrids) ndarray, dtype=np.complex128

The structure factor for each atom at each G-vector.

Return type:

SI

get_abs_kpts(scaled_kpts)

Get absolute k-points (in 1/Bohr), given “scaled” k-points in fractions of lattice vectors.

Parameters:

scaled_kpts – (nkpts, 3) ndarray of floats

Returns:

(nkpts, 3) ndarray of floats

Return type:

abs_kpts

get_ao_indices(bas_list, ao_loc=None)

Generate (dis-continued) AO indices for basis specified in bas_list

get_bounding_sphere(rcut)

Finds all the lattice points within a sphere of radius rcut.

Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3] See Martin p. 85

Parameters:

rcut – number real space cut-off for interaction

Returns:

ndarray of 3 ints defining N_x

Return type:

cut

get_enuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

get_ewald_params(precision=None, mesh=None)

Choose a reasonable value of Ewald ‘eta’ and ‘cut’ parameters. eta^2 is the exponent coefficient of the model Gaussian charge for nucleus at R: frac{eta^3}{pi^1.5} e^{-eta^2 (r-R)^2}

Choice is based on largest G vector and desired relative precision.

The relative error in the G-space sum is given by

precision ~ 4pi Gmax^2 e^{(-Gmax^2)/(4 eta^2)}

which determines eta. Then, real-space cutoff is determined by (exp. factors only)

precision ~ erfc(eta*rcut) / rcut ~ e^{(-eta**2 rcut*2)}

Returns:

float

The Ewald ‘eta’ and ‘cut’ parameters.

Return type:

ew_eta, ew_cut

get_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
get_lattice_Ls(nimgs=None, rcut=None, dimension=None, discard=True)

Get the (Cartesian, unitful) lattice translation vectors for nearby images. The translation vectors can be used for the lattice summation.

Kwargs:
discard:

Drop less important Ls based on AO values on grid

get_nimgs(precision=None)

Choose number of basis function images in lattice sums to include for given precision in overlap, using

precision ~ int r^l e^{-alpha r^2} (r-rcut)^l e^{-alpha (r-rcut)^2} ~ (rcut^2/(2alpha))^l e^{alpha/2 rcut^2}

where alpha is the smallest exponent in the basis. Note that assumes an isolated exponent in the middle of the box, so it adds one additional lattice vector to be safe.

get_overlap_cond(shls_slice=None)

Overlap magnitudes measured by -log(overlap) between two shells

Parameters:

mol – an instance of Mole

Returns:

2D mask array of shape (nbas,nbas)

get_scaled_atom_coords(a=None)

Get scaled atomic coordinates.

get_scaled_kpts(abs_kpts, kpts_in_ibz=True)

Get scaled k-points, given absolute k-points in 1/Bohr.

Parameters:
  • abs_kpts – (nkpts, 3) ndarray of floats or KPoints object

  • kpts_in_ibz – bool If True, return k-points in IBZ; otherwise, return k-points in BZ. Default value is True. This has effects only if abs_kpts is a KPoints object

Returns:

(nkpts, 3) ndarray of floats

Return type:

scaled_kpts

get_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

property gs
gto_norm(l, expnt)

Normalized factor for GTO radial part \(g=r^l e^{-\alpha r^2}\)

\[\frac{1}{\sqrt{\int g^2 r^2 dr}} = \sqrt{\frac{2^{2l+3} (l+1)! (2a)^{l+1.5}}{(2l+2)!\sqrt{\pi}}}\]

Ref: H. B. Schlegel and M. J. Frisch, Int. J. Quant. Chem., 54(1995), 83-87.

Parameters:
  • l (int) – angular momentum

  • expnt – exponent \(\alpha\)

Returns:

normalization factor

Examples:

>>> print(gto_norm(0, 1))
2.5264751109842591
property h
has_ecp()

Whether pseudo potential is used in the system.

has_ecp_soc()

Whether spin-orbit coupling is enabled in ECP.

incore_anyway = False
intor(intor, comp=None, hermi=0, aosym='s1', out=None, shls_slice=None, grids=None)

Integral generator.

Parameters:

intor – str Name of the 1e or 2e AO integrals. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

hermiint

Symmetry of the integrals

0 : no symmetry assumed (default)
1 : hermitian
2 : anti-hermitian
shls_slice4-element, 6-element or 8-element tuple

Label the start-stop shells for each index in the integral. For example, the 8-element tuple for the 2-electron integral tensor (ij|kl) = intor(‘int2e’) are specified as (ish_start, ish_end, jsh_start, jsh_end, ksh_start, ksh_end, lsh_start, lsh_end)

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor('int1e_ipnuc_sph', comp=3) # <nabla i | V_nuc | j>
[[[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.10289944  0.48176097]
  [-0.48176097 -0.10289944]]]
>>> mol.intor('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_asymmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be anti-hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_asymmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j  0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j  0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_by_shell(intor, shells, comp=None, grids=None)

For given 2, 3 or 4 shells, interface for libcint to get 1e, 2e, 2-center-2e or 3-center-2e integrals

Parameters:
  • intor_name – str See also getints() for the supported intor_name

  • shls – list of int The AO shell-ids of the integrals

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

Returns:

ndarray of 2-dim to 5-dim, depending on the integral type (1e, 2e, 3c-2e, 2c2e) and the value of comp

Examples

The gradients of the spherical 2e integrals

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> gto.getints_by_shell('int2e_ip1_sph', (0,1,0,1), mol._atm, mol._bas, mol._env, comp=3)
[[[[[-0.        ]]]]
  [[[[-0.        ]]]]
  [[[[-0.08760462]]]]]
intor_symmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_symmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
kernel(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

lattice_vectors()

Convert the primitive lattice vectors.

Return 3x3 array in which each row represents one direction of the lattice vectors (unit in Bohr)

classmethod loads(molstr)

Deserialize a str containing a JSON document to a Cell object.

loads_(molstr)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

make_atm_env(atom, ptr=0, nucmod=1, nucprop=None)

Convert the internal format Mole._atom to the format required by libcint integrals

make_bas_env(basis_add, atom_id=0, ptr=0)

Convert Mole.basis to the argument bas for libcint integrals

make_ecp_env(_atm, _ecp, pre_env=[])

Generate the input arguments _ecpbas for ECP integrals

make_env(atoms, basis, pre_env=[], nucmod={}, nucprop=None)

Generate the input arguments for libcint library based on internal format Mole._atom and Mole._basis

make_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
max_memory = 4000
property mesh
property ms

Spin quantum number. multiplicity = ms*2+1

property multiplicity
property nao
nao_2c()

Total number of contracted spinor GTOs for the given Mole object

nao_2c_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spinor basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id, 0-based

  • bas_id1 – int stop shell id, 0-based

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_2c_range(mol, 2, 4)
(4, 12)
nao_cart()

Total number of contracted cartesian GTOs for the given Mole object

nao_nr()

Total number of contracted GTOs for the given Mole object

nao_nr_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spherical basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id

  • bas_id1 – int stop shell id

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_nr_range(mol, 2, 4)
(2, 6)
property natm
property nbas
property nelec
property nelectron
property nimgs
npgto_nr(cart=None)

Total number of primitive spherical GTOs for the given Mole object

offset_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_ao_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

property omega
output = None
pack()

Pack the input args of Cell to a dict, which can be serialized with pickle

pbc_eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_intor(intor, comp=None, hermi=0, kpts=None, kpt=None, shls_slice=None, **kwargs)

One-electron integrals with PBC.

\[\sum_T \int \mu(r) * [intor] * \nu (r-T) dr\]

See also Mole.intor

post_kernel(envs)

A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.

pre_kernel(envs)

A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.

precision = 1e-08
property rcut
rcut_by_shells(precision=None, rcut=0, return_pgf_radius=False)

Compute shell and primitive gaussian function radii.

reciprocal_vectors(norm_to=6.283185307179586)
\[\begin{split}\begin{align} \mathbf{b_1} &= 2\pi \frac{\mathbf{a_2} \times \mathbf{a_3}}{\mathbf{a_1} \cdot (\mathbf{a_2} \times \mathbf{a_3})} \\ \mathbf{b_2} &= 2\pi \frac{\mathbf{a_3} \times \mathbf{a_1}}{\mathbf{a_2} \cdot (\mathbf{a_3} \times \mathbf{a_1})} \\ \mathbf{b_3} &= 2\pi \frac{\mathbf{a_1} \times \mathbf{a_2}}{\mathbf{a_3} \cdot (\mathbf{a_1} \times \mathbf{a_2})} \end{align}\end{split}\]
run(*args, **kwargs)

Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.

search_ao_label()

Find the index of the AO basis function based on the given ao_label

Parameters:

ao_label – string or a list of strings The regular expression pattern to match the orbital labels returned by mol.ao_labels()

Returns:

A list of index for the AOs that matches the given ao_label RE pattern

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='ccpvtz')
>>> mol.search_ao_label('Cl.*p')
[19 20 21 22 23 24 25 26 27 28 29 30]
>>> mol.search_ao_label('Cl 2p')
[19 20 21]
>>> mol.search_ao_label(['Cl.*d', 'Cl 4p'])
[25 26 27 31 32 33 34 35 36 37 38 39 40]
search_ao_nr(atm_id, l, m, atmshell)

Search the first basis function id (not the shell id) which matches the given atom-id, angular momentum magnetic angular momentum, principal shell.

Parameters:
  • atm_id – int atom id, 0-based

  • l – int angular momentum

  • m – int magnetic angular momentum

  • atmshell – int principal quantum number

Returns:

basis function id, 0-based. If not found, return None

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> mol.search_ao_nr(1, 1, -1, 3) # Cl 3px
7
search_ao_r(atm_id, l, j, m, atmshell)
search_shell_id(atm_id, l)
set(*args, **kwargs)

Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

set_common_orig(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_orig_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_f12_zeta(zeta)

Set zeta for YP exp(-zeta r12)/r12 or STG exp(-zeta r12) type integrals

set_geom_(atoms_or_coords, unit=None, symmetry=None, inplace=True)

Update geometry

set_nuc_mod(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_nuc_mod_(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_range_coulomb(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_range_coulomb_(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_rinv_orig(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_orig_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_zeta(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

set_rinv_zeta_(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

sph2spinor_coeff()

Transformation matrix that transforms real-spherical GTOs to spinor GTOs for all basis functions

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> ca, cb = mol.sph2spinor_coeff()
>>> s0 = mol.intor('int1e_ovlp_spinor')
>>> s1 = ca.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(ca)
>>> s1+= cb.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(cb)
>>> print(abs(s1-s0).max())
>>> 6.66133814775e-16
sph_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spheric_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spin = 0
spinor_labels(fmt=True, base=0)

Labels of spinor GTO functions

stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
symmetrize_mesh(mesh=None)
symmetry = False
symmetry_subgroup = None
time_reversal_map()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

tmap()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

to_mol()

Return a Mole object using the same atoms and basis functions as the Cell object.

to_uncontracted_cartesian_basis()

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with uncontracted Cartesian basis and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.to_uncontracted_cartesian_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
tofile(filename, format=None)
tostring(format='poscar')

Convert cell geometry to a string of the required format.

Supported output formats:
poscar: VASP POSCAR
xyz: Extended XYZ with Lattice information
tot_electrons(nkpts=1)

Total number of electrons

unit = 'angstrom'
classmethod unpack(moldic)

Convert the packed dict to a Cell object, to generate the input arguments for Cell object.

unpack_(moldic)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

update(chkfile)
update_from_chk(chkfile)
verbose = 3
view(cls)

New view of object with the same attributes.

property vol
with_common_orig(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_common_origin(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_integral_screen(threshold)

Return a temporary mol context which has the required integral screen threshold

with_long_range_coulomb(omega)

Return a temporary mol context for long-range part of range-separated Coulomb operator.

with_range_coulomb(omega)

Return a temporary mol context which sets the required parameter omega for range-separated Coulomb operator. If omega = None, return the context for regular Coulomb integrals. See also mol.set_range_coulomb()

Examples:

>>> with mol.with_range_coulomb(omega=1.5):
...     mol.intor('int2e')
with_rinv_as_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_at_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_orig(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_origin(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_zeta(zeta)

Return a temporary mol context which has the rquired Gaussian charge distribution placed at “rinv_origin”: rho(r) = Norm * exp(-zeta * r^2). See also mol.set_rinv_zeta()

Examples:

>>> with mol.with_rinv_zeta(zeta=1.5), mol.with_rinv_origin((1.,0,0)):
...     mol.intor('int1e_rinv')
with_short_range_coulomb(omega)

Return a temporary mol context for short-range part of range-separated Coulomb operator.

class vayesta.lattmod.latt.Hubbard1D(nsite, nelectron=None, spin=0, hubbard_t=1.0, hubbard_u=0.0, v_nn=0.0, boundary='auto', **kwargs)[source]

Bases: Hubbard

Hubbard model in 1D.

get_eri(hubbard_u=None, v_nn=None)[source]
lattice_vectors()[source]

Lattice vectors of 1D Hubbard model.

An arbitrary value of 1 A is assumed between sites. The lattice vectors, however, are saved in units of Bohr.

atom_coords()[source]

np.asarray([mol.atom_coord(i) for i in range(mol.natm)])

get_index(i)[source]
property Gv
ao2mo(mo_coeffs, compact=False)
ao_labels(fmt=True)

Labels of AO basis functions

Kwargs:
fmtstr or bool

if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-AO-notation)] or formatted strings based on the argument “fmt”

property ao_loc

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_loc_2c()

Offset of every shell in the spinor basis function spectrum

Returns:

list, each entry is the corresponding start id of spinor function

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_2c(mol)
[0, 2, 4, 6, 12, 18, 20, 22, 24, 30, 36]
ao_loc_nr(cart=None)

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_rotation_matrix(orientation)

Matrix u to rotate AO basis to a new orientation.

atom_new_coords = mol.atom_coords().dot(orientation.T) new_AO = u * mol.AO new_orbitals_coef = u.dot(orbitals_coef)

aoslice_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

aoslice_by_atom()

One basis function per site (“atom”).

aoslice_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

apply(fn, *args, **kwargs)

Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

atom_charge(atm_id)

Nuclear effective charge of the given atom id Note “atom_charge /= charge(atom_symbol)” when ECP is enabled. Number of electrons screened by ECP can be obtained by charge(atom_symbol)-atom_charge

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_charge(1)
17
atom_charges()

np.asarray([mol.atom_charge(i) for i in range(mol.natm)])

atom_coord(atm_id, unit='Bohr')

Coordinates (ndarray) of the given atom id

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_coord(1)
[ 0.          0.          2.07869874]
atom_mass_list(isotope_avg=False)

A list of mass for all atoms in the molecule

Kwargs:
isotope_avgboolean

Whether to use the isotope average mass as the atomic mass

atom_nelec_core(atm_id)

Number of core electrons for pseudo potential.

atom_nshells(atm_id)

Number of basis/shells of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_nshells(1)
5
atom_pure_symbol(site)

For the given atom id, return the standard symbol (striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H
atom_shell_ids(atm_id)

A list of the shell-ids of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.atom_shell_ids(1)
[3, 4, 5, 6, 7]
atom_symbol(site)

For the given atom id, return the input symbol (without striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H^2
bas_angular(bas_id)

The angular momentum associated with the given basis

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
2
bas_atom(bas_id)

The atom (0-based id) that the given basis sits on

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
1
bas_coord(bas_id)

Coordinates (ndarray) associated with the given basis id

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.bas_coord(1)
[ 0.          0.          2.07869874]
bas_ctr_coeff(bas_id)

Contract coefficients (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.M(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_ctr_coeff(0)
[[ 10.03400444]
 [  4.1188704 ]
 [  1.53971186]]
bas_exp(bas_id)

exponents (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(0)
[ 13.01     1.962    0.4446]
bas_exps()

exponents of all basis return [mol.bas_exp(i) for i in range(self.nbas)]

bas_kappa(bas_id)

Kappa (if l < j, -l-1, else l) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(3)
0
bas_len_cart(bas_id)

The number of Cartesian function associated with given basis

bas_len_spinor(bas_id)

The number of spinor associated with given basis If kappa is 0, return 4l+2

bas_nctr(bas_id)

The number of contracted GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
3
bas_nprim(bas_id)

The number of primitive GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
11
bas_rcut(bas_id, precision=None)

Estimate the largest distance between the function and its image to reach the precision in overlap

precision ~ int g(r-0) g(r-Rcut)

build(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

build_lattice_symmetry(check_mesh_symmetry=True)

Build cell.lattice_symmetry object.

Kwargs:
check_mesh_symmetrybool

For nonsymmorphic symmetry groups, cell.mesh may have lower symmetry than the lattice. In this case, if check_mesh_symmetry is True, the lower symmetry group will be used. Otherwise, if check_mesh_symmetry is False, the mesh grid will be modified to satisfy the higher symmetry. Default value is True.

Note

This function modifies the attributes of cell.

cart = False
cart2sph_coeff(normalized='sp')

Transformation matrix that transforms Cartesian GTOs to spherical GTOs for all basis functions

Kwargs:
normalizedstring or boolean

How the Cartesian GTOs are normalized. Except s and p functions, Cartesian GTOs do not have the universal normalization coefficients for the different components of the same shell. The value of this argument can be one of ‘sp’, ‘all’, None. ‘sp’ means the Cartesian s and p basis are normalized. ‘all’ means all Cartesian functions are normalized. None means none of the Cartesian functions are normalized. The default value ‘sp’ is the convention used by libcint library.

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> c = mol.cart2sph_coeff()
>>> s0 = mol.intor('int1e_ovlp_sph')
>>> s1 = c.T.dot(mol.intor('int1e_ovlp_cart')).dot(c)
>>> print(abs(s1-s0).sum())
>>> 4.58676826646e-15
cart_labels(fmt=True, base=0)

Labels of Cartesian GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-xyz-notation)] or formatted strings based on the argument “fmt”

charge = 0
check_sanity()

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

condense_to_shell(mat, compressor='max')

The given matrix is first partitioned to blocks, based on AO shell as delimiter. Then call compressor function to abstract each block.

Parameters:

compressor – string or function if compressor is a string, its value can be sum, max, min, abssum, absmax, absmin, norm

copy(deep=True)

Deepcopy of the given Mole object

Some attributes are shared between the original and copied objects. Deepcopy is utilized here to ensure that operations on the copied object do not affect the original object.

cutoff_to_mesh(ke_cutoff)

Convert KE cutoff to FFT-mesh

Parameters:

ke_cutoff – float KE energy cutoff in a.u.

Returns:

(3,) array

Return type:

mesh

decontract_basis(atoms=None, to_cart=False, aggregate=False)

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with the uncontracted basis environment and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Kwargs:
atoms: list or str

Atoms on which the basis to be decontracted. By default, all basis are decontracted

to_cart: bool

Decontract basis and transfer to Cartesian basis

aggregate: bool

Whether to aggregate the transformation coefficients into a giant transformation matrix

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.decontract_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
property drop_exponent
dump_input()
dumps()

Serialize Cell object to a JSON formatted str.

property elements

A list of elements in the molecule

energy_nuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

property enuc

nuclear repulsion energy

static etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
property ew_cut
property ew_eta
ewald(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

exp_to_discard = None
static expand_etb(l, n, alpha, beta)

Generate the exponents of even tempered basis for Mole.basis. .. math:

e = e^{-\alpha * \beta^{i-1}} for i = 1 .. n
Parameters:
  • l – int Angular momentum

  • n – int Number of GTOs

Returns:

Formatted basis

Examples:

>>> gto.expand_etb(1, 3, 1.5, 2)
[[1, [6.0, 1]], [1, [3.0, 1]], [1, [1.5, 1]]]
static expand_etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
format_atom(atoms, origin=0, axes=None, unit='angstrom')

Convert the input Mole.atom to the internal data format. Including, changing the nuclear charge to atom symbol, converting the coordinates to AU, rotate and shift the molecule. If the atom is a string, it takes “;” and “n” for the mark to separate atoms; “,” and arbitrary length of blank space to separate the individual terms for an atom. Blank line will be ignored.

Parameters:

atoms – list or str the same to Mole.atom

Kwargs:
originndarray

new axis origin.

axesndarray

(new_x, new_y, new_z), new coordinates

unitstr or number

If unit is one of strings (B, b, Bohr, bohr, AU, au), the coordinates of the input atoms are the atomic unit; If unit is one of strings (A, a, Angstrom, angstrom, Ang, ang), the coordinates are in the unit of angstrom; If a number is given, the number are considered as the Bohr value (in angstrom), which should be around 0.53. Set unit=1 if wishing to preserve the unit of the coordinates.

Returns:

“atoms” in the internal format. The internal format is
atom = [[atom1, (x, y, z)],
[atom2, (x, y, z)],
[atomN, (x, y, z)]]

Examples:

>>> gto.format_atom('9,0,0,0; h@1 0 0 1', origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H@1', [-1.0, -1.0, 0.0]]]
>>> gto.format_atom(['9,0,0,0', (1, (0, 0, 1))], origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H', [-1, -1, 0]]]
static format_basis(basis_tab, sort_basis=True)

Convert the input Mole.basis to the internal data format.

``{ atom: [(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..))),

(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..)))], … }``

Parameters:

basis_tab – dict Similar to Mole.basis, it cannot be a str

Returns:

Formatted basis

Examples:

>>> gto.format_basis({'H':'sto-3g', 'H^2': '3-21g'})
{'H': [[0,
    [3.4252509099999999, 0.15432897000000001],
    [0.62391373000000006, 0.53532813999999995],
    [0.16885539999999999, 0.44463454000000002]]],
 'H^2': [[0,
    [5.4471780000000001, 0.15628500000000001],
    [0.82454700000000003, 0.90469100000000002]],
    [0, [0.18319199999999999, 1.0]]]}
>>> gto.format_basis({'H':'gth-szv'})
{'H': [[0,
    (8.3744350009, -0.0283380461),
    (1.8058681460, -0.1333810052),
    (0.4852528328, -0.3995676063),
    (0.1658236932, -0.5531027541)]]}
static format_ecp(ecp_tab)

Convert the input ecp (dict) to the internal data format:

{ atom: (nelec,  # core electrons
((l, # l=-1 for UL, l>=0 for Ul to indicate |l><l|
(((exp_1, c_1), # for r^0

(exp_2, c_2), …),

((exp_1, c_1), # for r^1

(exp_2, c_2), …),

((exp_1, c_1), # for r^2

…))))),

…}

static format_pseudo(pseudo_tab)

Convert the input pseudo (dict) to the internal data format:

{ atom: ( (nelec_s, nele_p, nelec_d, ...),
         rloc, nexp, (cexp_1, cexp_2, ..., cexp_nexp),
         nproj_types,
         (r1, nproj1, ( (hproj1[1,1], hproj1[1,2], ..., hproj1[1,nproj1]),
                        (hproj1[2,1], hproj1[2,2], ..., hproj1[2,nproj1]),
                        ...
                        (hproj1[nproj1,1], hproj1[nproj1,2], ...        ) )),
         (r2, nproj2, ( (hproj2[1,1], hproj2[1,2], ..., hproj2[1,nproj1]),
         ... ) )
         )
 ... }
Parameters:

pseudo_tab – dict Similar to pseudo (a dict), it cannot be a str

Returns:

Formatted pseudo

Examples:

>>> pbc.format_pseudo({'H':'gth-blyp', 'He': 'gth-pade'})
{'H': [[1],
    0.2, 2, [-4.19596147, 0.73049821], 0],
 'He': [[2],
    0.2, 2, [-9.1120234, 1.69836797], 0]}
from_ase(ase_atom)

Update cell based on given ase atom object

Examples:

>>> from ase.lattice import bulk
>>> cell.from_ase(bulk('C', 'diamond', a=LATTICE_CONST))
fromfile(filename, format=None)

Update the Cell object based on the input geometry file

fromstring(string, format='poscar')

Update the Cell object based on the input geometry string

gen_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

get_Gv(mesh=None, **kwargs)

Calculate three-dimensional G-vectors for the cell; see MH (3.8).

Indices along each direction go as [0…N-1, -N…-1] to follow FFT convention.

Parameters:

cell – instance of Cell

Returns:

(ngrids, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_Gv_weights(mesh=None, **kwargs)

Calculate G-vectors and weights.

Returns:

(ngris, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_SI(Gv=None, mesh=None, atmlst=None)

Calculate the structure factor (0D, 1D, 2D, 3D) for all atoms; see MH (3.34).

Parameters:
  • cell – instance of Cell

  • Gv – (N,3) array G vectors

  • atmlst – list of ints, optional Indices of atoms for which the structure factors are computed.

Returns:

(natm, ngrids) ndarray, dtype=np.complex128

The structure factor for each atom at each G-vector.

Return type:

SI

get_abs_kpts(scaled_kpts)

Get absolute k-points (in 1/Bohr), given “scaled” k-points in fractions of lattice vectors.

Parameters:

scaled_kpts – (nkpts, 3) ndarray of floats

Returns:

(nkpts, 3) ndarray of floats

Return type:

abs_kpts

get_ao_indices(bas_list, ao_loc=None)

Generate (dis-continued) AO indices for basis specified in bas_list

get_bounding_sphere(rcut)

Finds all the lattice points within a sphere of radius rcut.

Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3] See Martin p. 85

Parameters:

rcut – number real space cut-off for interaction

Returns:

ndarray of 3 ints defining N_x

Return type:

cut

get_enuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

get_ewald_params(precision=None, mesh=None)

Choose a reasonable value of Ewald ‘eta’ and ‘cut’ parameters. eta^2 is the exponent coefficient of the model Gaussian charge for nucleus at R: frac{eta^3}{pi^1.5} e^{-eta^2 (r-R)^2}

Choice is based on largest G vector and desired relative precision.

The relative error in the G-space sum is given by

precision ~ 4pi Gmax^2 e^{(-Gmax^2)/(4 eta^2)}

which determines eta. Then, real-space cutoff is determined by (exp. factors only)

precision ~ erfc(eta*rcut) / rcut ~ e^{(-eta**2 rcut*2)}

Returns:

float

The Ewald ‘eta’ and ‘cut’ parameters.

Return type:

ew_eta, ew_cut

get_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
get_lattice_Ls(nimgs=None, rcut=None, dimension=None, discard=True)

Get the (Cartesian, unitful) lattice translation vectors for nearby images. The translation vectors can be used for the lattice summation.

Kwargs:
discard:

Drop less important Ls based on AO values on grid

get_nimgs(precision=None)

Choose number of basis function images in lattice sums to include for given precision in overlap, using

precision ~ int r^l e^{-alpha r^2} (r-rcut)^l e^{-alpha (r-rcut)^2} ~ (rcut^2/(2alpha))^l e^{alpha/2 rcut^2}

where alpha is the smallest exponent in the basis. Note that assumes an isolated exponent in the middle of the box, so it adds one additional lattice vector to be safe.

get_overlap_cond(shls_slice=None)

Overlap magnitudes measured by -log(overlap) between two shells

Parameters:

mol – an instance of Mole

Returns:

2D mask array of shape (nbas,nbas)

get_scaled_atom_coords(a=None)

Get scaled atomic coordinates.

get_scaled_kpts(abs_kpts, kpts_in_ibz=True)

Get scaled k-points, given absolute k-points in 1/Bohr.

Parameters:
  • abs_kpts – (nkpts, 3) ndarray of floats or KPoints object

  • kpts_in_ibz – bool If True, return k-points in IBZ; otherwise, return k-points in BZ. Default value is True. This has effects only if abs_kpts is a KPoints object

Returns:

(nkpts, 3) ndarray of floats

Return type:

scaled_kpts

get_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

property gs
gto_norm(l, expnt)

Normalized factor for GTO radial part \(g=r^l e^{-\alpha r^2}\)

\[\frac{1}{\sqrt{\int g^2 r^2 dr}} = \sqrt{\frac{2^{2l+3} (l+1)! (2a)^{l+1.5}}{(2l+2)!\sqrt{\pi}}}\]

Ref: H. B. Schlegel and M. J. Frisch, Int. J. Quant. Chem., 54(1995), 83-87.

Parameters:
  • l (int) – angular momentum

  • expnt – exponent \(\alpha\)

Returns:

normalization factor

Examples:

>>> print(gto_norm(0, 1))
2.5264751109842591
property h
has_ecp()

Whether pseudo potential is used in the system.

has_ecp_soc()

Whether spin-orbit coupling is enabled in ECP.

incore_anyway = False
intor(intor, comp=None, hermi=0, aosym='s1', out=None, shls_slice=None, grids=None)

Integral generator.

Parameters:

intor – str Name of the 1e or 2e AO integrals. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

hermiint

Symmetry of the integrals

0 : no symmetry assumed (default)
1 : hermitian
2 : anti-hermitian
shls_slice4-element, 6-element or 8-element tuple

Label the start-stop shells for each index in the integral. For example, the 8-element tuple for the 2-electron integral tensor (ij|kl) = intor(‘int2e’) are specified as (ish_start, ish_end, jsh_start, jsh_end, ksh_start, ksh_end, lsh_start, lsh_end)

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor('int1e_ipnuc_sph', comp=3) # <nabla i | V_nuc | j>
[[[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.10289944  0.48176097]
  [-0.48176097 -0.10289944]]]
>>> mol.intor('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_asymmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be anti-hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_asymmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j  0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j  0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_by_shell(intor, shells, comp=None, grids=None)

For given 2, 3 or 4 shells, interface for libcint to get 1e, 2e, 2-center-2e or 3-center-2e integrals

Parameters:
  • intor_name – str See also getints() for the supported intor_name

  • shls – list of int The AO shell-ids of the integrals

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

Returns:

ndarray of 2-dim to 5-dim, depending on the integral type (1e, 2e, 3c-2e, 2c2e) and the value of comp

Examples

The gradients of the spherical 2e integrals

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> gto.getints_by_shell('int2e_ip1_sph', (0,1,0,1), mol._atm, mol._bas, mol._env, comp=3)
[[[[[-0.        ]]]]
  [[[[-0.        ]]]]
  [[[[-0.08760462]]]]]
intor_symmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_symmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
kernel(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

classmethod loads(molstr)

Deserialize a str containing a JSON document to a Cell object.

loads_(molstr)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

make_atm_env(atom, ptr=0, nucmod=1, nucprop=None)

Convert the internal format Mole._atom to the format required by libcint integrals

make_bas_env(basis_add, atom_id=0, ptr=0)

Convert Mole.basis to the argument bas for libcint integrals

make_ecp_env(_atm, _ecp, pre_env=[])

Generate the input arguments _ecpbas for ECP integrals

make_env(atoms, basis, pre_env=[], nucmod={}, nucprop=None)

Generate the input arguments for libcint library based on internal format Mole._atom and Mole._basis

make_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
max_memory = 4000
property mesh
property ms

Spin quantum number. multiplicity = ms*2+1

property multiplicity
property nao
nao_2c()

Total number of contracted spinor GTOs for the given Mole object

nao_2c_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spinor basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id, 0-based

  • bas_id1 – int stop shell id, 0-based

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_2c_range(mol, 2, 4)
(4, 12)
nao_cart()

Total number of contracted cartesian GTOs for the given Mole object

nao_nr()

Total number of contracted GTOs for the given Mole object

nao_nr_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spherical basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id

  • bas_id1 – int stop shell id

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_nr_range(mol, 2, 4)
(2, 6)
property natm
property nbas
property nelec
property nelectron
property nimgs
npgto_nr(cart=None)

Total number of primitive spherical GTOs for the given Mole object

offset_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_ao_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

property omega
output = None
pack()

Pack the input args of Cell to a dict, which can be serialized with pickle

pbc_eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_intor(intor, comp=None, hermi=0, kpts=None, kpt=None, shls_slice=None, **kwargs)

One-electron integrals with PBC.

\[\sum_T \int \mu(r) * [intor] * \nu (r-T) dr\]

See also Mole.intor

post_kernel(envs)

A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.

pre_kernel(envs)

A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.

precision = 1e-08
property rcut
rcut_by_shells(precision=None, rcut=0, return_pgf_radius=False)

Compute shell and primitive gaussian function radii.

reciprocal_vectors(norm_to=6.283185307179586)
\[\begin{split}\begin{align} \mathbf{b_1} &= 2\pi \frac{\mathbf{a_2} \times \mathbf{a_3}}{\mathbf{a_1} \cdot (\mathbf{a_2} \times \mathbf{a_3})} \\ \mathbf{b_2} &= 2\pi \frac{\mathbf{a_3} \times \mathbf{a_1}}{\mathbf{a_2} \cdot (\mathbf{a_3} \times \mathbf{a_1})} \\ \mathbf{b_3} &= 2\pi \frac{\mathbf{a_1} \times \mathbf{a_2}}{\mathbf{a_3} \cdot (\mathbf{a_1} \times \mathbf{a_2})} \end{align}\end{split}\]
run(*args, **kwargs)

Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.

search_ao_label()

Find the index of the AO basis function based on the given ao_label

Parameters:

ao_label – string or a list of strings The regular expression pattern to match the orbital labels returned by mol.ao_labels()

Returns:

A list of index for the AOs that matches the given ao_label RE pattern

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='ccpvtz')
>>> mol.search_ao_label('Cl.*p')
[19 20 21 22 23 24 25 26 27 28 29 30]
>>> mol.search_ao_label('Cl 2p')
[19 20 21]
>>> mol.search_ao_label(['Cl.*d', 'Cl 4p'])
[25 26 27 31 32 33 34 35 36 37 38 39 40]
search_ao_nr(atm_id, l, m, atmshell)

Search the first basis function id (not the shell id) which matches the given atom-id, angular momentum magnetic angular momentum, principal shell.

Parameters:
  • atm_id – int atom id, 0-based

  • l – int angular momentum

  • m – int magnetic angular momentum

  • atmshell – int principal quantum number

Returns:

basis function id, 0-based. If not found, return None

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> mol.search_ao_nr(1, 1, -1, 3) # Cl 3px
7
search_ao_r(atm_id, l, j, m, atmshell)
search_shell_id(atm_id, l)
set(*args, **kwargs)

Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

set_common_orig(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_orig_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_f12_zeta(zeta)

Set zeta for YP exp(-zeta r12)/r12 or STG exp(-zeta r12) type integrals

set_geom_(atoms_or_coords, unit=None, symmetry=None, inplace=True)

Update geometry

set_nuc_mod(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_nuc_mod_(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_range_coulomb(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_range_coulomb_(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_rinv_orig(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_orig_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_zeta(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

set_rinv_zeta_(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

sph2spinor_coeff()

Transformation matrix that transforms real-spherical GTOs to spinor GTOs for all basis functions

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> ca, cb = mol.sph2spinor_coeff()
>>> s0 = mol.intor('int1e_ovlp_spinor')
>>> s1 = ca.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(ca)
>>> s1+= cb.conj().T.dot(mol.intor('int1e_ovlp_sph')).dot(cb)
>>> print(abs(s1-s0).max())
>>> 6.66133814775e-16
sph_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spheric_labels(fmt=True, base=0)

Labels for spherical GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-real-spherical-notation] or formatted strings based on the argument “fmt”

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> gto.sph_labels(mol)
[(0, 'H', '1s', ''), (1, 'Cl', '1s', ''), (1, 'Cl', '2s', ''), (1, 'Cl', '3s', ''),
 (1, 'Cl', '2p', 'x'), (1, 'Cl', '2p', 'y'), (1, 'Cl', '2p', 'z'), (1, 'Cl', '3p', 'x'),
 (1, 'Cl', '3p', 'y'), (1, 'Cl', '3p', 'z')]
spin = 0
spinor_labels(fmt=True, base=0)

Labels of spinor GTO functions

stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
symmetrize_mesh(mesh=None)
symmetry = False
symmetry_subgroup = None
time_reversal_map()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

tmap()

The index to map the spinor functions and its time reversal counterpart. The returned indices have positive or negative values. For the i-th basis function, if the returned j = idx[i] < 0, it means \(T|i\rangle = -|j\rangle\), otherwise \(T|i\rangle = |j\rangle\)

to_mol()

Return a Mole object using the same atoms and basis functions as the Cell object.

to_uncontracted_cartesian_basis()

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with uncontracted Cartesian basis and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.to_uncontracted_cartesian_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
tofile(filename, format=None)
tostring(format='poscar')

Convert cell geometry to a string of the required format.

Supported output formats:
poscar: VASP POSCAR
xyz: Extended XYZ with Lattice information
tot_electrons(nkpts=1)

Total number of electrons

unit = 'angstrom'
classmethod unpack(moldic)

Convert the packed dict to a Cell object, to generate the input arguments for Cell object.

unpack_(moldic)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

update(chkfile)
update_from_chk(chkfile)
verbose = 3
view(cls)

New view of object with the same attributes.

property vol
with_common_orig(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_common_origin(coord)

Return a temporary mol context which has the rquired common origin. The required common origin has no effects out of the temporary context. See also mol.set_common_origin()

Examples:

>>> with mol.with_common_origin((1,0,0)):
...     mol.intor('int1e_r', comp=3)
with_integral_screen(threshold)

Return a temporary mol context which has the required integral screen threshold

with_long_range_coulomb(omega)

Return a temporary mol context for long-range part of range-separated Coulomb operator.

with_range_coulomb(omega)

Return a temporary mol context which sets the required parameter omega for range-separated Coulomb operator. If omega = None, return the context for regular Coulomb integrals. See also mol.set_range_coulomb()

Examples:

>>> with mol.with_range_coulomb(omega=1.5):
...     mol.intor('int2e')
with_rinv_as_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_at_nucleus(atm_id)

Return a temporary mol context in which the rinv operator (1/r) is treated like the Coulomb potential of a Gaussian charge distribution rho(r) = Norm * exp(-zeta * r^2) at the place of the input atm_id.

Examples:

>>> with mol.with_rinv_at_nucleus(3):
...     mol.intor('int1e_rinv')
with_rinv_orig(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_origin(coord)

Return a temporary mol context which has the rquired origin of 1/r operator. The required origin has no effects out of the temporary context. See also mol.set_rinv_origin()

Examples:

>>> with mol.with_rinv_origin((1,0,0)):
...     mol.intor('int1e_rinv')
with_rinv_zeta(zeta)

Return a temporary mol context which has the rquired Gaussian charge distribution placed at “rinv_origin”: rho(r) = Norm * exp(-zeta * r^2). See also mol.set_rinv_zeta()

Examples:

>>> with mol.with_rinv_zeta(zeta=1.5), mol.with_rinv_origin((1.,0,0)):
...     mol.intor('int1e_rinv')
with_short_range_coulomb(omega)

Return a temporary mol context for short-range part of range-separated Coulomb operator.

class vayesta.lattmod.latt.Hubbard2D(nsites, nelectron=None, spin=0, hubbard_t=1.0, hubbard_u=0.0, boundary='auto', tiles=(1, 1), order=None, **kwargs)[source]

Bases: Hubbard

get_index(i, j)[source]
get_eri(hubbard_u=None, v_nn=None)[source]
lattice_vectors()[source]

Lattice vectors of 1D Hubbard model.

An arbitrary value of 1 A is assumed between sites. The lattice vectors, however, are saved in units of Bohr.

atom_coords()[source]

Sites are ordered by default as:

6 7 8 3 4 5 0 1 2

static get_tiles_order(nsites, tiles)[source]
property Gv
ao2mo(mo_coeffs, compact=False)
ao_labels(fmt=True)

Labels of AO basis functions

Kwargs:
fmtstr or bool

if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-AO-notation)] or formatted strings based on the argument “fmt”

property ao_loc

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_loc_2c()

Offset of every shell in the spinor basis function spectrum

Returns:

list, each entry is the corresponding start id of spinor function

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_2c(mol)
[0, 2, 4, 6, 12, 18, 20, 22, 24, 30, 36]
ao_loc_nr(cart=None)

Offset of every shell in the spherical basis function spectrum

Returns:

list, each entry is the corresponding start basis function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.ao_loc_nr(mol)
[0, 1, 2, 3, 6, 9, 10, 11, 12, 15, 18]
ao_rotation_matrix(orientation)

Matrix u to rotate AO basis to a new orientation.

atom_new_coords = mol.atom_coords().dot(orientation.T) new_AO = u * mol.AO new_orbitals_coef = u.dot(orbitals_coef)

aoslice_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

aoslice_by_atom()

One basis function per site (“atom”).

aoslice_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

apply(fn, *args, **kwargs)

Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

atom_charge(atm_id)

Nuclear effective charge of the given atom id Note “atom_charge /= charge(atom_symbol)” when ECP is enabled. Number of electrons screened by ECP can be obtained by charge(atom_symbol)-atom_charge

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_charge(1)
17
atom_charges()

np.asarray([mol.atom_charge(i) for i in range(mol.natm)])

atom_coord(atm_id, unit='Bohr')

Coordinates (ndarray) of the given atom id

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_coord(1)
[ 0.          0.          2.07869874]
atom_mass_list(isotope_avg=False)

A list of mass for all atoms in the molecule

Kwargs:
isotope_avgboolean

Whether to use the isotope average mass as the atomic mass

atom_nelec_core(atm_id)

Number of core electrons for pseudo potential.

atom_nshells(atm_id)

Number of basis/shells of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.atom_nshells(1)
5
atom_pure_symbol(site)

For the given atom id, return the standard symbol (striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H
atom_shell_ids(atm_id)

A list of the shell-ids of the given atom

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.atom_shell_ids(1)
[3, 4, 5, 6, 7]
atom_symbol(site)

For the given atom id, return the input symbol (without striping special characters)

Parameters:

atm_id – int 0-based

Examples:

>>> mol.build(atom='H^2 0 0 0; H 0 0 1.1')
>>> mol.atom_symbol(0)
H^2
bas_angular(bas_id)

The angular momentum associated with the given basis

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
2
bas_atom(bas_id)

The atom (0-based id) that the given basis sits on

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(7)
1
bas_coord(bas_id)

Coordinates (ndarray) associated with the given basis id

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1')
>>> mol.bas_coord(1)
[ 0.          0.          2.07869874]
bas_ctr_coeff(bas_id)

Contract coefficients (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.M(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_ctr_coeff(0)
[[ 10.03400444]
 [  4.1188704 ]
 [  1.53971186]]
bas_exp(bas_id)

exponents (ndarray) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(0)
[ 13.01     1.962    0.4446]
bas_exps()

exponents of all basis return [mol.bas_exp(i) for i in range(self.nbas)]

bas_kappa(bas_id)

Kappa (if l < j, -l-1, else l) of the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_kappa(3)
0
bas_len_cart(bas_id)

The number of Cartesian function associated with given basis

bas_len_spinor(bas_id)

The number of spinor associated with given basis If kappa is 0, return 4l+2

bas_nctr(bas_id)

The number of contracted GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
3
bas_nprim(bas_id)

The number of primitive GTOs for the given shell

Parameters:

bas_id – int 0-based

Examples:

>>> mol.build(atom='H 0 0 0; Cl 0 0 1.1', basis='cc-pvdz')
>>> mol.bas_atom(3)
11
bas_rcut(bas_id, precision=None)

Estimate the largest distance between the function and its image to reach the precision in overlap

precision ~ int g(r-0) g(r-Rcut)

build(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

build_lattice_symmetry(check_mesh_symmetry=True)

Build cell.lattice_symmetry object.

Kwargs:
check_mesh_symmetrybool

For nonsymmorphic symmetry groups, cell.mesh may have lower symmetry than the lattice. In this case, if check_mesh_symmetry is True, the lower symmetry group will be used. Otherwise, if check_mesh_symmetry is False, the mesh grid will be modified to satisfy the higher symmetry. Default value is True.

Note

This function modifies the attributes of cell.

cart = False
cart2sph_coeff(normalized='sp')

Transformation matrix that transforms Cartesian GTOs to spherical GTOs for all basis functions

Kwargs:
normalizedstring or boolean

How the Cartesian GTOs are normalized. Except s and p functions, Cartesian GTOs do not have the universal normalization coefficients for the different components of the same shell. The value of this argument can be one of ‘sp’, ‘all’, None. ‘sp’ means the Cartesian s and p basis are normalized. ‘all’ means all Cartesian functions are normalized. None means none of the Cartesian functions are normalized. The default value ‘sp’ is the convention used by libcint library.

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvtz')
>>> c = mol.cart2sph_coeff()
>>> s0 = mol.intor('int1e_ovlp_sph')
>>> s1 = c.T.dot(mol.intor('int1e_ovlp_cart')).dot(c)
>>> print(abs(s1-s0).sum())
>>> 4.58676826646e-15
cart_labels(fmt=True, base=0)

Labels of Cartesian GTO functions

Kwargs:

fmt : str or bool if fmt is boolean, it controls whether to format the labels and the default format is “%d%3s %s%-4s”. if fmt is string, the string will be used as the print format.

Returns:

List of [(atom-id, symbol-str, nl-str, str-of-xyz-notation)] or formatted strings based on the argument “fmt”

charge = 0
check_sanity()

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

condense_to_shell(mat, compressor='max')

The given matrix is first partitioned to blocks, based on AO shell as delimiter. Then call compressor function to abstract each block.

Parameters:

compressor – string or function if compressor is a string, its value can be sum, max, min, abssum, absmax, absmin, norm

copy(deep=True)

Deepcopy of the given Mole object

Some attributes are shared between the original and copied objects. Deepcopy is utilized here to ensure that operations on the copied object do not affect the original object.

cutoff_to_mesh(ke_cutoff)

Convert KE cutoff to FFT-mesh

Parameters:

ke_cutoff – float KE energy cutoff in a.u.

Returns:

(3,) array

Return type:

mesh

decontract_basis(atoms=None, to_cart=False, aggregate=False)

Decontract the basis of a Mole or a Cell. Returns a Mole (Cell) object with the uncontracted basis environment and a list of coefficients that transform the uncontracted basis to the original basis. Each element in the coefficients list corresponds to one shell of the original Mole (Cell).

Kwargs:
atoms: list or str

Atoms on which the basis to be decontracted. By default, all basis are decontracted

to_cart: bool

Decontract basis and transfer to Cartesian basis

aggregate: bool

Whether to aggregate the transformation coefficients into a giant transformation matrix

Examples:

>>> mol = gto.M(atom='Ne', basis='ccpvdz')
>>> pmol, ctr_coeff = mol.decontract_basis()
>>> c = scipy.linalg.block_diag(*ctr_coeff)
>>> s = reduce(numpy.dot, (c.T, pmol.intor('int1e_ovlp'), c))
>>> abs(s-mol.intor('int1e_ovlp')).max()
0.0
property drop_exponent
dump_input()
dumps()

Serialize Cell object to a JSON formatted str.

property elements

A list of elements in the molecule

energy_nuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

property enuc

nuclear repulsion energy

static etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
property ew_cut
property ew_eta
ewald(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

exp_to_discard = None
static expand_etb(l, n, alpha, beta)

Generate the exponents of even tempered basis for Mole.basis. .. math:

e = e^{-\alpha * \beta^{i-1}} for i = 1 .. n
Parameters:
  • l – int Angular momentum

  • n – int Number of GTOs

Returns:

Formatted basis

Examples:

>>> gto.expand_etb(1, 3, 1.5, 2)
[[1, [6.0, 1]], [1, [3.0, 1]], [1, [1.5, 1]]]
static expand_etbs(etbs)

Generate even tempered basis. See also expand_etb()

Parameters:

[ (etbs =) –

Returns:

Formatted basis

Examples:

>>> gto.expand_etbs([(0, 2, 1.5, 2.), (1, 2, 1, 2.)])
[[0, [6.0, 1]], [0, [3.0, 1]], [1, [1., 1]], [1, [2., 1]]]
format_atom(atoms, origin=0, axes=None, unit='angstrom')

Convert the input Mole.atom to the internal data format. Including, changing the nuclear charge to atom symbol, converting the coordinates to AU, rotate and shift the molecule. If the atom is a string, it takes “;” and “n” for the mark to separate atoms; “,” and arbitrary length of blank space to separate the individual terms for an atom. Blank line will be ignored.

Parameters:

atoms – list or str the same to Mole.atom

Kwargs:
originndarray

new axis origin.

axesndarray

(new_x, new_y, new_z), new coordinates

unitstr or number

If unit is one of strings (B, b, Bohr, bohr, AU, au), the coordinates of the input atoms are the atomic unit; If unit is one of strings (A, a, Angstrom, angstrom, Ang, ang), the coordinates are in the unit of angstrom; If a number is given, the number are considered as the Bohr value (in angstrom), which should be around 0.53. Set unit=1 if wishing to preserve the unit of the coordinates.

Returns:

“atoms” in the internal format. The internal format is
atom = [[atom1, (x, y, z)],
[atom2, (x, y, z)],
[atomN, (x, y, z)]]

Examples:

>>> gto.format_atom('9,0,0,0; h@1 0 0 1', origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H@1', [-1.0, -1.0, 0.0]]]
>>> gto.format_atom(['9,0,0,0', (1, (0, 0, 1))], origin=(1,1,1))
[['F', [-1.0, -1.0, -1.0]], ['H', [-1, -1, 0]]]
static format_basis(basis_tab, sort_basis=True)

Convert the input Mole.basis to the internal data format.

``{ atom: [(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..))),

(l, ((-exp, c_1, c_2, ..),

(-exp, c_1, c_2, ..)))], … }``

Parameters:

basis_tab – dict Similar to Mole.basis, it cannot be a str

Returns:

Formatted basis

Examples:

>>> gto.format_basis({'H':'sto-3g', 'H^2': '3-21g'})
{'H': [[0,
    [3.4252509099999999, 0.15432897000000001],
    [0.62391373000000006, 0.53532813999999995],
    [0.16885539999999999, 0.44463454000000002]]],
 'H^2': [[0,
    [5.4471780000000001, 0.15628500000000001],
    [0.82454700000000003, 0.90469100000000002]],
    [0, [0.18319199999999999, 1.0]]]}
>>> gto.format_basis({'H':'gth-szv'})
{'H': [[0,
    (8.3744350009, -0.0283380461),
    (1.8058681460, -0.1333810052),
    (0.4852528328, -0.3995676063),
    (0.1658236932, -0.5531027541)]]}
static format_ecp(ecp_tab)

Convert the input ecp (dict) to the internal data format:

{ atom: (nelec,  # core electrons
((l, # l=-1 for UL, l>=0 for Ul to indicate |l><l|
(((exp_1, c_1), # for r^0

(exp_2, c_2), …),

((exp_1, c_1), # for r^1

(exp_2, c_2), …),

((exp_1, c_1), # for r^2

…))))),

…}

static format_pseudo(pseudo_tab)

Convert the input pseudo (dict) to the internal data format:

{ atom: ( (nelec_s, nele_p, nelec_d, ...),
         rloc, nexp, (cexp_1, cexp_2, ..., cexp_nexp),
         nproj_types,
         (r1, nproj1, ( (hproj1[1,1], hproj1[1,2], ..., hproj1[1,nproj1]),
                        (hproj1[2,1], hproj1[2,2], ..., hproj1[2,nproj1]),
                        ...
                        (hproj1[nproj1,1], hproj1[nproj1,2], ...        ) )),
         (r2, nproj2, ( (hproj2[1,1], hproj2[1,2], ..., hproj2[1,nproj1]),
         ... ) )
         )
 ... }
Parameters:

pseudo_tab – dict Similar to pseudo (a dict), it cannot be a str

Returns:

Formatted pseudo

Examples:

>>> pbc.format_pseudo({'H':'gth-blyp', 'He': 'gth-pade'})
{'H': [[1],
    0.2, 2, [-4.19596147, 0.73049821], 0],
 'He': [[2],
    0.2, 2, [-9.1120234, 1.69836797], 0]}
from_ase(ase_atom)

Update cell based on given ase atom object

Examples:

>>> from ase.lattice import bulk
>>> cell.from_ase(bulk('C', 'diamond', a=LATTICE_CONST))
fromfile(filename, format=None)

Update the Cell object based on the input geometry file

fromstring(string, format='poscar')

Update the Cell object based on the input geometry string

gen_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

get_Gv(mesh=None, **kwargs)

Calculate three-dimensional G-vectors for the cell; see MH (3.8).

Indices along each direction go as [0…N-1, -N…-1] to follow FFT convention.

Parameters:

cell – instance of Cell

Returns:

(ngrids, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_Gv_weights(mesh=None, **kwargs)

Calculate G-vectors and weights.

Returns:

(ngris, 3) ndarray of floats

The array of G-vectors.

Return type:

Gv

get_SI(Gv=None, mesh=None, atmlst=None)

Calculate the structure factor (0D, 1D, 2D, 3D) for all atoms; see MH (3.34).

Parameters:
  • cell – instance of Cell

  • Gv – (N,3) array G vectors

  • atmlst – list of ints, optional Indices of atoms for which the structure factors are computed.

Returns:

(natm, ngrids) ndarray, dtype=np.complex128

The structure factor for each atom at each G-vector.

Return type:

SI

get_abs_kpts(scaled_kpts)

Get absolute k-points (in 1/Bohr), given “scaled” k-points in fractions of lattice vectors.

Parameters:

scaled_kpts – (nkpts, 3) ndarray of floats

Returns:

(nkpts, 3) ndarray of floats

Return type:

abs_kpts

get_ao_indices(bas_list, ao_loc=None)

Generate (dis-continued) AO indices for basis specified in bas_list

get_bounding_sphere(rcut)

Finds all the lattice points within a sphere of radius rcut.

Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3] See Martin p. 85

Parameters:

rcut – number real space cut-off for interaction

Returns:

ndarray of 3 ints defining N_x

Return type:

cut

get_enuc(ew_eta=None, ew_cut=None)

Perform real (R) and reciprocal (G) space Ewald sum for the energy.

Formulation of Martin, App. F2.

Returns:

float

The Ewald energy consisting of overlap, self, and G-space sum.

See also

pyscf.pbc.gto.get_ewald_params

get_ewald_params(precision=None, mesh=None)

Choose a reasonable value of Ewald ‘eta’ and ‘cut’ parameters. eta^2 is the exponent coefficient of the model Gaussian charge for nucleus at R: frac{eta^3}{pi^1.5} e^{-eta^2 (r-R)^2}

Choice is based on largest G vector and desired relative precision.

The relative error in the G-space sum is given by

precision ~ 4pi Gmax^2 e^{(-Gmax^2)/(4 eta^2)}

which determines eta. Then, real-space cutoff is determined by (exp. factors only)

precision ~ erfc(eta*rcut) / rcut ~ e^{(-eta**2 rcut*2)}

Returns:

float

The Ewald ‘eta’ and ‘cut’ parameters.

Return type:

ew_eta, ew_cut

get_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
get_lattice_Ls(nimgs=None, rcut=None, dimension=None, discard=True)

Get the (Cartesian, unitful) lattice translation vectors for nearby images. The translation vectors can be used for the lattice summation.

Kwargs:
discard:

Drop less important Ls based on AO values on grid

get_nimgs(precision=None)

Choose number of basis function images in lattice sums to include for given precision in overlap, using

precision ~ int r^l e^{-alpha r^2} (r-rcut)^l e^{-alpha (r-rcut)^2} ~ (rcut^2/(2alpha))^l e^{alpha/2 rcut^2}

where alpha is the smallest exponent in the basis. Note that assumes an isolated exponent in the middle of the box, so it adds one additional lattice vector to be safe.

get_overlap_cond(shls_slice=None)

Overlap magnitudes measured by -log(overlap) between two shells

Parameters:

mol – an instance of Mole

Returns:

2D mask array of shape (nbas,nbas)

get_scaled_atom_coords(a=None)

Get scaled atomic coordinates.

get_scaled_kpts(abs_kpts, kpts_in_ibz=True)

Get scaled k-points, given absolute k-points in 1/Bohr.

Parameters:
  • abs_kpts – (nkpts, 3) ndarray of floats or KPoints object

  • kpts_in_ibz – bool If True, return k-points in IBZ; otherwise, return k-points in BZ. Default value is True. This has effects only if abs_kpts is a KPoints object

Returns:

(nkpts, 3) ndarray of floats

Return type:

scaled_kpts

get_uniform_grids(mesh=None, wrap_around=True)

Generate a uniform real-space grid consistent w/ samp thm; see MH (3.19).

Parameters:

cell – instance of Cell

Returns:

(ngx*ngy*ngz, 3) ndarray

The real-space grid point coordinates.

Return type:

coords

property gs
gto_norm(l, expnt)

Normalized factor for GTO radial part \(g=r^l e^{-\alpha r^2}\)

\[\frac{1}{\sqrt{\int g^2 r^2 dr}} = \sqrt{\frac{2^{2l+3} (l+1)! (2a)^{l+1.5}}{(2l+2)!\sqrt{\pi}}}\]

Ref: H. B. Schlegel and M. J. Frisch, Int. J. Quant. Chem., 54(1995), 83-87.

Parameters:
  • l (int) – angular momentum

  • expnt – exponent \(\alpha\)

Returns:

normalization factor

Examples:

>>> print(gto_norm(0, 1))
2.5264751109842591
property h
has_ecp()

Whether pseudo potential is used in the system.

has_ecp_soc()

Whether spin-orbit coupling is enabled in ECP.

incore_anyway = False
intor(intor, comp=None, hermi=0, aosym='s1', out=None, shls_slice=None, grids=None)

Integral generator.

Parameters:

intor – str Name of the 1e or 2e AO integrals. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

hermiint

Symmetry of the integrals

0 : no symmetry assumed (default)
1 : hermitian
2 : anti-hermitian
shls_slice4-element, 6-element or 8-element tuple

Label the start-stop shells for each index in the integral. For example, the 8-element tuple for the 2-electron integral tensor (ij|kl) = intor(‘int2e’) are specified as (ish_start, ish_end, jsh_start, jsh_end, ksh_start, ksh_end, lsh_start, lsh_end)

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor('int1e_ipnuc_sph', comp=3) # <nabla i | V_nuc | j>
[[[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.          0.        ]
  [ 0.          0.        ]]
 [[ 0.10289944  0.48176097]
  [-0.48176097 -0.10289944]]]
>>> mol.intor('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_asymmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be anti-hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_asymmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j  0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j  0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
intor_by_shell(intor, shells, comp=None, grids=None)

For given 2, 3 or 4 shells, interface for libcint to get 1e, 2e, 2-center-2e or 3-center-2e integrals

Parameters:
  • intor_name – str See also getints() for the supported intor_name

  • shls – list of int The AO shell-ids of the integrals

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp has 3 components.

Returns:

ndarray of 2-dim to 5-dim, depending on the integral type (1e, 2e, 3c-2e, 2c2e) and the value of comp

Examples

The gradients of the spherical 2e integrals

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> gto.getints_by_shell('int2e_ip1_sph', (0,1,0,1), mol._atm, mol._bas, mol._env, comp=3)
[[[[[-0.        ]]]]
  [[[[-0.        ]]]]
  [[[[-0.08760462]]]]]
intor_symmetric(intor, comp=None, grids=None)

One-electron integral generator. The integrals are assumed to be hermitian

Parameters:

intor – str Name of the 1-electron integral. Ref to getints() for the complete list of available 1-electron integral names

Kwargs:
compint

Components of the integrals, e.g. int1e_ipovlp_sph has 3 components.

gridsndarray

Coordinates of grids for the int1e_grids integrals

Returns:

ndarray of 1-electron integrals, can be either 2-dim or 3-dim, depending on comp

Examples:

>>> mol.build(atom='H 0 0 0; H 0 0 1.1', basis='sto-3g')
>>> mol.intor_symmetric('int1e_nuc_spinor')
[[-1.69771092+0.j  0.00000000+0.j -0.67146312+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -1.69771092+0.j  0.00000000+0.j -0.67146312+0.j]
 [-0.67146312+0.j  0.00000000+0.j -1.69771092+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.67146312+0.j  0.00000000+0.j -1.69771092+0.j]]
kernel(dump_input=True, parse_arg=False, a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None, h=None, dimension=None, rcut=None, low_dim_ft_type=None, space_group_symmetry=None, symmorphic=None, use_loose_rcut=None, use_particle_mesh_ewald=None, fractional=None, *args, **kwargs)

Setup Mole molecule and Cell and initialize some control parameters. Whenever you change the value of the attributes of Cell, you need call this function to refresh the internal data of Cell.

Kwargs:
a(3,3) ndarray

The real-space cell lattice vectors. Each row represents a lattice vector.

fractionalbool

Whether the atom postions are specified in fractional coordinates. The default value is False, which means the coordinates are interpreted as Cartesian coordinate.

mesh(3,) ndarray of ints

The number of positive G-vectors along each direction.

ke_cutofffloat

If set, defines a spherical cutoff of planewaves, with .5 * G**2 < ke_cutoff The default value is estimated based on precision

precisionfloat

To control Ewald sums and lattice sums accuracy

nimgs(3,) ndarray of ints

Number of repeated images in lattice summation to produce periodicity. This value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

rcutfloat

Cutoff radius (unit Bohr) in lattice summation to produce periodicity. The value can be estimated based on the required precision. It’s recommended NOT making changes to this value.

h(3,3) ndarray

a.T. Deprecated

dimensionint

Default is 3

low_dim_ft_typestr

For semi-empirical periodic systems, whether to calculate integrals at the non-PBC dimension using the sampled mesh grids in infinity vacuum (inf_vacuum) or truncated Coulomb potential (analytic_2d_1). Unless explicitly specified, analytic_2d_1 is used for 2D system and inf_vacuum is assumed for 1D and 0D.

space_group_symmetrybool

Whether to consider space group symmetry. Default is False.

symmorphicbool

Whether the lattice is symmorphic. If set to True, even if the lattice is non-symmorphic, only symmorphic space group symmetry will be considered. Default is False, meaning the space group is determined by the lattice symmetry to be symmorphic or non-symmorphic.

classmethod loads(molstr)

Deserialize a str containing a JSON document to a Cell object.

loads_(molstr)

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

make_atm_env(atom, ptr=0, nucmod=1, nucprop=None)

Convert the internal format Mole._atom to the format required by libcint integrals

make_bas_env(basis_add, atom_id=0, ptr=0)

Convert Mole.basis to the argument bas for libcint integrals

make_ecp_env(_atm, _ecp, pre_env=[])

Generate the input arguments _ecpbas for ECP integrals

make_env(atoms, basis, pre_env=[], nucmod={}, nucprop=None)

Generate the input arguments for libcint library based on internal format Mole._atom and Mole._basis

make_kpts(nks, wrap_around=False, with_gamma_point=True, scaled_center=None, space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)

Given number of kpoints along x,y,z , generate kpoints

Parameters:

nks – (3,) ndarray

Kwargs:
wrap_aroundbool

To ensure all kpts are in first Brillouin zone.

with_gamma_pointbool

Whether to shift Monkhorst-pack grid to include gamma-point.

scaled_center(3,) array

Shift all points in the Monkhorst-pack grid to be centered on scaled_center, given as the zeroth index of the returned kpts. Scaled meaning that the k-points are scaled to a grid from [-1,1] x [-1,1] x [-1,1]

space_group_symmetrybool

Whether to consider space group symmetry

time_reversal_symmetrybool

Whether to consider time reversal symmetry

Returns:

kpts in absolute value (unit 1/Bohr). Gamma point is placed at the first place in the k-points list; instance of KPoints if k-point symmetry is considered

Examples:

>>> cell.make_kpts((4,4,4))
max_memory = 4000
property mesh
property ms

Spin quantum number. multiplicity = ms*2+1

property multiplicity
property nao
nao_2c()

Total number of contracted spinor GTOs for the given Mole object

nao_2c_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spinor basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id, 0-based

  • bas_id1 – int stop shell id, 0-based

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_2c_range(mol, 2, 4)
(4, 12)
nao_cart()

Total number of contracted cartesian GTOs for the given Mole object

nao_nr()

Total number of contracted GTOs for the given Mole object

nao_nr_range(bas_id0, bas_id1)

Lower and upper boundary of contracted spherical basis functions associated with the given shell range

Parameters:
  • molMole object

  • bas_id0 – int start shell id

  • bas_id1 – int stop shell id

Returns:

tuple of start basis function id and the stop function id

Examples:

>>> mol = gto.M(atom='O 0 0 0; C 0 0 1', basis='6-31g')
>>> gto.nao_nr_range(mol, 2, 4)
(2, 6)
property natm
property nbas
property nelec
property nelectron
property nimgs
npgto_nr(cart=None)

Total number of primitive spherical GTOs for the given Mole object

offset_2c_by_atom()

2-component AO offset for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_ao_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

offset_nr_by_atom(ao_loc=None)

AO offsets for each atom. Return a list, each item of the list gives (start-shell-id, stop-shell-id, start-AO-id, stop-AO-id)

property omega
output = None
pack()

Pack the input args of Cell to a dict, which can be serialized with pickle

pbc_eval_ao(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_eval_gto(eval_name, coords, comp=None, kpts=None, kpt=None, shls_slice=None, non0tab=None, ao_loc=None, cutoff=None, out=None, Ls=None, rcut=None)

Evaluate PBC-AO function value on the given grids,

Parameters:
  • eval_name

    str:

    ==========================  =======================
    Function                    Expression
    ==========================  =======================
    "GTOval_sph"                \sum_T exp(ik*T) |AO>
    "GTOval_ip_sph"             nabla \sum_T exp(ik*T) |AO>
    "GTOval_cart"               \sum_T exp(ik*T) |AO>
    "GTOval_ip_cart"            nabla \sum_T exp(ik*T) |AO>
    ==========================  =======================
    

  • atm – int32 ndarray libcint integral function argument

  • bas – int32 ndarray libcint integral function argument

  • env – float64 ndarray libcint integral function argument

  • coords – 2D array, shape (N,3) The coordinates of the grids.

Kwargs:
shls_slice2-element list

(shl_start, shl_end). If given, only part of AOs (shl_start <= shell_id < shl_end) are evaluated. By default, all shells defined in cell will be evaluated.

non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling dft.gen_grid.make_mask()

cutofffloat

AO values smaller than cutoff will be set to zero. The default cutoff threshold is ~1e-22 (defined in gto/grid_ao_drv.h)

outndarray

If provided, results are written into this array.

Returns:

A list of 2D (or 3D) arrays to hold the AO values on grids. Each element of the list corresponds to a k-point and it has the shape (N,nao) Or shape (*,N,nao).

Examples:

>>> cell = pbc.gto.M(a=numpy.eye(3)*4, atom='He 1 1 1', basis='6-31g')
>>> coords = cell.get_uniform_grids([10,10,10])
>>> kpts = cell.make_kpts([3,3,3])
>>> ao_value = cell.pbc_eval_gto("GTOval_sph", coords, kpts)
>>> len(ao_value)
27
>>> ao_value[0].shape
(1000, 2)
>>> ao_value = cell.pbc_eval_gto("GTOval_ig_sph", coords, kpts, comp=3)
>>> print(ao_value.shape)
>>> len(ao_value)
27
>>> ao_value[0].shape
(3, 1000, 2)
pbc_intor(intor, comp=None, hermi=0, kpts=None, kpt=None, shls_slice=None, **kwargs)

One-electron integrals with PBC.

\[\sum_T \int \mu(r) * [intor] * \nu (r-T) dr\]

See also Mole.intor

post_kernel(envs)

A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.

pre_kernel(envs)

A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.

precision = 1e-08
property rcut
rcut_by_shells(precision=None, rcut=0, return_pgf_radius=False)

Compute shell and primitive gaussian function radii.

reciprocal_vectors(norm_to=6.283185307179586)
\[\begin{split}\begin{align} \mathbf{b_1} &= 2\pi \frac{\mathbf{a_2} \times \mathbf{a_3}}{\mathbf{a_1} \cdot (\mathbf{a_2} \times \mathbf{a_3})} \\ \mathbf{b_2} &= 2\pi \frac{\mathbf{a_3} \times \mathbf{a_1}}{\mathbf{a_2} \cdot (\mathbf{a_3} \times \mathbf{a_1})} \\ \mathbf{b_3} &= 2\pi \frac{\mathbf{a_1} \times \mathbf{a_2}}{\mathbf{a_3} \cdot (\mathbf{a_1} \times \mathbf{a_2})} \end{align}\end{split}\]
run(*args, **kwargs)

Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.

search_ao_label()

Find the index of the AO basis function based on the given ao_label

Parameters:

ao_label – string or a list of strings The regular expression pattern to match the orbital labels returned by mol.ao_labels()

Returns:

A list of index for the AOs that matches the given ao_label RE pattern

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='ccpvtz')
>>> mol.search_ao_label('Cl.*p')
[19 20 21 22 23 24 25 26 27 28 29 30]
>>> mol.search_ao_label('Cl 2p')
[19 20 21]
>>> mol.search_ao_label(['Cl.*d', 'Cl 4p'])
[25 26 27 31 32 33 34 35 36 37 38 39 40]
search_ao_nr(atm_id, l, m, atmshell)

Search the first basis function id (not the shell id) which matches the given atom-id, angular momentum magnetic angular momentum, principal shell.

Parameters:
  • atm_id – int atom id, 0-based

  • l – int angular momentum

  • m – int magnetic angular momentum

  • atmshell – int principal quantum number

Returns:

basis function id, 0-based. If not found, return None

Examples:

>>> mol = gto.M(atom='H 0 0 0; Cl 0 0 1', basis='sto-3g')
>>> mol.search_ao_nr(1, 1, -1, 3) # Cl 3px
7
search_ao_r(atm_id, l, j, m, atmshell)
search_shell_id(atm_id, l)
set(*args, **kwargs)

Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

set_common_orig(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_orig_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_common_origin_(coord)

Update common origin for integrals of dipole, rxp etc. Note the unit of the coordinates needs to be Bohr

Examples:

>>> mol.set_common_origin(0)
>>> mol.set_common_origin((1,0,0))
set_f12_zeta(zeta)

Set zeta for YP exp(-zeta r12)/r12 or STG exp(-zeta r12) type integrals

set_geom_(atoms_or_coords, unit=None, symmetry=None, inplace=True)

Update geometry

set_nuc_mod(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_nuc_mod_(atm_id, zeta)

Change the nuclear charge distribution of the given atom ID. The charge distribution is defined as: rho(r) = nuc_charge * Norm * exp(-zeta * r^2). This function can only be called after .build() method is executed.

Examples:

>>> for ia in range(mol.natm):
...     zeta = gto.filatov_nuc_mod(mol.atom_charge(ia))
...     mol.set_nuc_mod(ia, zeta)
set_range_coulomb(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_range_coulomb_(omega)

Switch on range-separated Coulomb operator for all 2e integrals

Parameters:

omega

double

= 0 : Regular electron repulsion integral
> 0 : Long-range operator erf(omega r12) / r12
< 0 : Short-range operator erfc(omega r12) /r12

set_rinv_orig(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_orig_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_origin_(coord)

Update origin for operator \(\frac{1}{|r-R_O|}\). Note the unit is Bohr

Examples:

>>> mol.set_rinv_origin(0)
>>> mol.set_rinv_origin((0,1,0))
set_rinv_zeta(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affects the behavior of int1e_rinv_* functions. Make sure to set it back to 0 after using it!

set_rinv_zeta_(zeta)

Assume the charge distribution on the “rinv_origin”. zeta is the parameter to control the charge distribution: rho(r) = Norm * exp(-zeta * r^2). Be careful when call this function. It affe