8#ifndef SRC_APPS_CHEM_AC_H_
9#define SRC_APPS_CHEM_AC_H_
24template<
unsigned long int NDIM>
43 for(
unsigned i = 0; i <
NDIM; i++){
44 distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
51 template <
typename Archive>
72template<
unsigned long int NDIM>
74 std::vector< atom_information<NDIM> >
atoms_;
85 template <
typename Archive>
107 std::stringstream sac_data(ac_data);
110 while (sac_data >> word) {
111 std::transform(word.begin(), word.end(), word.begin(), ::toupper);
114 }
else if(word ==
"EION") {
116 }
else if(word ==
"EHOMO"){
118 }
else if(word ==
"R1"){
120 }
else if(word ==
"R2"){
122 }
else if(word ==
"INTERPOL"){
125 std::cout <<
"Invalid entry in ac line\n";
142 std::cout <<
"\nAsymptotic correction parameters\n";
143 std::cout <<
"---------------------------------------\n";
144 std::cout <<
"Atom vector is not empty: " << !
atoms_.empty() <<
"\n";
145 std::cout <<
"Using multipole approximation: " <<
use_mult_ <<
"\n";
146 std::cout <<
"Number of electrons = " <<
num_elec_ <<
"\n";
147 std::cout <<
"Ionisation energy = " <<
e_ion_ <<
"\n";
148 std::cout <<
"E(HOMO) = " <<
eh_ <<
"\n";
149 std::cout <<
"R1 = " <<
R1_ <<
"\n";
150 std::cout <<
"R2 = " <<
R2_ <<
"\n";
161 else if(
R1_ == 0.0 or
R2_ == 0.0) std::cout <<
"\n\nWARNING: R1 or R2 is zero!\n\n";
163 else if(world.
rank()==0) std::cout <<
"AC object was initialized succesfully!\n\n";
169template<
unsigned long int NDIM>
192 bool inside_R1 =
false;
193 std::vector<atom_information<NDIM> > between;
204 if(x.R1 <
d and
d < x.R2) {
205 between.push_back(x);
214 else if(between.empty()){
228 if(
ac_param_.interpolation_scheme_==
"constant"){
233 for(
const auto& x:between){
250 for(
unsigned i = 0; i <
NDIM; i++){
251 distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
264template<
unsigned long int NDIM>
281 bool inside_R1 =
false;
282 std::vector<atom_information<NDIM> > between;
295 if(x.R1 <
d and
d < x.R2) {
296 between.push_back(x);
303 if(inside_R1){
return 0.0;}
306 else if(between.empty()){
return 1.0*
potential(r);}
319 for(
unsigned i = 0; i <
NDIM; i++){
320 distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
354template<
unsigned long int NDIM>
368 fcube(key,(*
f),qp,intpol);
377 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f;
379 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f2;
381 template <
typename Archive>
void serialize(Archive& ar) {}
386template<
unsigned long int NDIM>
407 fcube(key,(*
f),qp,intpol);
415 result = tmp1 - tmp2 + tmp3;
419 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f;
421 template <
typename Archive>
void serialize(Archive& ar) {}
430template<
unsigned long int NDIM>
448 const std::string ac_data=
"none";
450 initialized_=
ac_param_.initialize(calc->molecule, ac_data, 1.0-calc->xc.hf_exchange_coefficient(), calc->param.charge());
455 if(ac_data!=
"none")
ac_param_.check(world);
465 std::cout <<
"Apply AC Scheme with multipole approximation\n";
468 std::cout <<
"OR NOT -- EMPTY VECTOR ATOMS!!!\n";
485 xc_functional.template unaryop<UnaryOpStructure<NDIM> >(U_total);
498 std::cout <<
"Apply AC Scheme with hartree potential\n";
501 std::cout <<
"OR NOT -- EMPTY VECTOR ATOMS!!!\n";
This header should include pretty much everything needed for the parallel runtime.
ACParameters< NDIM > ac_param_
Parameter for the asymtotic correction.
Definition AC.h:435
Function< double, NDIM > apply(Function< double, NDIM > xc_functional) const
Definition AC.h:463
double shift() const
Definition AC.h:437
bool initialized_
Definition AC.h:436
bool initialized() const
Definition AC.h:440
AC(const ACParameters< NDIM > &ac_param)
Definition AC.h:443
Function< double, NDIM > apply(Function< double, NDIM > xc_functional, const Function< double, NDIM > v_hartree) const
Definition AC.h:494
AC(const AC &other)
Definition AC.h:458
AC(World &world, std::shared_ptr< SCF > calc)
Definition AC.h:447
const long * dims() const
Returns the array of tensor dimensions.
Definition basetensor.h:153
long ndim() const
Returns the number of dimensions in the tensor.
Definition basetensor.h:144
FunctionCommonData holds all Function data common for given k.
Definition function_common_data.h:52
Tensor< double > quad_x
quadrature points
Definition function_common_data.h:99
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:101
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
A multiresolution adaptive numerical function.
Definition mra.h:144
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:70
Definition molecule.h:129
A tensor is a multidimensional array.
Definition tensor.h:318
Tensor< T > & emul(const Tensor< T > &t)
Inplace multiply by corresponding elements of argument Tensor.
Definition tensor.h:1800
A simple, fixed dimension vector.
Definition vector.h:64
void broadcast_serializable(objT &obj, ProcessID root)
Broadcast a serializable object.
Definition worldgop.h:774
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
WorldGopInterface & gop
Global operations.
Definition world.h:216
Functor for the correction factor, which is multiplied with the exchange correlation potential.
Definition AC.h:170
int_factor_functor()
Definition AC.h:175
double operator()(const Vector< double, NDIM > &r) const
Definition AC.h:187
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition AC.h:226
int_factor_functor(const ACParameters< NDIM > &ac_param)
Definition AC.h:178
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition AC.h:248
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition AC.h:259
Functor for the 1/r potential to induce the correct asymptotic behaviour of the exchange correlation ...
Definition AC.h:265
double operator()(const Vector< double, NDIM > &r) const
Definition AC.h:278
lr_pot_functor()
Definition AC.h:270
lr_pot_functor(const ACParameters< NDIM > &ac_param)
Definition AC.h:273
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition AC.h:317
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition AC.h:349
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition AC.h:342
double potential(const Vector< double, NDIM > &r) const
Definition AC.h:330
Defines/implements plotting interface for functions.
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#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 DFConvergence.h:9
double slater_radius(int atomic_number)
Definition AC.cc:11
double distance(double a, double b)
Default function for computing the distance between two doubles.
Definition spectralprop.h:95
Tensor< T > fcube(const Key< NDIM > &, T(*f)(const Vector< double, NDIM > &), const Tensor< double > &)
Definition mraimpl.h:2217
std::vector< atom_information< 3 > > make_atom_vec(const Molecule &molecule, double R1_, double R2_)
Definition AC.cc:38
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:2233
static const double d
Definition nonlinschro.cc:121
Contains all the parameters for the asymptotic correction.
Definition AC.h:73
std::vector< atom_information< NDIM > > atoms_
Definition AC.h:74
double dft_coefficient_
upper boundary for interpolation area
Definition AC.h:80
int num_elec_
dft coefficient for hybrid functionals (=1.0 for non hybrid)
Definition AC.h:81
double R1_
energy of the homo without ac
Definition AC.h:78
double e_ion_
set true to use multipole approximation
Definition AC.h:76
double eh_
ionisation energy of corresponding ion without ac
Definition AC.h:77
ACParameters(const ACParameters &other)
Definition AC.h:135
ACParameters()
Definition AC.h:90
double R2_
lower boundary interpolation area
Definition AC.h:79
std::string interpolation_scheme_
number of electrons
Definition AC.h:82
void check(World &world)
Definition AC.h:156
void print(World &world)
Definition AC.h:140
void serialize(Archive &ar)
scheme for interpolation between xc-functional and 1/r-potential
Definition AC.h:86
bool use_mult_
Definition AC.h:75
bool initialize(Molecule molecule, std::string ac_data, double dft_coeff, double tot_charge)
Definition AC.h:101
computes the corrected exchange correlation potential using the hartree potential
Definition AC.h:387
void operator()(const Key< NDIM > &key, Tensor< double > &result, const Tensor< double > &vxc, const Tensor< double > &vhartree) const
Definition AC.h:400
FunctionCommonData< double, NDIM > cdata
Definition AC.h:420
BinaryOpStructure()
necessary to compile the program without getting a strange error i dont understand
Definition AC.h:389
void serialize(Archive &ar)
Definition AC.h:421
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition AC.h:419
BinaryOpStructure(const BinaryOpStructure< NDIM > &other)
Definition AC.h:395
BinaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_)
Definition AC.h:391
computes the corrected exchange correlation potential using the multipole approximation
Definition AC.h:355
FunctionCommonData< double, NDIM > cdata
Definition AC.h:380
void serialize(Archive &ar)
Definition AC.h:381
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2
shared pointer to object of lr_pot_functor
Definition AC.h:379
void operator()(const Key< NDIM > &key, Tensor< double > &t) const
Definition AC.h:364
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition AC.h:377
UnaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_, const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2_)
Definition AC.h:357
Class to compute the energy functional.
Definition xcfunctional.h:573
constexpr std::size_t NDIM
Definition testgconv.cc:54
static Molecule molecule
Definition testperiodicdft.cc:39