8 #ifndef SRC_APPS_CHEM_TDHF_H_
9 #define SRC_APPS_CHEM_TDHF_H_
45 initialize < double > (
"thresh", 1.e-5);
46 initialize < double > (
"econv", 1.e-5);
47 initialize < double > (
"dconv", 1.e-4);
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");
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)");
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);
72 (
"damping_width", 0.0,
"every exop is multiplied with e^(-exponent*r2) to avoid noise at the boundaries");
74 initialize < bool > (
"debug",
false);
75 initialize < bool > (
"plot",
false);
77 initialize<int> (
"print_level",3,
"0: no output; 1: final energy; 2: iterations; 3: timings; 10: debug");
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");
84 initialize < std::string >
85 (
"guess_excitation_operators",
"quadrupole",
"guess type", {
"dipole+",
"quadrupole",
"octopole",
"custom"});
90 (
"guess_cm", 2.0,
"center-of-mass functions, s/p shell with exponent -(e_homo/c)");
95 (
"guess_diag",
true,
"use the diagonal approximation for the guess (only e_a -e_i terms in CIS matrix)");
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");
104 (
"store_potential",
true,
"store the potential for orthogonalizations or recalculate it");
106 initialize < size_t > (
"guess_maxiter", 5,
"maximum number of guess iterations ");
126 initialize < std::vector<std::string> >
127 (
"exops", {
""},
"applies only if guess_excitation_operator is custom");
135 std::size_t
nexcitations()
const {
return get<std::size_t>(
"nexcitations"); }
137 long freeze()
const {
return get<long>(
"freeze"); }
139 std::string
irrep()
const {
return get<std::string>(
"irrep"); }
141 bool triplet()
const {
return get<bool>(
"triplet"); }
143 bool do_oep()
const {
return get<bool>(
"do_oep"); }
148 double thresh()
const {
return get<double>(
"thresh"); }
150 double econv()
const {
return get<double>(
"econv"); }
152 double dconv()
const {
return get<double>(
"dconv"); }
155 bool debug()
const {
return get<bool>(
"debug"); }
157 std::string
restart()
const {
return get<std::string>(
"restart"); }
162 std::vector<size_t>
excitations()
const {
return get<std::vector<size_t> >(
"excitations"); }
164 bool plot()
const {
return get<bool>(
"plot"); }
169 std::size_t
maxiter()
const {
return get<std::size_t>(
"maxiter"); }
171 std::size_t
kain_subspace()
const {
return get<std::size_t>(
"kain_subspace"); }
178 std::vector<std::string>
exops()
const {
return get<std::vector<std::string> >(
"exops"); }
190 double guess_cm()
const {
return get<double>(
"guess_cm"); }
196 std::size_t
guess_maxiter()
const {
return get<std::size_t>(
"guess_maxiter"); }
217 std::string
name()
const {
return "TDHF";};
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.");
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:");
261 auto n=std::dynamic_pointer_cast<Nemo>(
reference_);
263 return n->get_calc();
267 std::shared_ptr<Nemo> n;
268 n=std::dynamic_pointer_cast<Nemo>(
reference_);
276 auto n=std::dynamic_pointer_cast<Nemo>(
reference_);
293 std::vector<CC_vecfunction>
sort_xfunctions(std::vector<CC_vecfunction> x)
const;
296 void print_xfunctions(
const std::vector<CC_vecfunction>&
f,
const std::string message)
const;
301 void initialize(std::vector<CC_vecfunction> &start)
const;
303 void symmetrize(std::vector<CC_vecfunction> &
v)
const;
310 std::vector<CC_vecfunction>
solve_cis()
const;
313 void analyze(
const std::vector<CC_vecfunction> &x)
const;
320 std::vector<CC_vecfunction>
solve_cis(std::vector<CC_vecfunction> &start)
const;
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;
352 std::vector<vector_real_function_3d>
353 apply_G(std::vector<CC_vecfunction> &x, std::vector<vector_real_function_3d> &
V)
const;
388 std::vector<vector_real_function_3d>
make_potentials(
const std::vector<CC_vecfunction> &x)
const;
398 std::vector<vector_real_function_3d>
399 make_tdhf_potentials(std::vector<CC_vecfunction> &x,
const std::vector<CC_vecfunction> &y)
const;
405 void orthonormalize(std::vector<CC_vecfunction> &x, std::vector<vector_real_function_3d> &
V)
const;
411 const std::vector<vector_real_function_3d> &
V)
const;
415 std::vector<vector_real_function_3d>
417 std::vector<CC_vecfunction> tmp;
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());
426 std::vector<CC_vecfunction>
450 auto n=std::dynamic_pointer_cast<Nemo>(
reference_);
452 return n->get_calc()->aeps(i);
517 std::shared_ptr<CCConvolutionOperator<double,3>>
g12;
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
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