27 #include </usr/include/math.h>
36 : xc(&xc), what(what), ispin(ispin){}
45 madness::Tensor<double> r = xc->
vxc(t, ispin, what);
52 : xc(&xc), what(what), ispin(ispin){}
61 madness::Tensor<double> r = xc->
fxc(t, ispin, what);
68 : xc(&xc), what(what), ispin(ispin){}
77 madness::Tensor<double> result;
81 result=xc->
fxc(t,ispin,0);
85 result=xc->
fxc(t,ispin,1);
89 result=xc->
fxc(t,ispin,2);
99 : xc(&xc), what(what), ispin(ispin){}
109 madness::Tensor<double> result;
111 std::vector< madness::Tensor<double> > rho;
113 madness::Tensor<double> fxc = xc->
fxc(rho, ispin, 0);
130 std::vector< madness::Tensor<double> > rho_and_sigma;
132 madness::Tensor<double> d2fdrho2;
133 madness::Tensor<double> d2fdrhodsigma;
134 madness::Tensor<double> d2fdsigma2;
135 rho_and_sigma.push_back(t[0]);
136 rho_and_sigma.push_back(t[1]);
141 d2fdrho2 = xc->
fxc(rho_and_sigma,ispin,0);
142 d2fdrhodsigma = xc->
fxc(rho_and_sigma,ispin,1);
146 d2fdrhodsigma.emul(t[2]);
147 result.gaxpy(1.0,d2fdrhodsigma,2.0);
154 d2fdrhodsigma = xc->
fxc(rho_and_sigma,ispin,1);
155 d2fdsigma2 = xc->
fxc(rho_and_sigma,ispin,2);
157 result = d2fdrhodsigma;
159 d2fdsigma2.emul(t[2]);
160 result.gaxpy(2.0,d2fdsigma2,4.0);
167 result = xc->
vxc(rho_and_sigma,ispin,1);
170 else MADNESS_EXCEPTION(
"What parameter of convolute_with_kernel was not from 0-2",1);
189 std::vector<madness::Tensor<double> > rho;
191 if(xc->
is_gga()) rho.push_back(t[1]);
192 madness::Tensor<double> fxc = xc->
fxc(rho, ispin, what);
207 std::cout <<
"Used Potential:\n";
208 std::cout <<
"lda: " << xcfunctional_.
is_lda();
209 std::cout <<
"gga: " << xcfunctional_.
is_gga();
210 std::cout <<
" spin polarized: " << xcfunctional_.
is_spin_polarized() << std::endl;
215 for(
size_t i=0;i<calc.
amo.size();i++){
216 rho +=calc.
amo[i]*calc.
amo[i];
221 if(xcfunctional_.
is_gga()){
223 std::vector< std::shared_ptr<real_derivative_3d> >
gradop;
224 gradop =gradient_operator<double,3>(
world);
226 for (
int axis = 0; axis < 3; ++axis){
227 delrho.push_back((*gradop[axis])(rho,
false));
231 sigma_= delrho[0] * delrho[0] + delrho[1] * delrho[1]+ delrho[2] * delrho[2];
234 vxc_=make_unperturbed_vxc(rho_);
238 double exc = 0.5*
inner(vxc_,rho_);
239 std::cout <<
"unperturbed exchange correlation energy : " << exc <<
" density norm: " << rho_.
norm2() <<
" vxc norm : " << vxc_.
norm2()<< std::endl;
260 return xcfunctional_.
is_gga();
WorldGopInterface & gop
Global operations.
Definition: worldfwd.h:462
const int what
Definition: TDA_XC.h:102
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition: TDA_XC.h:58
real_function_3d get_unperturbed_vxc() const
Definition: TDA_XC.h:254
Main include file for MADNESS and defines Function interface.
const int ispin
Definition: TDA_XC.h:56
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition: TDA_XC.h:105
const XCfunctional * xc
Definition: TDA_XC.h:38
const XCfunctional * xc
Definition: TDA_XC.h:54
bool is_lda() const
Returns true if the potential is lda.
Definition: chem/xcfunctional_ldaonly.cc:57
unperturbed_vxc(const XCfunctional &xc, int ispin, int what)
Definition: TDA_XC.h:35
Definition: chem/SCF.h:712
vecfuncT apply_kernel(const vecfuncT &x) const
Definition: TDA_XC.cc:157
XCfunctional xc
Definition: hedft.cc:54
const int what
Definition: TDA_XC.h:55
const int ispin
Definition: TDA_XC.h:72
make_fxc(const XCfunctional &xc, int ispin, int what)
Definition: TDA_XC.h:51
void plot_plane(World &world, const Function< double, NDIM > &function, const std::string name)
Definition: funcplot.h:531
const int what
Definition: TDA_XC.h:39
T inner(const vecfunc< T, NDIM > &a, const vecfunc< T, NDIM > &b)
the non-linear solver requires an inner product
Definition: nemo.h:112
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition: TDA_XC.h:74
vecfuncT amo
alpha and beta molecular orbitals
Definition: chem/SCF.h:729
const int what
Definition: TDA_XC.h:182
Implements most functionality of separated operators.
bool is_gga() const
Definition: TDA_XC.h:259
double norm2() const
Returns the 2-norm of the function ... global sum ... works in either basis.
Definition: mra.h:650
Defines operations on vectors of FunctionsThis file defines a number of operations on vectors of func...
const int ispin
Definition: TDA_XC.h:103
void reconstruct(bool fence=true) const
Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm...
Definition: mra.h:737
Example implementation of Krylov-subspace nonlinear equation solver.
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition: TDA_XC.h:185
vector< functionT > vecfuncT
Definition: chem/corepotential.cc:61
std::vector< std::shared_ptr< real_derivative_3d > > gradop
Definition: h2dft.cc:52
vecfuncT get_lda_intermediate(vecfuncT &mos) const
Definition: TDA_XC.h:257
World & world
The world.
Definition: TDA_XC.h:247
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
void fence()
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition: worldgop.cc:52
const XCfunctional * xc
Definition: TDA_XC.h:70
madness::Tensor< double > fxc(const std::vector< madness::Tensor< double > > &t, const int ispin, const int what) const
Definition: chem/xcfunctional_ldaonly.cc:150
XCfunctional get_xcfunctional() const
Definition: TDA_XC.h:255
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition: TDA_XC.h:42
madness::Tensor< double > vxc(const std::vector< madness::Tensor< double > > &t, const int ispin, const int what) const
Computes components of the potential (derivative of the energy functional) at np points.
Definition: chem/xcfunctional_ldaonly.cc:115
TDA_DFT(World &world, const SCF &calc)
Definition: TDA_XC.h:204
perturbed_vxc(const XCfunctional &xc, int ispin, int what)
Definition: TDA_XC.h:98
real_function_3d get_perturbed_potential(const real_function_3d &perturbed_density)
Definition: TDA_XC.h:251
const XCfunctional * xc
Definition: TDA_XC.h:181
get_derivatives(const XCfunctional &xc, int ispin, int what)
Definition: TDA_XC.h:67
const XCfunctional * xc
Definition: TDA_XC.h:101
Implements (2nd generation) static load/data balancing for functions.
const int what
Definition: TDA_XC.h:71
const int ispin
Definition: TDA_XC.h:183
FunctionFactory< double, 3 > real_factory_3d
Definition: functypedefs.h:93
const int ispin
Definition: TDA_XC.h:40
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
apply_kernel_functor(const XCfunctional &xc, int ispin, int what)
Definition: TDA_XC.h:180
bool is_gga() const
Returns true if the potential is gga (needs first derivatives)
Definition: chem/xcfunctional_ldaonly.cc:61
real_function_3d convolution_with_kernel(real_function_3d &perturbed_density) const
Definition: TDA_XC.cc:32
Simplified interface to XC functionals.
Definition: chem/xcfunctional.h:41
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
vecfuncT evaluate_derivatives() const
Definition: TDA_XC.cc:17
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
real_function_3d calculate_unperturbed_vxc(const real_function_3d &rho) const
Definition: TDA_XC.h:256
bool is_spin_polarized() const
Returns true if the functional is spin_polarized.
Definition: chem/xcfunctional.h:156