MADNESS 0.10.1
znemo.h
Go to the documentation of this file.
1/*
2 * Nemocomplex.h
3 *
4 * Created on: 14 Nov 2018
5 * Author: fbischoff
6 */
7
8#ifndef SRC_APPS_CHEM_ZNEMO_H_
9#define SRC_APPS_CHEM_ZNEMO_H_
10
18#include <madness/chem/nemo.h>
19#include <madness/misc/info.h>
20#include <madness/mra/mra.h>
23#include <madness/mra/vmra.h>
24
25namespace madness {
26
27class Diamagnetic_potential_factor;
28
29
30
32 bool print_nothing_=true;
33 bool print_setup_=false;
34 bool print_energies_=false;
35 bool print_timings_=false;
38
39 printleveler(int printlevel) {
40 print_debug_information_=(printlevel>=10);
41 print_convergence_=(printlevel>=4);
42 print_timings_=(printlevel>=3);
43 print_energies_=(printlevel>=2);
44 print_setup_=(printlevel>=1);
45 }
46
47 bool print_setup() const {return print_setup_;}
48 bool print_energies() const {return print_energies_;}
49 bool print_timings() const {return print_timings_;}
52
53};
54
55
57public:
58
59 /// ctor reading out the input file
61 initialize<double>("physical_B",0.0);
62 initialize<double>("explicit_B",0.0);
63 initialize<std::vector<double> >("box",{1.0, 0.01, 0.0, 0.0, 0.0});
64 initialize<double>("shift",0.0);
65 initialize<int>("printlevel",2); // 0: energies, 1: fock matrix, 2: function sizes
66 initialize<bool>("use_v_vector",false);
67 initialize<double>("potential_radius",-1.0);
68 initialize<std::vector<std::string> >("guess",std::vector<std::string>(),"list of l,m,exponent"); // atomic guess functions l, ml, exponent
69 initialize<std::vector<std::string> >("guess_functions",std::vector<std::string>(),"list function names"); // atomic guess functions l, ml, exponent
70 }
71
73 // read input file
74 read_input_and_commandline_options(world,parser,"complex");
75 }
76
78 double pb=physical_B();
79 double eb=explicit_B();
80 double remaining_B=fabs(pb-eb);
82
83 double wave_function_radius=2.0*sqrt(-log(thresh)/remaining_B);
84 double potential_radius=wave_function_radius*1.6;
85 double box_radius=wave_function_radius*1.33;
86
87 set_derived_value("box",std::vector<double>{box_radius,0.01});
88 set_derived_value("potential_radius",potential_radius);
90
91 }
92
93 int printlevel() const {return get<int>("printlevel");}
94 double shift() const {return get<double>("shift");}
95 double physical_B() const {return get<double>("physical_b");}
96 double explicit_B() const {return get<double>("explicit_b");}
97 std::vector<double> box() const {return get<std::vector<double> >("box");}
98 double potential_radius() const {return get<double>("potential_radius");}
99 bool use_v_vector() const {return get<bool>("use_v_vector");}
100 std::vector<std::string> guess() const {return get<std::vector<std::string>>("guess");}
101 std::vector<std::string> guess_functions() const {return get<std::vector<std::string>>("guess_functions");}
102
103};
104
105
106class Znemo : public NemoBase, public QCPropertyInterface {
107 friend class Zcis;
108
109 struct potentials {
110 potentials(World& world, const std::size_t nmo) {
111 vnuc_mo=zero_functions<double_complex,3>(world,nmo);
112 diamagnetic_mo=zero_functions<double_complex,3>(world,nmo);
113 lz_mo=zero_functions<double_complex,3>(world,nmo);
114 J_mo=zero_functions<double_complex,3>(world,nmo);
115 K_mo=zero_functions<double_complex,3>(world,nmo);
116 spin_zeeman_mo=zero_functions<double_complex,3>(world,nmo);
117 zeeman_R_comm=zero_functions<double_complex,3>(world,nmo);
118
119 }
120
131
132
133 std::vector<complex_function_3d> vnuc_mo;
134 std::vector<complex_function_3d> diamagnetic_mo;
135 std::vector<complex_function_3d> lz_mo;
136 std::vector<complex_function_3d> J_mo;
137 std::vector<complex_function_3d> K_mo;
138 std::vector<complex_function_3d> spin_zeeman_mo;
139 std::vector<complex_function_3d> lz_commutator;
140 std::vector<complex_function_3d> zeeman_R_comm;
141 };
142public:
143 struct timer {
145 double ttt,sss;
146 bool do_print=true;
147
149 world.gop.fence();
150 ttt=wall_time();
151 sss=cpu_time();
152 }
153
154 void tag(const std::string msg) {
155 world.gop.fence();
156 double tt1=wall_time()-ttt;
157 double ss1=cpu_time()-sss;
158 if (world.rank()==0 and do_print) printf("timer: %20.20s %8.2fs %8.2fs\n", msg.c_str(), ss1, tt1);
159 ttt=wall_time();
160 sss=cpu_time();
161 }
162
163 void end(const std::string msg) {
164 world.gop.fence();
165 double tt1=wall_time()-ttt;
166 double ss1=cpu_time()-sss;
167 if (world.rank()==0 and do_print) printf("timer: %20.20s %8.2fs %8.2fs\n", msg.c_str(), ss1, tt1);
168 }
169 };
170
171
172public:
173 Znemo(World& w, const commandlineparser& parser);
174
175 /// compute the molecular energy
176 double value() {return value(mol.get_all_coords());}
177
178 /// compute the molecular energy
179 double value(const Tensor<double>& x) override;
180
181 void output_calc_info_schema(const double& energy) const;
182
183 std::string name() const override {return "znemo";};
184
185 static void help() {
186 print_header2("help page for ZNEMO ");
187 print("The znemo code computes Hartree-Fock energies and gradients in the presence of a strong");
188 print("magnetic field");
189 print("");
190 print("You can print all available calculation parameters by running\n");
191 print("znemo --print_parameters\n");
192 print("You can perform a simple calculation by running\n");
193 print("znemo --geometry=h2o.xyz\n");
194 print("provided you have an xyz file in your directory.");
195
196 }
197
198 static void print_parameters() {
201 print("default calculations parameters for the znemo program are the same as for the nemo program");
202 print("default parameters for the magnetic field of the znemo program are");
203 zparam.print("complex","end");
204 print("\n\nthe molecular geometry must be specified in a separate block:");
206 }
207
208 bool selftest() override {
209 return true;
210 };
211
212 /// adapt the thresholds consistently to a common value
213 void recompute_factors_and_potentials(const double thresh);
214
215 bool need_recompute_factors_and_potentials(const double thresh) const override;
216 void invalidate_factors_and_potentials() override;
217
218 void iterate();
219
220 Tensor<double> gradient(const Tensor<double>& x) override;
224
225 bool test() const;
226
227 const CalculationParameters& get_cparam() const {return cparam;};
228 Molecule& molecule() override {return mol;};
229 const Molecule& molecule() const {return mol;};
230
231 /// test the identity <F| f (T + Vdia ) f |F> = <F|f^2 (T + Udia) |F>
232 bool test_U_potentials() const;
233
234 /// analyse the results only
235
236 /// @return the energy
237 double analyze();
238
239 /// compute the expectation value of the kinetic momentum p
241 Tensor<double> p_exp(3);
242 for (auto& mo : amo) p_exp+=imag(inner(world,mo,grad(mo)));
243 for (auto& mo : bmo) p_exp+=imag(inner(world,mo,grad(mo)));
244 return p_exp;
245 }
246
247 /// compute the expectation value of the linear moment r
249 std::vector<real_function_3d> r(3);
250 r[0]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[0];});
251 r[1]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[1];});
252 r[2]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[2];});
253
254 Tensor<double> r_exp(3);
255 for (auto& mo : amo) r_exp+=real(inner(world,mo,r*mo));
256 for (auto& mo : bmo) r_exp+=real(inner(world,mo,r*mo));
257 return r_exp;
258 }
259
260 /// compute the expectation value of the magnetic vector potential A
261 Tensor<double> compute_magnetic_potential_expectation(const std::vector<real_function_3d>& A) const {
262 Tensor<double> A_exp(3);
263 for (auto& mo : amo) A_exp+=real(inner(world,mo,A*mo));
264 for (auto& mo : bmo) A_exp+=real(inner(world,mo,A*mo));
265 return A_exp;
266 }
267
268 /// compute the shift of the molecule such that the kinetic momentum vanishes
270 Tensor<double> S(3);
271 const double B=param.physical_B();
272
273 S(0l)=-p_exp(1);
274 S(1) =p_exp(0l);
275 S(2) =p_exp(2);
276 S*=-2.0/(B*(amo.size()+bmo.size()));
277 return S;
278 }
279
280 /// compute the current density
281 std::vector<real_function_3d> compute_current_density(
282 const std::vector<complex_function_3d>& alpha_mo,
283 const std::vector<complex_function_3d>& beta_mo) const;
284
285 /// compute the magnetic vector potential A
286 static std::vector<real_function_3d> compute_magnetic_vector_potential(World& world,
287 const coord_3d& Bvec) {
288 std::vector<real_function_3d> r(3), A(3);
289 r[0]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[0];});
290 r[1]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[1];});
291 r[2]=real_factory_3d(world).functor([] (const coord_3d& r) {return r[2];});
292
293 A[0]=Bvec[1]*r[2]-Bvec[2]*r[1];
294 A[1]=Bvec[2]*r[0]-Bvec[0l]*r[2];
295 A[2]=Bvec[0l]*r[1]-Bvec[1]*r[0];
296
297 return 0.5*A;
298 }
299
300 /// are there explicit beta orbitals
301 bool have_beta() const {
302 return ((not cparam.spin_restricted()) and (cparam.nbeta()>0));
303 }
304
305 void save_orbitals(std::string suffix) const;
306
307 /// get initial orbitals from guesses
309
310 /// read the guess orbitals from a previous nemo or moldft calculation
311 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
312 read_real_guess() const;
313
314 /// read the guess orbitals from a previous nemo or moldft calculation
315 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
316 read_complex_guess() const;
317
318 /// read a list of functions for the guess
319 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
321
322 /// read guess as projection of the orbitals onto an AO basis set (for geometry optimization)
323 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
324 read_restartaodata() const;
325
326 /// read orbitals from a znemo calculation
327 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
328 read_reference() const;
329
330 /// hcore guess including the magnetic field
331 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
332 hcore_guess() const;
333
334 std::pair<MolecularOrbitals<double_complex,3>, MolecularOrbitals<double_complex,3> >
335 custom_guess() const;
336
337 void save_orbitals() const {
338 std::string name="reference";
339 print("saving orbitals to file",name);
340
342
343 ar & amo.size() & bmo.size() & aeps & beps;
344 for (auto& a: amo) ar & a;
345 for (auto& a: bmo) ar & a;
346
347 // save AO restart data
351
353 }
354
355 void do_step_restriction(const std::vector<complex_function_3d>& mo,
356 std::vector<complex_function_3d>& mo_new) const;
357
358 /// rotate the KAIN subspace (cf. SCF.cc)
359 template<typename solverT>
360 void rotate_subspace(const Tensor<double_complex>& U, solverT& solver) const {
361 double trantol=FunctionDefaults<3>::get_thresh()*0.1;
362 std::vector < std::vector<Function<double_complex, 3> > >&ulist = solver.get_ulist();
363 std::vector < std::vector<Function<double_complex, 3> > >&rlist = solver.get_rlist();
364 for (unsigned int iter = 0; iter < ulist.size(); ++iter) {
365 std::vector<Function<double_complex, 3> >& v = ulist[iter];
366 std::vector<Function<double_complex, 3> >& r = rlist[iter];
367 std::vector<Function<double_complex, 3> > vnew = transform(world, v, U, trantol, false);
368 std::vector<Function<double_complex, 3> > rnew = transform(world, r, U, trantol, true);
369
370 world.gop.fence();
371 for (size_t i=0; i<v.size(); i++) {
372 v[i] = vnew[i];
373 r[i] = rnew[i];
374 }
375 }
376 world.gop.fence();
377 }
378
379 double compute_energy(const std::vector<complex_function_3d>& amo, const potentials& apot,
380 const std::vector<complex_function_3d>& bmo, const potentials& bpot, const bool do_print, const bool no_confinement) const;
381
382 /// compute the potential operators applied on the orbitals
383 potentials compute_potentials(const std::vector<complex_function_3d>& mo,
385 const std::vector<complex_function_3d>& rhs) const;
386
388 const std::vector<complex_function_3d>& mo,
389 const potentials& pot) const;
390
391 std::vector<complex_function_3d> compute_residuals(
392 const std::vector<complex_function_3d>& Vpsi,
393 const std::vector<complex_function_3d>& psi,
394 Tensor<double>& eps,
395 const double levelshift=0.0) const;
396
397 void canonicalize(std::vector<complex_function_3d>& amo,
398 std::vector<complex_function_3d>& vnemo,
399 potentials& pot,
400 XNonlinearSolver<std::vector<complex_function_3d> ,double_complex, vector_function_allocator<double_complex,3> >& solver,
402
403 std::vector<complex_function_3d> orthonormalize(const std::vector<complex_function_3d>& mo) const;
404
405 std::vector<complex_function_3d> normalize(const std::vector<complex_function_3d>& mo) const;
406
407
408 real_function_3d compute_nemo_density(const std::vector<complex_function_3d>& amo,
409 const std::vector<complex_function_3d>& bmo) const {
413 return density;
414 }
415
416
417 real_function_3d compute_nemo_spin_density(const std::vector<complex_function_3d>& amo,
418 const std::vector<complex_function_3d>& bmo) const {
420
423 return density;
424 }
425
426
427 real_function_3d compute_density(const std::vector<complex_function_3d>& amo,
428 const std::vector<complex_function_3d>& bmo) const;
429
430
431 real_function_3d compute_spin_density(const std::vector<complex_function_3d>& amo,
432 const std::vector<complex_function_3d>& bmo) const;
433
434 std::vector<complex_function_3d> make_bra(const std::vector<complex_function_3d>& mo) const;
435
436
437protected:
438
443
444 /// standard calculation parameters
446
447 std::shared_ptr<Diamagnetic_potential_factor> diafac;
448
449 /// the magnetic field B=rot(A)
451
452 /// nuclear potential
453 std::shared_ptr<PotentialManager> potentialmanager;
454public:
455 /// the molecular orbitals -- alpha
456 std::vector<complex_function_3d> amo, bmo;
457protected:
458 /// the orbital energies
460
461 /// the spherical damping box
463
464 /// the linear moments r={x,y,z}
465 std::vector<real_function_3d> rvec;
466
467 std::shared_ptr<real_convolution_3d> coulop;
468
469
470 struct s_orbital : public FunctionFunctorInterface<double_complex,3> {
471
472 double exponent=1.0;
473 coord_3d origin={0.0,0.0,0.0};
474 s_orbital(const double& expo, const coord_3d& o) :
475 exponent(expo), origin(o) {
477 }
478
479 double_complex operator()(const coord_3d& xyz1) const {
480 coord_3d xyz=xyz1-origin;
481 double r=xyz.normf();
482 return exp(-exponent*r);
483 }
484
485 };
486
487 struct p_orbital : public FunctionFunctorInterface<double_complex,3> {
488
489 long m=0;
490 double exponent=1.0;
491 coord_3d origin={0.0,0.0,0.0};
492 p_orbital(const long& mm, const double& expo, const coord_3d& o)
493 : m(mm), exponent(expo), origin(o) {
494 MADNESS_ASSERT(m>-2 and m<2);
496 }
497
498 double_complex operator()(const coord_3d& xyz1) const {
499 coord_3d xyz=xyz1-origin;
500 double r=xyz.normf();
501
502 if (m==0) {
503 double theta=acos(xyz[2]/r);
504 //double phi=atan2(xyz[1],xyz[0]);
505 return r*exp(-exponent*r)*cos(theta);
506 } else {
507 double theta=acos(xyz[2]/r);
508 double phi=atan2(xyz[1],xyz[0]);
509 return r*exp(-exponent*r)*sin(theta)*exp(double(m)*double_complex(0.0,1.0)*phi);
510 }
511 }
512
513 };
514
515 /// following Doucot Pascier 2005
517
518 int m=0;
519 double l=0.0; ///< radius Eq. (29)
520 coord_3d origin={0.0,0.0,0.0};
521
522 landau_wave_function(const int m, const double B,
523 const coord_3d& origin={0.0,0.0,0.0})
524 : m(m), l(1.0/sqrt(B)), origin(origin) {
525 print("origin",origin);
526 MADNESS_ASSERT(m>=0);
527 MADNESS_ASSERT(B>0);
528 }
529
530 /// following Eq. (43)
531 double_complex operator()(const coord_3d& xyz1) const {
532 const coord_3d xyz=xyz1-origin;
533 const double_complex z(xyz[0],xyz[1]); // z = x + iy
534 const double_complex zbar(xyz[0],-xyz[1]);
535
536 double z_confinement=exp(-0.01*xyz[2]); // make wf decay in z-direction
537 return std::pow(zbar/l,double(m)) * exp(-0.25*zbar*z/(l*l)) * z_confinement;
538 }
539 };
540
541 public:
542 void test_compute_current_density() const;
543
544public:
546};
547
548
549
550
551} // namespace madness
552#endif /* SRC_APPS_CHEM_ZNEMO_H_ */
double w(double t, double eps)
Definition DKops.h:22
Operators for the molecular HF and DFT code.
std::complex< double > double_complex
Definition cfft.h:14
Definition test_ar.cc:118
Definition test_ar.cc:141
Contracted Gaussian basis.
Definition madness/chem/molecularbasis.h:465
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:279
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
Function< T, NDIM > & scale(const Q q, bool fence=true)
Inplace, scale the function by a constant. No communication except for optional fence.
Definition mra.h:953
Definition MolecularOrbitals.h:24
static void save_restartaodata(World &world, const Molecule &molecule, const MolecularOrbitals< T, NDIM > &amo, const MolecularOrbitals< T, NDIM > &bmo, const AtomicBasisSet &aobasis)
save MOs in the AO projection for geometry restart
Definition MolecularOrbitals.cc:83
MolecularOrbitals & update_mos_and_eps(const std::vector< Function< T, NDIM > > &mo_new, const Tensor< double > &eps_new)
updates will keep other member variables
Definition MolecularOrbitals.h:109
Definition molecule.h:124
madness::Tensor< double > get_all_coords() const
Definition molecule.cc:397
static void print_parameters()
Definition molecule.cc:110
Definition nemo.h:69
Function< typename Tensor< T >::scalar_type, NDIM > compute_density(const std::vector< Function< T, NDIM > > nemo) const
Definition nemo.h:139
World & world
Definition nemo.h:310
std::vector< std::string > guess() const
Definition znemo.h:100
Nemo_complex_Parameters()
ctor reading out the input file
Definition znemo.h:60
int printlevel() const
Definition znemo.h:93
std::vector< std::string > guess_functions() const
Definition znemo.h:101
std::vector< double > box() const
Definition znemo.h:97
double shift() const
Definition znemo.h:94
Nemo_complex_Parameters(World &world, const commandlineparser &parser)
Definition znemo.h:72
bool use_v_vector() const
Definition znemo.h:99
double physical_B() const
Definition znemo.h:95
double explicit_B() const
Definition znemo.h:96
double potential_radius() const
Definition znemo.h:98
void set_derived_values()
Definition znemo.h:77
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
void print(const std::string header="", const std::string footer="") const
print all parameters
Definition QCCalculationParametersBase.cc:22
void set_derived_value(const std::string &key, const T &value)
Definition QCCalculationParametersBase.h:403
class implementing properties of QC models
Definition QCPropertyInterface.h:11
virtual real_function_3d density() const
Definition QCPropertyInterface.h:25
A tensor is a multidimension array.
Definition tensor.h:317
T normf() const
Calculate the 2-norm of the vector elements.
Definition vector.h:400
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
A parallel world class.
Definition world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:318
WorldGopInterface & gop
Global operations.
Definition world.h:205
Generalized version of NonlinearSolver not limited to a single madness function.
Definition nonlinsol.h:202
Definition zcis.h:62
Definition znemo.h:106
AtomicBasisSet aobasis
Definition znemo.h:441
printleveler print_info
Definition znemo.h:442
Molecule & molecule() override
return the molecule of the target
Definition znemo.h:228
std::shared_ptr< Diamagnetic_potential_factor > diafac
Definition znemo.h:447
Tensor< double > aeps
the orbital energies
Definition znemo.h:459
std::vector< real_function_3d > rvec
the linear moments r={x,y,z}
Definition znemo.h:465
void do_step_restriction(const std::vector< complex_function_3d > &mo, std::vector< complex_function_3d > &mo_new) const
Definition madness/chem/znemo.cc:746
potentials compute_potentials(const std::vector< complex_function_3d > &mo, const real_function_3d &density, const std::vector< complex_function_3d > &rhs) const
compute the potential operators applied on the orbitals
Definition madness/chem/znemo.cc:1063
void rotate_subspace(const Tensor< double_complex > &U, solverT &solver) const
rotate the KAIN subspace (cf. SCF.cc)
Definition znemo.h:360
std::vector< complex_function_3d > compute_residuals(const std::vector< complex_function_3d > &Vpsi, const std::vector< complex_function_3d > &psi, Tensor< double > &eps, const double levelshift=0.0) const
Definition madness/chem/znemo.cc:1124
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > read_real_guess() const
read the guess orbitals from a previous nemo or moldft calculation
Definition madness/chem/znemo.cc:848
double compute_energy(const std::vector< complex_function_3d > &amo, const potentials &apot, const std::vector< complex_function_3d > &bmo, const potentials &bpot, const bool do_print, const bool no_confinement) const
Definition madness/chem/znemo.cc:534
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > read_reference() const
read orbitals from a znemo calculation
Definition madness/chem/znemo.cc:937
std::vector< complex_function_3d > amo
the molecular orbitals – alpha
Definition znemo.h:456
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > read_restartaodata() const
read guess as projection of the orbitals onto an AO basis set (for geometry optimization)
Definition madness/chem/znemo.cc:917
bool test_U_potentials() const
test the identity <F| f (T + Vdia ) f |F> = <F|f^2 (T + Udia) |F>
Definition madness/chem/znemo.cc:114
Tensor< double > beps
Definition znemo.h:459
const CalculationParameters & get_cparam() const
Definition znemo.h:227
Tensor< double > compute_standard_gauge_shift(const Tensor< double > &p_exp) const
compute the shift of the molecule such that the kinetic momentum vanishes
Definition znemo.h:269
void test_landau_wave_function()
Definition madness/chem/znemo.cc:718
bool need_recompute_factors_and_potentials(const double thresh) const override
Definition madness/chem/znemo.cc:55
void output_calc_info_schema(const double &energy) const
Definition madness/chem/znemo.cc:173
std::string name() const override
Definition znemo.h:183
real_function_3d sbox
the spherical damping box
Definition znemo.h:462
void iterate()
Definition madness/chem/znemo.cc:205
std::vector< complex_function_3d > make_bra(const std::vector< complex_function_3d > &mo) const
Definition madness/chem/znemo.cc:358
bool have_beta() const
are there explicit beta orbitals
Definition znemo.h:301
std::vector< complex_function_3d > bmo
Definition znemo.h:456
void test_compute_current_density() const
Definition madness/chem/znemo.cc:700
Tensor< double > compute_kinetic_momentum() const
compute the expectation value of the kinetic momentum p
Definition znemo.h:240
Tensor< double > compute_magnetic_potential_expectation(const std::vector< real_function_3d > &A) const
compute the expectation value of the magnetic vector potential A
Definition znemo.h:261
coord_3d B
the magnetic field B=rot(A)
Definition znemo.h:450
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > read_explicit_guess_functions() const
read a list of functions for the guess
Definition madness/chem/znemo.cc:891
std::vector< complex_function_3d > orthonormalize(const std::vector< complex_function_3d > &mo) const
Definition madness/chem/znemo.cc:335
double value()
compute the molecular energy
Definition znemo.h:176
real_function_3d compute_density(const std::vector< complex_function_3d > &amo, const std::vector< complex_function_3d > &bmo) const
Definition madness/chem/znemo.cc:348
void save_orbitals() const
Definition znemo.h:337
std::shared_ptr< PotentialManager > potentialmanager
nuclear potential
Definition znemo.h:453
real_function_3d compute_nemo_spin_density(const std::vector< complex_function_3d > &amo, const std::vector< complex_function_3d > &bmo) const
Definition znemo.h:417
void get_initial_orbitals()
get initial orbitals from guesses
Definition madness/chem/znemo.cc:770
void canonicalize(std::vector< complex_function_3d > &amo, std::vector< complex_function_3d > &vnemo, potentials &pot, XNonlinearSolver< std::vector< complex_function_3d >, double_complex, vector_function_allocator< double_complex, 3 > > &solver, Tensor< double_complex > fock, Tensor< double_complex > ovlp) const
Definition madness/chem/znemo.cc:1171
real_function_3d compute_nemo_density(const std::vector< complex_function_3d > &amo, const std::vector< complex_function_3d > &bmo) const
Definition znemo.h:408
std::shared_ptr< real_convolution_3d > coulop
Definition znemo.h:467
Tensor< double > gradient()
Definition znemo.h:221
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > read_complex_guess() const
read the guess orbitals from a previous nemo or moldft calculation
Definition madness/chem/znemo.cc:883
void recompute_factors_and_potentials(const double thresh)
adapt the thresholds consistently to a common value
Definition madness/chem/znemo.cc:69
Nemo::NemoCalculationParameters cparam
standard calculation parameters
Definition znemo.h:445
static std::vector< real_function_3d > compute_magnetic_vector_potential(World &world, const coord_3d &Bvec)
compute the magnetic vector potential A
Definition znemo.h:286
Tensor< double > compute_linear_moment() const
compute the expectation value of the linear moment r
Definition znemo.h:248
real_function_3d compute_spin_density(const std::vector< complex_function_3d > &amo, const std::vector< complex_function_3d > &bmo) const
Definition madness/chem/znemo.cc:353
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > custom_guess() const
Definition madness/chem/znemo.cc:962
static void print_parameters()
Definition znemo.h:198
Molecule mol
Definition znemo.h:439
Tensor< double_complex > compute_vmat(const std::vector< complex_function_3d > &mo, const potentials &pot) const
Definition madness/chem/znemo.cc:1104
void invalidate_factors_and_potentials() override
Definition madness/chem/znemo.cc:63
double analyze()
analyse the results only
Definition madness/chem/znemo.cc:363
std::pair< MolecularOrbitals< double_complex, 3 >, MolecularOrbitals< double_complex, 3 > > hcore_guess() const
hcore guess including the magnetic field
Definition madness/chem/znemo.cc:1001
bool selftest() override
Definition znemo.h:208
static void help()
Definition znemo.h:185
std::vector< complex_function_3d > normalize(const std::vector< complex_function_3d > &mo) const
Definition madness/chem/znemo.cc:341
bool test() const
Definition madness/chem/znemo.cc:101
Nemo_complex_Parameters param
Definition znemo.h:440
const Molecule & molecule() const
Definition znemo.h:229
std::vector< real_function_3d > compute_current_density(const std::vector< complex_function_3d > &alpha_mo, const std::vector< complex_function_3d > &beta_mo) const
compute the current density
Definition madness/chem/znemo.cc:629
An archive for storing local or parallel data wrapping a BinaryFstreamOutputArchive.
Definition parallel_archive.h:321
double(* energy)()
Definition derivatives.cc:58
double psi(const Vector< double, 3 > &r)
Definition hatom_energy.cc:78
static const double v
Definition hatom_sf_dirac.cc:20
Defines functions that give information on this version of MADNESS.
double ss1
Definition lapack.cc:62
double tt1
Definition lapack.cc:62
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
optimize the geometrical structure of a molecule
Main include file for MADNESS and defines Function interface.
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
static double cpu_time()
Returns the cpu time in seconds relative to an arbitrary origin.
Definition timers.h:127
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > transform(World &world, const std::vector< Function< T, NDIM > > &v, const Tensor< R > &c, bool fence=true)
Transforms a vector of functions according to new[i] = sum[j] old[j]*c[j,i].
Definition vmra.h:689
FunctionFactory< double, 3 > real_factory_3d
Definition functypedefs.h:93
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
double wall_time()
Returns the wall time in seconds relative to an arbitrary origin.
Definition timers.cc:48
Function< double, 3 > real_function_3d
Definition functypedefs.h:65
double inner(response_space &a, response_space &b)
Definition response_functions.h:442
double imag(double x)
Definition complexfun.h:56
std::vector< Function< T, NDIM > > grad(const Function< T, NDIM > &f, bool refine=false, bool fence=true)
shorthand gradient operator
Definition vmra.h:1875
double real(double x)
Definition complexfun.h:52
static const double a
Definition nonlinschro.cc:118
Implementation of Krylov-subspace nonlinear equation solver.
Implements most functionality of separated operators.
static const double thresh
Definition rk.cc:45
Definition CalculationParameters.h:51
int nbeta() const
Definition CalculationParameters.h:163
bool spin_restricted() const
Definition CalculationParameters.h:174
class holding parameters for a nemo calculation beyond the standard dft parameters from moldft
Definition nemo.h:333
following Doucot Pascier 2005
Definition znemo.h:516
coord_3d origin
Definition znemo.h:520
double l
radius Eq. (29)
Definition znemo.h:519
double_complex operator()(const coord_3d &xyz1) const
following Eq. (43)
Definition znemo.h:531
int m
Definition znemo.h:518
landau_wave_function(const int m, const double B, const coord_3d &origin={0.0, 0.0, 0.0})
Definition znemo.h:522
Definition znemo.h:487
double exponent
Definition znemo.h:490
p_orbital(const long &mm, const double &expo, const coord_3d &o)
Definition znemo.h:492
long m
Definition znemo.h:489
double_complex operator()(const coord_3d &xyz1) const
Definition znemo.h:498
coord_3d origin
Definition znemo.h:491
Definition znemo.h:109
potentials(World &world, const std::size_t nmo)
Definition znemo.h:110
std::vector< complex_function_3d > lz_mo
Definition znemo.h:135
std::vector< complex_function_3d > diamagnetic_mo
Definition znemo.h:134
std::vector< complex_function_3d > lz_commutator
Definition znemo.h:139
void transform(const Tensor< double_complex > &U)
Definition znemo.h:121
std::vector< complex_function_3d > zeeman_R_comm
Definition znemo.h:140
std::vector< complex_function_3d > spin_zeeman_mo
Definition znemo.h:138
std::vector< complex_function_3d > J_mo
Definition znemo.h:136
std::vector< complex_function_3d > vnuc_mo
Definition znemo.h:133
std::vector< complex_function_3d > K_mo
Definition znemo.h:137
Definition znemo.h:470
coord_3d origin
Definition znemo.h:473
s_orbital(const double &expo, const coord_3d &o)
Definition znemo.h:474
double exponent
Definition znemo.h:472
double_complex operator()(const coord_3d &xyz1) const
Definition znemo.h:479
Definition znemo.h:143
void tag(const std::string msg)
Definition znemo.h:154
bool do_print
Definition znemo.h:146
void end(const std::string msg)
Definition znemo.h:163
World & world
Definition znemo.h:144
double sss
Definition znemo.h:145
timer(World &world, bool do_print=true)
Definition znemo.h:148
double ttt
Definition znemo.h:145
very simple command line parser
Definition commandlineparser.h:15
Definition znemo.h:31
bool print_timings_
Definition znemo.h:35
bool print_convergence_
Definition znemo.h:36
bool print_setup() const
Definition znemo.h:47
bool print_energies_
Definition znemo.h:34
bool print_convergence() const
Definition znemo.h:50
bool print_energies() const
Definition znemo.h:48
bool print_debug() const
Definition znemo.h:51
bool print_nothing_
Definition znemo.h:32
printleveler(int printlevel)
Definition znemo.h:39
bool print_debug_information_
Definition znemo.h:37
bool print_timings() const
Definition znemo.h:49
bool print_setup_
Definition znemo.h:33
Definition nonlinsol.h:169
Defines operations on vectors of Functions.