Basis set

The basis set is defined as a dictionary, where the keys are the types of the basis sets, and the values are the basis set:

basis = Dict("ao"=>"cc-pVTZ",
             "jkfit"=>"cc-pvtz-jkfit",
             "mpfit"=>"cc-pvtz-mpfit")

The basis set dictionary contains three keys: ao, jkfit, and mpfit. The ao key contains the basis set for the AO integrals, the jkfit key contains the basis set for the density fitting integrals in the Hartree-Fock calculations, and the mpfit key contains the fitting basis set for the correlated calculations.

Alternatively, you can define the basis set using a string that defines the AO basis. In this case, the jkfit and mpfit basis names will be generated automatically. Here's an example of how you can define the basis set using a string:

basis = "cc-pVDZ"

Common acronyms are also supported for the basis set names, e.g., cc-pVDZ can be written as vdz, and aug-cc-pVTZ can be written as avtz.

Exported functions and types

ElemCo.BasisSets.AbstractAngularShellType
AbstractAngularShell

Abstract type for angular shells, i.e, subshells with the same angular momentum. For general contracted basis sets, the angular shell is a collection of all subshells with the same l quantum number. TODO For some other basis sets (e.g., the def2-family), the angular shell can be a single subshell with a specific l quantum number. See SphericalAngularShell and CartesianAngularShell. id is the index of the angular shell in the basis set.

ElemCo.BasisSets.BasisCenterType
BasisCenter

A basis center (atom) with basis functions.

  • name::String: basis center name (e.g., "H1")

  • position::StaticArraysCore.SVector{3, Float64}: atomic position in Bohr (3D vector)

  • atomic_number::Int64: atomic number

  • basis::String: name of the basis set (e.g., "cc-pVDZ")

  • shells::Vector{ElemCo.BasisSets.AbstractAngularShell}: array of angular shells

ElemCo.BasisSets.BasisContractionType
BasisContraction{N, T}

A basis contraction with N primitives and coefficients of type T. exprange is the range of primitives (from exponents in the angular shell).

ElemCo.BasisSets.BasisSetType
BasisSet

A basis set with basis centers (atoms) and basis functions.

  • centers::Vector{ElemCo.BasisSets.BasisCenter}: array of basis centers (atoms) with basis functions.

  • shell_indices::Vector{CartesianIndex{2}}: indices for angular shells.

  • center_ranges::Vector{UnitRange{Int64}}: center ranges for each basis set in a combined set.

  • shell_ranges::Vector{UnitRange{Int64}}: angular shell ranges for each basis sets in a combined set.

  • lib::ElemCo.BasisSets.AbstractILib: infos for integral library.

ElemCo.BasisSets.CartesianAngularShellType
CartesianAngularShell

Type for cartesian angular shells, i.e, subshells with the same angular momentum. For general contracted basis sets, the angular shell is a collection of all subshells with the same l quantum number. For some other basis sets (e.g., the def2-family), the angular shell can be a single subshell with a specific l quantum number. id is the index of the angular shell in the basis set.

  • element::String: element symbol (e.g., "H")

  • l::Int64: angular momentum

  • exponents::StaticArraysCore.SVector: array of exponents

  • subshells::Vector{ElemCo.BasisSets.BasisContraction}: array of subshells (contractions)

  • id::Int64: index of the angular shell in the basis set

ElemCo.BasisSets.SphericalAngularShellType
SphericalAngularShell

Type for spherical angular shells, i.e, subshells with the same angular momentum. For general contracted basis sets, the angular shell is a collection of all subshells with the same l quantum number. For some other basis sets (e.g., the def2-family), the angular shell can be a single subshell with a specific l quantum number. id is the index of the angular shell in the basis set.

  • element::String: element symbol (e.g., "H")

  • l::Int64: angular momentum

  • exponents::StaticArraysCore.SVector: array of exponents

  • subshells::Vector{ElemCo.BasisSets.BasisContraction}: array of subshells (contractions)

  • id::Int64: index of the angular shell in the basis set

ElemCo.BasisSets.ao_listFunction
ao_list(basis::BasisSet, ibas=1)

Return the list of atomic orbitals in the basis set.

For a combined basis set, use ibas to select the basis set.

