33#ifndef MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
34#define MADNESS_CHEM_POTENTIALMANAGER_H__INCLUDED
246 int special_level_ = 18;
252 : atom(atom), special_level_(special_level) {}
294 template <
typename Int>
297 std::array<Int, 3> lattice_sum_range)
298 : atoms(atoms), cell(
std::move(
c)), bc(
std::move(
b)), range(
std::move(r)),
299 cell_width{cell(0, 1) - cell(0, 0), cell(1, 1) - cell(1, 0),
300 cell(2, 1) - cell(2, 0)},
301 rcell_width{1. / cell_width[0], 1. / cell_width[1],
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;
382 double smoothing_param,
385 int special_level = 15);
387 double operator()(
const coord_3d& x)
const final;
412 : mol(
molecule), core_type_(core_type) {}
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) {
453 if (nshell == 0)
continue;
454 for (
unsigned int c=0;
c<nshell; ++
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) {
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;
500 for (
unsigned int c=0;
c<ncore; ++
c) {
502 int max_m = (l+1)*(l+2)/2;
503 for (
int m=0;
m<max_m; ++
m) {
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;
528 if (core_type_.substr(0,3) ==
"mcp") {
530 gaxpy(world, 1.0, Vpsi, 1.0, core_projection(world, amo));
543 if (core_type_ !=
"" && core_type_ !=
"none") {
Declaration of utility class and functions for atom.
unsigned int atomic_number
Atomic number.
Definition molecule.h:63
madness::Vector< double, 3 > get_coords() const
Definition molecule.h:106
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
Functor representing the Fermi nuclear density distribution for a given atom.
Definition potentialmanager.h:243
const Atom & atom
Definition potentialmanager.h:245
FermiNuclearDensityFunctor(const Atom &atom, int special_level=18)
Definition potentialmanager.h:251
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
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:101
FunctionFactory implements the named-parameter idiom for Function.
Definition function_factory.h:86
virtual FunctionFactory & thresh(double thresh)
Definition function_factory.h:198
FunctionFactory & functor(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > &f)
Definition function_factory.h:141
FunctionFactory & truncate_on_project()
Definition function_factory.h:264
FunctionFactory & initial_level(int initial_level)
Definition function_factory.h:204
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:1126
void set_thresh(double value, bool fence=true)
Sets the value of the truncation threshold. Optional global fence.
Definition mra.h:687
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:712
const Function< T, NDIM > & reconstruct(bool fence=true) const
Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm.
Definition mra.h:944
Functor for evaluating the Coulomb potential of all nuclei of a molecule; nuclei are represented by p...
Definition potentialmanager.h:215
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
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
std::vector< madness::Vector< double, 3 > > get_all_coords_vec() const
Definition molecule.cc:463
double get_core_bc(unsigned int atn, unsigned int c) const
Definition molecule.h:449
const Atom & get_atom(unsigned int i) const
Definition molecule.cc:502
double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1222
double molecular_core_potential(double x, double y, double z) const
Definition molecule.cc:1235
double nuclear_attraction_potential(double x, double y, double z) const
nuclear attraction potential for the whole molecule
Definition molecule.cc:1088
size_t natom() const
Definition molecule.h:463
double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1213
unsigned int get_core_l(unsigned int atn, unsigned int c) const
Definition molecule.h:447
unsigned int n_core_orb(unsigned int atn) const
Definition molecule.h:440
Default functor for evaluating nuclear density at a given point in space.
Definition potentialmanager.h:168
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:100
Tensor< double > cell
Definition potentialmanager.h:172
const Molecule & atoms
Definition potentialmanager.h:170
NuclearDensityFunctor & set_rscale(double rscale)
Definition potentialmanager.cc:104
double rscale
Definition potentialmanager.h:176
double operator()(const coord_3d &x) const final
Definition potentialmanager.cc:72
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:98
int special_level_
Definition potentialmanager.h:175
Manages molecular potentials and core projections for quantum chemistry calculations.
Definition potentialmanager.h:404
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
Functor for evaluating a smoothed atomic potential, supporting open and periodic boundary conditions.
Definition potentialmanager.h:358
const Atom & atom
Definition potentialmanager.h:360
Level special_level_
Definition potentialmanager.h:364
BoundaryConditions< 3 > bc_
Definition potentialmanager.h:362
Tensor< double > cell
Definition potentialmanager.h:363
double smoothing_param
Definition potentialmanager.h:361
A tensor is a multidimensional array.
Definition tensor.h:318
Functor for evaluating the Wigner-Seitz potential in a simulation cell.
Definition potentialmanager.h:276
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
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
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 DFConvergence.h:9
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:59
std::array< LatticeRange, NDIM > lattice_sum_range()
Definition bc.h:253
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
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:244
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