33#ifndef MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
34#define MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
79 return molecule.nuclear_attraction_potential(r[0], r[1], r[2]);
104 return molecule.molecular_core_potential(r[0], r[1], r[2]);
294 template <
typename Int>
303 for (
int d = 0;
d != 3; ++
d)
326 double operator()(
const coord_3d &x)
const final;
328 std::vector<coord_3d> special_points() const
final;
331 std::array<std::int64_t, 3> result;
332 for (
int d = 0;
d != 3; ++
d) {
333 result[
d] =
bc.is_periodic()[
d] ? (
range[
d].iextent_x2() + 1) / 2 : 0;
342 const std::array<KernelRange, 3>
range;
419 return this->core_type_;
443 int npsi =
psi.size();
444 if (npsi == 0)
return psi;
445 int natom =
mol.natom();
449 for (
int i=0; i<natom; ++i) {
452 unsigned int nshell =
mol.n_core_orb(atn);
453 if (nshell == 0)
continue;
454 for (
unsigned int c=0;
c<nshell; ++
c) {
455 unsigned int l =
mol.get_core_l(atn,
c);
456 int max_m = (l+1)*(l+2)/2;
458 for (
int m=0;
m<max_m; ++
m) {
461 overlap_sum += overlap;
462 for (
int j=0; j<npsi; ++j) {
463 if (include_Bc) overlap[j] *=
mol.get_core_bc(atn,
c);
464 proj[j] += core.
scale(overlap[j]);
470 if (world.
rank() == 0)
print(
"sum_k <core_k|psi_i>:", overlap_sum);
495 std::vector<double>
bc;
496 unsigned int atn =
mol.get_atom(atom).atomic_number;
497 unsigned int ncore =
mol.n_core_orb(atn);
500 for (
unsigned int c=0;
c<ncore; ++
c) {
501 unsigned int l =
mol.get_core_l(atn,
c);
502 int max_m = (l+1)*(l+2)/2;
503 for (
int m=0;
m<max_m; ++
m) {
508 bc.push_back(
mol.get_core_bc(atn,
c));
514 for (
unsigned int c=0;
c<cores.size(); ++
c) {
518 for (
unsigned int i=0; i<
mo.size(); ++i) {
519 rcore += rdcores[i] * rcores[i] * occ[i];
521 r += 2.0 *
bc[
c] * rcore;
Declaration of utility class and functions for atom.
unsigned int atomic_number
Atomic number.
Definition molecule.h:63
This class is used to specify boundary conditions for all operators.
Definition bc.h:72
Functor for evaluating the derivative of a core orbital for a given atom in a molecule.
Definition potentialmanager.h:143
double operator()(const coord_3d &r) const
Definition potentialmanager.h:153
CoreOrbitalDerivativeFunctor(Molecule &molecule, int atom, int axis, unsigned int core, int m)
Definition potentialmanager.h:151
const Molecule molecule
Definition potentialmanager.h:144
const int axis
Definition potentialmanager.h:145
const int atom
Definition potentialmanager.h:145
const unsigned int core
Definition potentialmanager.h:146
const int m
Definition potentialmanager.h:147
Functor for evaluating a core orbital of a specific atom in a molecule.
Definition potentialmanager.h:119
CoreOrbitalFunctor(Molecule &molecule, int atom, unsigned int core, int m)
Definition potentialmanager.h:127
double operator()(const coord_3d &r) const
Definition potentialmanager.h:129
const int m
Definition potentialmanager.h:123
const unsigned int core
Definition potentialmanager.h:122
const int atom
Definition potentialmanager.h:121
const Molecule molecule
Definition potentialmanager.h:120
const Atom & atom
Definition potentialmanager.h:245
FermiNuclearDensityFunctor(const Atom &atom, int special_level=18)
Definition potentialmanager.h:251
int special_level_
Definition potentialmanager.h:246
madness::Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6).
Definition potentialmanager.h:256
std::vector< coord_3d > special_points() const final
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:258
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:183
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition funcdefaults.h:315
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition funcdefaults.h:352
FunctionFunctorInterface()
Definition function_interface.h:77
Function< T, NDIM > & scale(const Q q, bool fence=true)
Inplace, scale the function by a constant. No communication except for optional fence.
Definition mra.h:1132
void set_thresh(double value, bool fence=true)
Sets the value of the truncation threshold. Optional global fence.
Definition mra.h:684
const Function< T, NDIM > & reconstruct(bool fence=true) const
Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm.
Definition mra.h:950
madness::Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6).
Definition potentialmanager.h:228
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:230
GaussianNuclearDensityPotentialFunctor(const madness::Molecule &molecule, int special_level=15)
Definition potentialmanager.h:223
const Molecule & molecule
Definition potentialmanager.h:217
int special_level_
Definition potentialmanager.h:218
Definition kernelrange.h:60
Functor for evaluating the molecular core potential at a given point in space.
Definition potentialmanager.h:94
double operator()(const coord_3d &r) const
Definition potentialmanager.h:103
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:107
MolecularCorePotentialFunctor(const Molecule &molecule)
Definition potentialmanager.h:100
const Molecule & molecule
Definition potentialmanager.h:96
Functor for evaluating the nuclear attraction potential of a molecule at a given point.
Definition potentialmanager.h:69
MolecularPotentialFunctor(const Molecule &molecule)
Definition potentialmanager.h:75
const Molecule & molecule
Definition potentialmanager.h:71
double operator()(const coord_3d &r) const
Definition potentialmanager.h:78
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:82
Definition molecule.h:129
BoundaryConditions< 3 > bc_
Definition potentialmanager.h:171
Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6).
Definition potentialmanager.cc:103
Tensor< double > cell
Definition potentialmanager.h:172
const Molecule & atoms
Definition potentialmanager.h:170
NuclearDensityFunctor & set_rscale(double rscale)
Definition potentialmanager.cc:107
double rscale
Definition potentialmanager.h:176
NuclearDensityFunctor(const Molecule &atoms, const BoundaryConditions< 3 > &bc=FunctionDefaults< 3 >::get_bc(), const Tensor< double > &cell=FunctionDefaults< 3 >::get_cell(), int special_level=15, double rscale=1.0)
Constructs a NuclearDensityFunctor for evaluating nuclear densities.
Definition potentialmanager.cc:53
double operator()(const coord_3d &x) const final
Definition potentialmanager.cc:73
std::vector< coord_3d > special_points_
Definition potentialmanager.h:173
int maxR
Definition potentialmanager.h:174
std::vector< coord_3d > special_points() const final
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.cc:101
int special_level_
Definition potentialmanager.h:175
Molecule mol
Definition potentialmanager.h:406
void apply_nonlocal_potential(World &world, const vector_real_function_3d &amo, vector_real_function_3d Vpsi)
Definition potentialmanager.h:527
const Molecule & molecule() const
Definition potentialmanager.h:414
const real_function_3d & vnuclear()
Definition potentialmanager.h:422
PotentialManager(const Molecule &molecule, const std::string &core_type)
Definition potentialmanager.h:411
const std::string & core_type() const
Definition potentialmanager.h:418
real_function_3d vnuc
Definition potentialmanager.h:407
vector_real_function_3d core_projection(World &world, const vector_real_function_3d &psi, const bool include_Bc=true)
Projects the input wavefunctions onto the atomic core orbitals.
Definition potentialmanager.h:441
double core_projector_derivative(World &world, const vector_real_function_3d &mo, const real_tensor &occ, int atom, int axis)
Computes the derivative of the core projector operator with respect to a given axis for a specified a...
Definition potentialmanager.h:492
void make_nuclear_potential(World &world)
Definition potentialmanager.h:535
std::string core_type_
Definition potentialmanager.h:408
const Atom & atom
Definition potentialmanager.h:360
Level special_level_
Definition potentialmanager.h:364
BoundaryConditions< 3 > bc_
Definition potentialmanager.h:362
std::vector< coord_3d > special_points() const final
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.cc:254
SAPFunctor(const Atom &atom, double smoothing_param, const BoundaryConditions< 3 > &bc=FunctionDefaults< 3 >::get_bc(), const Tensor< double > &cell=FunctionDefaults< 3 >::get_cell(), int special_level=15)
Constructs a SAPFunctor for evaluating a smoothed 1/r potential.
Definition potentialmanager.cc:212
Tensor< double > cell
Definition potentialmanager.h:363
Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6).
Definition potentialmanager.cc:251
double operator()(const coord_3d &x) const final
Definition potentialmanager.cc:225
double smoothing_param
Definition potentialmanager.h:361
A tensor is a multidimensional array.
Definition tensor.h:313
const BoundaryConditions< 3 > bc
Definition potentialmanager.h:341
WignerSeitzPotentialFunctor(const Molecule &atoms, Tensor< double > c, BoundaryConditions< 3 > b, std::array< KernelRange, 3 > r)
Constructs a WignerSeitzPotentialFunctor with default lattice sum range.
Definition potentialmanager.h:322
const std::array< double, 3 > rcell_width
Definition potentialmanager.h:344
const std::array< double, 3 > cell_width
Definition potentialmanager.h:343
const std::array< std::int64_t, 3 > lattice_sum_range
Definition potentialmanager.h:345
WignerSeitzPotentialFunctor(const Molecule &atoms, Tensor< double > c, BoundaryConditions< 3 > b, std::array< KernelRange, 3 > r, std::array< Int, 3 > lattice_sum_range)
Constructs a WignerSeitzPotentialFunctor evaluating the potential in a simulation cell due to point c...
Definition potentialmanager.h:295
const std::array< KernelRange, 3 > range
Definition potentialmanager.h:342
const Tensor< double > cell
Definition potentialmanager.h:340
const Molecule & atoms
Definition potentialmanager.h:339
static std::array< std::int64_t, 3 > make_default_lattice_sum_range(const BoundaryConditions< 3 > &bc, const std::array< KernelRange, 3 > &range)
Definition potentialmanager.h:330
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:177
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
Declaration of core potential related class.
static const double R
Definition csqrt.cc:46
std::complex< double > inner(const Fcwf &psi, const Fcwf &phi)
Definition fcwf.cc:311
double psi(const Vector< double, 3 > &r)
Definition hatom_energy.cc:78
Provides 1D cubic interpolation class.
#define final(a, b, c)
Definition lookup3.c:165
#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
void print(const tensorT &t)
Definition mcpfit.cc:140
Header to declare stuff which has not yet found a home.
Main include file for MADNESS and defines Function interface.
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
std::optional< BoundaryConditions< NDIM > > FunctionDefaults< NDIM >::bc
Definition mraimpl.h:3890
std::shared_ptr< FunctionFunctorInterface< double, 3 > > real_functor_3d
Definition functypedefs.h:122
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:94
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
int Level
Definition key.h:60
FunctionFactory< double, 3 > real_factory_3d
Definition functypedefs.h:108
Function< double, 3 > real_function_3d
Definition functypedefs.h:80
std::vector< Function< T, NDIM > > zero_functions_compressed(World &world, int n, bool fence=true)
Generates a vector of zero functions (compressed).
Definition vmra.h:450
Vector< double, 3 > coord_3d
Definition funcplot.h:1074
bool FunctionDefaults< NDIM >::truncate_on_project
Definition mraimpl.h:3887
Tensor< double > real_tensor
Definition functypedefs.h:55
void gaxpy(const double a, ScalarResult< T > &left, const double b, const T &right, const bool fence=true)
the result type of a macrotask must implement gaxpy
Definition macrotaskq.h:243
@ mo
moldft orbitals psi
Definition Restart.h:59
static const double b
Definition nonlinschro.cc:119
static const double d
Definition nonlinschro.cc:121
static const double c
Definition relops.cc:10
static const double m
Definition relops.cc:9
Defines and implements most of Tensor.
std::size_t axis
Definition testpdiff.cc:59