1 #ifndef MOLECULAR_MASK_H
2 #define MOLECULAR_MASK_H
11 double x = a[0] - b[0];
12 double y = a[1] - b[1];
13 double z = a[2] - b[2];
14 return sqrt(x*x + y*y + z*z);
32 return (r - center)*(1.0/
distance(r,center));
36 double mask(
double s)
const {
37 if (s > 6.0)
return 0.0;
38 else if (s < -6.0)
return 1.0;
39 else return 0.5*
erfc(s);
50 if (
fabs(s) > 6.0)
return 0.0;
51 return -
exp(-s*s)*fac;
56 double s =
sdf(r, atomic_coords[i], atomic_radii[i]);
63 double s =
sdf(r, atomic_coords[i], atomic_radii[i]);
64 return cmask(s/sigma);
69 double s =
sdf(r, atomic_coords[i], atomic_radii[i]);
76 std::vector<double>
m(natom);
78 for (
int i=0; i<
natom; i++) {
87 for (
int i=0; i<
natom; i++) {
96 const std::vector<double> atomic_radii,
97 const std::vector<madness::coord_3d> atomic_coords)
99 , atomic_radii(atomic_radii)
100 , atomic_coords(atomic_coords)
101 , natom(atomic_coords.size())
103 MADNESS_ASSERT(atomic_radii.size() == atomic_coords.size());
107 std::vector< madness::Vector<double,3> > v;
109 for (
int t=0; t<=npt; t++) {
111 for (
int p=0; p<2*npt; p++) {
116 for (
int i=0; i<
natom; i++) {
117 const double x = atomic_coords[i][0] + atomic_radii[i]*xx;
118 const double y = atomic_coords[i][1] + atomic_radii[i]*yy;
119 const double z = atomic_coords[i][2] + atomic_radii[i]*zz;
122 if (t==0 || t==npt)
break;
142 for (
int i=0; i<
natom; i++) {
166 for (
int i=0; i<
natom; i++) {
205 const double Vint, Vext, fac;
210 const std::vector<double> atomic_radii,
211 const std::vector<madness::coord_3d> atomic_coords)
212 : cmask(sigma, atomic_radii, atomic_coords)
215 , fac(
log(Vext/Vint))
217 if (Vint <= 0 || Vext <= 0)
throw "Only works for positive values";
222 if (c == 0.0)
return Vint;
223 else if (c == 1.0)
return Vext;
224 else return Vint *
exp(fac * c);
239 const std::vector<double> atomic_radii,
240 const std::vector<madness::coord_3d> atomic_coords)
241 : s(sigma, Vint, Vext, atomic_radii, atomic_coords)
263 return sqrt(grad[0]*grad[0] + grad[1]*grad[1] + grad[2]*grad[2]);
302 const std::vector<double> atomic_radii,
303 const std::vector<madness::coord_3d> atomic_coords,
305 : g(sigma, atomic_radii, atomic_coords, i)
306 , fac(
log(Vint/Vext))
308 if (Vint <= 0 || Vext <= 0)
throw "Only works for positive values";
Definition: molecularmask.h:18
const mpreal erfc(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2464
const mpreal exp(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2234
const double pi
Mathematical constant pi.
Definition: constants.h:44
Definition: molecularmask.h:272
Main include file for MADNESS and defines Function interface.
MolecularVolumeMaskGrad(double sigma, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords, int i)
Definition: molecularmask.h:276
const mpreal log(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2213
MolecularSurface(double sigma, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:255
Definition: molecularmask.h:252
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:261
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:220
double atomic_cmask(const madness::coord_3d &r, unsigned int i) const
Definition: molecularmask.h:62
const double sigma
Definition: dielectric.cc:187
Defines common mathematical and physical constants.
const double sigma
Definition: molecularmask.h:20
MolecularVolumeExponentialSwitchReciprocal(double sigma, double Vint, double Vext, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:236
const mpreal cos(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2255
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:148
Vector< double, 3 > coord_3d
Definition: funcplot.h:634
Definition: molecularmask.h:131
Computes the reciprocal of MolecularVolumeExponentialSwitch.
Definition: molecularmask.h:233
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:164
madness::coord_3d grad_atomic_mask(const madness::coord_3d &r, unsigned int i) const
Definition: molecularmask.h:68
MolecularVolumeMask(double sigma, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:134
Vector< T, 1 > vec(T x)
Your friendly neighborhood factory function.
Definition: array.h:456
double sdf(const madness::coord_3d &r, const madness::coord_3d ¢er, double R) const
Definition: molecularmask.h:26
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:284
const std::vector< madness::coord_3d > atomic_coords
Definition: molecularmask.h:22
madness::coord_3d grad_sdf(const madness::coord_3d &r, const madness::coord_3d ¢er) const
Definition: molecularmask.h:31
double cmask(double s) const
Definition: molecularmask.h:43
MolecularVolumeExponentialSwitchLogGrad(double sigma, double Vint, double Vext, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords, int i)
Definition: molecularmask.h:299
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
Definition: molecularmask.h:155
MolecularVolumeExponentialSwitch(double sigma, double Vint, double Vext, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:207
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:266
MolecularMaskBase(double sigma, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:95
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:315
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:311
double dmask(double s) const
Definition: molecularmask.h:48
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:289
const mpreal sin(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2262
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:58
const double m
Definition: gfit.cc:199
double mask(double s) const
Definition: molecularmask.h:36
std::vector< madness::Vector< double, 3 > > special_points() const
Definition: molecularmask.h:106
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:227
MolecularVolumeComplementMask(double sigma, const std::vector< double > atomic_radii, const std::vector< madness::coord_3d > atomic_coords)
Definition: molecularmask.h:158
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:140
const std::vector< double > atomic_radii
Definition: molecularmask.h:21
double atomic_mask(const madness::coord_3d &r, unsigned int i) const
Definition: molecularmask.h:55
Switches between positive values Vint and Vext with special log derivative.
Definition: molecularmask.h:203
Returns the requested component of the derivative of the log of MolecularVolumeExponentialSwitch.
Definition: molecularmask.h:295
const mpreal fabs(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2187
const double c
Definition: gfit.cc:200
FLOAT b(int j, FLOAT z)
Definition: y1.cc:79
const int natom
Definition: molecularmask.h:23
virtual double operator()(const madness::coord_3d &r) const
Definition: molecularmask.h:244
madness::coord_3d gradient(const madness::coord_3d &r) const
Definition: molecularmask.h:74
std::vector< madness::Vector< double, 3 > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition: molecularmask.h:172
double distance(const madness::coord_3d &a, const madness::coord_3d &b)
Definition: molecularmask.h:10