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