ElemCo.BasisSets.basis_nameFunction
basis_name(atoms, type="ao")

Return the name of the basis set (or unknown if not found). atoms can be a single atom ::Atom or a system ::AbstractSystem.

ElemCo.BasisSets.center_rangeMethod
center_range(bs::BasisSet, i::Int)

Return the range of centers for the ith basis set.

The range is used to access the centers in the basis set, e.g., bs.centers[i] for i in center_range(bs, 1) gives the centers of the first basis set.

ElemCo.BasisSets.coefficients_1matFunction
coefficients_1mat(ashell::AbstractAngularShell)

Return a single contraction matrix of the coefficients in the angular shell (nprimitives × nsubshells). The contractions are normalized.

The missing coefficients are set to zero in the matrix.

ElemCo.BasisSets.combineMethod
combine(bs1::BasisSet, bs2::BasisSet)

Combine two basis sets.

The centers are concatenated. The center/shell ranges (center_ranges/shell_ranges) corresponding to the centers/shells for each basis set can be used to access the centers/shells in the combined basis set, e.g. bs.centers[i] for i in bs.center_ranges[1] gives the centers of the first basis set in the combined set.

ElemCo.BasisSets.generate_basisFunction
generate_basis(EC::ECInfo, type="ao"; basisset::AbstractString="")

Generate basis sets for integral calculations.

The basis set is stored in BasisSet object. type can be "ao", "mpfit" or "jkfit". If basisset is provided, it is used as the basis set.

ElemCo.BasisSets.generate_basisFunction
generate_basis(ms::AbstractSystem, type="ao"; cartesian=false, basisset::AbstractString="")

Generate basis sets for integral calculations.

The basis set is stored in BasisSet object. type can be "ao", "mpfit" or "jkfit". If basisset is provided, it is used as the basis set.

ElemCo.BasisSets.n_aoMethod
n_ao(ashell::AbstractAngularShell)

Return the number of atomic orbitals in the angular shell.

ElemCo.BasisSets.n_aoMethod
n_ao(atom::BasisCenter)

Return the number of atomic orbitals in the basis set for atom.

ElemCo.BasisSets.n_aoMethod
n_ao(atoms::BasisSet)

Return the number of atomic orbitals in the basis set.

ElemCo.BasisSets.n_coefficients_1matMethod
n_coefficients_1mat(ashell::AbstractAngularShell)

Return the number of coefficients in the angular shell for a single contraction matrix.

The missing coefficients will be set to zero.

ElemCo.BasisSets.shell_rangeMethod
shell_range(bs::BasisSet, i::Int)

Return the range of angular shells for the ith basis set.

The range is used to access the angular shells in the basis set, e.g., bs[i] for i in shell_range(bs, 1) gives the angular shells of the first basis set.

Internal functions and types

ElemCo.BasisSets.CartesianAtomicOrbitalType

CartesianAtomicOrbital

Represents an atomic orbital in a cartesian basis set.

  • icenter::UInt16: index of the center in the basis set object

  • iangularshell::UInt16: index of the angular shell in the basis set object

  • isubshell::UInt8: index of the subshell in the angular shell

  • n::UInt8: principal quantum number

  • l::UInt8: orbital angular momentum quantum number

  • ml::Int8: magnetic "quantum number" (ml = -l:l(l+1)/2)

ElemCo.BasisSets.SphericalAtomicOrbitalType

SphericalAtomicOrbital

Represents an atomic orbital in a spherical basis set.

  • icenter::UInt16: index of the center in the basis set object

  • iangularshell::UInt16: index of the angular shell in the basis set object

  • isubshell::UInt8: index of the contraction in the angular shell

  • n::UInt8: principal quantum number

  • l::UInt8: orbital angular momentum quantum number

  • ml::Int8: magnetic quantum number (ml = -l:l)

Base.getindexMethod
Base.getindex(bs::BasisSet, i::CartesianIndex{2})

Return the the angular shell.

Base.getindexMethod
Base.getindex(bs::BasisSet, i::Int, j::Int)

Return the the angular shell.

Base.getindexMethod
Base.getindex(bs::BasisSet, i::Int)

Return the the angular shell.

Base.iterateFunction
Base.iterate(bs::BasisSet, state=1)

