ampsci
High-precision calculations for one- and two-valence atomic systems
ConfigurationInteraction.hpp
1#pragma once
2#include "CSF.hpp"
3#include "Coulomb/QkTable.hpp"
4#include "Coulomb/meTable.hpp"
5#include "IO/InputBlock.hpp"
6#include "Wavefunction/DiracSpinor.hpp"
7#include "Wavefunction/Wavefunction.hpp"
8#include <iostream>
9#include <string>
10#include <vector>
11
12//! Functions and classes for Configuration Interaction calculations
13/*! @details
14 Main functions are:
15 - @ref configuration_interaction
16 - @ref run_CI
17
18 Main Classes are:
19 - @ref CSF2
20 - @ref PsiJPi
21*/
22namespace CI {
23
24/*!
25 @brief Runs Configuration Interation: returns CI solutions for all
26 requested J and parity values.
27
28 @details
29 Reads options from @p input, the CI Input Block, and constructs the CI basis
30 from @p wf, computes the required Coulomb (and optionally Breit and two-body
31 MBPT) integrals, then calls run_CI() for each requested (J, parity) pair.
32
33 The returned vector contains one @ref PsiJPi per {J, parity} combination, each
34 holding the eigenvalues and CI expansion coefficients for the requested number
35 of solutions.
36
37 As of writing, options are:
38 @code{.java}
39 // Available CI options/blocks
40 CI{
41 ci_basis;
42 // Basis used for CI expansion; must be a sub-set of
43 // full ampsci basis [default: 20spdf]
44 J;
45 // List of total angular momentum J for CI solutions
46 // (comma separated). Must be integers (two-electron
47 // only). []
48 J+;
49 // As above, but for EVEN CSFs only (takes precedence
50 // over J).
51 J-;
52 // As above, but for ODD CSFs (takes precedence over J).
53 num_solutions;
54 // Number of CI solutions to find (for each J/pi) [5]
55 all_below_cm;
56 // Find all CI solutions for energies below this
57 // threshold, in inverse cm. Note that this is the total
58 // energy, not the excitation energy. If set,
59 // num_solutions is ignored.
60 sigma1;
61 // Include one-body MBPT correlations? [false]
62 sigma2;
63 // Include two-body MBPT correlations? [false]
64 Brueckner;
65 // Use Brueckner (spectrum) states for CI basis? Must
66 // have Spectrum and sigma1. [false]
67 cis2_basis;
68 // The subset of ci_basis for which the two-body MBPT
69 // corrections are calculated. Must be a subset of
70 // ci_basis. If existing sk file has more integrals,
71 // they will be used. [default: Nspdf, where N is
72 // maximum n for core + 3]
73 Breit2;
74 // Include two-body Breit? Default is true if Breit
75 // included in HF. Ignored if Breit not included in HF.
76 // [true]
77 Breit_basis;
78 // Subset of ci_basis used to include two-body Breit
79 // corrections into CI matrix. Large basis is slow, uses
80 // huge memory, and makes small contribution. [default:
81 // Nspdf, where N is maximum n for core + 6]
82 s1_basis;
83 // Usually should be left as default. Basis used for the
84 // one-body MBPT diagrams (Sigma^1) internal lines.
85 // These are the most important, so in general the
86 // default (all basis states) should be used. Must be a
87 // subset of full ampsci basis. [default: full basis]
88 // - Note: if CorrelationPotential is available, it
89 // will be used instead of calculating the Sigma_1
90 // integrals
91 s2_basis;
92 // Usually should be left blank. Basis used for internal
93 // lines of the two-body MBPT diagrams (Sigma^2)
94 // internal lines. Must be a subset of s1_basis.
95 // [default: s1_basis]
96 n_min_core;
97 // Minimum n for core to be included in MBPT [1]
98 max_k;
99 // Maximum k (multipolarity) to include when calculating
100 // new Coulomb integrals. Higher k often contribute
101 // negligably. Note: if qk file already has higher-k
102 // terms, they will be included. Set negative (or very
103 // large) to include all k. [8]
104 denominators;
105 // 'RS', 'Fermi', 'Fermi0'. Denominators used in Sigma2
106 // matrix elements. RS uses actual states for external
107 // legs, Fermi uses the lowest excited state for each
108 // kappa, Fermi0 uses lowest excited state for all
109 // kappas (and thus cancels in all except diagram 'd').
110 // [Fermi0]
111 qk_file;
112 // Filename for storing two-body Coulomb integrals. By
113 // default, is ~ At.qk, where At is atomic symbol +
114 // 'identity'.
115 sk_file;
116 // Filename for storing two-body Sigma_2 integrals. By
117 // default, is At_n_b_k.sk, where At is atomic symbol, n
118 // is n_min_core, b is cis2_basis, k is max_k.
119 bk_file;
120 // Filename for storing two-body Breit integrals. By
121 // default, is ~ At.bk, where At is atomic symbol +
122 // 'identity'.
123 no_new_integrals;
124 // Usually false. If set to true, ampsci will not
125 // calculate any new Coulomb or Sigma_2 integrals, even
126 // if they are implied by the above settings. This saves
127 // time when we know all required integrals already
128 // exist, since the code doesn't need to check. [true]
129 exclude_wrong_parity_box;
130 // Excludes the Sigma_2 box corrections that have
131 // 'wrong' parity when calculating Sigma2 matrix
132 // elements. Note: If existing sk file already has
133 // these, they will be included [false]
134 sort_output;
135 // Sort output by energy? Default is to sort by J and Pi
136 // first. [false]
137 print_details;
138 // Condition to print details of each CI solution
139 // (otherwise just prints summary) [true]
140 parallel_ci;
141 // Run CI in parallel (solve each J/Pi in parallel).
142 // Faster, uses slightly more memory [true]
143 }
144 @endcode
145 * Always check for up-to-date options from command line: `$ ampsci -i CI`
146 * See also @ref run_CI, which this function calls
147
148 @param input Input block containing CI options.
149 @param wf Fully initialised Wavefunction object supplying the orbital
150 basis and radial grid.
151 @return Vector of PsiJPi, one entry per (J, parity) combination requested.
152*/
153std::vector<PsiJPi> configuration_interaction(const IO::InputBlock &input,
154 const Wavefunction &wf);
155
156/*!
157 @brief Constructs and solves the CI eigenvalue problem for a single J,pi
158 @details
159 Builds the CI+MBPT Hamiltonian matrix in the basis of two-electron
160 configuration state functions (CSFs) with total angular momentum
161 @p twoJ /2 and parity @p parity,
162 then solves the eigenvalue problem to obtain CI energies and
163 expansion coefficients.
164
165 The Hamiltonian includes:
166 - one-body terms from @p h1
167 - two-body Coulomb interaction via the \f$ Q^k \f$ integrals in @p qk
168 - optionally, two-body Breit corrections via \f$ B^k \f$ integrals in @p Bk
169 (used if @p Bk is non-empty)
170 - optionally, two-body MBPT \f$ \Sigma_2 \f$ corrections via \f$ S^k \f$
171 integrals in @p Sk (used if @p include_Sigma2 is true, and @p Sk is non-empty)
172
173 The number of solutions returned is controlled by @p num_solutions and
174 @p all_below: if @p all_below is set it takes precedence and all eigenstates
175 with total energy below the threshold are found.
176
177 @param ci_sp_basis Single-particle basis states spanning the CI space.
178 @param twoJ Twice the total angular momentum, 2J (must be a
179 non-negative even integer for two-electron systems).
180 @param parity Parity of the sector: +1 (even) or -1 (odd).
181 @param num_solutions Number of lowest eigenstates to find. Ignored if
182 @p all_below_cm is set. Pass 0 to find all solutions.
183 @param all_below_cm If set, find all eigenstates with total energy below this
184 value (in cm^-1). Overrides @p num_solutions.
185 @param h1 Table of one-body Hamiltonian matrix elements between
186 single-particle basis states.
187 @param qk Table of two-body Coulomb \f$ Q^k \f$ integrals.
188 @param Bk Table of two-body Breit \f$ B^k \f$ integrals. Ignored
189 (treated as absent) if the table is empty.
190 @param Sk Table of two-body MBPT \f$ \Sigma_2 \f$ (\f$ S^k \f$)
191 integrals. Only used when @p include_Sigma2 is true.
192 @param include_Sigma2 If true, add two-body MBPT corrections from @p Sk to
193 the CI Hamiltonian.
194 @param print_details If true, print a breakdown of the leading configurations
195 for each solution. Leads to very large output if
196 @p num_solutions is large
197 @param outstream Output stream for progress and results [default: stdout].
198 @return PsiJPi (@ref PsiJPi) containing the CI eigenvalues and expansion
199 coefficients for the requested solutions.
200*/
201PsiJPi run_CI(const std::vector<DiracSpinor> &ci_sp_basis, int twoJ, int parity,
202 int num_solutions, std::optional<double> all_below_cm,
203 const Coulomb::meTable<double> &h1, const Coulomb::QkTable &qk,
204 const Coulomb::WkTable &Bk, const Coulomb::LkTable &Sk,
205 bool include_Sigma2, bool print_details,
206 std::ostream &outstream = std::cout,
207 const std::string &ci_fname = "");
208
209} // namespace CI
Base class template to store Coulomb integrals, and similar. 3 specific cases (by template instantiat...
Definition QkTable.hpp:102
Look-up table for matrix elements. Note: does not assume any symmetry: (a,b) is stored independantly ...
Definition meTable.hpp:17
Holds a named list of key=value options and nested InputBlocks.
Definition InputBlock.hpp:154
Stores Wavefunction (set of valence orbitals, grid, HF etc.)
Definition Wavefunction.hpp:37
Functions and classes for Configuration Interaction calculations.
Definition CI_Integrals.cpp:11
PsiJPi run_CI(const std::vector< DiracSpinor > &ci_sp_basis, int twoJ, int parity, int num_solutions, std::optional< double > all_below_cm, const Coulomb::meTable< double > &h1, const Coulomb::QkTable &qk, const Coulomb::WkTable &Bk, const Coulomb::LkTable &Sk, bool include_Sigma2, bool print_details, std::ostream &outstream, const std::string &ci_fname)
Constructs and solves the CI eigenvalue problem for a single J,pi.
Definition ConfigurationInteraction.cpp:514
std::vector< PsiJPi > configuration_interaction(const IO::InputBlock &input, const Wavefunction &wf)
Runs Configuration Interation: returns CI solutions for all requested J and parity values.
Definition ConfigurationInteraction.cpp:24