FCIDump files

ElemCo.FciDumps — Module

Read and write fcidump format integrals. Individual arrays of integrals can also be in *.npy format

source

The FCIDump file format is a simple text file format for storing molecular integrals. It is used by many quantum chemistry programs.

Storage of molecular integrals

ElemCo.FciDumps.FDump — Type
FDump{T,N}

Molecular integrals

The 2-e integrals are stored in the physicists' notation: int2[pqrs] $= <pq|rs>=v_{pq}^{rs}$

T denotes the element type of integrals (Float64 or ComplexF64)

N denotes the number of indices in the 2-e-integral tensors, for N=3 (usual) the last two indices are stored as a single uppertriangular index (r <= s)

  • int2::Array{T} where T<:Number: 2-e⁻ integrals for restricted orbitals fcidump.

  • int2aa::Array{T} where T<:Number: αα 2-e⁻ integrals for unrestricted orbitals fcidump.

  • int2bb::Array{T} where T<:Number: ββ 2-e⁻ integrals for unrestricted orbitals fcidump.

  • int2ab::Array{T, 4} where T<:Number: αβ 2-e⁻ integrals for unrestricted orbitals fcidump.

  • int2ep::Array{T, 4} where T<:Number: e⁻e⁺ 2-body integrals for restricted orbitals fcidump.

  • int1::Matrix{T} where T<:Number: 1-e⁻ integrals for restricted orbitals fcidump.

  • int1a::Matrix{T} where T<:Number: α 1-e⁻ integrals for unrestricted orbitals fcidump.

  • int1b::Matrix{T} where T<:Number: β 1-e⁻ integrals for unrestricted orbitals fcidump.

  • int1p::Matrix{T} where T<:Number: 1-e⁺ integrals for restricted orbitals fcidump.

  • int0::Float64: core energy

  • head::ElemCo.FciDumps.FDumpHeader: header of fcidump file, a dictionary of arrays.

  • origin::String: path of the original fcidump file, empty if created from scratch.

  • modified::Bool: ⟨false⟩ has the integrals been modified after reading?

  • uhf::Bool: ⟨false⟩ a convinience variable, has to coincide with head["IUHF"][1] > 0.

  • epdump::Bool: ⟨false⟩ a convenience variable, has to coincide with head["NPOS"][1] > 0.

  • df3idx::Bool: ⟨false⟩ 3-index DF integrals are stored in scratch (mmL) and need contraction to 4-index.

  • orig_orbs::Vector{Int64}: for ElemCo-generated reduced (frozen-core/deleted-virtual) dumps: the contiguous full-space (original) orbital range of the active orbitals (frozen core below it, deleted virtuals above it), i.e. active orbital k corresponds to full orbital orig_orbs[k] (sorted; NOT necessarily contiguous – region/redundant "Deleted" virtuals are dropped at their actual indices). Empty for externally-read or non-reduced dumps. Used to translate user-supplied orbital lists (occa/occb/active), which always refer to the full MO space, to the active space.

source

Exported functions

ElemCo.FciDumps.headvar — Method
headvar(fd::FDump, key::String)

Check header for key, return value if a list, or the element or nothing if not there.

source
ElemCo.FciDumps.headvar — Method
headvar(head::FDumpHeader, key::String)

Check header for key, return value if a list, or the element or nothing if not there.

source
ElemCo.FciDumps.headvar — Method
headvar(fd::FDump, key::String, ::Type{T}) where {T}

Check header for key, return the first element or nothing if not there.

source
ElemCo.FciDumps.headvar — Method
headvar(head::FDumpHeader, key::String, ::Type{T}) where {T}

Check header for key of type T, return the first element or nothing if not there.

source
ElemCo.FciDumps.headvars — Method
headvars(fd::FDump, key::String, ::Type{T}) where {T}

Check header for key, return a vector of values or nothing if not there.

source
ElemCo.FciDumps.headvars — Method
headvars(head::FDumpHeader, key::String, ::Type{T}) where {T}

Check header for key of type T, return a vector of values or nothing if not there.

source
ElemCo.FciDumps.int1_npy_filename — Function
int1_npy_filename(fd::FDump, spincase::Symbol=:α)

Return filename for 1-e integrals in npy format. spincase can be :α, :β, or :p for UHF fcidump.

source
ElemCo.FciDumps.int2_npy_filename — Function
int2_npy_filename(fd::FDump, spincase::Symbol=:α)

Return filename for 2-e integrals in npy format. spincase can be :α, :β, :αβ, or :ep for UHF fcidump.

source
ElemCo.FciDumps.integ1 — Function
integ1(fd::FDump, spincase::Symbol=:α)

Return 1-e⁻ integrals (for UHF fcidump: for spincase). spincase can be :α or :β or :p.

source
ElemCo.FciDumps.integ2 — Function
integ2(fd::FDump, spincase::Symbol=:α)

Return 2-e⁻ or e⁻e⁺ integrals (for UHF fcidump: for spincase). spincase can be :α, :β, :αβ or :p.

