ElemCo.jl global information

Constants

ElemCo.ECInfos.DEFAULT_ELTYPE — Constant
DEFAULT_ELTYPE

Global default element type for ECInfo. Can be changed via set_default_eltype!(T) or @set_default_eltype T. Default is Float64.

source

Main structure

ElemCo.ECInfos.ECInfo — Type
ECInfo{T}

Global information for ElemCo.

T is the element type for the fcidump integrals (default: Float64).

  • 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::ElemCo.MSystems.MSystem: molecular system.

  • fd::ElemCo.FciDumps.TFDump: fcidump.

  • ao_direct::Bool: ⟨false⟩ the current correlated calculation runs AO-direct (integrals are read from the ao_int2/h_AA scratch files instead of an MO fcidump). Set by the drivers for the duration of an AO-direct run and reset afterwards.

  • 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-β
    • p for positron
    • e for virtual positron
    • 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. Subspaces with multiple characters are possible using {}, e.g., C_vo{bX} contains $U_{a}^{i\bar X}$.

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

Exported functions

ElemCo.ECInfos.freeze_core! — Function
freeze_core!(EC::ECInfo, core::Symbol, freeze_nocc::Int, freeze_orbs=[]; verbose=true)

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 MSystems.guess_ncore.

source
ElemCo.ECInfos.freeze_nvirt! — Function
freeze_nvirt!(EC::ECInfo, nfreeze::Int, freeze_orbs=[]; verbose=true)

Freeze nfreeze virtual orbitals or orbitals on the freeze_orbs list.

source
ElemCo.ECInfos.fullfilename — Method

fullfilename(EC::ECInfo, name::String)

Return the full filename for file name in ECInfo.

The file is assumed to be in the scratch directory EC.scr with extension EC.ext. The filename is canonicalized by canonicalize_filename(name) and the extension is added.

source
ElemCo.ECInfos.get_occvirt — Method
get_occvirt(occas::String, occbs::String, norb, nelec; ms2=0, orbsym=Vector{Int}, ignore_error=false, verbose=true, orig_orbs=1:0)

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. If orig_orbs is non-empty, the occupation strings are interpreted in the full MO space and translated to the active space (see translate_orbs_to_active).

source
ElemCo.ECInfos.isalphaspin — Method
isalphaspin(sp1::Char,sp2::Char)

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

source
ElemCo.ECInfos.parse_orbstring — Method
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.

source
ElemCo.ECInfos.restore_fd_space! — Method
restore_fd_space!(EC::ECInfo; verbose=false)

Restore the space from fcidump.

Returns the current space, which can be used to restore the current space afterwards using restore_space! and the space before freezing orbitals, which can be used to determine the core/deleted orbitals.

This is useful to restore the original space after freezing orbitals. The subspaces 'o' , 'O', 'v', 'V', 'a', etc., correspond to the full system space.

source
ElemCo.ECInfos.restore_full_space! — Method
 restore_full_space!(EC::ECInfo; verbose=false)

Restore the full space from either system or fcidump, depending on which is set up.

Returns the current space, which can be used to restore the current space afterwards using restore_space! and the space before freezing orbitals, which can be used to determine the core/deleted orbitals.

This is useful to restore the original space after freezing orbitals. The subspaces 'o' , 'O', 'v', 'V', 'a', etc., correspond to the full system space.

source
ElemCo.ECInfos.restore_system_space! — Method
restore_system_space!(EC::ECInfo; verbose=false)

Restore the system space (i.e., the space set up by setup_space_system!).

Returns the current space, which can be used to restore the current space afterwards using restore_space! and the space before freezing orbitals, which can be used to determine the core/deleted orbitals.

This is useful to restore the original space after freezing orbitals. The subspaces 'o' , 'O', 'v', 'V', 'a', etc., correspond to the full system space.

source
ElemCo.ECInfos.setup_space! — Method
setup_space!(EC::ECInfo, norb, nelec, npos, ms2, orbsym; verbose=true, orig_orbs=1:0)

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

If orig_orbs is non-empty (a reduced dump), the occa/occb/active orbital lists are interpreted in the full MO space and translated to the active space (see translate_orbs_to_active).

source
ElemCo.ECInfos.setup_space_fd! — Method
setup_space_fd!(EC::ECInfo; norb=nothing, verbose=true)

Setup EC.space from fcidump EC.fd.

If norb is given it overrides the dump's NORB (and ORBSYM is truncated to norb); this is used to set up the space for a reduced orbital count (e.g. the non-deleted MO space) before the integrals are actually transformed/reindexed.

source
ElemCo.ECInfos.with_local_options — Method
with_local_options(f::Function, EC::ECInfo, local_opts::NamedTuple)

Execute function f with local options applied, then restore original options.

The local_opts is a NamedTuple where keys are option category names (e.g., wf, cc, scf) and values are NamedTuples of option key-value pairs.

Example

with_local_options(EC, (wf=(charge=-1, ms2=1), cc=(maxit=30,))) do
  ccdriver(EC, "ccsd")
end
source

File management

ElemCo.ECInfos.add_file! — Function
add_file!(EC::ECInfo, name::String, descr::String; overwrite=false)

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

source
ElemCo.ECInfos.delete_files! — Function
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"
source
delete_files!(EC::ECInfo, which::AbstractArray{String})

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

Examples:

  • 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".
source

Internal functions

ElemCo.ECInfos.active_space — Method
active_space(EC::ECInfo)

Return active space and the new doubly-occupied (closed-shell) space.

EC.space has to be set up. The active space is defined either

  • from the option wf.active, if set up. The format is either an occupation string, or (#elec, #orb).
  • from the singly-occupied orbitals in the reference occupation (from EC.space).

If orig_orbs is non-empty, an active orbital-list string is interpreted in the full MO space and translated to the active space (see translate_orbs_to_active). The (#elec, #orb) format is relative to the current space and is not translated.

source
ElemCo.ECInfos.canonicalize_filename — Method
canonicalize_filename(name::String)

Canonicalize a filename by stripping whitespace and changing each capital letter to the corresponding lowercase letter plus 'ß'.

source
ElemCo.ECInfos.remove_orbs_from_spaces! — Method
remove_orbs_from_spaces!(EC::ECInfo, orbs; exclude=[':', 'm', 'M'])

Remove orbs from all subspaces in EC.space.

exclude is a list of subspaces to exclude (by default, exclude full MO spaces).

source
ElemCo.ECInfos.symorb2orb — Method
symorb2orb(symorb::AbstractString, 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.

source
ElemCo.ECInfos.translate_orbs_to_active — Method
translate_orbs_to_active(orbs::Vector{Int}, orig_orbs::AbstractVector{Int})

Translate full-MO-space orbital indices orbs to the active-space numbering of a reduced dump. The active orbitals are the contiguous full-space range orig_orbs (= lo:hi, with the frozen core below lo and any deleted/frozen virtuals above hi); active orbital k is full orbital lo + k - 1. Frozen-core orbitals (1:lo-1) are occupied in the reference but not part of the active space and are dropped; any other orbital outside lo:hi (a frozen virtual or an out-of-range index) raises an error, since these lists are usually user input. If orig_orbs is empty (external or non-reduced dump), orbs is returned unchanged (indices are taken as-is).

source

Abstract types