39 #ifndef MADNESS_INTERIOR_BC_DENSITY_H__INCLUDED
40 #define MADNESS_INTERIOR_BC_DENSITY_H__INCLUDED
59 : leaf_value(leaf_value), parent_value(parent_value) {}
64 if(key.
level() <= 1) {
65 return 100.0*(leaf_value+parent_value);
79 TipMolecule() : dmi(1.0), denscoeffs(Tensor<double>()),
80 basis(std::vector<BasisFunc>(0)) {}
88 const std::vector<BasisFunc> &
basis;
104 const Tensor<double> &denscoeffs,
const std::vector<Atom*> &atoms,
105 const std::vector<BasisFunc> &basis,
double phi,
double d)
106 : dmi(eps), tip(NULL), solid(NULL), penalty_prefact(penalty),
107 eps(eps), denscoeffs(denscoeffs), basis(basis),
108 atom_centers(0), phi(0.5*phi), d(d), proton_stdev(0.0003/0.052918),
119 dda_init_level =
ceil(
log(5669.15 / eps) /
log(2.0) - 4);
120 if(dda_init_level < 6)
124 edens_init_level =
ceil(
log(5669.15 /
sqrt(0.5 / 18.731137))
126 if(edens_init_level < 6)
127 edens_init_level = 6;
130 pdens_init_level =
ceil(
log(5669.15 / proton_stdev)
132 if(pdens_init_level < 6)
133 pdens_init_level = 6;
136 for(std::vector<Atom*>::const_iterator iter = atoms.begin();
137 iter != atoms.end(); ++iter) {
139 atom_centers.push_back((*iter)->getCenter());
146 normal[0] = normal[1] = 0.0;
148 point[0] = point[1] = point[2] = 0.0;
149 solid =
new SDFPlane(normal, point);
156 proton_inverse = 0.5 / (proton_stdev * proton_stdev);
171 * Inhomogeneity(x) - DirichletCond(x) *
187 return ElectronDensity(x);
190 error(
"shouldn't be here...");
217 atom_centers.
begin();
218 iter != atom_centers.end();
221 r2 = (x[0] - (*iter)[0])*(x[0] - (*iter)[0])
222 + (x[1] - (*iter)[1])*(x[1] - (*iter)[1])
223 + (x[2] - (*iter)[2])*(x[2] - (*iter)[2]);
225 r2 *= proton_inverse;
231 dens += ElectronDensity(x);
240 if(x[0]*x[0] + x[1]*x[1] +
241 (x[2]-5.0/0.052918)*(x[2]-5.0/0.052918) > 100.0)
248 long nstate = denscoeffs.dim(0);
249 long nbasis = denscoeffs.dim(1);
250 for(
long state = 0; state < nstate; ++state) {
255 perstate += denscoeffs(state,
func) *
256 basis[
func]->operator()(x);
259 ret += perstate * perstate;
272 return std::vector<Vector<double, 3> >();
280 return dda_init_level;
283 return pdens_init_level;
286 return edens_init_level;
289 if(pdens_init_level > dda_init_level)
290 return pdens_init_level;
292 return dda_init_level;
315 outvec = invec +
G(b*invec);
326 #endif // MADNESS_INTERIOR_BC_DENSITY_H__INCLUDED
bool is_leaf() const
Returns true if this does not have children.
Definition: funcimpl.h:202
Use a Gaussian for the surface function and the corresponding erf for the domain mask.
Definition: sdf_domainmask.h:374
void error(const char *msg)
Definition: world.cc:128
double mask(double d) const
Value of characteristic function at normal distance d from the surface.
Definition: sdf_domainmask.h:395
const mpreal exp(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2234
A paraboloid (3 dimensions)
Definition: sdf_shape_3D.h:219
const double pi
Mathematical constant pi.
Definition: constants.h:44
T norm(Vector< T, N > v)
Compute norm of a Vector.
Definition: array.h:447
Setup the tip-molecule problem.
Definition: density.h:77
std::complex< double > func(int n, int t1, int t2, int t3, double xx, double yy, double zz)
Definition: wannier.cc:98
Main include file for MADNESS and defines Function interface.
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:577
std::vector< Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: density.h:270
const mpreal log(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2213
int pdens_init_level
Definition: density.h:86
std::vector< Vector< double, 3 > > atom_centers
Definition: density.h:89
double proton_stdev
Definition: density.h:91
Level special_level()
Override this change level refinement for special points (default is 6)
Definition: density.h:278
DirichletCondIntOp(const SeparatedConvolution< double, NDIM > &gin, const Function< double, NDIM > &bin)
Definition: density.h:321
virtual double sdf(const Vector< double, NDIM > &x) const =0
Returns the signed distance from the surface,.
iterator begin()
Definition: array.h:189
double parent_value
Definition: density.h:57
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:896
double penalty_prefact
Definition: density.h:85
const mpreal ceil(const mpreal &v)
Definition: mpreal.h:2596
TipMolecule(double eps, double penalty, const Tensor< double > &denscoeffs, const std::vector< Atom * > &atoms, const std::vector< BasisFunc > &basis, double phi, double d)
Sets up the data for the problem-inspecific parts.
Definition: density.h:103
virtual double DirichletCond(const Vector< double, 3 > &x) const
Definition: density.h:196
const std::vector< BasisFunc > & basis
Definition: density.h:88
void action(const Function< double, NDIM > &invec, Function< double, NDIM > &outvec) const
Applies the operator to invec.
Definition: density.h:312
double surface(double d) const
Value of surface function at distance d normal to surface.
Definition: sdf_domainmask.h:426
pcomplex_operatorT G
Definition: tdse1d.cc:168
The operator needed for solving for with GMRES.
Definition: density.h:299
double phi
Definition: density.h:90
Level level() const
Definition: key.h:220
const SeparatedConvolution< double, NDIM > & G
The Green's function.
Definition: density.h:302
FunctorOutput
Definition: density.h:50
const Function< double, NDIM > & b
The surface function (normalized)
Definition: density.h:304
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
int Level
Definition: key.h:58
double leaf_value
Definition: density.h:56
FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree.
Definition: derivative.h:58
Implements the SignedDFInterface for common 3-D geometric objects.This file provides signed distance ...
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:58
DirichletLBCost(double leaf_value=1.0, double parent_value=1.0)
Definition: density.h:58
A plane surface (3 dimensions)
Definition: sdf_shape_3D.h:67
Implements (2nd generation) static load/data balancing for functions.
SignedDFInterface< 3 > * tip
Definition: density.h:84
FunctorOutput fop
Definition: density.h:100
const Tensor< double > & denscoeffs
Definition: density.h:87
virtual double Inhomogeneity(const Vector< double, 3 > &x) const
The PDE's inhomogeneity.
Definition: density.h:206
GaussianDomainMask dmi
Definition: density.h:83
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
A generic operator: takes in one T and produces another T.
Definition: gmres.h:62
virtual double ElectronDensity(const Vector< double, 3 > &x) const
Definition: density.h:238
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
virtual ~TipMolecule()
Definition: density.h:159