33#ifndef MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
34#define MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
234 int special_level_ = 18;
238 : atom(atom), special_level_(special_level) {}
278 template <
typename Int>
281 std::array<Int, 3> lattice_sum_range)
282 : atoms(atoms), cell(
std::move(
c)), bc(
std::move(
b)), range(
std::move(r)),
283 cell_width{cell(0, 1) - cell(0, 0), cell(1, 1) - cell(1, 0),
284 cell(2, 1) - cell(2, 0)},
285 rcell_width{1. / cell_width[0], 1. / cell_width[1],
286 1. / cell_width[2]}, lattice_sum_range{lattice_sum_range[0], lattice_sum_range[1], lattice_sum_range[2]} {
287 for (
int d = 0;
d != 3; ++
d)
310 double operator()(
const coord_3d &x)
const final;
312 std::vector<coord_3d> special_points() const
final;
315 std::array<std::int64_t, 3> result;
316 for (
int d = 0;
d != 3; ++
d) {
317 result[
d] = bc.is_periodic()[
d] ? (range[
d].iextent_x2() + 1) / 2 : 0;
326 const std::array<KernelRange, 3>
range;
364 double smoothing_param,
367 int special_level = 15);
369 double operator()(
const coord_3d& x)
const final;
394 : mol(
molecule), core_type_(core_type) {}
401 return this->core_type_;
425 int npsi =
psi.size();
426 if (npsi == 0)
return psi;
427 int natom = mol.
natom();
431 for (
int i=0; i<natom; ++i) {
435 if (nshell == 0)
continue;
436 for (
unsigned int c=0;
c<nshell; ++
c) {
438 int max_m = (l+1)*(l+2)/2;
440 for (
int m=0;
m<max_m; ++
m) {
443 overlap_sum += overlap;
444 for (
int j=0; j<npsi; ++j) {
446 proj[j] += core.
scale(overlap[j]);
452 if (world.
rank() == 0)
print(
"sum_k <core_k|psi_i>:", overlap_sum);
477 std::vector<double> bc;
482 for (
unsigned int c=0;
c<ncore; ++
c) {
484 int max_m = (l+1)*(l+2)/2;
485 for (
int m=0;
m<max_m; ++
m) {
496 for (
unsigned int c=0;
c<cores.size(); ++
c) {
500 for (
unsigned int i=0; i<mo.size(); ++i) {
501 rcore += rdcores[i] * rcores[i] * occ[i];
503 r += 2.0 * bc[
c] * rcore;
510 if (core_type_.substr(0,3) ==
"mcp") {
512 gaxpy(world, 1.0, Vpsi, 1.0, core_projection(world, amo));
525 if (core_type_ !=
"" && core_type_ !=
"none") {
Declaration of utility class and functions for atom.
unsigned int atomic_number
Atomic number.
Definition molecule.h:61
madness::Vector< double, 3 > get_coords() const
Definition molecule.h:99
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:137
double operator()(const coord_3d &r) const
Definition potentialmanager.h:145
CoreOrbitalDerivativeFunctor(Molecule &molecule, int atom, int axis, unsigned int core, int m)
Definition potentialmanager.h:143
const Molecule molecule
Definition potentialmanager.h:138
const int axis
Definition potentialmanager.h:139
const int atom
Definition potentialmanager.h:139
const unsigned int core
Definition potentialmanager.h:140
const int m
Definition potentialmanager.h:141
Functor for evaluating a core orbital of a specific atom in a molecule.
Definition potentialmanager.h:115
CoreOrbitalFunctor(Molecule &molecule, int atom, unsigned int core, int m)
Definition potentialmanager.h:121
double operator()(const coord_3d &r) const
Definition potentialmanager.h:123
const int m
Definition potentialmanager.h:119
const unsigned int core
Definition potentialmanager.h:118
const int atom
Definition potentialmanager.h:117
const Molecule molecule
Definition potentialmanager.h:116
Functor representing the Fermi nuclear density distribution for a given atom.
Definition potentialmanager.h:231
const Atom & atom
Definition potentialmanager.h:233
FermiNuclearDensityFunctor(const Atom &atom, int special_level=18)
Definition potentialmanager.h:237
madness::Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6)
Definition potentialmanager.h:242
std::vector< coord_3d > special_points() const final
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:244
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:100
static double thresh
Truncation threshold.
Definition funcdefaults.h:106
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
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:995
double thresh() const
Returns value of truncation threshold. No communication.
Definition mra.h:607
void set_thresh(double value, bool fence=true)
Sets the value of the truncation threshold. Optional global fence.
Definition mra.h:617
Function< T, NDIM > & truncate(double tol=0.0, bool fence=true)
Truncate the function with optional fence. Compresses with fence if not compressed.
Definition mra.h:642
const Function< T, NDIM > & reconstruct(bool fence=true) const
Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm.
Definition mra.h:817
Functor for evaluating the Coulomb potential of all nuclei of a molecule; nuclei are represented by p...
Definition potentialmanager.h:205
GaussianNuclearDensityFunctor(const madness::Molecule &molecule, int special_level=15)
Definition potentialmanager.h:211
madness::Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6)
Definition potentialmanager.h:216
const Molecule & molecule
Definition potentialmanager.h:207
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:218
Definition kernelrange.h:19
Functor for evaluating the molecular core potential at a given point in space.
Definition potentialmanager.h:92
double operator()(const coord_3d &r) const
Definition potentialmanager.h:99
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:103
MolecularCorePotentialFunctor(const Molecule &molecule)
Definition potentialmanager.h:96
const Molecule & molecule
Definition potentialmanager.h:94
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:73
const Molecule & molecule
Definition potentialmanager.h:71
double operator()(const coord_3d &r) const
Definition potentialmanager.h:76
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.h:80
Definition molecule.h:124
std::vector< madness::Vector< double, 3 > > get_all_coords_vec() const
Definition molecule.cc:408
double get_core_bc(unsigned int atn, unsigned int c) const
Definition molecule.h:373
const Atom & get_atom(unsigned int i) const
Definition molecule.cc:447
double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1094
double molecular_core_potential(double x, double y, double z) const
Definition molecule.cc:1107
double nuclear_attraction_potential(double x, double y, double z) const
nuclear attraction potential for the whole molecule
Definition molecule.cc:960
size_t natom() const
Definition molecule.h:389
double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1085
unsigned int get_core_l(unsigned int atn, unsigned int c) const
Definition molecule.h:369
unsigned int n_core_orb(unsigned int atn) const
Definition molecule.h:362
Default functor for evaluating nuclear density at a given point in space.
Definition potentialmanager.h:160
BoundaryConditions< 3 > bc_
Definition potentialmanager.h:163
Level special_level() const final
Override this to change the minimum level of refinement at special points (default is 6)
Definition potentialmanager.cc:100
Tensor< double > cell
Definition potentialmanager.h:164
const Molecule & atoms
Definition potentialmanager.h:162
NuclearDensityFunctor & set_rscale(double rscale)
Definition potentialmanager.cc:104
double rscale
Definition potentialmanager.h:168
double operator()(const coord_3d &x) const final
Definition potentialmanager.cc:72
std::vector< coord_3d > special_points_
Definition potentialmanager.h:165
int maxR
Definition potentialmanager.h:166
std::vector< coord_3d > special_points() const final
Override this to return list of special points to be refined more deeply.
Definition potentialmanager.cc:98
int special_level_
Definition potentialmanager.h:167
Manages molecular potentials and core projections for quantum chemistry calculations.
Definition potentialmanager.h:386
Molecule mol
Definition potentialmanager.h:388
void apply_nonlocal_potential(World &world, const vector_real_function_3d &amo, vector_real_function_3d Vpsi)
Definition potentialmanager.h:509
const Molecule & molecule() const
Definition potentialmanager.h:396
const real_function_3d & vnuclear()
Definition potentialmanager.h:404
PotentialManager(const Molecule &molecule, const std::string &core_type)
Definition potentialmanager.h:393
const std::string & core_type() const
Definition potentialmanager.h:400
real_function_3d vnuc
Definition potentialmanager.h:389
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:423
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:474
void make_nuclear_potential(World &world)
Definition potentialmanager.h:517
std::string core_type_
Definition potentialmanager.h:390
Functor for evaluating a smoothed atomic potential, supporting open and periodic boundary conditions.
Definition potentialmanager.h:342
const Atom & atom
Definition potentialmanager.h:344
Level special_level_
Definition potentialmanager.h:348
BoundaryConditions< 3 > bc_
Definition potentialmanager.h:346
Tensor< double > cell
Definition potentialmanager.h:347
double smoothing_param
Definition potentialmanager.h:345
A tensor is a multidimensional array.
Definition tensor.h:317
Functor for evaluating the Wigner-Seitz potential in a simulation cell.
Definition potentialmanager.h:262
const BoundaryConditions< 3 > bc
Definition potentialmanager.h:325
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:306
const std::array< double, 3 > rcell_width
Definition potentialmanager.h:328
const std::array< double, 3 > cell_width
Definition potentialmanager.h:327
const std::array< std::int64_t, 3 > lattice_sum_range
Definition potentialmanager.h:329
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:279
const std::array< KernelRange, 3 > range
Definition potentialmanager.h:326
const Tensor< double > cell
Definition potentialmanager.h:324
const Molecule & atoms
Definition potentialmanager.h:323
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
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:320
WorldGopInterface & gop
Global operations.
Definition world.h:207
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:275
double psi(const Vector< double, 3 > &r)
Definition hatom_energy.cc:78
double func(double x)
A simple program for testing the CubicInterpolationTable class.
Definition interp3.cc:43
Provides 1D cubic interpolation class.
#define final(a, b, c)
Definition lookup3.c:153
#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 DFParameters.h:10
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
int Level
Definition key.h:58
FunctionFactory< double, 3 > real_factory_3d
Definition functypedefs.h:108
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:245
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
static Molecule molecule
Definition testperiodicdft.cc:39
real_function_1d vnuc(World &world, double t)
Definition testspectralprop.cc:347