53 typedef Tensor< std::complex<double> >
ctensorT;
55 typedef FunctionFactory<std::complex<double>,3>
factoryT;
60 void 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));
84 void 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));
109 void 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;
155 : k(k), weight(weight), begin(begin), end(end) {}
158 : k(k), weight(weight), begin(-1), end(-1) {}
160 KPoint(
const double& k0,
const double& k1,
const double& k2,
const double& weight)
161 : weight(weight), begin(-1), end(-1)
163 k[0] = k0; k[1] = k1; k[2] = k2;
168 return ((idx >= begin) && (idx < end)) ?
true :
false;
171 template <
typename Archive>
173 ar & k & weight & begin &
end;
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,
225 const std::complex<double>
I = std::complex<double>(0.0, 1.0);
229 double ksquared = k0*k0 + k1*k1 + k2*k2;
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;
250 c(i, j) =
inner(v[i], tmp);
257 std::vector< std::shared_ptr < Derivative< std::complex<Q>,
NDIM> > >
gradop =
258 gradient_operator<std::complex<Q>,
NDIM>(world);
259 for (
int axis = 0; axis < 3; axis++)
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);
284 for (
int axis = 0; axis < 3; axis++) {
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);
312 for (
int axis = 0; axis < 3; axis++) {
Vector< double, 3 > coordT
Definition: esolver.h:44
std::shared_ptr< WorldDCPmapInterface< Key< 3 > > > pmapT
Definition: esolver.h:43
Definition: shared_ptr_bits.h:38
void reconstruct(World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
Reconstruct a vector of functions.
Definition: vmra.h:149
const T1 const T2 const T3 & f3
Definition: gtest-tuple.h:686
void gaxpy(World &world, Q alpha, std::vector< Function< T, NDIM > > &a, Q beta, const std::vector< Function< R, NDIM > > &b, bool fence=true)
Generalized A*X+Y for vectors of functions -— a[i] = alpha*a[i] + beta*b[i].
Definition: vmra.h:680
std::vector< rfunctionT > rvecfuncT
Definition: esolver.h:51
void print_cube(World &world, const Function< double, 3 > &f, int npts)
Definition: esolver.h:60
unsigned int begin
Definition: esolver.h:142
Function< std::complex< double >, 3 > cfunctionT
Definition: esolver.h:48
const int NDIM
Definition: tdse1.cc:44
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
ctensorT kinetic_energy_matrix2(World &world, const std::vector< Function< std::complex< Q >, NDIM > > &v)
Definition: esolver.h:302
std::vector< functionT > vecfuncT
Definition: esolver.h:50
double weight
Definition: esolver.h:139
Function< double, 3 > rfunctionT
Definition: esolver.h:49
FunctionFactory< double, 3 > rfactoryT
Definition: esolver.h:56
NDIM & f
Definition: mra.h:2179
Function< double, 3 > functionT
Definition: DFcode/corepotential.cc:57
std::vector< cfunctionT > cvecfuncT
Definition: esolver.h:52
Definition: esolver.h:136
void serialize(Archive &ar)
Definition: esolver.h:172
T inner(const vecfunc< T, NDIM > &a, const vecfunc< T, NDIM > &b)
the non-linear solver requires an inner product
Definition: nemo.h:112
FunctionFactory< std::complex< double >, 3 > factoryT
Definition: esolver.h:55
KPoint()
Definition: esolver.h:145
const int k
Definition: dielectric.cc:184
Vector< double, 3 > coordT
Definition: DFcode/corepotential.cc:55
std::vector< std::shared_ptr< real_derivative_3d > > gradop
Definition: h2dft.cc:52
coordT k
Definition: esolver.h:138
unsigned int end
Definition: esolver.h:143
std::istream & operator>>(std::istream &is, KPoint &kpt)
Definition: esolver.h:178
std::shared_ptr< FunctionFunctorInterface< double, 3 > > rfunctorT
Definition: esolver.h:46
KPoint(const coordT &k, const double &weight)
Definition: esolver.h:157
Tensor< std::complex< double > > ctensorT
Definition: esolver.h:53
std::shared_ptr< operatorT > poperatorT
Definition: esolver.h:58
Function< std::complex< double >, 3 > functionT
Definition: esolver.h:47
Tensor< double > rtensorT
Definition: esolver.h:54
KPoint(const double &k0, const double &k1, const double &k2, const double &weight)
Definition: esolver.h:160
const T1 & f1
Definition: gtest-tuple.h:680
Derivative< double_complex, 3 > complex_derivative_3d
Definition: functypedefs.h:177
const T1 const T2 & f2
Definition: gtest-tuple.h:680
bool is_equal(double val1, double val2, double eps)
Definition: esolver.h:190
const mpreal fabs(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2187
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
KPoint(const coordT &k, const double &weight, const int &begin, const int &end)
Definition: esolver.h:153
Function< T, NDIM > apply(const Derivative< T, NDIM > &D, const Function< T, NDIM > &f, bool fence=true)
Applies derivative operator to function (for syntactic equivalence to integral operator apply) ...
Definition: derivative.h:613
const double c
Definition: gfit.cc:200
SeparatedConvolution< double, 3 > operatorT
Definition: esolver.h:57
bool is_orb_in_kpoint(unsigned int idx)
Definition: esolver.h:166
void matrix_inner(DistributedMatrix< T > &A, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< T, NDIM > > &g, bool sym=false)
Definition: DFcode/distpm.cc:38
std::shared_ptr< FunctionFunctorInterface< std::complex< double >, 3 > > functorT
Definition: esolver.h:45
Function< T, NDIM > conj(const Function< T, NDIM > &f, bool fence=true)
Return the complex conjugate of the input function with the same distribution and optional fence...
Definition: mra.h:1879
void compress(World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
Compress a vector of functions.
Definition: vmra.h:130
std::vector< Function< double, 3 > > vecfuncT
Definition: tdhf_CIS.h:75