43typedef std::shared_ptr< WorldDCPmapInterface< Key<3> > >
pmapT;
45typedef std::shared_ptr< FunctionFunctorInterface<std::complex<double>,3> >
functorT;
46typedef std::shared_ptr< FunctionFunctorInterface<double,3> >
rfunctorT;
53typedef Tensor< std::complex<double> >
ctensorT;
55typedef FunctionFactory<std::complex<double>,3>
factoryT;
60void print_cube(World& world,
const Function<double,3>&
f,
int npts)
63 if (world.rank() == 0) printf(
"\n");
64 Tensor<double> csize = FunctionDefaults<3>::get_cell_width();
66 for (
int i = 0; i < npts; i++)
68 for (
int j = 0; j < npts; j++)
70 for (
int k = 0;
k < npts;
k++)
72 double x = (i+0.5) * (csize[0]/npts) - csize[0]/2;
73 double y = (j+0.5) * (csize[1]/npts) - csize[1]/2;
74 double z = (
k+0.5) * (csize[2]/npts) - csize[2]/2;
76 p[0] = x;
p[1] = y;
p[2] = z;
77 if (world.rank() == 0)
78 printf(
"%10.2f%10.2f%10.2f%15.8f\n", x, y, z,
f(
p));
84void print_cube(World& world,
const Function<double,3>&
f1,
const Function<double,3>&
f2,
int npts)
88 if (world.rank() == 0) printf(
"\n");
89 Tensor<double> csize = FunctionDefaults<3>::get_cell_width();
91 for (
int i = 0; i < npts; i++)
93 for (
int j = 0; j < npts; j++)
95 for (
int k = 0;
k < npts;
k++)
97 double x = (i+0.5) * (csize[0]/npts) - csize[0]/2;
98 double y = (j+0.5) * (csize[1]/npts) - csize[1]/2;
99 double z = (
k+0.5) * (csize[2]/npts) - csize[2]/2;
101 p[0] = x;
p[1] = y;
p[2] = z;
102 if (world.rank() == 0)
103 printf(
"%10.2f%10.2f%10.2f%15.8f%15.8f\n", x, y, z,
f1(
p),
f2(
p));
109void print_cube(World& world,
const Function<double,3>&
f1,
const Function<double,3>&
f2,
110 const Function<double,3>&
f3,
int npts)
115 if (world.rank() == 0) printf(
"\n");
116 Tensor<double> csize = FunctionDefaults<3>::get_cell_width();
118 for (
int i = 0; i < npts; i++)
120 for (
int j = 0; j < npts; j++)
122 for (
int k = 0;
k < npts;
k++)
124 double x = (i+0.5) * (csize[0]/npts) - csize[0]/2;
125 double y = (j+0.5) * (csize[1]/npts) - csize[1]/2;
126 double z = (
k+0.5) * (csize[2]/npts) - csize[2]/2;
128 p[0] = x;
p[1] = y;
p[2] = z;
129 if (world.rank() == 0)
130 printf(
"%10.2f%10.2f%10.2f%15.8f%15.8f%15.8f\n", x, y, z,
f1(
p),
f2(
p),
f3(
p));
147 k[0] = 0.0;
k[1] = 0.0;
k[2] = 0.0;
168 return ((idx >=
begin) && (idx <
end)) ? true :
false;
171 template <
typename Archive>
180 for (
unsigned int i = 0; i < kpt.
k.size(); i++)
190 bool is_equal(
double val1,
double val2,
double eps)
192 double d = fabs(val1-val2);
193 return (fabs(
d) <= eps) ? true :
false;
216 template <
typename Q,
int NDIM>
218 const std::vector< Function<std::complex<Q>,
NDIM> >&
v,
222 reconstruct(world,
v);
225 const std::complex<double>
I = std::complex<double>(0.0, 1.0);
232 complex_derivative_3d Dx(world,0);
233 complex_derivative_3d Dy(world,1);
234 complex_derivative_3d Dz(world,2);
235 for (
int i = 0; i < n; i++)
237 for (
int j = 0; j <= i; j++)
245 functionT dv2_j = Dx(Dx(
v[j])) + Dy(Dy(
v[j])) + Dz(Dz(
v[j]));
246 functionT dv_j = std::complex<Q>(0.0, 2.0*
k0) * Dx(
v[j]) +
247 std::complex<Q>(0.0, 2.0*
k1) * Dy(
v[j]) +
248 std::complex<Q>(0.0, 2.0*
k2) * Dz(
v[j]);
249 functionT tmp = (ksquared*
v[j]) - dv_j - dv2_j;
257 std::vector< std::shared_ptr < Derivative< std::complex<Q>,
NDIM> > >
gradop =
258 gradient_operator<std::complex<Q>,
NDIM>(world);
271 template <
typename Q,
int NDIM>
273 const std::vector< Function<std::complex<Q>,
NDIM> >&
v,
277 const std::complex<double>
I = std::complex<double>(0.0, 1.0);
278 const std::complex<double> one = std::complex<double>(1.0, 0.0);
282 std::vector< std::shared_ptr < Derivative< std::complex<Q>,
NDIM> > >
gradop =
283 gradient_operator<std::complex<Q>,
NDIM>(world);
285 reconstruct(world,
v);
290 for (
int i=0; i<n; i++) dv[i].gaxpy(one,
v[i],
I*
k.k[
axis],
false);
301 template <
typename Q,
int NDIM>
303 const std::vector< Function<std::complex<Q>,
NDIM> >&
v)
305 const std::complex<double>
I = std::complex<double>(0.0, 1.0);
306 const std::complex<double> one = std::complex<double>(1.0, 0.0);
310 std::vector< std::shared_ptr < Derivative< std::complex<Q>,
NDIM> > >
gradop =
311 gradient_operator<std::complex<Q>,
NDIM>(world);
313 reconstruct(world,
v);
double(* f)(const coord_3d &)
Definition derivatives.cc:54
double(* f1)(const coord_3d &)
Definition derivatives.cc:55
double(* f3)(const coord_3d &)
Definition derivatives.cc:57
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
double(* f2)(const coord_3d &)
Definition derivatives.cc:56
std::shared_ptr< WorldDCPmapInterface< Key< 3 > > > pmapT
Definition esolver.h:43
Function< std::complex< double >, 3 > cfunctionT
Definition esolver.h:48
std::istream & operator>>(std::istream &is, KPoint &kpt)
Definition esolver.h:178
bool is_equal(double val1, double val2, double eps)
Definition esolver.h:190
FunctionFactory< std::complex< double >, 3 > factoryT
Definition esolver.h:55
void print_cube(World &world, const Function< double, 3 > &f, int npts)
Definition esolver.h:60
Tensor< std::complex< double > > ctensorT
Definition esolver.h:53
Vector< double, 3 > coordT
Definition esolver.h:44
std::shared_ptr< FunctionFunctorInterface< double, 3 > > rfunctorT
Definition esolver.h:46
Tensor< double > rtensorT
Definition esolver.h:54
std::vector< rfunctionT > rvecfuncT
Definition esolver.h:51
Function< std::complex< double >, 3 > functionT
Definition esolver.h:47
std::shared_ptr< FunctionFunctorInterface< std::complex< double >, 3 > > functorT
Definition esolver.h:45
SeparatedConvolution< double, 3 > operatorT
Definition esolver.h:57
std::shared_ptr< operatorT> poperatorT
Definition esolver.h:58
Function< double, 3 > rfunctionT
Definition esolver.h:49
ctensorT kinetic_energy_matrix_slow(World &world, const std::vector< Function< std::complex< Q >, NDIM > > &v, const bool periodic, const KPoint k=KPoint(coordT(0.0), 0.0))
Definition esolver.h:217
std::vector< cfunctionT > cvecfuncT
Definition esolver.h:52
std::vector< functionT > vecfuncT
Definition esolver.h:50
ctensorT kinetic_energy_matrix2(World &world, const std::vector< Function< std::complex< Q >, NDIM > > &v)
Definition esolver.h:302
ctensorT kinetic_energy_matrix(World &world, const std::vector< Function< std::complex< Q >, NDIM > > &v, const bool periodic, const KPoint k=KPoint(coordT(0.0), 0.0))
Definition esolver.h:272
FunctionFactory< double, 3 > rfactoryT
Definition esolver.h:56
Tensor< std::complex< double > > matrix_inner(World &world, std::vector< Fcwf > &a, std::vector< Fcwf > &b)
Definition fcwf.cc:431
Fcwf apply(World &world, real_convolution_3d &op, const Fcwf &psi)
Definition fcwf.cc:281
std::complex< double > inner(const Fcwf &psi, const Fcwf &phi)
Definition fcwf.cc:275
std::vector< std::shared_ptr< real_derivative_3d > > gradop
Definition h2dft.cc:51
static const double v
Definition hatom_sf_dirac.cc:20
vector< functionT > vecfuncT
Definition mcpfit.cc:51
Vector< double, 3 > coordT
Definition mcpfit.cc:48
static const double d
Definition nonlinschro.cc:121
static const double c
Definition relops.cc:10
static const long k
Definition rk.cc:44
void serialize(Archive &ar)
Definition esolver.h:172
unsigned int end
Definition esolver.h:143
coordT k
Definition esolver.h:138
unsigned int begin
Definition esolver.h:142
KPoint(const coordT &k, const double &weight, const int &begin, const int &end)
Definition esolver.h:153
KPoint()
Definition esolver.h:145
double weight
Definition esolver.h:139
KPoint(const coordT &k, const double &weight)
Definition esolver.h:157
KPoint(const double &k0, const double &k1, const double &k2, const double &weight)
Definition esolver.h:160
bool is_orb_in_kpoint(unsigned int idx)
Definition esolver.h:166
static const double_complex I
Definition tdse1d.cc:164
template Tensor< double_complex > conj(const Tensor< double_complex > &t)
static const std::size_t NDIM
Definition testpdiff.cc:42
std::size_t axis
Definition testpdiff.cc:59
double k0
Definition testperiodic.cc:66
double k2
Definition testperiodic.cc:68
double k1
Definition testperiodic.cc:67