Iterate over the basis angular shells in the basis set.

Base.lengthMethod
Base.length(bs::BasisSet)

Return the number of angular shells in the basis set.

ElemCo.BasisSets.full_basis_nameMethod
full_basis_name(basis_name::AbstractString)

Return the full basis name and version number (if given as *.v[0-2], otherwise -1 is returned).

I.e,

  • [a][wc/c]vXz* -> [aug-]cc-p[wc/c]vXz*
  • svp* -> def2-svp*
  • [tq]zvp* -> def2-[tq]zvp*

Additionally check for version number (e.g., vdz.v2)

ElemCo.BasisSets.parse_basisMethod
parse_basis(basis_name::String, atom::Atom; cartesian=false)

Search and parse the basis set for a given atom.

Return a list of subshells AbstractSubShell.

ElemCo.BasisSets.parse_basis_blockMethod
parse_basis_block(basisblock::AbstractString, atom::Atom; cartesian=false)

Parse the basis block for a given atom.

Return a list of angular shells AbstractAngularShell. The basis block is in the Molpro format:

  • ! comments
  • s,p,d,f,g,h angular momentum
  • c, <from>.<to> contraction coefficients for primitives

Example cc-pVDZ for H atom:

s, H , 13.0100000, 1.9620000, 0.4446000, 0.1220000
c, 1.4, 0.0196850, 0.1379770, 0.4781480, 0.5012400
c, 4.4, 1.0000000
p, H , 0.7270000
c, 1.1, 1.0000000

For generally-contracted basis sets (like the one above), one angular shell is created for each angular momentum type s,p,d,f,g,h with the corresponding exponents and contraction coefficients. For other basis sets, like the def2-SVP, each contraction is a separate angular shell:

! hydrogen             (4s,1p) -> [2s,1p]
s, H , 13.0107010, 1.9622572, 0.44453796, 0.12194962
c, 1.3, 0.19682158E-01, 0.13796524, 0.47831935
c, 4.4, 1.0000000
p, H , 0.8000000
c, 1.1, 1.0000000
ElemCo.BasisSets.parse_contractionMethod
parse_contraction(conline::AbstractString)

Parse contraction coefficients from a line in the basis block.

Return the range of exponents and the contraction coefficients as a tuple. The line is in the Molpro format: c, 1.4, 0.0196850, 0.1379770, 0.4781480, 0.5012400 where c is the contraction, 1.4 is the exponent range, and the rest are the coefficients.

ElemCo.BasisSets.parse_exponentsMethod
parse_exponents(expline::AbstractString)

Parse exponents from a line in the basis block.

Return the angular momentum and exponents as a tuple. The line is in the Molpro format: s, H , 13.0100000, 1.9620000, 0.4446000, 0.1220000 where s is the angular momentum, H is the element symbol, and the rest are the exponents.

ElemCo.BasisSets.read_basis_blockMethod
read_basis_block(basisfile::AbstractString, atom::Atom)

Read the basis block for a given atom.

The basis library is in the Molpro format:

  • ! comments
  • basis block starts with ! <elementname> ....
  • basis block ends with ! or }
  • basis block contains:
  • s,p,d,f,g,h angular momentum
  • c, <from>.<to> contraction coefficients for primitives

Example cc-pVDZ for H atom:

!
! hydrogen             (4s,1p) -> [2s,1p]
s, H , 13.0100000, 1.9620000, 0.4446000, 0.1220000
c, 1.4, 0.0196850, 0.1379770, 0.4781480, 0.5012400
c, 4.4, 1.0000000
p, H , 0.7270000
c, 1.1, 1.0000000
!
ElemCo.BasisSets.set_id!Method
set_id!(ashells::AbstractArray{AbstractAngularShell}, start_id)

Set the id for each angular shell in the array. Return the next id.

ElemCo.BasisSets.set_id!Method
set_id!(centers::AbstractArray{BasisCenter}, start_id)

Set the id for each angular shell in the array of centers. Return the next id.

ElemCo.BasisSets.split_angular_shellMethod
split_angular_shell(ashell::AbstractAngularShell; cartesian=false)

If the ranges of exponents do not overlap, split the angular shell into separate angular shells for each subshell. The shells are kept together only if one is a subset of the other.