MADNESS  version 0.9
wavef.h
Go to the documentation of this file.
1 /*
2  this file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31  $Id$
32 */
33 #ifndef WAVEF_H
34 #define WAVEF_H
35 //\file wavef.h
36 //\brief The hydrogenic bound and continuum states
37 /************************************************************************
38  * Here is a madness representation of the hydrogenic wave functions.
39  * The bound states come from the Gnu Scientific Library. The unbound
40  * states are generated with the confluent hypergeometric function which
41  * uses gmp and mpfr for extended precision
42  *
43  * Using: Gnu Scientific Library http://www.gnu.org/software/gsl/
44  * GNU Multiple Precision library http://gmplib.org/
45  * mpfr http://www.mpfr.org/
46  * By: Nick Vence
47  ************************************************************************/
48 //#define WORLD_INSTANTIATE_STATIC_TEMPLATES
49 #include <madness/mra/mra.h>
50 #include <complex>
51 #include <iostream>
52 #include <stdio.h>
53 #include <complex>
54 #include <iomanip>
55 #include <time.h>
56 #include "hyp.h"
57 #include "interp.h"
58 
59 #define PRINT(str) if(world.rank()==0) std::cout << str
60 #define PRINTLINE(str) if(world.rank()==0) std::cout << str << std::endl
61 
62 const int nIOProcessors =1;
63 const std::string prefix = "data";
64 const int NDIM = 3;
65 
66 using namespace madness;
67 
68 typedef std::complex<double> complexd;
76 
77 const char* wave_function_filename(int step);
78 bool wave_function_exists(World& world, int step);
79 void wave_function_store(World& world, int step, const complex_functionT& psi);
81 
82 
83 
84 class baseWF : public madness::FunctionFunctorInterface<complexd,NDIM> {
85 public:
86  typedef std::complex<double> complexd;
88  virtual complexd operator()(const vector3D& x) const = 0;
89  static const complexd I;
90  static const double PI;
91 };
92 
93 /******************************************
94  * Scattering WaveFunction
95  ******************************************/
96 class ScatteringWF : public baseWF {
97 public:
98  ScatteringWF(madness::World& world, const double Z, double cutoff);
99  ScatteringWF(const double Z, double cutoff);
100  void Init(madness::World& world);
101  virtual complexd f11(const double r) const = 0;
102  virtual double getk() const = 0;
103  virtual complexd setAA() = 0;
104  virtual complexd setBB() = 0;
105  complexd aForm(complexd ZZ) const;
106  complexd gamma(double re, double im);
107  complexd gamma(complexd AA);
109  const double Z_;
110  const double cutoff_;
112  double dx;
113  double k_;
122  double domain;
123  int n;
124 protected:
125  struct MemberFuncPtr {
127  MemberFuncPtr(ScatteringWF* obj) : obj(obj) {}
128  complexd operator()(double x) {return obj->f11(x);}
129  };
130 };
131 
132 class PhiK : public ScatteringWF {
133 public:
134  PhiK(madness::World& world, const double Z, const vector3D& kVec, double cutoff);
135  PhiK(const double Z, const vector3D& kVec, double cutoff);
136  complexd operator()(const vector3D& x) const;
137  complexd f11(const double r) const ;
138  complexd setAA();
139  complexd setBB();
140  double getk() const;
141 private:
142  const vector3D kVec_;
143 };
144 
145 class Phikl : public ScatteringWF {
146 public:
147  Phikl(const double Z, const double k, const int l, double cutoff);
148  Phikl(madness::World& world, const double Z, const double k, const int l, double cutoff);
149  complexd operator()(const vector3D& x) const;
150  complexd f11(const double r) const ;
151  complexd setAA();
152  complexd setBB();
153  double getk() const ;
154 private:
155  const int l_;
156 };
157 
158 /******************************************
159  * Bound WaveFunction
160  ******************************************/
161 class BoundWF : public baseWF {
162 public:
163  BoundWF(double Z, int nn, int ll, int mm );
164  complexd operator()(const vector3D& x) const;
165 private:
166  double Z;
167  int n;
168  int l;
169  int m;
170 };
171 
172 /******************************************
173  *Exp[ I*(k.r) ]
174  ******************************************/
175 class Expikr : public baseWF
176 {
177 public:
178  Expikr(const vector3D& kVec);
179  complexd operator()(const vector3D& r) const;
180 private:
181  vector3D kVec;
182  double k;
183  double costhK;
184 };
185 
186 class Gaussian : public baseWF
187 {
188 public:
189  Gaussian(double a);
190  complexd operator()(const vector3D& r) const;
191 private:
192  double a;
193 };
194 
195 
196 class Yl0 : public madness::FunctionFunctorInterface<double,NDIM> {
197 public:
198  Yl0(const int l);
199  double operator()(const vector3D& r) const;
200  int l_;
201 };
202 #endif
complexd mAA
Definition: wavef.h:121
CubicInterpolationTable< complexd > fit1F1
Definition: wavef.h:108
Definition: shared_ptr_bits.h:38
Main include file for MADNESS and defines Function interface.
complexd rGammaAA
Definition: wavef.h:119
FunctionFactory< complexd, NDIM > complex_factoryT
Definition: wavef.h:72
const std::string prefix
Definition: wavef.h:63
void wave_function_store(World &world, int step, const complex_functionT &psi)
Definition: extra.cc:23
const double cutoff_
Definition: wavef.h:110
::std::string string
Definition: gtest-port.h:872
double k_
Definition: wavef.h:113
complexd gammaBB
Definition: wavef.h:116
FunctionFactory< double, 3 > factoryT
Definition: chem/corepotential.cc:60
Definition: wavef.h:196
double dx
Definition: wavef.h:112
complexd operator()(double x)
Definition: wavef.h:128
Definition: wavef.h:84
const int NDIM
Definition: wavef.h:64
Definition: wavef.h:186
complexd BB
Definition: wavef.h:115
bool wave_function_exists(World &world, int step)
Definition: extra.cc:20
static const double PI
Definition: wavef.h:90
Function< std::complex< double >, 3 > complex_functionT
Definition: chem/SCF.h:72
std::shared_ptr< FunctionFunctorInterface< double, 3 > > functorT
Definition: chem/corepotential.cc:58
Definition: wavef.h:132
std::complex< double > complexd
Definition: wavef.h:68
const int k
Definition: dielectric.cc:184
complexd expmIPIAArGammaBBmAA
Definition: wavef.h:117
const char * wave_function_filename(int step)
Definition: extra.cc:15
complexd AA
Definition: wavef.h:114
double psi(const Vector< double, 3 > &r)
Definition: apps/ii/hatom_energy.cc:42
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
const int nIOProcessors
Definition: wavef.h:62
Function< double, 3 > functionT
Definition: chem/corepotential.cc:59
double domain
Definition: wavef.h:122
Definition: wavef.h:145
int n
Definition: wavef.h:123
void Init(int &argc, char **&argv)
Analogous to MPI_Init.
Definition: safempi.h:730
madness::Vector< double, NDIM > vector3D
Definition: wavef.h:69
Definition: wavef.h:96
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
const mpreal gamma(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2429
madness::Vector< double, NDIM > vector3D
Definition: wavef.h:87
Definition: wavef.h:161
std::complex< double > complexd
Definition: wavef.h:86
A multiresolution adaptive numerical function.
Definition: derivative.h:61
const double Z_
Definition: wavef.h:109
ScatteringWF * obj
Definition: wavef.h:126
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:58
virtual complexd f11(const double r) const =0
const double m
Definition: gfit.cc:199
complexd expPIZ_2kXgamma1pIZ_k
Definition: wavef.h:118
static const complexd I
Definition: wavef.h:89
std::shared_ptr< WorldDCPmapInterface< Key< 3 > > > pmapT
Definition: chem/SCF.h:60
complexd AAmBB
Definition: wavef.h:120
complex_functionT wave_function_load(World &world, int step)
Definition: extra.cc:27
complexd one
Definition: wavef.h:111
Definition: wavef.h:175
FunctionFactory implements the named-parameter idiom for Function.
Definition: funcimpl.h:70
int l_
Definition: wavef.h:200
MemberFuncPtr(ScatteringWF *obj)
Definition: wavef.h:127
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
Definition: wavef.h:125