36 #ifndef MADNESS_SVPE_H
37 #define MADNESS_SVPE_H
59 std::vector<double>& atomic_radii;
60 std::vector< madness::Vector<double,3> > atomic_coords;
72 std::vector<double>& atomic_radii,
79 ,atomic_radii(atomic_radii)
80 ,atomic_coords(atomic_coords)
92 rdielectric =
real_factory_3d(world).functor(rdielectric_functor).nofence();
96 scale(world, dlog, rfourpi);
108 return (dlog[0]*Dx(u) + dlog[1]*Dy(u) + dlog[2]*Dz(u)).
truncate();
113 double convfact = 6.423049507*std::pow(10,-4);
114 return surface.
trace()*surface_tension*convfact;
118 const bool USE_SOLVER =
true;
119 double tol =
std::max(1e-3,FunctionDefaults<3>::get_thresh());
125 double unorm = U.
norm2();
126 double surf = surface.
trace();
127 double vol = volume.
trace();
128 if(world.rank() == 0){
129 print(
"SURFACE ", surf);
130 print(
"VOLUMEE ", vol);
137 if (world.rank() == 0){
145 for (
int iter=0; iter<maxiter; iter++) {
151 plot_line(
"svpe_SurfaceCharge.dat",1001,lo,hi,surface_charge);
153 rvec = (U -U0 +
op(surface_charge)).
truncate() ;
155 double err = rvec.
norm2();
158 std::printf(
"%8d %22.10f \n", iter, err);
160 if (err >0.3*unorm){ U = 0.5*U + 0.5*U_new;
164 if (err < 10.0*tol)
break;
178 plot_line(
"svp_2D_surface.dat",1001,lo,hi,surface);
179 plot_line(
"svp_2D_reaction_pot.dat",1001,lo,hi,Ureaction);
181 plotdx(surface,
"svp_3D_surface.dx");
182 plotdx(Ureaction,
"svpe_reaction_pot.dx");
A simple Krylov-subspace nonlinear equation solver.
Definition: nonlinsol.h:91
Definition: shared_ptr_bits.h:38
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
Definition: molecularmask.h:252
double make_cav_energy(const double &surface_tension) const
Definition: svpe.h:111
void plotdx(const Function< T, NDIM > &f, const char *filename, const Tensor< double > &cell=FunctionDefaults< NDIM >::get_cell(), const std::vector< long > &npt=std::vector< long >(NDIM, 201L), bool binary=true)
Writes an OpenDX format file with a cube/slice of points on a uniform grid.
Definition: mraimpl.h:3228
void truncate(World &world, std::vector< Function< T, NDIM > > &v, double tol=0.0, bool fence=true)
Truncates a vector of functions.
Definition: vmra.h:194
Defines common mathematical and physical constants.
Vector< double, 3 > coord_3d
Definition: funcplot.h:634
Definition: molecularmask.h:131
Defines interfaces for optimization and non-linear equation solvers.
real_function_3d realfunc
Definition: svpe.h:49
Computes the reciprocal of MolecularVolumeExponentialSwitch.
Definition: molecularmask.h:233
std::vector< real_function_3d > vector_real_function_3d
Definition: functypedefs.h:79
real_functor_3d realfunct
Definition: svpe.h:50
realfunc ScreenReactionPotential(World &world, int maxiter, const realfunc rhot, bool solventplot) const
Definition: svpe.h:117
Function< double, 3 > real_function_3d
Definition: functypedefs.h:65
Derivative< double, 3 > real_derivative_3d
Definition: functypedefs.h:170
World & world() const
Returns the world.
Definition: mra.h:622
double norm2() const
Returns the 2-norm of the function ... global sum ... works in either basis.
Definition: mra.h:650
#define max(a, b)
Definition: lda.h:53
void scale(World &world, std::vector< Function< T, NDIM > > &v, const std::vector< Q > &factors, bool fence=true)
Scales inplace a vector of functions by distinct values.
Definition: vmra.h:290
Function< double, NDIM > update(const Function< double, NDIM > &u, const Function< double, NDIM > &r, const double rcondtol=1e-8, const double cabsmax=1000.0)
Computes next trial solution vector.
Definition: nonlinsol.h:111
void print(const tensorT &t)
Definition: DFcode/mcpfit.cc:140
const double pi
Definition: navstokes_cosines.cc:91
T trace() const
Returns global value of int(f(x),x) ... global comm required.
Definition: mra.h:1034
SeparatedConvolution< double, 3 > real_convolution_3d
Definition: functypedefs.h:121
realfunc make_surface_charge(const realfunc &u) const
Given the full Coulomb potential computes the surface charge.
Definition: svpe.h:104
std::shared_ptr< FunctionFunctorInterface< double, 3 > > real_functor_3d
Definition: functypedefs.h:107
Implements the SignedDFInterface for common 3-D geometric objects.This file provides signed distance ...
ScreenSolventPotential(World &world, double &sigma, double &epsilon_1, double &epsilon_2, int &maxiter, std::vector< double > &atomic_radii, std::vector< madness::Vector< double, 3 > > atomic_coords)
Definition: svpe.h:67
void plot_line(const char *filename, int npt, const Vector< double, NDIM > &lo, const Vector< double, NDIM > &hi, const Function< T, NDIM > &f)
Generates ASCII file tabulating f(r) at npoints along line r=lo,...,hi.
Definition: funcplot.h:388
Implements (2nd generation) static load/data balancing for functions.
Defines/implements plotting interface for functions.
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
void print(const A &a)
Print a single item to std::cout terminating with new line.
Definition: print.h:122
FunctionFactory< double, 3 > real_factory_3d
Definition: functypedefs.h:93
Returns the requested component of the derivative of the log of MolecularVolumeExponentialSwitch.
Definition: molecularmask.h:295