8#ifndef SRC_APPS_CHEM_ZCIS_H_
9#define SRC_APPS_CHEM_ZCIS_H_
32 initialize<std::string>(
"guess_excitation_operators",
"dipole+");
33 initialize<std::vector<std::string> >(
"exops",{
"x 1.0",
"y 1.0",
"z 1.0",
"x 2.0 , y 2.0 , z 2.0"});
34 initialize<int>(
"freeze",0);
35 initialize<int>(
"guess_excitations",4);
36 initialize<int>(
"guess_maxiter",4);
38 initialize<double>(
"omega",0.0);
39 initialize<int>(
"maxiter",10);
40 initialize<bool>(
"swap_ab",
false);
41 initialize<double>(
"dconv",1.e-3);
42 initialize<int>(
"printlevel",1);
47 std::vector<std::string>
exops()
const {
return get<std::vector<std::string> >(
"exops");};
48 int freeze()
const {
return get<int>(
"freeze");};
50 double thresh()
const {
return get<double>(
"thresh");};
51 double omega()
const {
return get<double>(
"omega");};
52 int maxiter()
const {
return get<int>(
"maxiter");};
54 bool swap_ab()
const {
return get<bool>(
"swap_ab");};
55 double dconv()
const {
return get<double>(
"dconv");};
68 std::vector<complex_function_3d>
apot;
69 std::vector<complex_function_3d>
bpot;
87 const std::vector<root>&
v,
94 int nocca=
v.front().afunction.size();
95 int noccb=
v.front().bfunction.size();
97 std::vector<root> result(
m);
99 for (
auto&& r : result) {
100 r.afunction= zero_functions_compressed<double_complex,3>(
world, nocca,
false);
101 r.bfunction= zero_functions_compressed<double_complex,3>(
world, noccb,
false);
102 r.apot= zero_functions_compressed<double_complex,3>(
world, nocca,
false);
103 r.bpot= zero_functions_compressed<double_complex,3>(
world, noccb,
false);
105 for (
auto&& vv :
v) {
113 for (
int i=0; i<
m; ++i) {
114 for (
int j=0; j<n; ++j) {
142 print(
"The zcis code computes excited states for a znemo calculation in the CIS approximation");
143 print(
"\nYou can print all available calculation parameters by running\n");
144 print(
"zcis --print_parameters\n");
145 print(
"You can perform a simple calculation by running\n");
146 print(
"zcis --geometry=h2o.xyz\n");
147 print(
"provided you have an xyz file in your directory.");
153 print(
"The zcis program requires converged znemo orbitals");
154 print(
"\ndefault parameters for the response part of the zcis program are");
155 param.print(
"response",
"end");
156 print(
"\n\nthe molecular geometry must be specified in a separate block:");
161 std::string
name()
const {
return "zcis";};
179 std::vector<complex_function_3d>& virtuals,
Tensor<double>& veps)
const;
193 std::vector<complex_function_3d>
active_mo(
const std::vector<complex_function_3d>& mo)
const {
194 if (mo.size()<=
size_t(
cis_param.
freeze()))
return std::vector<complex_function_3d> ();
195 std::vector<complex_function_3d> result;
215 if (dim1==0)
return std::make_tuple(
Tensor<T>(),rhs);
216 if (dim1==rhs.
size())
return std::make_tuple(rhs,
Tensor<T>());
220 return std::make_tuple(t1,t2);
230 if (
nemo->cparam.spin_restricted()) {
234 std::vector<complex_function_3d> rhs_file=zero_functions_compressed<double_complex,3>(
world,rhs.
size());
235 std::vector<complex_function_3d> rhs_file1;
237 for (
size_t i=0; i<rhs_file1.size(); ++i) rhs_file[i]=rhs_file1[i];
238 std::vector<double> dnorm=
norm2s(
world,rhs-rhs_file);
244 static std::tuple<std::vector<complex_function_3d>, std::vector<complex_function_3d> >
245 split(
const std::vector<complex_function_3d>& rhs,
int dim1) {
248 if (dim1==0)
return std::make_tuple(std::vector<complex_function_3d>(),rhs);
249 if (
size_t(dim1)==rhs.size())
return std::make_tuple(rhs,std::vector<complex_function_3d>());
251 std::vector<complex_function_3d> t1,t2;
252 copy(rhs.begin(),rhs.begin()+dim1,back_inserter(t1));
253 copy(rhs.begin()+dim1,rhs.end(),back_inserter(t2));
255 return std::make_tuple(t1,t2);
double w(double t, double eps)
Definition DKops.h:22
std::complex< double > double_complex
Definition cfft.h:14
long ndim() const
Returns the number of dimensions in the tensor.
Definition basetensor.h:144
long size() const
Returns the number of elements in the tensor.
Definition basetensor.h:138
int guess_maxiter() const
Definition zcis.h:53
int guess_excitations() const
Definition zcis.h:49
std::vector< std::string > exops() const
Definition zcis.h:47
std::string guess_excitation_operators() const
Definition zcis.h:46
double dconv() const
Definition zcis.h:55
bool swap_ab() const
Definition zcis.h:54
Complex_CIS_Parameters(World &world, const commandlineparser &parser)
ctor reading out the input file
Definition zcis.h:25
double omega() const
Definition zcis.h:51
int freeze() const
Definition zcis.h:48
int maxiter() const
Definition zcis.h:52
Complex_CIS_Parameters()
Definition zcis.h:29
double thresh() const
Definition zcis.h:50
int printlevel() const
Definition zcis.h:56
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:204
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
void print(const std::string header="", const std::string footer="") const
print all parameters
Definition QCCalculationParametersBase.cc:22
class implementing properties of QC models
Definition QCPropertyInterface.h:11
virtual real_function_3d density() const
Definition QCPropertyInterface.h:25
orthogonality projector
Definition projector.h:186
vecfuncT get_ket_vector() const
Definition projector.h:243
A slice defines a sub-range or patch of a dimension.
Definition slice.h:103
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 size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:328
WorldGopInterface & gop
Global operations.
Definition world.h:205
std::vector< root > make_guess() const
Definition madness/chem/zcis.cc:345
void compute_potentials(std::vector< root > &roots, const real_function_3d &totdens) const
Definition madness/chem/zcis.cc:152
virtual ~Zcis()
Definition zcis.h:136
virtual bool selftest()
Definition zcis.h:163
Tensor< double_complex > make_CIS_matrix(const Tensor< double > &veps, const Tensor< double > &oeps) const
Definition madness/chem/zcis.cc:511
static void print_parameters()
Definition zcis.h:151
QProjector< double_complex, 3 > Qa
orthogonality projector
Definition zcis.h:268
Tensor< double > noct(const Tensor< double > &eps) const
return the active orbitals only
Definition zcis.h:187
void canonicalize(const std::vector< complex_function_3d > &mo, const real_function_3d &density, std::vector< complex_function_3d > &virtuals, Tensor< double > &veps) const
Definition madness/chem/zcis.cc:491
static Tensor< T > concatenate(const Tensor< T > &t1, const Tensor< T > &t2)
little helper function
Definition zcis.h:202
std::vector< complex_function_3d > active_mo(const std::vector< complex_function_3d > &mo) const
return the active orbitals only
Definition zcis.h:193
double value()
Definition madness/chem/zcis.cc:14
static std::tuple< std::vector< complex_function_3d >, std::vector< complex_function_3d > > split(const std::vector< complex_function_3d > &rhs, int dim1)
Definition zcis.h:245
static std::tuple< Tensor< T >, Tensor< T > > split(const Tensor< T > &rhs, int dim1)
Definition zcis.h:212
Complex_CIS_Parameters cis_param
the parameters
Definition zcis.h:262
static void help()
Definition zcis.h:140
void normalize(std::vector< root > &roots) const
Definition madness/chem/zcis.cc:599
std::string name() const
Definition zcis.h:161
Tensor< double_complex > compute_fock_pt(const std::vector< root > &roots) const
Definition madness/chem/zcis.cc:219
void iterate(std::vector< root > &roots) const
iterate the roots
Definition madness/chem/zcis.cc:32
void orthonormalize(std::vector< root > &roots, const Tensor< double_complex > &fock_pt_a) const
Definition madness/chem/zcis.cc:541
std::vector< root > roots
the x vectors
Definition zcis.h:271
World & world
the world
Definition zcis.h:259
Zcis(World &w, const commandlineparser &parser, std::shared_ptr< Znemo > n)
Definition zcis.h:128
std::vector< complex_function_3d > compute_residuals(root &root) const
Definition madness/chem/zcis.cc:244
static std::vector< root > transform(World &world, const std::vector< root > &v, const Tensor< double_complex > &c, bool fence=true)
Definition zcis.h:86
std::vector< root > read_guess() const
Definition madness/chem/zcis.cc:303
void compare_to_file(const std::vector< complex_function_3d > &rhs, const std::string name) const
Definition zcis.h:229
QProjector< double_complex, 3 > Qb
Definition zcis.h:268
std::shared_ptr< Znemo > nemo
the reference
Definition zcis.h:265
void save_guess(const std::vector< root > &roots) const
Definition madness/chem/zcis.cc:326
static const double v
Definition hatom_sf_dirac.cc:20
#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
Main include file for MADNESS and defines Function interface.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
void save_function(const std::vector< Function< T, NDIM > > &f, const std::string name)
save a vector of functions
Definition vmra.h:2117
void print_header2(const std::string &s)
medium section heading
Definition print.cc:54
std::vector< double > norm2s(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norms of a vector of functions.
Definition vmra.h:827
void compress(World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
Compress a vector of functions.
Definition vmra.h:133
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
NDIM const Function< R, NDIM > & g
Definition mra.h:2416
void load_function(World &world, std::vector< Function< T, NDIM > > &f, const std::string name)
load a vector of functions
Definition vmra.h:2105
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 gaxpy(const double a, ScalarResult< T > &left, const double b, const T &right, const bool fence=true)
the result type of a macrotask must implement gaxpy
Definition macrotaskq.h:140
static const double c
Definition relops.cc:10
static const double m
Definition relops.cc:9
std::vector< complex_function_3d > afunction
Definition zcis.h:66
double omega
Definition zcis.h:70
friend double_complex inner(const root &f, const root &g)
inner product for the KAIN solver
Definition zcis.h:76
double delta
Definition zcis.h:71
std::vector< complex_function_3d > bpot
Definition zcis.h:69
std::vector< complex_function_3d > apot
Definition zcis.h:68
std::vector< complex_function_3d > bfunction
Definition zcis.h:67
double energy_change
Definition zcis.h:72
very simple command line parser
Definition commandlineparser.h:15
InputParameters param
Definition tdse.cc:203