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.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
- 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
objectSome 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 theatom
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))
- 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
objectkpts_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 : hermitian2 : 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_nameshls – 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 bylibcint
integrals
- make_bas_env(basis_add, atom_id=0, ptr=0)
Convert
Mole.basis
to the argumentbas
forlibcint
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 formatMole._atom
andMole._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:
mol –
Mole
objectbas_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:
mol –
Mole
objectbas_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 withpickle
- 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
- 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 forCell
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.
- 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
objectSome 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 theatom
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))
- 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
objectkpts_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 : hermitian2 : 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_nameshls – 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 bylibcint
integrals
- make_bas_env(basis_add, atom_id=0, ptr=0)
Convert
Mole.basis
to the argumentbas
forlibcint
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 formatMole._atom
andMole._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:
mol –
Mole
objectbas_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:
mol –
Mole
objectbas_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 withpickle
- 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
- 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 forCell
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.
- 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.
- 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
objectSome 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 theatom
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))
- 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
objectkpts_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 : hermitian2 : 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_nameshls – 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 bylibcint
integrals
- make_bas_env(basis_add, atom_id=0, ptr=0)
Convert
Mole.basis
to the argumentbas
forlibcint
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 formatMole._atom
andMole._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:
mol –
Mole
objectbas_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:
mol –
Mole
objectbas_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 withpickle
- 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
- 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 forCell
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
- 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.
- 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
objectSome 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 theatom
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))
- 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
objectkpts_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 : hermitian2 : 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_nameshls – 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 bylibcint
integrals
- make_bas_env(basis_add, atom_id=0, ptr=0)
Convert
Mole.basis
to the argumentbas
forlibcint
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 formatMole._atom
andMole._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:
mol –
Mole
objectbas_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:
mol –
Mole
objectbas_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 withpickle
- 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
- 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 forCell
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.LatticeRHF(mol, *args, **kwargs)[source]
Bases:
LatticeSCF
,RHF
- get_jk(mol=None, dm=None, *args, **kwargs)[source]
Compute J, K matrices for all input density matrices
- Parameters:
mol – an instance of
Mole
dm – ndarray or list of ndarrays A density matrix or a list of density matrices
- Kwargs:
- hermiint
Whether J, K matrix is hermitian
0 : not hermitian and not symmetric1 : hermitian or symmetric2 : anti-hermitian- vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
- with_jboolean
Whether to compute J matrices
- with_kboolean
Whether to compute K matrices
- omegafloat
Parameter of range-separated Coulomb operator: erf( omega * r12 ) / r12. If specified, integration are evaluated based on the long-range part of the range-separated Coulomb operator.
- Returns:
Depending on the given dm, the function returns one J and one K matrix, or a list of J matrices and a list of K matrices, corresponding to the input density matrices.
Examples:
>>> from pyscf import gto, scf >>> from pyscf.scf import _vhf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dms = numpy.random.random((3,mol.nao_nr(),mol.nao_nr())) >>> j, k = scf.hf.get_jk(mol, dms, hermi=0) >>> print(j.shape) (3, 2, 2)
- CCSD(frozen=None, mo_coeff=None, mo_occ=None)
restricted CCSD
- verbose
int Print level. Default value equals to
Mole.verbose
- max_memory
float or int Allowed memory in MB. Default value equals to
Mole.max_memory
- conv_tol
float converge threshold. Default is 1e-7.
- conv_tol_normt
float converge threshold for norm(t1,t2). Default is 1e-5.
- max_cycle
int max number of iterations. Default is 50.
- diis_space
int DIIS space size. Default is 6.
- diis_start_cycle
int The step to start DIIS. Default is 0.
- iterative_damping
float The self consistent damping parameter.
- direct
bool AO-direct CCSD. Default is False.
- async_io
bool Allow for asynchronous function execution. Default is True.
- incore_complete
bool Avoid all I/O (also for DIIS). Default is False.
- level_shift
float A shift on virtual orbital energies to stabilize the CCSD iteration
- frozen
int or list If integer is given, the inner-most orbitals are frozen from CC amplitudes. Given the orbital indices (0-based) in a list, both occupied and virtual orbitals can be frozen in CC calculation.
>>> mol = gto.M(atom = 'H 0 0 0; F 0 0 1.1', basis = 'ccpvdz') >>> mf = scf.RHF(mol).run() >>> # freeze 2 core orbitals >>> mycc = cc.CCSD(mf).set(frozen = 2).run() >>> # auto-generate the number of core orbitals to be frozen (1 in this case) >>> mycc = cc.CCSD(mf).set_frozen().run() >>> # freeze 2 core orbitals and 3 high lying unoccupied orbitals >>> mycc.set(frozen = [0,1,16,17,18]).run()
- callback
function(envs_dict) => None callback function takes one dict as the argument which is generated by the builtin function
locals()
, so that the callback function can access all local variables in the current environment.
Saved results:
- convergedbool
Whether the CCSD iteration converged
- e_corrfloat
CCSD correlation correction
- e_totfloat
Total CCSD energy (HF + correlation)
- t1, t2 :
T amplitudes t1[i,a], t2[i,j,a,b] (i,j in occ, a,b in virt)
- l1, l2 :
Lambda amplitudes l1[i,a], l2[i,j,a,b] (i,j in occ, a,b in virt)
- cyclesint
The number of iteration cycles performed
- CISD(*args, **kwargs)
- DFMP2(*args, **kwargs)
- DIIS
alias of
CDIIS
- MP2(*args, **kwargs)
restricted MP2 with canonical HF and non-canonical HF reference
- verbose
int Print level. Default value equals to
Mole.verbose
- max_memory
float or int Allowed memory in MB. Default value equals to
Mole.max_memory
- conv_tol
float For non-canonical MP2, converge threshold for MP2 correlation energy. Default value is 1e-7.
- conv_tol_normt
float For non-canonical MP2, converge threshold for norm(t2). Default value is 1e-5.
- max_cycle
int For non-canonical MP2, max number of MP2 iterations. Default value is 50.
- diis_space
int For non-canonical MP2, DIIS space size in MP2 iterations. Default is 6.
- level_shift
float A shift on virtual orbital energies to stabilize the MP2 iterations.
- frozen
int or list If integer is given, the inner-most orbitals are excluded from MP2 amplitudes. Given the orbital indices (0-based) in a list, both occupied and virtual orbitals can be frozen in MP2 calculation.
>>> mol = gto.M(atom = 'H 0 0 0; F 0 0 1.1', basis = 'ccpvdz') >>> mf = scf.RHF(mol).run() >>> # freeze 2 core orbitals >>> pt = mp.MP2(mf).set(frozen = 2).run() >>> # auto-generate the number of core orbitals to be frozen (1 in this case) >>> pt = mp.MP2(mf).set_frozen().run() >>> # freeze 2 core orbitals and 3 high lying unoccupied orbitals >>> pt.set(frozen = [0,1,16,17,18]).run()
Saved results
- e_corrfloat
MP2 correlation correction
- e_corr_ss/osfloat
Same-spin and opposite-spin component of the MP2 correlation energy
- e_totfloat
Total MP2 energy (HF + correlation)
- t2 :
T amplitudes t2[i,j,a,b] (i,j in occ, a,b in virt)
- QCISD(frozen=None, mo_coeff=None, mo_occ=None)
restricted QCISD
- analyze(verbose=None, with_meta_lowdin=True, **kwargs)
Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.
- 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.
- as_scanner()
Generating a scanner/solver for HF PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total HF energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters assigned in the SCF object (DIIS, conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf >>> hf_scanner = scf.RHF(gto.Mole().set(verbose=0)).as_scanner() >>> hf_scanner(gto.M(atom='H 0 0 0; F 0 0 1.1')) -98.552190448277955 >>> hf_scanner(gto.M(atom='H 0 0 0; F 0 0 1.5')) -98.414750424294368
- build(mol=None)
- callback = None
- canonicalize(mo_coeff, mo_occ, fock=None)
Canonicalization diagonalizes the Fock matrix within occupied, open, virtual subspaces separatedly (without change occupancy).
- property cell
- check_convergence = None
- 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.
- conv_check = True
- conv_tol = 1e-09
- conv_tol_cpscf = 1e-08
- conv_tol_grad = None
- convert_from_(mf)
Convert the input mean-field object to RHF/ROHF
- copy()
Returns a shallow copy
- damp = 0
- density_fit()
- diis = True
- diis_damp = 0
- diis_file = None
- diis_space = 8
- diis_space_rollback = 0
- diis_start_cycle = 1
- dip_moment(mol=None, dm=None, unit='Debye', origin=None, verbose=3, **kwargs)
Dipole moment calculation
\[\begin{split}\mu_x = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|x|\mu) + \sum_A Q_A X_A\\ \mu_y = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|y|\mu) + \sum_A Q_A Y_A\\ \mu_z = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|z|\mu) + \sum_A Q_A Z_A\end{split}\]where \(\mu_x, \mu_y, \mu_z\) are the x, y and z components of dipole moment
- Parameters:
mol – an instance of
Mole
dm – a 2D ndarrays density matrices
origin – optional; length 3 list, tuple, or 1D array Location of the origin. By default, the point (0, 0, 0) is used.
- Returns:
the dipole moment on x, y and z component
- Return type:
A list
- direct_scf = True
- direct_scf_tol = 1e-13
- disp = None
- do_disp(disp=None)
Check whether to apply dispersion correction based on the xc attribute. If dispersion is allowed, return the DFTD3 disp version, such as d3bj, d3zero, d4.
- dump_chk(envs_or_file)
Serialize the SCF object and save it to the specified chkfile.
- Parameters:
envs_or_file – If this argument is a file path, the serialized SCF object is saved to the file specified by this argument. If this attribute is a dict (created by locals()), the necessary variables are saved to the file specified by the attribute mf.chkfile.
- dump_flags(verbose=None)
- dump_scf_summary(verbose=5)
- eig(h, s)
Solver for generalized eigenvalue problem
\[HC = SCE\]
- energy_elec(dm=None, h1e=None, vhf=None)
Electronic part of Hartree-Fock energy, for given core hamiltonian and HF potential
… math:
E = \sum_{ij}h_{ij} \gamma_{ji} + \frac{1}{2}\sum_{ijkl} \gamma_{ji}\gamma_{lk} \langle ik||jl\rangle
Note this function has side effects which cause mf.scf_summary updated.
- Parameters:
mf – an instance of SCF class
- Kwargs:
- dm2D ndarray
one-particle density matrix
- h1e2D ndarray
Core hamiltonian
- vhf2D ndarray
HF potential
- Returns:
Hartree-Fock electronic energy and the Coulomb energy
Examples:
>>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> mf = scf.RHF(mol) >>> mf.scf() >>> dm = mf.make_rdm1() >>> scf.hf.energy_elec(mf, dm) (-1.5176090667746334, 0.60917167853723675) >>> mf.energy_elec(dm) (-1.5176090667746334, 0.60917167853723675)
- energy_nuc()
- energy_tot(dm=None, h1e=None, vhf=None)
Total Hartree-Fock energy, electronic part plus nuclear repulsion See
scf.hf.energy_elec()
for the electron partNote this function has side effects which cause mf.scf_summary updated.
- from_chk(chkfile=None, project=None)
Read the HF results from checkpoint file, then project it to the basis defined by
mol
- Kwargs:
- projectNone or bool
Whether to project chkfile’s orbitals to the new basis. Note when the geometry of the chkfile and the given molecule are very different, this projection can produce very poor initial guess. In PES scanning, it is recommended to switch off project.
If project is set to None, the projection is only applied when the basis sets of the chkfile’s molecule are different to the basis sets of the given molecule (regardless whether the geometry of the two molecules are different). Note the basis sets are considered to be different if the two molecules are derived from the same molecule with different ordering of atoms.
- Returns:
Density matrix, 2D ndarray
- gen_response(mo_coeff=None, mo_occ=None, singlet=None, hermi=0, max_memory=None)
Generate a function to compute the product of RHF response function and RHF density matrices.
- Kwargs:
- singlet (None or boolean)If singlet is None, response function for
orbital hessian or CPHF will be generated. If singlet is boolean, it is used in TDDFT response kernel.
- get_dispersion(disp=None, with_3body=None, verbose=None)
- get_fock(h1e=None, s1e=None, vhf=None, dm=None, cycle=-1, diis=None, diis_start_cycle=None, level_shift_factor=None, damp_factor=None, fock_last=None)
F = h^{core} + V^{HF}
Special treatment (damping, DIIS, or level shift) will be applied to the Fock matrix if diis and cycle is specified (The two parameters are passed to get_fock function during the SCF iteration)
- Kwargs:
- h1e2D ndarray
Core hamiltonian
- s1e2D ndarray
Overlap matrix, for DIIS
- vhf2D ndarray
HF potential matrix
- dm2D ndarray
Density matrix, for DIIS
- cycleint
Then present SCF iteration step, for DIIS
- diisan object of
SCF.DIIS
class DIIS object to hold intermediate Fock and error vectors
- diis_start_cycleint
The step to start DIIS. Default is 0.
- level_shift_factorfloat or int
Level shift (in AU) for virtual space. Default is 0.
- get_grad(mo_coeff, mo_occ, fock=None)
RHF orbital gradients
- Parameters:
mo_coeff – 2D ndarray Obital coefficients
mo_occ – 1D ndarray Orbital occupancy
fock_ao – 2D ndarray Fock matrix in AO representation
- Returns:
Gradients in MO representation. It’s a num_occ*num_vir vector.
- get_hcore(*args, **kwargs)
- get_j(mol=None, dm=None, hermi=1, omega=None)
Compute J matrices for all input density matrices
- get_k(mol=None, dm=None, hermi=1, omega=None)
Compute K matrices for all input density matrices
- get_occ(mo_energy=None, mo_coeff=None)
Label the occupancies for each orbital
- Kwargs:
- mo_energy1D ndarray
Obital energies
- mo_coeff2D ndarray
Obital coefficients
Examples:
>>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> energy = numpy.array([-10., -1., 1, -2., 0, -3]) >>> mf.get_occ(energy) array([2, 2, 0, 2, 2, 2])
- get_ovlp(mol=None)
- get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1)
Hartree-Fock potential matrix for the given density matrix
- Parameters:
mol – an instance of
Mole
dm – ndarray or list of ndarrays A density matrix or a list of density matrices
- Kwargs:
- dm_lastndarray or a list of ndarrays or 0
The density matrix baseline. If not 0, this function computes the increment of HF potential w.r.t. the reference HF potential matrix.
- vhf_lastndarray or a list of ndarrays or 0
The reference HF potential matrix.
- hermiint
Whether J, K matrix is hermitian
0 : no hermitian or symmetric1 : hermitian2 : anti-hermitian- vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
- Returns:
matrix Vhf = 2*J - K. Vhf can be a list matrices, corresponding to the input density matrices.
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> from pyscf.scf import _vhf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dm0 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf0 = scf.hf.get_veff(mol, dm0, hermi=0) >>> dm1 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf1 = scf.hf.get_veff(mol, dm1, hermi=0) >>> vhf2 = scf.hf.get_veff(mol, dm1, dm_last=dm0, vhf_last=vhf0, hermi=0) >>> numpy.allclose(vhf1, vhf2) True
- init_direct_scf(mol=None)
- init_guess = 'minao'
- init_guess_by_1e(mol=None)
Generate initial guess density matrix from core hamiltonian
- Returns:
Density matrix, 2D ndarray
- init_guess_by_atom(mol=None)
Generate initial guess density matrix from superposition of atomic HF density matrix. The atomic HF is occupancy averaged RHF
- Returns:
Density matrix, 2D ndarray
- init_guess_by_chkfile(chkfile=None, project=None)
Read the HF results from checkpoint file, then project it to the basis defined by
mol
- Kwargs:
- projectNone or bool
Whether to project chkfile’s orbitals to the new basis. Note when the geometry of the chkfile and the given molecule are very different, this projection can produce very poor initial guess. In PES scanning, it is recommended to switch off project.
If project is set to None, the projection is only applied when the basis sets of the chkfile’s molecule are different to the basis sets of the given molecule (regardless whether the geometry of the two molecules are different). Note the basis sets are considered to be different if the two molecules are derived from the same molecule with different ordering of atoms.
- Returns:
Density matrix, 2D ndarray
- init_guess_by_huckel(mol=None)
Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089
- Returns:
Density matrix, 2D ndarray
- init_guess_by_minao(mol=None)
Generate initial guess density matrix based on ANO basis, then project the density matrix to the basis set defined by
mol
- Returns:
Density matrix, 2D ndarray
Examples:
>>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> scf.hf.init_guess_by_minao(mol) array([[ 0.94758917, 0.09227308], [ 0.09227308, 0.94758917]])
- init_guess_by_mod_huckel(updated_rule, mol=None)
Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089
In contrast to init_guess_by_huckel, this routine employs the updated GWH rule from doi:10.1021/ja00480a005 to form the guess.
- Returns:
Density matrix, 2D ndarray
- init_guess_by_sap(mol=None, **kwargs)
Generate initial guess density matrix from a superposition of atomic potentials (SAP), doi:10.1021/acs.jctc.8b01089. This is the Gaussian fit implementation, see doi:10.1063/5.0004046.
- Parameters:
mol – MoleBase object the molecule object for which the initial guess is evaluated
sap_basis – dict SAP basis in internal format (python dictionary)
- Returns:
- ndarray
SAP initial guess density matrix
- Return type:
dm0
- istype(type_code)
Checks if the object is an instance of the class specified by the type_code. type_code can be a class or a str. If the type_code is a class, it is equivalent to the Python built-in function isinstance. If the type_code is a str, it checks the type_code against the names of the object and all its parent classes.
- kernel(dm0=None, **kwargs)
SCF main driver
- Kwargs:
- dm0ndarray
If given, it will be used as the initial guess density matrix
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> dm_guess = numpy.eye(mol.nao_nr()) >>> mf.kernel(dm_guess) converged SCF energy = -98.5521904482821 -98.552190448282104
- level_shift = 0
- make_rdm1(mo_coeff=None, mo_occ=None, **kwargs)
One-particle density matrix in AO representation
- Parameters:
mo_coeff – 2D ndarray Orbital coefficients. Each column is one orbital.
mo_occ – 1D ndarray Occupancy
- Returns:
One-particle density matrix, 2D ndarray
- make_rdm2(mo_coeff=None, mo_occ=None, **kwargs)
Two-particle density matrix in AO representation
- Parameters:
mo_coeff – 2D ndarray Orbital coefficients. Each column is one orbital.
mo_occ – 1D ndarray Occupancy
- Returns:
Two-particle density matrix, 4D ndarray
- max_cycle = 50
- mulliken_meta(mol=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- mulliken_pop(mol=None, dm=None, s=None, verbose=5)
Mulliken population analysis
\[M_{ij} = D_{ij} S_{ji}\]Mulliken charges
\[\delta_i = \sum_j M_{ij}\]- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- mulliken_pop_meta_lowdin_ao(*args, **kwargs)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- newton()
Create an SOSCF object based on the mean-field object
- nuc_grad_method()
Hook to create object for analytical nuclear gradients.
- property opt
- pop(*args, **kwargs)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- 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.
- quad_moment(mol=None, dm=None, unit='DebyeAngstrom', origin=None, verbose=3, **kwargs)
Calculates traceless quadrupole moment tensor.
The traceless quadrupole tensor is given by
\[\begin{split}Q_{ij} &= - \frac{1}{2} \sum_{\mu \nu} P_{\mu \nu} \left[ 3 (\nu | r_i r_j | \mu) - \delta_{ij} (\nu | r^2 | \mu) \right] \\ &+ \frac{1}{2} \sum_A Q_A \left( R_{iA} R_{jA} - \delta_{ij} \|\mathbf{R}_A\|^2 \right).\end{split}\]If the molecule has a dipole, the quadrupole moment depends on the location of the origin. By default, the origin is taken to be (0, 0, 0), but it can be set manually via the keyword argument origin.
- Parameters:
mol – an instance of
Mole
dm – a 2D ndarrays density matrices
origin – optional; length 3 list, tuple, or 1D array Location of the origin. By default, it is (0, 0, 0).
- Returns:
Traceless quadrupole tensor, 2D ndarray.
- remove_soscf()
Remove the SOSCF decorator
- reset(mol=None)
Reset mol and relevant attributes associated to the old mol object
- 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.
- sap_basis = 'sapgrasplarge'
- scf(dm0=None, **kwargs)
SCF main driver
- Kwargs:
- dm0ndarray
If given, it will be used as the initial guess density matrix
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> dm_guess = numpy.eye(mol.nao_nr()) >>> mf.kernel(dm_guess) converged SCF energy = -98.5521904482821 -98.552190448282104
- 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.
- sfx2c1e()
- spin_square(mo_coeff=None, s=None)
Spin square and multiplicity of RHF determinant
- stability(internal=True, external=False, verbose=None, return_status=False, **kwargs)
RHF/RKS stability analysis.
See also pyscf.scf.stability.rhf_stability function.
- Kwargs:
- internalbool
Internal stability, within the RHF optimization space.
- externalbool
External stability. Including the RHF -> UHF and real -> complex stability analysis.
- return_status: bool
Whether to return stable_i and stable_e
- Returns:
If return_status is False (default), the return value includes two set of orbitals, which are more close to the stable condition. The first corresponds to the internal stability and the second corresponds to the external stability.
Else, another two boolean variables (indicating current status: stable or unstable) are returned. The first corresponds to the internal stability and the second corresponds to the external stability.
- stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
- to_ghf()
Convert the input mean-field object to a GHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_gks(xc='HF')
Convert the input mean-field object to a GKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_gpu(out=None)
Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.
- to_ks(xc='HF')
Convert to RKS object.
- to_rhf()
Convert the input mean-field object to a RHF/ROHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_rks(xc='HF')
Convert the input mean-field object to a RKS/ROKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_uhf()
Convert the input mean-field object to a UHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_uks(xc='HF')
Convert the input mean-field object to a UKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- update(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_from_chk(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_from_chk_(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- verbose = 0
- view(cls)
New view of object with the same attributes.
- x2c()
- x2c1e()
- class vayesta.lattmod.latt.LatticeUHF(mol, *args, **kwargs)[source]
Bases:
LatticeSCF
,UHF
- get_jk(mol=None, dm=None, *args, **kwargs)[source]
Coulomb (J) and exchange (K)
- Parameters:
dm – a list of 2D arrays or a list of 3D arrays (alpha_dm, beta_dm) or (alpha_dms, beta_dms)
- CCSD(frozen=None, mo_coeff=None, mo_occ=None)
restricted CCSD
- verbose
int Print level. Default value equals to
Mole.verbose
- max_memory
float or int Allowed memory in MB. Default value equals to
Mole.max_memory
- conv_tol
float converge threshold. Default is 1e-7.
- conv_tol_normt
float converge threshold for norm(t1,t2). Default is 1e-5.
- max_cycle
int max number of iterations. Default is 50.
- diis_space
int DIIS space size. Default is 6.
- diis_start_cycle
int The step to start DIIS. Default is 0.
- iterative_damping
float The self consistent damping parameter.
- direct
bool AO-direct CCSD. Default is False.
- async_io
bool Allow for asynchronous function execution. Default is True.
- incore_complete
bool Avoid all I/O (also for DIIS). Default is False.
- level_shift
float A shift on virtual orbital energies to stabilize the CCSD iteration
- frozen
int or list If integer is given, the inner-most orbitals are frozen from CC amplitudes. Given the orbital indices (0-based) in a list, both occupied and virtual orbitals can be frozen in CC calculation.
>>> mol = gto.M(atom = 'H 0 0 0; F 0 0 1.1', basis = 'ccpvdz') >>> mf = scf.RHF(mol).run() >>> # freeze 2 core orbitals >>> mycc = cc.CCSD(mf).set(frozen = 2).run() >>> # auto-generate the number of core orbitals to be frozen (1 in this case) >>> mycc = cc.CCSD(mf).set_frozen().run() >>> # freeze 2 core orbitals and 3 high lying unoccupied orbitals >>> mycc.set(frozen = [0,1,16,17,18]).run()
- callback
function(envs_dict) => None callback function takes one dict as the argument which is generated by the builtin function
locals()
, so that the callback function can access all local variables in the current environment.
Saved results:
- convergedbool
Whether the CCSD iteration converged
- e_corrfloat
CCSD correlation correction
- e_totfloat
Total CCSD energy (HF + correlation)
- t1, t2 :
T amplitudes t1[i,a], t2[i,j,a,b] (i,j in occ, a,b in virt)
- l1, l2 :
Lambda amplitudes l1[i,a], l2[i,j,a,b] (i,j in occ, a,b in virt)
- cyclesint
The number of iteration cycles performed
- CISD(*args, **kwargs)
- DFMP2 = None
- DIIS
alias of
CDIIS
- MP2(*args, **kwargs)
- QCISD(frozen=None, mo_coeff=None, mo_occ=None)
restricted QCISD
- analyze(verbose=None, with_meta_lowdin=True, **kwargs)
Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.
- 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.
- as_scanner()
Generating a scanner/solver for HF PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total HF energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters assigned in the SCF object (DIIS, conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf >>> hf_scanner = scf.RHF(gto.Mole().set(verbose=0)).as_scanner() >>> hf_scanner(gto.M(atom='H 0 0 0; F 0 0 1.1')) -98.552190448277955 >>> hf_scanner(gto.M(atom='H 0 0 0; F 0 0 1.5')) -98.414750424294368
- build(mol=None)
- callback = None
- canonicalize(mo_coeff, mo_occ, fock=None)
Canonicalization diagonalizes the UHF Fock matrix within occupied, virtual subspaces separatedly (without change occupancy).
- property cell
- check_convergence = None
- 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.
- conv_check = True
- conv_tol = 1e-09
- conv_tol_cpscf = 1e-08
- conv_tol_grad = None
- convert_from_(mf)
Create UHF object based on the RHF/ROHF object
- copy()
Returns a shallow copy
- damp = 0
- density_fit()
- det_ovlp(mo1, mo2, occ1, occ2, ovlp=None)
Calculate the overlap between two different determinants. It is the product of single values of molecular orbital overlap matrix.
\[S_{12} = \langle \Psi_A | \Psi_B \rangle = (\mathrm{det}\mathbf{U}) (\mathrm{det}\mathbf{V^\dagger}) \prod\limits_{i=1}\limits^{2N} \lambda_{ii}\]where \(\mathbf{U}, \mathbf{V}, \lambda\) are unitary matrices and single values generated by single value decomposition(SVD) of the overlap matrix \(\mathbf{O}\) which is the overlap matrix of two sets of molecular orbitals:
\[\mathbf{U}^\dagger \mathbf{O} \mathbf{V} = \mathbf{\Lambda}\]- Parameters:
mo1 – 2D ndarrays Molecualr orbital coefficients
mo2 – 2D ndarrays Molecualr orbital coefficients
occ1 – 2D ndarrays occupation numbers
occ2 – 2D ndarrays occupation numbers
- Returns:
the product of single values: float (x_a, x_b): 1D ndarrays \(\mathbf{U} \mathbf{\Lambda}^{-1} \mathbf{V}^\dagger\) They are used to calculate asymmetric density matrix
- Return type:
A list
- diis = True
- diis_damp = 0
- diis_file = None
- diis_space = 8
- diis_space_rollback = 0
- diis_start_cycle = 1
- dip_moment(mol=None, dm=None, unit='Debye', origin=None, verbose=3, **kwargs)
Dipole moment calculation
\[\begin{split}\mu_x = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|x|\mu) + \sum_A Q_A X_A\\ \mu_y = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|y|\mu) + \sum_A Q_A Y_A\\ \mu_z = -\sum_{\mu}\sum_{\nu} P_{\mu\nu}(\nu|z|\mu) + \sum_A Q_A Z_A\end{split}\]where \(\mu_x, \mu_y, \mu_z\) are the x, y and z components of dipole moment
- Parameters:
mol – an instance of
Mole
dm – a 2D ndarrays density matrices
origin – optional; length 3 list, tuple, or 1D array Location of the origin. By default, the point (0, 0, 0) is used.
- Returns:
the dipole moment on x, y and z component
- Return type:
A list
- direct_scf = True
- direct_scf_tol = 1e-13
- disp = None
- do_disp(disp=None)
Check whether to apply dispersion correction based on the xc attribute. If dispersion is allowed, return the DFTD3 disp version, such as d3bj, d3zero, d4.
- dump_chk(envs_or_file)
Serialize the SCF object and save it to the specified chkfile.
- Parameters:
envs_or_file – If this argument is a file path, the serialized SCF object is saved to the file specified by this argument. If this attribute is a dict (created by locals()), the necessary variables are saved to the file specified by the attribute mf.chkfile.
- dump_flags(verbose=None)
- dump_scf_summary(verbose=5)
- eig(fock, s)
Solver for generalized eigenvalue problem
\[HC = SCE\]
- energy_elec(dm=None, h1e=None, vhf=None)
Electronic energy of Unrestricted Hartree-Fock
Note this function has side effects which cause mf.scf_summary updated.
- Returns:
Hartree-Fock electronic energy and the 2-electron part contribution
- energy_nuc()
- energy_tot(dm=None, h1e=None, vhf=None)
Total Hartree-Fock energy, electronic part plus nuclear repulsion See
scf.hf.energy_elec()
for the electron partNote this function has side effects which cause mf.scf_summary updated.
- from_chk(chkfile=None, project=None)
Read the HF results from checkpoint file, then project it to the basis defined by
mol
- Kwargs:
- projectNone or bool
Whether to project chkfile’s orbitals to the new basis. Note when the geometry of the chkfile and the given molecule are very different, this projection can produce very poor initial guess. In PES scanning, it is recommended to switch off project.
If project is set to None, the projection is only applied when the basis sets of the chkfile’s molecule are different to the basis sets of the given molecule (regardless whether the geometry of the two molecules are different). Note the basis sets are considered to be different if the two molecules are derived from the same molecule with different ordering of atoms.
- Returns:
Density matrix, 2D ndarray
- gen_response(mo_coeff=None, mo_occ=None, with_j=True, hermi=0, max_memory=None)
Generate a function to compute the product of UHF response function and UHF density matrices.
- get_dispersion(disp=None, with_3body=None, verbose=None)
- get_fock(h1e=None, s1e=None, vhf=None, dm=None, cycle=-1, diis=None, diis_start_cycle=None, level_shift_factor=None, damp_factor=None, fock_last=None)
F = h^{core} + V^{HF}
Special treatment (damping, DIIS, or level shift) will be applied to the Fock matrix if diis and cycle is specified (The two parameters are passed to get_fock function during the SCF iteration)
- Kwargs:
- h1e2D ndarray
Core hamiltonian
- s1e2D ndarray
Overlap matrix, for DIIS
- vhf2D ndarray
HF potential matrix
- dm2D ndarray
Density matrix, for DIIS
- cycleint
Then present SCF iteration step, for DIIS
- diisan object of
SCF.DIIS
class DIIS object to hold intermediate Fock and error vectors
- diis_start_cycleint
The step to start DIIS. Default is 0.
- level_shift_factorfloat or int
Level shift (in AU) for virtual space. Default is 0.
- get_grad(mo_coeff, mo_occ, fock=None)
RHF orbital gradients
- Parameters:
mo_coeff – 2D ndarray Obital coefficients
mo_occ – 1D ndarray Orbital occupancy
fock_ao – 2D ndarray Fock matrix in AO representation
- Returns:
Gradients in MO representation. It’s a num_occ*num_vir vector.
- get_hcore(*args, **kwargs)
- get_j(mol=None, dm=None, hermi=1, omega=None)
Compute J matrices for all input density matrices
- get_k(mol=None, dm=None, hermi=1, omega=None)
Compute K matrices for all input density matrices
- get_occ(mo_energy=None, mo_coeff=None)
Label the occupancies for each orbital
- Kwargs:
- mo_energy1D ndarray
Obital energies
- mo_coeff2D ndarray
Obital coefficients
Examples:
>>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> energy = numpy.array([-10., -1., 1, -2., 0, -3]) >>> mf.get_occ(energy) array([2, 2, 0, 2, 2, 2])
- get_ovlp(mol=None)
- get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1)
Unrestricted Hartree-Fock potential matrix of alpha and beta spins, for the given density matrix
\[\begin{split}V_{ij}^\alpha &= \sum_{kl} (ij|kl)(\gamma_{lk}^\alpha+\gamma_{lk}^\beta) - \sum_{kl} (il|kj)\gamma_{lk}^\alpha \\ V_{ij}^\beta &= \sum_{kl} (ij|kl)(\gamma_{lk}^\alpha+\gamma_{lk}^\beta) - \sum_{kl} (il|kj)\gamma_{lk}^\beta\end{split}\]- Parameters:
mol – an instance of
Mole
dm – a list of ndarrays A list of density matrices, stored as (alpha,alpha,…,beta,beta,…)
- Kwargs:
- dm_lastndarray or a list of ndarrays or 0
The density matrix baseline. When it is not 0, this function computes the increment of HF potential w.r.t. the reference HF potential matrix.
- vhf_lastndarray or a list of ndarrays or 0
The reference HF potential matrix.
- hermiint
Whether J, K matrix is hermitian
0 : no hermitian or symmetric1 : hermitian2 : anti-hermitian- vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
- Returns:
\(V_{hf} = (V^\alpha, V^\beta)\). \(V^\alpha\) (and \(V^\beta\)) can be a list matrices, corresponding to the input density matrices.
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dmsa = numpy.random.random((3,mol.nao_nr(),mol.nao_nr())) >>> dmsb = numpy.random.random((3,mol.nao_nr(),mol.nao_nr())) >>> dms = numpy.vstack((dmsa,dmsb)) >>> dms.shape (6, 2, 2) >>> vhfa, vhfb = scf.uhf.get_veff(mol, dms, hermi=0) >>> vhfa.shape (3, 2, 2) >>> vhfb.shape (3, 2, 2)
- init_direct_scf(mol=None)
- init_guess = 'minao'
- init_guess_breaksym = 1
- init_guess_by_1e(mol=None, breaksym=None)
Generate initial guess density matrix from core hamiltonian
- Returns:
Density matrix, 2D ndarray
- init_guess_by_atom(mol=None, breaksym=None)
Generate initial guess density matrix from superposition of atomic HF density matrix. The atomic HF is occupancy averaged RHF
- Returns:
Density matrix, 2D ndarray
- init_guess_by_chkfile(chkfile=None, project=None)
Read the HF results from checkpoint file, then project it to the basis defined by
mol
- Kwargs:
- projectNone or bool
Whether to project chkfile’s orbitals to the new basis. Note when the geometry of the chkfile and the given molecule are very different, this projection can produce very poor initial guess. In PES scanning, it is recommended to switch off project.
If project is set to None, the projection is only applied when the basis sets of the chkfile’s molecule are different to the basis sets of the given molecule (regardless whether the geometry of the two molecules are different). Note the basis sets are considered to be different if the two molecules are derived from the same molecule with different ordering of atoms.
- Returns:
Density matrix, 2D ndarray
- init_guess_by_huckel(mol=None, breaksym=None)
Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089
- Returns:
Density matrix, 2D ndarray
- init_guess_by_minao(mol=None, breaksym=None)
Initial guess in terms of the overlap to minimal basis.
- init_guess_by_mod_huckel(mol=None, breaksym=None)
Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089
In contrast to init_guess_by_huckel, this routine employs the updated GWH rule from doi:10.1021/ja00480a005 to form the guess.
- Returns:
Density matrix, 2D ndarray
- init_guess_by_sap(mol=None, breaksym=None, **kwargs)
Generate initial guess density matrix from a superposition of atomic potentials (SAP), doi:10.1021/acs.jctc.8b01089. This is the Gaussian fit implementation, see doi:10.1063/5.0004046.
- Parameters:
mol – MoleBase object the molecule object for which the initial guess is evaluated
sap_basis – dict SAP basis in internal format (python dictionary)
- Returns:
- ndarray
SAP initial guess density matrix
- Return type:
dm0
- istype(type_code)
Checks if the object is an instance of the class specified by the type_code. type_code can be a class or a str. If the type_code is a class, it is equivalent to the Python built-in function isinstance. If the type_code is a str, it checks the type_code against the names of the object and all its parent classes.
- kernel(dm0=None, **kwargs)
SCF main driver
- Kwargs:
- dm0ndarray
If given, it will be used as the initial guess density matrix
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> dm_guess = numpy.eye(mol.nao_nr()) >>> mf.kernel(dm_guess) converged SCF energy = -98.5521904482821 -98.552190448282104
- level_shift = 0
- make_asym_dm(mo1, mo2, occ1, occ2, x)
One-particle asymmetric density matrix
- Parameters:
mo1 – 2D ndarrays Molecualr orbital coefficients
mo2 – 2D ndarrays Molecualr orbital coefficients
occ1 – 2D ndarrays Occupation numbers
occ2 – 2D ndarrays Occupation numbers
x – 2D ndarrays \(\mathbf{U} \mathbf{\Lambda}^{-1} \mathbf{V}^\dagger\). See also
det_ovlp()
- Returns:
A list of 2D ndarrays for alpha and beta spin
Examples:
>>> mf1 = scf.UHF(gto.M(atom='H 0 0 0; F 0 0 1.3', basis='ccpvdz')).run() >>> mf2 = scf.UHF(gto.M(atom='H 0 0 0; F 0 0 1.4', basis='ccpvdz')).run() >>> s = gto.intor_cross('int1e_ovlp_sph', mf1.mol, mf2.mol) >>> det, x = det_ovlp(mf1.mo_coeff, mf1.mo_occ, mf2.mo_coeff, mf2.mo_occ, s) >>> adm = make_asym_dm(mf1.mo_coeff, mf1.mo_occ, mf2.mo_coeff, mf2.mo_occ, x) >>> adm.shape (2, 19, 19)
- make_rdm1(mo_coeff=None, mo_occ=None, **kwargs)
One-particle density matrix in AO representation
- Parameters:
mo_coeff – tuple of 2D ndarrays Orbital coefficients for alpha and beta spins. Each column is one orbital.
mo_occ – tuple of 1D ndarrays Occupancies for alpha and beta spins.
- Returns:
A list of 2D ndarrays for alpha and beta spins
- make_rdm2(mo_coeff=None, mo_occ=None, **kwargs)
Two-particle density matrix in AO representation
- Parameters:
mo_coeff – tuple of 2D ndarrays Orbital coefficients for alpha and beta spins. Each column is one orbital.
mo_occ – tuple of 1D ndarrays Occupancies for alpha and beta spins.
- Returns:
A tuple of three 4D ndarrays for alpha,alpha and alpha,beta and beta,beta spins
- max_cycle = 50
- mulliken_meta(mol=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- mulliken_meta_spin(mol=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)
- mulliken_pop(mol=None, dm=None, s=None, verbose=5)
Mulliken population analysis
\[M_{ij} = D_{ij} S_{ji}\]Mulliken charges
\[\delta_i = \sum_j M_{ij}\]- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- mulliken_pop_meta_lowdin_ao(*args, **kwargs)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- mulliken_spin_pop(mol=None, dm=None, s=None, verbose=5)
- property nelec
- property nelectron_alpha
- newton()
Create an SOSCF object based on the mean-field object
- nuc_grad_method()
Hook to create object for analytical nuclear gradients.
- property opt
- pop(*args, **kwargs)
Mulliken population analysis, based on meta-Lowdin AOs. In the meta-lowdin, the AOs are grouped in three sets: core, valence and Rydberg, the orthogonalization are carried out within each subsets.
- Parameters:
mol – an instance of
Mole
dm – ndarray or 2-item list of ndarray Density matrix. ROHF dm is a 2-item list of 2D array
- Kwargs:
verbose : int or instance of
lib.logger.Logger
- pre_orth_methodstr
Pre-orthogonalization, which localized GTOs for each atom. To obtain the occupied and unoccupied atomic shells, there are three methods
‘ano’ : Project GTOs to ANO basis‘minao’ : Project GTOs to MINAO basis‘scf’ : Symmetry-averaged fractional occupation atomic RHF
- Returns:
pop, charges
- popnparray
Mulliken population on each atomic orbitals
- chargesnparray
Mulliken charges
- Return type:
A list
- 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.
- quad_moment(mol=None, dm=None, unit='DebyeAngstrom', origin=None, verbose=3, **kwargs)
Calculates traceless quadrupole moment tensor.
The traceless quadrupole tensor is given by
\[\begin{split}Q_{ij} &= - \frac{1}{2} \sum_{\mu \nu} P_{\mu \nu} \left[ 3 (\nu | r_i r_j | \mu) - \delta_{ij} (\nu | r^2 | \mu) \right] \\ &+ \frac{1}{2} \sum_A Q_A \left( R_{iA} R_{jA} - \delta_{ij} \|\mathbf{R}_A\|^2 \right).\end{split}\]If the molecule has a dipole, the quadrupole moment depends on the location of the origin. By default, the origin is taken to be (0, 0, 0), but it can be set manually via the keyword argument origin.
- Parameters:
mol – an instance of
Mole
dm – a 2D ndarrays density matrices
origin – optional; length 3 list, tuple, or 1D array Location of the origin. By default, it is (0, 0, 0).
- Returns:
Traceless quadrupole tensor, 2D ndarray.
- remove_soscf()
Remove the SOSCF decorator
- reset(mol=None)
Reset mol and relevant attributes associated to the old mol object
- 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.
- sap_basis = 'sapgrasplarge'
- scf(dm0=None, **kwargs)
SCF main driver
- Kwargs:
- dm0ndarray
If given, it will be used as the initial guess density matrix
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> mol = gto.M(atom='H 0 0 0; F 0 0 1.1') >>> mf = scf.hf.SCF(mol) >>> dm_guess = numpy.eye(mol.nao_nr()) >>> mf.kernel(dm_guess) converged SCF energy = -98.5521904482821 -98.552190448282104
- 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.
- sfx2c1e()
- spin_square(mo_coeff=None, s=None)
Spin square and multiplicity of UHF determinant
\[S^2 = \frac{1}{2}(S_+ S_- + S_- S_+) + S_z^2\]where \(S_+ = \sum_i S_{i+}\) is effective for all beta occupied orbitals; \(S_- = \sum_i S_{i-}\) is effective for all alpha occupied orbitals.
- There are two possibilities for \(S_+ S_-\)
same electron \(S_+ S_- = \sum_i s_{i+} s_{i-}\),
\[\sum_i \langle UHF|s_{i+} s_{i-}|UHF\rangle = \sum_{pq}\langle p|s_+s_-|q\rangle \gamma_{qp} = n_\alpha\]2) different electrons \(S_+ S_- = \sum s_{i+} s_{j-}, (i\neq j)\). There are in total \(n(n-1)\) terms. As a two-particle operator,
\[\langle S_+ S_- \rangle = \langle ij|s_+ s_-|ij\rangle - \langle ij|s_+ s_-|ji\rangle = -\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle\]
- Similarly, for \(S_- S_+\)
same electron
\[\sum_i \langle s_{i-} s_{i+}\rangle = n_\beta\]different electrons
\[\langle S_- S_+ \rangle = -\langle i^\beta|j^\alpha\rangle \langle j^\alpha|i^\beta\rangle\]
- For \(S_z^2\)
same electron
\[\langle s_z^2\rangle = \frac{1}{4}(n_\alpha + n_\beta)\]different electrons
\[\begin{split}&\frac{1}{2}\sum_{ij}(\langle ij|2s_{z1}s_{z2}|ij\rangle -\langle ij|2s_{z1}s_{z2}|ji\rangle) \\ &=\frac{1}{4}(\langle i^\alpha|i^\alpha\rangle \langle j^\alpha|j^\alpha\rangle - \langle i^\alpha|i^\alpha\rangle \langle j^\beta|j^\beta\rangle - \langle i^\beta|i^\beta\rangle \langle j^\alpha|j^\alpha\rangle + \langle i^\beta|i^\beta\rangle \langle j^\beta|j^\beta\rangle) \\ &-\frac{1}{4}(\langle i^\alpha|j^\alpha\rangle \langle j^\alpha|i^\alpha\rangle + \langle i^\beta|j^\beta\rangle\langle j^\beta|i^\beta\rangle) \\ &=\frac{1}{4}(n_\alpha^2 - n_\alpha n_\beta - n_\beta n_\alpha + n_\beta^2) -\frac{1}{4}(n_\alpha + n_\beta) \\ &=\frac{1}{4}((n_\alpha-n_\beta)^2 - (n_\alpha+n_\beta))\end{split}\]
In total
\[\begin{split}\langle S^2\rangle &= \frac{1}{2} (n_\alpha-\sum_{ij}\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle +n_\beta -\sum_{ij}\langle i^\beta|j^\alpha\rangle\langle j^\alpha|i^\beta\rangle) + \frac{1}{4}(n_\alpha-n_\beta)^2 \\\end{split}\]- Parameters:
mo – a list of 2 ndarrays Occupied alpha and occupied beta orbitals
- Kwargs:
- sndarray
AO overlap
- Returns:
A list of two floats. The first is the expectation value of S^2. The second is the corresponding 2S+1
Examples:
>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz', charge=1, spin=1, verbose=0) >>> mf = scf.UHF(mol) >>> mf.kernel() -75.623975516256706 >>> mo = (mf.mo_coeff[0][:,mf.mo_occ[0]>0], mf.mo_coeff[1][:,mf.mo_occ[1]>0]) >>> print('S^2 = %.7f, 2S+1 = %.7f' % spin_square(mo, mol.intor('int1e_ovlp_sph'))) S^2 = 0.7570150, 2S+1 = 2.0070027
- stability(internal=True, external=False, verbose=None, return_status=False, **kwargs)
Stability analysis for UHF/UKS method.
See also pyscf.scf.stability.uhf_stability function.
- Parameters:
mf – UHF or UKS object
- Kwargs:
- internalbool
Internal stability, within the UHF space.
- externalbool
External stability. Including the UHF -> GHF and real -> complex stability analysis.
- return_status: bool
Whether to return stable_i and stable_e
- Returns:
If return_status is False (default), the return value includes two set of orbitals, which are more close to the stable condition. The first corresponds to the internal stability and the second corresponds to the external stability.
Else, another two boolean variables (indicating current status: stable or unstable) are returned. The first corresponds to the internal stability and the second corresponds to the external stability.
- stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
- to_ghf()
Convert the input mean-field object to a GHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_gks(xc='HF')
Convert the input mean-field object to a GKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_gpu(out=None)
Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.
- to_ks(xc='HF')
Convert to UKS object.
- to_rhf()
Convert the input mean-field object to a RHF/ROHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_rks(xc='HF')
Convert the input mean-field object to a RKS/ROKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_uhf()
Convert the input mean-field object to a UHF object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- to_uks(xc='HF')
Convert the input mean-field object to a UKS object.
Note this conversion only changes the class of the mean-field object. The total energy and wave-function are the same as them in the input mean-field object.
- update(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_from_chk(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- update_from_chk_(chkfile=None)
Read attributes from the chkfile then replace the attributes of current object. It’s an alias of function update_from_chk_.
- verbose = 0
- view(cls)
New view of object with the same attributes.
- x2c()
- x2c1e()
Module contents
Lattice model module