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>
190 bool inside_R1 =
false;
191 std::vector<atom_information<NDIM> > between;
202 if(x.R1 <
d and
d < x.R2) {
203 between.push_back(x);
212 else if(between.empty()){
226 if(
ac_param_.interpolation_scheme_==
"constant"){
231 for(
const auto& x:between){
248 for(
unsigned i = 0; i <
NDIM; i++){
249 distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
262template<
unsigned long int NDIM>
277 bool inside_R1 =
false;
278 std::vector<atom_information<NDIM> > between;
291 if(x.R1 <
d and
d < x.R2) {
292 between.push_back(x);
299 if(inside_R1){
return 0.0;}
302 else if(between.empty()){
return 1.0*
potential(r);}
315 for(
unsigned i = 0; i <
NDIM; i++){
316 distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
350template<
unsigned long int NDIM>
364 fcube(key,(*
f),qp,intpol);
373 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f;
375 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f2;
377 template <
typename Archive>
void serialize(Archive& ar) {}
382template<
unsigned long int NDIM>
403 fcube(key,(*
f),qp,intpol);
411 result = tmp1 - tmp2 + tmp3;
415 std::shared_ptr<FunctionFunctorInterface<double,NDIM> >
f;
417 template <
typename Archive>
void serialize(Archive& ar) {}
426template<
unsigned long int NDIM>
443 initialized_=
ac_param_.initialize(calc->molecule, calc->param.ac_data(), 1.0-calc->xc.hf_exchange_coefficient(), calc->param.charge());
448 if(calc->param.ac_data()!=
"none")
ac_param_.check(world);
458 std::cout <<
"Apply AC Scheme with multipole approximation\n";
461 std::cout <<
"OR NOT -- EMPTY VECTOR ATOMS!!!\n";
478 xc_functional.template unaryop<UnaryOpStructure<NDIM> >(U_total);
491 std::cout <<
"Apply AC Scheme with hartree potential\n";
494 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:431
Function< double, NDIM > apply(Function< double, NDIM > xc_functional) const
Definition AC.h:456
double shift() const
Definition AC.h:433
bool initialized_
Definition AC.h:432
bool initialized() const
Definition AC.h:436
AC(const ACParameters< NDIM > &ac_param)
Definition AC.h:439
Function< double, NDIM > apply(Function< double, NDIM > xc_functional, const Function< double, NDIM > v_hartree) const
Definition AC.h:487
AC(const AC &other)
Definition AC.h:451
AC(World &world, std::shared_ptr< SCF > calc)
Definition AC.h:441
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:204
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:122
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:66
Definition molecule.h:124
A tensor is a multidimension array.
Definition tensor.h:317
Tensor< T > & emul(const Tensor< T > &t)
Inplace multiply by corresponding elements of argument Tensor.
Definition tensor.h:1798
A simple, fixed dimension vector.
Definition vector.h:64
void broadcast_serializable(objT &obj, ProcessID root)
Broadcast a serializable object.
Definition worldgop.h:754
A parallel world class.
Definition world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:318
WorldGopInterface & gop
Global operations.
Definition world.h:205
Functor for the correction factor, which is multiplied with the exchange correlation potential.
Definition AC.h:170
int_factor_functor()
Definition AC.h:173
double operator()(const Vector< double, NDIM > &r) const
Definition AC.h:185
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition AC.h:224
int_factor_functor(const ACParameters< NDIM > &ac_param)
Definition AC.h:176
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition AC.h:246
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition AC.h:257
Functor for the 1/r potential to induce the correct asymptotic behaviour of the exchange correlation ...
Definition AC.h:263
double operator()(const Vector< double, NDIM > &r) const
Definition AC.h:274
lr_pot_functor()
Definition AC.h:266
lr_pot_functor(const ACParameters< NDIM > &ac_param)
Definition AC.h:269
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition AC.h:313
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition AC.h:345
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition AC.h:338
double potential(const Vector< double, NDIM > &r) const
Definition AC.h:326
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 DFParameters.h:10
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:2163
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:2002
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:383
void operator()(const Key< NDIM > &key, Tensor< double > &result, const Tensor< double > &vxc, const Tensor< double > &vhartree) const
Definition AC.h:396
FunctionCommonData< double, NDIM > cdata
Definition AC.h:416
BinaryOpStructure()
necessary to compile the program without getting a strange error i dont understand
Definition AC.h:385
void serialize(Archive &ar)
Definition AC.h:417
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition AC.h:415
BinaryOpStructure(const BinaryOpStructure< NDIM > &other)
Definition AC.h:391
BinaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_)
Definition AC.h:387
computes the corrected exchange correlation potential using the multipole approximation
Definition AC.h:351
FunctionCommonData< double, NDIM > cdata
Definition AC.h:376
void serialize(Archive &ar)
Definition AC.h:377
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2
shared pointer to object of lr_pot_functor
Definition AC.h:375
void operator()(const Key< NDIM > &key, Tensor< double > &t) const
Definition AC.h:360
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition AC.h:373
UnaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_, const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2_)
Definition AC.h:353
Class to compute the energy functional.
Definition xcfunctional.h:360
static const std::size_t NDIM
Definition testpdiff.cc:42
static Molecule molecule
Definition testperiodicdft.cc:38