MADNESS 0.10.1
ground_parameters.h
Go to the documentation of this file.
1
2/// \file GroundStateCalculation
3/// \brief Input parameters for a response calculation, read from a specified
4/// archive.
5
6#ifndef MADNESS_APPS_GROUNDPARAMS_H_INCLUDED
7#define MADNESS_APPS_GROUNDPARAMS_H_INCLUDED
8
9#include <utility>
10
11#include "../chem/molecule.h"
12#include "Plot_VTK.h"
13#include "basic_operators.h"
14#include "madness/chem/NWChem.h"// For nwchem interface
18#include "madness/chem/projector.h"// For easy calculation of (1 - \hat{\rho}^0)
22
23using namespace madness;
24
26 // Ground state parameters that are read in from archive
27 std::string inFile{"../moldft.restartdata"};///< Name of input archive to read in ground state
28 bool spinrestricted{true};///< Indicates if ground state calc. was open or closed
29 ///< shell
30 unsigned int num_orbitals{};///< Number of orbitals in ground state
31 Tensor<double> energies{}; ///< Energy of ground state orbitals
32 Tensor<double> occ{}; ///< Occupancy of ground state orbitals
33 double L{}; ///< Box size of ground state - response calcluation is in same box
34 int k{}; ///< Order of polynomial used in ground state
35 Molecule molecule_in{}; ///< The molecule used in ground state calculation
36 std::vector<real_function_3d> g_orbitals{};///< The ground state orbitals
37 std::string xc{}; ///< Name of xc functional used in ground state
38 std::string localize_method{}; ///< Name of xc functional used in ground state
39
40 // Default constructor
41public:
42 explicit GroundStateCalculation(World &world) { read(world); }
43
44 explicit GroundStateCalculation(World &world, const std::string &input_file)
45 : inFile{input_file} {
46 read(world);
47 }
48
50
51
52 bool is_spinrestricted() const { return spinrestricted; }
53
54 unsigned int n_orbitals() const { return num_orbitals; }
55
57
58 Tensor<double> get_occ() const { return occ; }
59
60 Molecule molecule() const { return molecule_in; }
61
62 double get_L() const { return L; }
63
64 int get_k() const { return k; }
65
67
68 std::string get_xc() const { return xc; }
69 std::string get_localize_method() const { return localize_method; }
70
71 std::string get_archive() const { return xc; }
72
73 // Initializes ResponseParameters using the contents of file \c filename
74 void read(World &world) {
75 // Save the filename
76
77 unsigned int dummyversion;
78 double dummy1;
79 std::vector<int> dummy2;
80
81 archive::ParallelInputArchive input(world, inFile.c_str());
82 input &dummyversion;
83 input &dummy1; // double
84 input &spinrestricted; // bool
85 input &L; // double box size
86 input &k; // int wavelet order
87 input &molecule_in; // Molecule
88 input &xc; // std:string xc functional
89 input &localize_method;// std:string localize method
90 input &num_orbitals; // int
91 input &energies; // Tensor<double> orbital energies
92 input &occ; // Tensor<double> orbital occupations
93 input &dummy2; // std::vector<int> sets of orbitals(?)
94
95 // Check that order is positive and less than 30
96 if (k < 1 or k > 30) {
97 if (world.rank() == 0)
98 print("\n ***PLEASE NOTE***\n Invalid wavelet order read from "
99 "archive, setting to 8.\n This seems to happen when the default "
100 "wavelet order is used in moldft.");
101 k = 8;
102 }
103 // Set this so we can read in whats
104 // written in the archive
106 // Possible to call this function multiple times now
107 // Do this to ensure everything works.
108 world.gop.fence();
109 g_orbitals.clear();
110 world.gop.fence();
111 // Read in ground state orbitals
112 for (unsigned int i = 0; i < num_orbitals; i++) {
113 real_function_3d reader;
114 input &reader;
115 g_orbitals.push_back(reader);
116 }
117 world.gop.fence();
118 //projector_irrep c2v("c2v");
119 //g_orbitals = c2v(g_orbitals);
120 // Clean up
121 truncate(world, g_orbitals);
122 }
123
124 // Prints all information
125 void print_params() const {
126 madness::print("\n Ground State Parameters");
127 madness::print(" -----------------------");
128 madness::print(" Ground State Archive:", inFile);
129 madness::print(" Ground State Functional:", xc);
130 madness::print(" Localize Method Functional:", localize_method);
131 madness::print(" Spin Restricted:", spinrestricted);
132 madness::print(" Number of orbitals:", num_orbitals);
133 madness::print(" L:", L);
134 madness::print(" Wavelet Order:", k);
135 madness::print(" Orbital Energies:", energies);
136 }
137};
138
139#endif
Operators for the molecular HF and DFT code.
Definition ground_parameters.h:25
std::string inFile
Name of input archive to read in ground state.
Definition ground_parameters.h:27
bool spinrestricted
shell
Definition ground_parameters.h:28
std::string xc
Name of xc functional used in ground state.
Definition ground_parameters.h:37
std::string get_localize_method() const
Definition ground_parameters.h:69
GroundStateCalculation(World &world)
Definition ground_parameters.h:42
double L
Box size of ground state - response calcluation is in same box.
Definition ground_parameters.h:33
double get_L() const
Definition ground_parameters.h:62
std::vector< real_function_3d > g_orbitals
The ground state orbitals.
Definition ground_parameters.h:36
std::string get_xc() const
Definition ground_parameters.h:68
vector_real_function_3d & orbitals()
Definition ground_parameters.h:66
std::string localize_method
Name of xc functional used in ground state.
Definition ground_parameters.h:38
Molecule molecule_in
The molecule used in ground state calculation.
Definition ground_parameters.h:35
Tensor< double > occ
Occupancy of ground state orbitals.
Definition ground_parameters.h:32
GroundStateCalculation(World &world, const std::string &input_file)
Definition ground_parameters.h:44
unsigned int n_orbitals() const
Definition ground_parameters.h:54
void print_params() const
Definition ground_parameters.h:125
int k
Order of polynomial used in ground state.
Definition ground_parameters.h:34
bool is_spinrestricted() const
Definition ground_parameters.h:52
int get_k() const
Definition ground_parameters.h:64
Tensor< double > get_energies() const
Definition ground_parameters.h:56
void read(World &world)
Definition ground_parameters.h:74
unsigned int num_orbitals
Number of orbitals in ground state.
Definition ground_parameters.h:30
Molecule molecule() const
Definition ground_parameters.h:60
Tensor< double > get_occ() const
Definition ground_parameters.h:58
Tensor< double > energies
Energy of ground state orbitals.
Definition ground_parameters.h:31
GroundStateCalculation(const GroundStateCalculation &other)=default
std::string get_archive() const
Definition ground_parameters.h:71
static void set_k(int value)
Sets the default wavelet order.
Definition funcdefaults.h:273
Definition molecule.h:124
A tensor is a multidimension array.
Definition tensor.h:317
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
An archive for storing local or parallel data, wrapping a BinaryFstreamInputArchive.
Definition parallel_archive.h:366
Provides FunctionDefaults and utilities for coordinate transformation.
Provides typedefs to hide use of templates and to increase interoperability.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
void truncate(World &world, response_space &v, double tol, bool fence)
Definition basic_operators.cc:30
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
Defines and implements most of Tensor.