MADNESS 0.10.1
TDHF.h
Go to the documentation of this file.
1/*
2 * TDHF.h
3 *
4 * Created on: Aug 11, 2016
5 * Author: kottmanj
6 */
7
8#ifndef SRC_APPS_CHEM_TDHF_H_
9#define SRC_APPS_CHEM_TDHF_H_
10
12#include<madness/chem/nemo.h>
16#include <math.h>
19
20
21namespace madness {
22 /// the TDHF parameter class
24
25 static constexpr char const *tag = "tdhf";
26
30
31 TDHFParameters(const TDHFParameters &other) = default;
32
33 /// todo: read_from_file compatible with dist. memory computation
34 TDHFParameters(World &world, const commandlineparser& parser) {
37 }
38
39 std::string get_tag() const override {
40 return std::string(tag);
41 }
42
43
45
46 // MRA stuff
47 initialize < double > ("thresh", 1.e-5);
48 initialize < double > ("econv", 1.e-5);
49 initialize < double > ("dconv", 1.e-4);
50
51 // physics
52 initialize < std::string >
53 ("calculation", "cis", "currently only cis=tda possible, TBD: thdf", {"cis"});
54 initialize < std::string >
55 ("response_kernel", "default", "default: corresponds to the ground state, libxc-notation otherwise");
56 initialize < bool > ("triplet", false, "calculate triplet excitation energies (only works for CIS)");
57 initialize < bool > ("do_oep", false, "use OEP potentials for the ground state exchange");
58 initialize < std::size_t > ("nexcitations", 1,"number of excitation to be computed");
59 initialize < long > ("freeze", -1, "the number of frozen occupied orbitals (-1: automatic)");
60 initialize < std::string > ("irrep", "all", "compute only irreps of the respective point group");
61
62 // solver
63 initialize < size_t > ("maxiter", 25, "maximum number of iterations in the final iterations");
64 initialize < std::size_t >
65 ("kain_subspace", 8, "use kain (kain subspace<=0 == no kain, kain_subspace==1 should have the same effect)");
66
67 // guess
68 initialize < double > ("guess_econv", 1.e-4);
69 initialize < double > ("guess_dconv", 1.e-3);
70 initialize < std::size_t > ("iterating_excitations", 2);
71 initialize < std::size_t > ("guess_excitations", 4);
72 initialize < std::size_t > ("guess_occ_to_virt", 5);
73 initialize < double >
74 ("damping_width", 0.0, "every exop is multiplied with e^(-exponent*r2) to avoid noise at the boundaries");
75
76 initialize < bool > ("debug", false);
77 initialize < bool > ("plot", false);
78// initialize < bool > ("no_compute", false);
79 initialize<int> ("print_level",3,"0: no output; 1: final energy; 2: iterations; 3: timings; 10: debug");
80
81// initialize <std::vector<size_t>> ("restart", std::vector<size_t>(), "excitations which will be read from disk");
82 initialize <std::string> ("restart", "iterate", "restart excitations from disk", {"no_restart","iterate","no_compute"});
83 initialize <std::vector<size_t>> ("excitations", std::vector<size_t>(), "ordering of the excitations read from disk");
84
85
86 initialize < std::string >
87 ("guess_excitation_operators", "quadrupole", "guess type", {"dipole+", "quadrupole", "octopole", "custom"});
88
89 /// add center of mass functions determined by the homo-energy
90 /// will add s,px,py,pz functions in the center of mass with exponent: -(e_homo/c) and c=guess_cm is the value of this parameter
91 initialize < double >
92 ("guess_cm", 2.0, "center-of-mass functions, s/p shell with exponent -(e_homo/c)");
93
94 /// use the diagonal approximation for the guess (only e_a -e_i terms in CIS matrix)
95 /// much faster
96 initialize < bool >
97 ("guess_diag", true, "use the diagonal approximation for the guess (only e_a -e_i terms in CIS matrix)");
98
99 /// determine active orbitals in guess (for all inactive orbitals only the diagonal e_a-e_i term is computed in the guess
100 /// guess_active_orbitals=0 is the same as guess_diag
101 initialize < std::size_t >
102 ("guess_active_orbitals", 0, "determine active orbitals in guess (for all inactive orbitals only the diagonal e_a-e_i term is computed in the guess");
103
104
105 initialize < bool >
106 ("store_potential", true, "store the potential for orthogonalizations or recalculate it");
107
108 initialize < size_t > ("guess_maxiter", 5, "maximum number of guess iterations ");
109
110 // /// determine how the virtuals for the guess are constructed: scf, external, custom, dipole, quadrupole
111 // /// scf: read in the ao set from scf (scales with system size)
112 // /// external: read in virtuals from disk
113 // /// custom or predefined strings like dipole, dipole+, ... : create virtuals form occupied orbitals by multiplying with polynomials
114 // /// |v> = |occ>*poly
115 // /// if custom is chosen:
116 // /// the polynomials can be determined by: exop x n1 y n2 z n3 c n4, x n11 ... x n44, ... which will be n4*x^n1*y^n2*z^n3 + n44*x^n11* ...
117 // /// e.g. for a dipole guess enter the exop keyword 3 times as:
118 // /// exop x 1.0
119 // /// exop y 1.0
120 // /// exop z 1.0
121 // /// the options dipole, dipole+, dipole+diffuse and quadrupole give predefined exops without explicitly stating them
122 // /// see the end of TDHF.cc for predefined keys
123 // std::string guess_excitation_operators="dipole+";
124 //
125 /// Vector of strings which contains the polynomial excitation operators
126 /// For this to be used the tda_guess key has to be "custom"
127 /// The strings are given in a format like: "c c1 x x1 y y1 z z1, c c2 x x2 y y2 z z2, ..." which will be interpreted as: c1*x^x1*y^y1*z^z1 + c2*x^x2*y^y2*z^z2 + ....
128 initialize < std::vector<std::string> >
129 ("exops", {""}, "applies only if guess_excitation_operator is custom");
130
131
132 }
133
134 void set_derived_values(const std::shared_ptr<SCF> &scf);
135
136 // physical part
137 std::size_t nexcitations() const { return get<std::size_t>("nexcitations"); }
138
139 long freeze() const { return get<long>("freeze"); }
140
141 std::string irrep() const { return get<std::string>("irrep"); }
142
143 bool triplet() const { return get<bool>("triplet"); }
144
145 bool do_oep() const { return get<bool>("do_oep"); }
146
147 std::string response_kernel() const { return get<std::string>("response_kernel"); }
148
149 // precision
150 double thresh() const { return get<double>("thresh"); }
151
152 double econv() const { return get<double>("econv"); }
153
154 double dconv() const { return get<double>("dconv"); }
155
156 // restart and plotting
157 bool debug() const { return get<bool>("debug"); }
158
159 std::string restart() const { return get<std::string>("restart"); }
160 bool no_compute() const { return (restart()=="no_compute"); }
161
162 int print_level() const {return get<int>("print_level");}
163
164 std::vector<size_t> excitations() const { return get<std::vector<size_t> >("excitations"); }
165
166 bool plot() const { return get<bool>("plot"); }
167
168 // solver parameters
169 std::size_t iterating_excitations() const { return get<std::size_t>("iterating_excitations"); }
170
171 std::size_t maxiter() const { return get<std::size_t>("maxiter"); }
172
173 std::size_t kain_subspace() const { return get<std::size_t>("kain_subspace"); }
174
175 bool store_potential() const { return get<bool>("store_potential"); }
176
177 // guess parameters
178// std::size_t guess_occ_to_virt() const { return get<std::size_t>("guess_occ_to_virt"); }
179
180 std::vector<std::string> exops() const { return get<std::vector<std::string> >("exops"); }
181
182// std::size_t guess_active_orbitals() const { return get<std::size_t>("guess_active_orbitals"); }
183
184 bool guess_diag() const { return get<bool>("guess_diag"); }
185
186 std::size_t guess_excitations() const { return get<std::size_t>("guess_excitations"); }
187
188 std::string guess_excitation_operators() const { return get<std::string>("guess_excitation_operators"); }
189
190 double damping_width() const { return get<double>("damping_width"); }
191
192 double guess_cm() const { return get<double>("guess_cm"); }
193
194 double guess_econv() const { return get<double>("guess_econv"); }
195
196 double guess_dconv() const { return get<double>("guess_dconv"); }
197
198 std::size_t guess_maxiter() const { return get<std::size_t>("guess_maxiter"); }
199
200 /// make parameters for convolution operator
203 result.freeze = freeze();
204 result.lo = lo;
205 result.thresh_op = thresh();
206 result.gamma = 1.0;
207 return result;
208 }
209 }; // end of parameter class
210
211
212/// The TDHF class
213/// solves CIS/TDA equations and hopefully soon the full TDHF/TDDFT equations
214class TDHF : public QCPropertyInterface {
215public:
216
217 TDHF(World &world, const TDHFParameters &parameters, std::shared_ptr<const Nemo> reference);
218
219 TDHF(World &world, const commandlineparser &parser);
220
221 TDHF(World &world, const commandlineparser &parser, std::shared_ptr<const Nemo> nemo);
222
223 virtual ~TDHF() {}
224
225 void initialize();
226
227 std::string name() const {return "TDHF";};
228
229 static void help() {
230 print_header2("help page for CIS ");
231 print("The CIS code computes Hartree-Fock and DFT excitations.");
232 print("A moldft or nemo calculation will be performed automatically unless there is already a ");
233 print("wave function on file ('restartdata.00000'). Both local and canonical orbitals can be ");
234 print("used, for the latter individual irreps may be chosen for computation");
235 print("Relevant parameters are derived from the reference calculation (moldft or nemo),");
236 print("such as k, nuclear_correlation_factor, charge, etc");
237 print("You can print all available calculation parameters by running\n");
238 print("cis --print_parameters\n");
239 print("You can perform a simple calculation by running\n");
240 print("cis --geometry=h2o.xyz\n");
241 print("provided you have an xyz file in your directory.");
242
243 }
244
245 void print_frozen_orbitals() const;
246
248
249 static void print_parameters() {
251 print("default parameters for the CIS program are\n");
252 param.print("response", "end");
253 print("\n\nthe molecular geometry must be specified in a separate block:");
255 }
256
257 virtual bool selftest() {
258 return true;
259 };
260
261 /// sets the reference wave function (nemo or oep)
262 void set_reference(std::shared_ptr<NemoBase> reference) {
263 reference_=reference;
264 }
265
266 std::shared_ptr<const NemoBase> get_reference() const {
267 return reference_;
268 }
269
270 std::shared_ptr<SCF> get_calc() const {
271 auto n=std::dynamic_pointer_cast<const Nemo>(reference_);
272 if (not n) MADNESS_EXCEPTION("could not cast NemoBase to Nemo",1);
273 return n->get_calc();
274 }
275
276 std::shared_ptr<const Nemo> get_nemo() const {
277 auto n=std::dynamic_pointer_cast<const Nemo>(reference_);
278 if (not n) MADNESS_EXCEPTION("could not cast NemoBase to Nemo",1);
279 return n;
280 }
281
282 void prepare_calculation();
283
285 auto n=std::dynamic_pointer_cast<const Nemo>(reference_);
286 if (not n) MADNESS_EXCEPTION("could not cast NemoBase to Nemo",1);
287 return n->get_calc_param();
288 }
289
293 static int test(World &world, commandlineparser& parser);
294
295 /// check consistency of the input parameters
296 void check_consistency() const;
297
298 /// plot planes and cubes
299 void plot(const vector_real_function_3d &vf, const std::string &name) const;
300
301 /// sort the xfunctions according to their excitation energy and name the excitation energies accordingly
302 std::vector<CC_vecfunction> sort_xfunctions(std::vector<CC_vecfunction> x) const;
303
304 /// print information
305 void print_xfunctions(const std::vector<CC_vecfunction>& f, const std::string message) const;
306
307 /// Initialize the CIS functions
308
309 /// @param[in\out] on input the already obtained guess functions (or empty vector), on output new guess functions are added
310 void initialize(std::vector<CC_vecfunction> &start) const;
311
312 void symmetrize(std::vector<CC_vecfunction> &v) const;
313
314 /// Solve the CIS equations
315
316 /// @param[in/out] CC_vecfunction
317 /// on input the guess functions (if empty or not enough the a guess will be generated)
318 /// on output the solution
319 std::vector<CC_vecfunction> solve_cis() const;
320
321 /// analyze the root: oscillator strength and contributions from occupied orbitals
322 nlohmann::json analyze(const std::vector<CC_vecfunction> &x) const;
323
324 const TDHFParameters& get_parameters() const {return parameters;};
325
326 std::vector<CC_vecfunction> get_converged_roots() const {return converged_roots;}
327
328private:
329 std::vector<CC_vecfunction> solve_cis(std::vector<CC_vecfunction> &start) const;
330
331 /// Solve TDHF equations (not ready)
332 void solve_tdhf(std::vector<CC_vecfunction> &guess) const;
333
334 /// iterate the CIS guess vectors
335 /// @param[in,out] x: on input the guess, on output the iterated guess
336 /// see CC_Structures.h CCParameters class for convergence criteria
337 bool iterate_cis_guess_vectors(std::vector<CC_vecfunction> &x) const;
338
339 /// iterate the final CIS vectors
340 /// @param[in,out] x: on input the guess, on output the iterated guess
341 /// see CC_Structures.h CCParameters class for convergence criteria
342 bool iterate_cis_final_vectors(std::vector<CC_vecfunction> &x) const;
343
344 /// General function to iterate vectors
345 /// @param[in,out] x: the CIS (or TDHF x) functions
346 /// @param[in,out] the TDHF y functions (empty for CIS)
347 /// @param[in] iterate_y, if true the y equation for TDHF is iterated
348 /// @param[in] dconv: wavefunction convergence (for the vector norm of the vectorfunction)
349 /// @param[in] econv: Energy convergece
350 /// @param[in] iter: maximum number of iterations
351 /// @param[in] kain: use kain if true (kainsubspace is controlled over CCParameters class)
352 bool iterate_vectors(std::vector<CC_vecfunction> &x, const std::vector<CC_vecfunction> &y, bool iterate_y,
353 const double dconv, const double econv, const double iter, const bool kain) const;
354
355 /// Apply the Greens function to a vector of vectorfunction with a given potential
356 /// @param[in] x: the vector of vectorfunctions where G will be applied to
357 /// @param[in] V: the vector of potentials to the vectorfunctions, will be cleared afterwards (potentials are all potentials excpet the nuclear: 2J - K + Q(2pJ - pK)
358 /// @param[out] the vectorfunctions after G has been applied
359 /// the energy is assumed to be stored in the CC_vecfunctions member omega
360 /// the wavefunction error is stored in the CC_vecfunctions member current_error
361 std::vector<vector_real_function_3d>
362 apply_G(std::vector<CC_vecfunction> &x, std::vector<vector_real_function_3d> &V) const;
363
364 /// Make the old CIS Guess
365 /// the routine is now used to create virtuals
366// std::vector<CC_vecfunction> make_old_guess(const vector_real_function_3d &f) const;
367
368 /// Create a set of virtual orbitals for the initial guess
370
371 /// multiply excitation operators defined in the parameters with the seed functions
372 /// @param[in] the seeds, define the function which are multiplied by the excitation operators
373 /// @param[in] use_trigo, if false polynomials are used for excitation operators, else trigonometric functions (i.e. x^2y vs sin^2(x)*sin(y))
374 /// Trigonometric functions are prefered since they are bounded (no weird behaviour at the boundaries for large exponents)
376 apply_excitation_operators(const vector_real_function_3d &seed, const bool &use_trigo = true) const;
377
378 /// make the initial guess by explicitly diagonalizing a CIS matrix with virtuals from the make_virtuals routine
379 vector<CC_vecfunction> make_guess_from_initial_diagonalization() const;
380
381 /// canonicalize a set of orbitals (here the virtuals for the guess)
383
384 /// compute the CIS matrix for a given set of virtuals
385
386 /// @param[in] virtuals the virtual orbitals
387 /// @param[in] veps the orbital energies of the virtuals
388 Tensor<double> make_cis_matrix(const vector_real_function_3d& virtuals, const Tensor<double> &veps) const;
389
390 std::string filename_for_roots(const int ex) const {
391 return get_calcparam().prefix()+"_root_"+std::to_string(ex);
392 }
393
394 /// Make the potentials to a given vector of vecfunctions (excitations)
395 /// @param[in] The vector of excitations
396 /// @param[out] The potentials
397 std::vector<vector_real_function_3d> make_potentials(const std::vector<CC_vecfunction> &x) const;
398
399 // /// Make the CIS potential for a single excitation vector
400 // vecfuncT get_cis_potential(const CC_vecfunction& x) const {
401 // return CCOPS.make_cis_potential(x);
402 // }
403 /// Make the TDA potential for a single excitation vector
405
406 /// Make the TDHF potential (not ready)
407 std::vector<vector_real_function_3d>
408 make_tdhf_potentials(std::vector<CC_vecfunction> &x, const std::vector<CC_vecfunction> &y) const;
409
410 /// orthonormalize a vector of excitations
411 /// @param[in,out] input: the excitations, output: the orthonormalized excitations
412 /// @param[in] input: the potentials, if empty the potentials will be recalculated but NOT stored
413 /// output: the transformed potentials
414 void orthonormalize(std::vector<CC_vecfunction> &x, std::vector<vector_real_function_3d> &V) const;
415
416 /// Calculate the perturbed fock matrix for a given vector of excitations
417 /// @param[in] input: the excitations
418 /// @param[in] input: the potentials, if empty the potentials will be recalculated but NOT stored
419 Tensor<double> make_perturbed_fock_matrix(const std::vector<CC_vecfunction> &x,
420 const std::vector<vector_real_function_3d> &V) const;
421
422 Tensor<double> make_overlap_matrix(const std::vector<CC_vecfunction> &x) const;
423
424 std::vector<vector_real_function_3d>
425 transform(const std::vector<vector_real_function_3d> &x, const madness::Tensor<double> U) const {
426 std::vector<CC_vecfunction> tmp;
427 for (const auto &xi:x) tmp.push_back(CC_vecfunction(xi));
428 std::vector<CC_vecfunction> tmp2 = transform(tmp, U);
429 std::vector<vector_real_function_3d> result;
430 for (const auto &xi:tmp2) result.push_back(xi.get_vecfunction());
431 return result;
432 }
433
434 /// Interface to the SCF.h fock_transform function
435 std::vector<CC_vecfunction>
436 transform(const std::vector<CC_vecfunction> &x, const madness::Tensor<double> U) const;
437
438
439 /// Helper function to initialize the const mo_bra and ket elements
440 CC_vecfunction make_mo_bra(const std::vector<Function<double,3>>& amo) const {
441 vector_real_function_3d tmp = get_reference()->get_ncf_ptr()->square()* amo;
443 truncate(world, tmp);
444 reconstruct(world, tmp);
445 CC_vecfunction mo_bra(tmp, HOLE);
446 return mo_bra;
447 }
448
449 CC_vecfunction make_mo_ket(const std::vector<Function<double,3>>& amo) const {
452 truncate(world, tmp);
453 reconstruct(world, tmp);
454 CC_vecfunction mo_ket(tmp, HOLE);
455 return mo_ket;
456 }
457
458 double get_orbital_energy(const size_t i) const {
459 auto n=std::dynamic_pointer_cast<const Nemo>(reference_);
460 if (not n) MADNESS_EXCEPTION("could not cast NemoBase to Nemo",1);
461 return n->get_calc()->aeps(i);
462 }
463
464 /// convenience
466 return make_bra(ket.get_vecfunction());
467 }
468
471 return make_bra(v).front();
472
473 }
474
475 /// maybe move this into nuclear_correlation class ?
477 CCTimer time(world, "Make Bra");
478 real_function_3d nucf = reference_->ncf->square();
479 vector_real_function_3d result = mul(world, nucf, ket);
480 time.info(parameters.debug());
481 return result;
482 }
483
486 for (size_t i = parameters.freeze(); i < mo_ket_.size(); i++) result.push_back(mo_ket_(i).function);
487 return result;
488 }
489
492 for (size_t i = parameters.freeze(); i < mo_ket_.size(); i++) result.push_back(mo_bra_(i).function);
493 return result;
494 }
495
496 /// compute the oscillator strength in the length representation
497
498 /// the oscillator strength is given by
499 /// \f[
500 /// f = 2/3 * \omega |<x | \vec \mu | i >| ^2 * 2
501 /// \f]
502 /// where \f$ x \f$ is the excited state, and \f$ i \f$ is the ground state
503 /// @param[in] root a converged root
504 double oscillator_strength_length(const CC_vecfunction &x) const;
505
506 /// compute the oscillator strength in the velocity representation
507
508 /// the oscillator strength is given by
509 /// \f[
510 /// f = 2/(3 * \omega) |<x | \vec p | i >| ^2 * 2
511 /// \f]
512 /// where \f$ x \f$ is the excited state, and \f$ i \f$ is the ground state
513 /// @param[in] root a converged root
514 double oscillator_strength_velocity(const CC_vecfunction &x) const;
515
516 /// Fock matrix for occupied orbitals
518 /// The MPI Communicator
520 /// The Nemo structure (convenience)
521 std::shared_ptr<const NemoBase> reference_;
522 /// The TDHFParameters for the Calculations
524 /// Operator Structure which can handle intermediates (use for exchange with GS orbitals)
525 /// Can be replaced by another potential manager
526 std::shared_ptr<CCConvolutionOperator<double,3>> g12;
527 /// MO bra and ket
530 /// the Projector to the virtual space
532 /// the symmetry projector
534 /// the messenger IO
536 /// converged roots
537 mutable std::vector<CC_vecfunction> converged_roots;
538 /// stored guess roots roots to feed into the cycle, sorted backwards for easier pop_back calling
539 mutable std::vector<CC_vecfunction> guess_roots;
540};
541
542
543} /* namespace madness */
544
545#endif /* SRC_APPS_CHEM_TDHF_H_ */
Operators for the molecular HF and DFT code.
A multiresolution adaptive numerical function.
Definition mra.h:139
Function< T, NDIM > & square(bool fence=true)
Inplace squaring of function ... global comm only if not reconstructed.
Definition mra.h:1114
Definition MolecularOrbitals.h:24
static void print_parameters()
Definition molecule.cc:115
class for holding the parameters for calculation
Definition QCCalculationParametersBase.h:294
virtual void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition QCCalculationParametersBase.h:330
class implementing properties of QC models
Definition QCPropertyInterface.h:11
orthogonality projector
Definition projector.h:186
Definition TDHF.h:214
std::shared_ptr< const Nemo > get_nemo() const
Definition TDHF.h:276
void solve_tdhf(std::vector< CC_vecfunction > &guess) const
Solve TDHF equations (not ready)
Definition TDHF.cc:455
Tensor< double > make_cis_matrix(const vector_real_function_3d &virtuals, const Tensor< double > &veps) const
compute the CIS matrix for a given set of virtuals
Definition TDHF.cc:1385
vector_real_function_3d make_bra(const vector_real_function_3d &ket) const
maybe move this into nuclear_correlation class ?
Definition TDHF.h:476
vector_real_function_3d make_virtuals() const
Create a set of virtual orbitals for the initial guess.
Definition TDHF.cc:1051
double oscillator_strength_length(const CC_vecfunction &x) const
compute the oscillator strength in the length representation
Definition TDHF.cc:1544
CalculationParameters get_calcparam() const
Definition TDHF.h:284
void check_consistency() const
check consistency of the input parameters
Definition TDHF.cc:1665
vector_real_function_3d get_tda_potential(const CC_vecfunction &x) const
Make the TDA potential for a single excitation vector.
Definition TDHF.cc:729
static void print_parameters()
Definition TDHF.h:249
void initialize()
Definition TDHF.cc:86
bool iterate_cis_guess_vectors(std::vector< CC_vecfunction > &x) const
Definition TDHF.cc:460
CC_vecfunction mo_bra_
Definition TDHF.h:529
CCMessenger msg
the messenger IO
Definition TDHF.h:535
World & world
The MPI Communicator.
Definition TDHF.h:519
virtual bool selftest()
Definition TDHF.h:257
std::vector< vector_real_function_3d > apply_G(std::vector< CC_vecfunction > &x, std::vector< vector_real_function_3d > &V) const
Definition TDHF.cc:641
double get_orbital_energy(const size_t i) const
Definition TDHF.h:458
const vector_real_function_3d get_active_mo_ket() const
Definition TDHF.h:484
vector_real_function_3d apply_excitation_operators(const vector_real_function_3d &seed, const bool &use_trigo=true) const
Definition TDHF.cc:1124
QProjector< double, 3 > Q
the Projector to the virtual space
Definition TDHF.h:531
MolecularOrbitals< double, 3 > enforce_core_valence_separation(const Tensor< double > &fmat) const
Definition TDHF.cc:110
void plot(const vector_real_function_3d &vf, const std::string &name) const
plot planes and cubes
Definition TDHF.cc:213
std::vector< CC_vecfunction > sort_xfunctions(std::vector< CC_vecfunction > x) const
sort the xfunctions according to their excitation energy and name the excitation energies accordingly
Definition TDHF.cc:222
std::shared_ptr< SCF > get_calc() const
Definition TDHF.h:270
virtual ~TDHF()
Definition TDHF.h:223
std::shared_ptr< const NemoBase > reference_
The Nemo structure (convenience)
Definition TDHF.h:521
bool iterate_cis_final_vectors(std::vector< CC_vecfunction > &x) const
Definition TDHF.cc:466
vector_real_function_3d canonicalize(const vector_real_function_3d &v, Tensor< double > &veps) const
canonicalize a set of orbitals (here the virtuals for the guess)
Definition TDHF.cc:1361
vector< CC_vecfunction > make_guess_from_initial_diagonalization() const
make the initial guess by explicitly diagonalizing a CIS matrix with virtuals from the make_virtuals ...
Definition TDHF.cc:1167
real_function_3d make_bra(const real_function_3d &ket) const
Definition TDHF.h:469
std::vector< CC_vecfunction > converged_roots
converged roots
Definition TDHF.h:537
void orthonormalize(std::vector< CC_vecfunction > &x, std::vector< vector_real_function_3d > &V) const
Definition TDHF.cc:851
std::shared_ptr< const NemoBase > get_reference() const
Definition TDHF.h:266
double oscillator_strength_velocity(const CC_vecfunction &x) const
compute the oscillator strength in the velocity representation
Definition TDHF.cc:1564
void prepare_calculation()
compute non-trivial prerequisites for the calculation
Definition TDHF.cc:150
static void help()
Definition TDHF.h:229
void symmetrize(std::vector< CC_vecfunction > &v) const
Definition TDHF.cc:284
std::vector< CC_vecfunction > guess_roots
stored guess roots roots to feed into the cycle, sorted backwards for easier pop_back calling
Definition TDHF.h:539
std::vector< vector_real_function_3d > make_tdhf_potentials(std::vector< CC_vecfunction > &x, const std::vector< CC_vecfunction > &y) const
Make the TDHF potential (not ready)
Definition TDHF.cc:846
Tensor< double > F_occ
Fock matrix for occupied orbitals.
Definition TDHF.h:517
std::shared_ptr< CCConvolutionOperator< double, 3 > > g12
Definition TDHF.h:526
std::string filename_for_roots(const int ex) const
Definition TDHF.h:390
CC_vecfunction mo_ket_
MO bra and ket.
Definition TDHF.h:528
std::string name() const
Definition TDHF.h:227
Tensor< double > make_overlap_matrix(const std::vector< CC_vecfunction > &x) const
Definition TDHF.cc:909
projector_irrep get_symmetry_projector() const
Definition TDHF.h:290
std::vector< CC_vecfunction > get_converged_roots() const
Definition TDHF.h:326
std::vector< CC_vecfunction > solve_cis() const
Solve the CIS equations.
Definition TDHF.cc:316
nlohmann::json analyze(const std::vector< CC_vecfunction > &x) const
analyze the root: oscillator strength and contributions from occupied orbitals
Definition TDHF.cc:1582
const TDHFParameters & get_parameters() const
Definition TDHF.h:324
projector_irrep symmetry_projector
the symmetry projector
Definition TDHF.h:533
TDHFParameters parameters
The TDHFParameters for the Calculations.
Definition TDHF.h:523
vector_real_function_3d make_bra(const CC_vecfunction &ket) const
convenience
Definition TDHF.h:465
std::vector< vector_real_function_3d > make_potentials(const std::vector< CC_vecfunction > &x) const
Definition TDHF.cc:715
std::vector< vector_real_function_3d > transform(const std::vector< vector_real_function_3d > &x, const madness::Tensor< double > U) const
Definition TDHF.h:425
CC_vecfunction make_mo_ket(const std::vector< Function< double, 3 > > &amo) const
Definition TDHF.h:449
Tensor< double > make_perturbed_fock_matrix(const std::vector< CC_vecfunction > &x, const std::vector< vector_real_function_3d > &V) const
Definition TDHF.cc:923
void set_reference(std::shared_ptr< NemoBase > reference)
sets the reference wave function (nemo or oep)
Definition TDHF.h:262
const vector_real_function_3d get_active_mo_bra() const
Definition TDHF.h:490
bool iterate_vectors(std::vector< CC_vecfunction > &x, const std::vector< CC_vecfunction > &y, bool iterate_y, const double dconv, const double econv, const double iter, const bool kain) const
Definition TDHF.cc:472
void print_xfunctions(const std::vector< CC_vecfunction > &f, const std::string message) const
print information
Definition TDHF.cc:228
void print_frozen_orbitals() const
Definition TDHF.cc:104
CC_vecfunction make_mo_bra(const std::vector< Function< double, 3 > > &amo) const
Helper function to initialize the const mo_bra and ket elements.
Definition TDHF.h:440
A tensor is a multidimensional array.
Definition tensor.h:317
A parallel world class.
Definition world.h:132
Definition pointgroupsymmetry.h:98
static double lo
Definition dirac-hatom.cc:23
static const double v
Definition hatom_sf_dirac.cc:20
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
void print_header2(const std::string &s)
medium section heading
Definition print.cc:54
Function< TENSOR_RESULT_TYPE(Q, T), NDIM > mul(const Q alpha, const Function< T, NDIM > &f, bool fence=true)
Returns new function equal to alpha*f(x) with optional fence.
Definition mra.h:1765
void truncate(World &world, response_space &v, double tol, bool fence)
Definition basic_operators.cc:31
@ HOLE
Definition ccpairfunction.h:26
const std::vector< Function< T, NDIM > > & reconstruct(const std::vector< Function< T, NDIM > > &v)
reconstruct a vector of functions
Definition vmra.h:162
void set_thresh(World &world, std::vector< Function< T, NDIM > > &v, double thresh, bool fence=true)
Sets the threshold in a vector of functions.
Definition vmra.h:1285
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:94
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:225
NDIM & f
Definition mra.h:2481
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2066
const double xi
Exponent for delta function approx.
Definition siam_example.cc:60
parameter class
Definition CCStructures.h:575
int freeze
Definition CCStructures.h:590
double lo
Definition CCStructures.h:589
double gamma
Definition CCStructures.h:591
double thresh_op
Definition CCStructures.h:588
Definition CCStructures.h:86
Timer Structure.
Definition CCStructures.h:131
void info(const bool debug=true, const double norm=12345.6789)
print out information about the passed time since the CC_TIMER object was created
Definition CCStructures.cc:52
A helper structure which holds a map of functions.
Definition CCStructures.h:334
size_t size() const
Get the size vector (number of functions in the map)
Definition CCStructures.h:530
vector_real_function_3d get_vecfunction() const
Returns all the functions of the map as vector.
Definition CCStructures.h:523
Definition CalculationParameters.h:51
std::string prefix() const
Definition CalculationParameters.h:147
the TDHF parameter class
Definition TDHF.h:23
void initialize_all()
Definition TDHF.h:44
bool guess_diag() const
Definition TDHF.h:184
bool store_potential() const
Definition TDHF.h:175
static constexpr char const * tag
Definition TDHF.h:25
void set_derived_values(const std::shared_ptr< SCF > &scf)
auto assigns all parameters which where not explicitly given and which depend on other parameters of ...
Definition TDHF.cc:1647
std::string response_kernel() const
Definition TDHF.h:147
std::string get_tag() const override
Definition TDHF.h:39
bool do_oep() const
Definition TDHF.h:145
TDHFParameters(const TDHFParameters &other)=default
double guess_econv() const
Definition TDHF.h:194
std::size_t kain_subspace() const
Definition TDHF.h:173
bool debug() const
Definition TDHF.h:157
TDHFParameters()
Definition TDHF.h:27
bool no_compute() const
Definition TDHF.h:160
std::size_t maxiter() const
Definition TDHF.h:171
double dconv() const
Definition TDHF.h:154
int print_level() const
Definition TDHF.h:162
std::size_t iterating_excitations() const
Definition TDHF.h:169
bool triplet() const
Definition TDHF.h:143
std::vector< std::string > exops() const
Definition TDHF.h:180
double damping_width() const
Definition TDHF.h:190
double thresh() const
Definition TDHF.h:150
std::vector< size_t > excitations() const
Definition TDHF.h:164
TDHFParameters(World &world, const commandlineparser &parser)
todo: read_from_file compatible with dist. memory computation
Definition TDHF.h:34
std::size_t guess_excitations() const
Definition TDHF.h:186
std::size_t nexcitations() const
Definition TDHF.h:137
std::string irrep() const
Definition TDHF.h:141
CCConvolutionOperator< double, 3 >::Parameters get_ccc_parameters(const double lo) const
make parameters for convolution operator
Definition TDHF.h:201
bool plot() const
Definition TDHF.h:166
double guess_dconv() const
Definition TDHF.h:196
std::size_t guess_maxiter() const
Definition TDHF.h:198
long freeze() const
Definition TDHF.h:139
double econv() const
Definition TDHF.h:152
std::string guess_excitation_operators() const
Definition TDHF.h:188
double guess_cm() const
Definition TDHF.h:192
std::string restart() const
Definition TDHF.h:159
very simple command line parser
Definition commandlineparser.h:15
static double V(const coordT &r)
Definition tdse.cc:288
InputParameters param
Definition tdse.cc:203
static double guess(const coordT &r)
Definition tdse.confused.cc:345
void test()
Definition y.cc:696