Calculations
ElemCo.ElemCo
— Module ╭─────────────╮
Electron Correlation methods
╰─────────────╯
The ElemCo
module contains the main macros and functions for running electronic structure calculations. The methods are contained in various submodules and are described in the following sections.
Various macros are defined and exported to simplify running calculations. The macros use several reserved variable names. The following table lists the reserved variable names and their meanings.
Variable | Meaning |
---|---|
EC::ECInfo | A global information object containing options, molecular system description, integrals and orbital spaces information, see ElemCo.ECInfo . |
geometry::String | Molecular coordinates, either in the xyz format or the file containing the xyz coordinates, see ElemCo.MSystem . |
basis::Dict | Basis set information, see ElemCo.MSystem |
fcidump::String | File containing the integrals in the FCIDUMP format, see ElemCo.FciDumps . |
The driver routines and macros return energies as ordered descriptive dictionaries ElemCo.ODDict
. The last energy is always the total energy (can be accessed using last_energy(energies)
). The following table lists the keys and their meanings.
Key | Meaning |
---|---|
E | Total energy |
Ec | Correlation energy |
HF | Hartree-Fock energy |
MP2 | MP2 energy |
CCSD | CCSD energy |
DCSD | DCSD energy |
SING2D-DCSD | singlet 2D-DCSD energy |
TRIP2D-DCSD | triplet 2D-DCSD energy |
etc. |
One can print the keys of the returned ODDict
to see all the available keys:
julia> println(keys(energies))
or display the complete dictionary together with the descriptions as
julia> display(energies)
The values and the descriptions can be accessed using the keys as
julia> energies["E"] # Total energy
julia> energies("E") # Description of the total energy
Macros
ElemCo.@ECinit
— Macro@ECinit()
Initialize EC::ECInfo
and add molecular system and/or fcidump if variables geometry::String
and basis::Dict{String,Any}
and/or fcidump::String
are defined.
If EC
is already initialized, it will be overwritten.
Examples
geometry="He 0.0 0.0 0.0"
basis = Dict("ao"=>"cc-pVDZ", "jkfit"=>"cc-pvtz-jkfit", "mpfit"=>"cc-pvdz-mpfit")
@ECinit
# output
Occupied orbitals:[1]
ElemCo.@bohf
— Macro@bohf()
Run bi-orthogonal HF calculation using FCIDUMP integrals.
The orbitals are stored to WfOptions.orb
. For open-shell systems (or UHF FCIDUMPs), the BO-UHF energy is calculated.
Examples
fcidump = "FCIDUMP"
@bohf
ElemCo.@bouhf
— Macro@bouhf()
Run bi-orthogonal UHF calculation using FCIDUMP integrals.
ElemCo.@cc
— Macro@cc(method, kwargs...)
Run coupled cluster calculation.
The type of the method is determined by the first argument (ccsd/ccsd(t)/dcsd etc). The method can be specified as a string or as a variable, e.g., @cc CCSD
or @cc "CCSD"
or ccmethod="CCSD"; @cc ccmethod
.
Keyword arguments
fcidump::String
: fcidump file (default: "", i.e., use integrals fromEC
).occa::String
: occupied α orbitals (default: "-").occb::String
: occupied β orbitals (default: "-").
The occupation strings can be given as a +
separated list, e.g. occa = 1+2+3
or equivalently 1-3
. Additionally, the spatial symmetry of the orbitals can be specified with the syntax orb.sym
, e.g. occa = "-5.1+-2.2+-4.3"
.
Examples
geometry="bohr
O 0.000000000 0.000000000 -0.130186067
H1 0.000000000 1.489124508 1.033245507
H2 0.000000000 -1.489124508 1.033245507"
basis = Dict("ao"=>"cc-pVDZ", "jkfit"=>"cc-pvtz-jkfit", "mpfit"=>"cc-pvdz-mpfit")
@dfhf
@dfints
@cc ccsd
ElemCo.@copyfile
— Macro@copyfile(from_file, to_file, kwargs...)
Copy file from_file
to to_file
in EC.scr
directory.
Keyword arguments
overwrite::Bool
: overwrite existing file (default:false
).
ElemCo.@dfcc
— Macro@dfcc(method="svd-dcsd")
Run coupled cluster calculation using density fitted integrals.
The type of the method is determined by the first argument. The method can be specified as a string or as a variable, e.g., @dfcc SVD-DCSD
or @dfcc "SVD-DCSD"
or ccmethod="SVD-DCSD"; @dfcc ccmethod
.
Examples
geometry="bohr
O 0.000000000 0.000000000 -0.130186067
H1 0.000000000 1.489124508 1.033245507
H2 0.000000000 -1.489124508 1.033245507"
basis = Dict("ao"=>"cc-pVDZ", "jkfit"=>"cc-pvtz-jkfit", "mpfit"=>"cc-pvdz-mpfit")
@dfhf
@dfcc svd-dcsd
ElemCo.@dfhf
— Macro@dfhf()
Run DF-HF calculation. The orbitals are stored to WfOptions.orb
.
ElemCo.@dfints
— Macro@dfints()
Generate 2 and 4-idx MO integrals using density fitting. The MO coefficients are read from WfOptions.orb
.
ElemCo.@dfuhf
— Macro@dfuhf()
Run DF-UHF calculation. The orbitals are stored to WfOptions.orb
.
ElemCo.@export_molden
— Macro@export_molden(filename)
Export current orbitals to Molden file filename
.
ElemCo.@freeze_orbs
— Macro@freeze_orbs(freeze_orbs)
Freeze orbitals in the integrals according to an array or range freeze_orbs
.
Examples
fcidump = "FCIDUMP"
@freeze_orbs 1:5
...
@ECinit
@freeze_orbs [1,2,20,21]
ElemCo.@import_matrix
— Macro@import_matrix(filename)
Import matrix from file file
.
The type of the matrix is determined automatically.
ElemCo.@loadfile
— Macro@loadfile(filename)
Read file filename
from EC.scr
directory.
Example
fock = @loadfile("f_mm")
orbs = @loadfile("C_Am")
ElemCo.@mainname
— Macro@mainname(file)
Return the main name of a file, i.e. the part before the last dot and the extension.
Examples
julia> @mainname("~/test.xyz")
("test", "xyz")
ElemCo.@opt
— Macro@opt(opt, kwargs...)
Alias for @set
.
ElemCo.@print_input
— Macro@print_input(print_init=false)
Print the input file content.
Can be used to print the input file content to the output.
ElemCo.@reset
— Macro@reset(opt)
Reset options for opt
to default values.
ElemCo.@rotate_orbs
— Macro@rotate_orbs(orb1, orb2, angle, kwargs...)
Rotate orbitals orb1
and orb2
from WfOptions.orb
by angle
(in degrees). For UHF, spin
can be :α
or :β
(keyword argument).
The orbitals are stored to WfOptions.orb
.
Keyword arguments
spin::Symbol
: spin of the orbitals (default::α
).
Examples
@dfhf
# swap orbitals 1 and 2
@rotate_orbs 1, 2, 90
ElemCo.@run
— Macrogeneral runner
ElemCo.@savefile
— Macro@savefile(filename, arr, kwargs...)
Save array or tuple of arrays arr
to file filename
in EC.scr
directory.
Keyword arguments
description::String
: description of the file (default: "tmp").overwrite::Bool
: overwrite existing file (default:false
).
ElemCo.@set
— Macro@set(opt, kwargs...)
Set options for EC::ECInfo
.
The first argument opt
is the name of the option (e.g., scf
, cc
, cholesky
), see ECInfos.Options
. The keyword arguments are the options to be set (e.g., thr=1.e-14
, maxit=10
). The current state of the options can be stored in a variable, e.g., opt_cc = @set cc
. The state can then be restored by @set cc opt_cc
. If EC
is not already initialized, it will be done.
Examples
optscf = @set scf thr=1.e-14 maxit=10
@set cc maxit=100
...
@set scf optscf
ElemCo.@show_orbs
— Macro@show_orbs(range=nothing)
Show orbitals in the integrals according to an array or range range
.
Examples
@dfhf
@show_orbs 1:5
ElemCo.@transform_ints
— Macro@transform_ints(type="")
Rotate FCIDump integrals using WfOptions.orb
as transformation matrices.
The orbitals are read from WfOptions.orb
. If type is one of [bo, BO, bi-orthogonal, Bi-orthogonal, biorth, biorthogonal, Biorthogonal], the bi-orthogonal orbitals are used and the left transformation matrix is read from WfOptions.orb
*WfOptions.left
.
ElemCo.@tryECinit
— Macro@tryECinit()
If EC::ECInfo
is not yet initialized, run @ECinit
macro.
ElemCo.@var2string
— Macro@var2string(var, strvar="")
Return string representation of var
.
If var
is a String variable, return the value of the variable. Otherwise, return the string representation of var
(or strvar
if provided).
Examples
julia> @var2string(CCSD)
"CCSD"
julia> CCSD = "UCCSD";
julia> @var2string(CCSD)
"UCCSD"
ElemCo.@write_ints
— Macro@write_ints(file="FCIDUMP", tol=-1.0)
Write FCIDump integrals to file file
.
If tol
is negative, all integrals are written, otherwise only integrals with absolute value larger than tol
are written.
Exported functions
Internal functions
ElemCo.__init__
— Method__init__()
Print the header with the version and the git hash of the current commit.