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