Use type-stable versions instead: integ2_ss for same-spin integrals and integ2_os for opposite-spin integrals.

source
ElemCo.FciDumps.integ2_ss — Function
integ2_ss(fd::FDump, spincase::Symbol=:α)

Return 2-e⁻ or e⁻e⁺ integrals (for UHF fcidump: for spincase). spincase can be :α, :β, or :p.

source
ElemCo.FciDumps.read_fcidump — Method
read_fcidump(fcidump::String, ::Type{T}, ::Val{N}) where {T<:Number, N}

Read ascii file (possibly with integrals in npy files).

source
ElemCo.FciDumps.read_fcidump — Method
read_fcidump(fcidump::String, ::Type{T}=Float64) where {T<:Number}

Read ascii file (possibly with integrals in npy files). The element type of the integrals is T (default: Float64).

source
ElemCo.FciDumps.reorder_orbs_int2 — Method
reorder_orbs_int2(int2::AbstractArray, orbs; alloc=dims->zeros(eltype(int2), dims))

Reorder orbitals in 2-e integrals according to orbs.

orbscan be a subset of orbitals or a permutation of orbitals. Return int2[orbs[p],orbs[q],orbs[r],orbs[s]] or the triangular version.

The reordered tensor is obtained from alloc(dims) (in-memory zeros by default) and filled one slice at a time; pass a memory-mapped allocator to keep the result on disk (and read the source int2 directly, e.g. when reducing a large memory-mapped MO dump to the active space).

source
ElemCo.FciDumps.write_fcidump — Method
write_fcidump(fd::FDump, fcidump::String; tol=-1.0, format=:ascii, charge=0)

Write fcidump file.

If tol >= 0.0, integrals with absolute value smaller than tol are omitted. If format is :npy, integrals are written to npy files in the same directory, otherwise if format is :ascii, integrals are written to ascii fcidump file.

charge is subtracted from the dump's NELEC (and MS2 adjusted to the resulting parity) in the written file, without touching fd: an in-memory dump generated by ElemCo carries the pre-charge electron count, because wf.charge is applied to it by setup_space_fd! — an EXPORTED file, in contrast, must state the actual number of electrons to be a self-contained description of the system. This is what @write_ints passes. It is deliberately left at 0 for a file that the same session will read back (int.fcidump), where wf.charge still describes the molecule.

source

Internal functions

ElemCo.FciDumps.parse_integ_value — Method
parse_integ_value(::Type{T}, linestr::AbstractString) where T

Parse integral value and indices from a fcidump line.

For complex integrals (ICMPLX=1), the format is (real,imaginary) i1 i2 i3 i4. For real integrals, the format is value i1 i2 i3 i4.

source
ElemCo.FciDumps.print_int_value — Method
print_int_value(fdf, integ, i1, i2, i3, i4)

Print integral value to fdf file.

For complex values, the format is (real,imaginary) i1 i2 i3 i4.

source
ElemCo.FciDumps.read_integrals! — Method
read_integrals!(int1::Matrix{T}, int2::Array{T,N},
                int1p::Matrix{T}, int2ep::Array{T,4},
                norb::Int, fdfile, simtra) where {T,N}

Read integrals from fcidump file with positron. We use a section counter to track which block we are reading: section==0: electron-electron 2-body (int2) section==1: electron-positron 2-body (int2ep) section==2: electron 1-body (int1) section==3: positron 1-body (int1p) When section==4 and a separator is encountered, the next line is core energy.

source
ElemCo.FciDumps.set_int2! — Method
set_int2!(int2::Array{<:Number,3}, i1, i2, i3, i4, integ, simtra, ab)

Set 2-e integral in int2 array to integ considering permutational symmetries.

For not ab: particle symmetry is assumed. Integrals are stored in physicists' notation.

source
ElemCo.FciDumps.set_int2! — Method
set_int2!(int2::Array{<:Number,4}, i1, i2, i3, i4, integ, simtra, ab)

Set 2-e integral in int2 array to integ considering permutational symmetries.

For not ab: particle symmetry is assumed. Integrals are stored in physicists' notation.

source
ElemCo.FciDumps.set_zero! — Method
set_zero!(fd::FDump, norb::Int=0)

Set all integrals to zero.

If norb is not provided, the integrals are set to zero with the same dimensions as before.

source
ElemCo.FciDumps.uses_reduced_permsym — Method
uses_reduced_permsym(fd::FDump{T}) where {T<:Number}

Return true if the reduced (similarity-transformed) permutational symmetry has to be used when reading/writing the integrals.

This is the case for similarity-transformed fcidumps (ST=1), and always for complex integrals, which lack the full permutational symmetry of real integrals. Complex integrals therefore use the same symmetry as ST=1 without setting the ST flag.

source
ElemCo.FciDumps.write_header — Method
write_header(fd::FDump, fdf; npy=false, charge=0)

Write header of fcidump file.

If npy is true, write NPY file names for integrals. charge is subtracted from the written NELEC (see write_fcidump); fd is not modified.

source