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