ElemCo.jl global information

Main structure


Global information for ElemCo.

  • scr::String: ⟨"system-tmpdir/elemcojlscr/jl_*"⟩ path to scratch directory.

  • ext::String: ⟨".bin"⟩ extension of temporary files.

  • verbosity::Int64: ⟨2⟩ verbosity level.

  • options::ElemCo.ECInfos.Options: options.

  • system::AtomsBase.AbstractSystem: molecular system.

  • fd::ElemCo.FciDump.FDump: fcidump.

  • files::Dict{String, String}: information about (temporary) files. The naming convention is: prefix_ + name (+extension EC.ext added automatically). prefix can be:

    • d for dressed integrals
    • S for overlap matrix
    • f for Fock matrix
    • e for orbital energies
    • D for density matrix
    • h for core Hamiltonian
    • C for transformation from one basis to another
    • T for amplitudes
    • U for trial vectors or Lagrange multipliers

    name is given by the subspaces involved:

    • o for occupied
    • v for virtual
    • O for occupied-β
    • V for virtual-β
    • m for (full) MO space
    • M for (full) β-MO space
    • A for AO basis
    • a for active orbitals
    • d for doubly-occupied (closed-shell) orbitals
    • s for singly-occupied (open-shell) orbitals
    • S for singly-occupied with β electron (open-shell) orbitals
    • P for auxiliary orbitals (fitting basis)
    • L for auxiliary orbitals (Cholesky decomposition, orthogonal)
    • X for auxiliary orbitals (amplitudes decomposition)

    The order of subspaces is important, e.g., ov is occupied-virtual, vo is virtual-occupied. Normally, the first subspaces correspond to subscripts of the tensor. For example, T_vo contains the singles amplitudes $T_{a}^{i}$. Disambiguity can be resolved by introducing ^ to separate the subscripts from the superscripts, e.g., d_XX contains $\hat v_{XY}$ and d_^XX contains $\hat v^{XY}$ integrals.

  • space::Dict{Char, Any}: subspaces: 'o'ccupied, 'v'irtual, 'O'ccupied-β, 'V'irtual-β, ':'/'m'/'M' full MO.

Exported functions

freeze_core!(EC::ECInfo, core::Symbol, freeze_nocc::Int, freeze_orbs=[])

Freeze freeze_nocc occupied orbitals or orbitals on the freeze_orbs list. If freeze_nocc is negative and freeze_orbs is empty: guess the number of core orbitals.

core as in MSystem.guess_ncore.

freeze_nvirt!(EC::ECInfo, nfreeze::Int, freeze_orbs=[])

Freeze nfreeze virtual orbitals or orbitals on the freeze_orbs list.

get_occvirt(EC::ECInfo, occas::String, occbs::String, norb, nelec; ms2=0, orbsym=Vector{Int})

Use a +/- string to specify the occupation. If occbs=="-", the occupation from occas is used (closed-shell). If both are "-", the occupation is deduced from nelec and ms2. The optional argument orbsym is a vector with length norb of orbital symmetries (1 to 8) for each orbital.


Check if the system is closed-shell according the to the reference occupation and FCIDump.


Try to guess spin of an electron: lowcase α, uppercase β, non-letters skipped. Return true for α spin. Throws an error if cannot decide.

len_spaces(EC::ECInfo, spaces::String)

Return lengths of spaces (e.g., "vo" for occupied and virtual orbitals).

parse_orbstring(orbs::String; orbsym=Vector{Int})

Parse a string specifying some list of orbitals, e.g., -3+5-8+10-12[1 2 3 5 6 7 8 10 11 12] or use ':' and ';' instead of '-' and '+', respectively.

setup_space!(EC::ECInfo, norb, nelec, ms2, orbsym)

Setup EC.space from norb, nelec, ms2, orbsym or occa/occb.

space4spin(sp::Char, alpha::Bool)

Return the space character for a given spin. sp on input has to be lowercase.

File management

add_file!(EC::ECInfo, name::String, descr::String; overwrite=false)

Add file name to ECInfo with (space-separated) descriptions descr. Possible description: tmp (temporary).

copy_file!(EC::ECInfo, from::AbstractString, to::AbstractString; overwrite=false)

Copy file from to to.

delete_files!(EC::ECInfo, which::AbstractString)

Delete files in ECInfo which match description in which.

which can be a space-separated string of descriptions (then all descriptions have to match) Examples:

  • delete_files!(EC, "tmp") deletes all temporary files.
  • delete_files!(EC, "tmp orbs") deletes all temporary files with additional description "orbs"
delete_files!(EC::ECInfo, which::AbstractArray{String})

Delete files in ECInfo which match any description in array which.


  • delete_files!(EC, ["tmp","orbs"]) deletes all temporary files and all files with description "orbs".
  • delete_files!(EC, ["tmp orbs","tmp2"]) deletes all temporary files with description "orbs" and all files with description "tmp2".

Internal functions

symorb2orb(symorb::SubString, symoffset::Vector{Int})

Convert a symorb (like 1.3 [orb.sym]) to an orbital number. If no sym given, just return the orbital number converted to Int.

Abstract types