33 #ifndef SVPE_MOLECULE_COLLOID_H
34 #define SVPE_MOLECULE_COLLOID_H
49 std::vector< madness::Vector<double,3> >
colloid_coords(
const double&d,
const double R,
const std::vector<double>
cc) {
54 double x = cc[0], y = cc[1], z = cc[2];
61 c[0][0]= x, c[0][1]= y - R - d , c[0][2] = z;
92 std::vector<double>
c(nsphere,0.0);
93 for(
int i=0; i<nsphere; i++)
113 static const double cutrho = 1e-12;
116 void operator()(
const Key<3>& key,
121 double d = func1(
IND);
122 double p = func2(
IND);
126 template <
typename Archive>
134 double sigma,
double epsilon_0,
double epsilon_1,
136 const double minlen,
double L,
const int maxiter)
141 , epsilon_0(epsilon_0)
142 , epsilon_1(epsilon_1)
143 , op(CoulombOperator(world, minlen, thresh))
148 MADNESS_ASSERT(atomic_radii.size() == atomic_coords.size());
157 rdielectric =
real_factory_3d(world).functor(rdielectric_functor).nofence();
159 dlog[0] =
real_factory_3d(world).functor(gradx_functor).nofence().truncate_on_project();
160 dlog[1] =
real_factory_3d(world).functor(grady_functor).nofence().truncate_on_project();
161 dlog[2] =
real_factory_3d(world).functor(gradz_functor).truncate_on_project();
176 real_function_3d sc = func_pdt(dlog[0],dx).
truncate() + func_pdt(dlog[1],dy).truncate() + func_pdt(dlog[2],dz).truncate();
191 real_function_3d sc = func_pdt(dlog[0],dx).
truncate() + func_pdt(dlog[1],dy).truncate() + func_pdt(dlog[2],dz).truncate();
205 plot_line(
"ab_sigma.dat", 1001, hi, lo, Sigmax, Sigmay, Sigmaz);
206 E[0] = Dx(
op(Sigmax)), E[1] = Dy(
op(Sigmay)), E[2] = Dz(
op(Sigmaz)) ;
219 double unorm = u.
norm2();
221 print(
"UNORM IS", unorm);
223 if (world.
rank()==0){
225 madness::print(
" Computing the Perturbed Potential (due to molecule) ");
229 for (
int iter=0; iter<
maxiter; iter++) {
233 double sigtot = surface_charge.
trace()*fac;
237 double change = (unew-u).
norm2();
239 print(
"iter", iter,
"change", change,
241 "surface charge", sigtot,
"used",
wall_time()-start);
245 if (change > 0.3*unorm)
246 u = 0.5*unew + 0.5*u;
250 if (change < 10.0*thresh)
break;
257 plot_line(
"colloid_rxn_pot.dat", 1001, lo, hi, urxn);
258 plot_line(
"colloid_surfcharge.dat", 1001, lo, hi, make_surface_charge(urxn).
scale(fac));
273 if (world.
rank()==0){
275 madness::print(
" Computing the Perturbed Potential (due to external field) ");
278 for (
int iter=0; iter<
maxiter; iter++) {
282 double sigtot = surface_charge.
trace()*fac;
285 double change = (unew-u).
norm2();
286 if (world.
rank()==0){
287 print(
"iter", iter,
"change", change,
289 "surface charge", sigtot,
"used",
wall_time()-start);
292 if (change > 0.3*unorm)
293 u = 0.5*unew + 0.5*u;
297 if (change <
std::min(1e-4,10.0*thresh))
break;
303 plot_line(
"laplace_surfcharge.dat", 1001, lo, hi, make_Laplace_surface_charge(u,E).
scale(fac));
304 plot_line(
"laplace_pot.dat", 1001, lo, hi, u);
314 double denominator = mask.
trace();
315 double Favx = numx/denominator, Favy = numy/denominator,Favz = numz/denominator;
316 return std::sqrt(std::pow(Favx,2.0) + std::pow(Favy,2.0) + std::pow(Favz,2.0));
const double thresh
Definition: dielectric.cc:185
A simple Krylov-subspace nonlinear equation solver.
Definition: nonlinsol.h:91
#define ITERATOR(t, exp)
Definition: tensor_macros.h:249
real_function_3d solve(const real_function_3d &rho) const
Solve for the full Coulomb potential using the free-particle GF.
Definition: svpe_molecule_colloid.h:211
Definition: shared_ptr_bits.h:38
const double pi
Mathematical constant pi.
Definition: constants.h:44
real_function_3d solve_Laplace(std::vector< double >E) const
Solve for the full Coulomb potential using the free-particle GF.
Definition: svpe_molecule_colloid.h:266
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
#define IND
Definition: tensor_macros.h:204
FunctionDefaults holds default paramaters as static class members.
Definition: funcdefaults.h:175
const double epsilon_1
Definition: dielectric.cc:190
Implements derivatives operators with variety of boundary conditions on simulation domain...
Definition: derivative.h:272
const double sigma
Definition: dielectric.cc:187
const double L
Definition: 3dharmonic.cc:123
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.
Convolutions in separated form (including Gaussian)
Definition: operator.h:117
std::vector< madness::Vector< double, 3 > > colloid_coords(const double &d, const double R, const std::vector< double > cc)
Definition: svpe_molecule_colloid.h:49
double ave_rxn_field(const real_function_3d &u, const real_function_3d &mask) const
Definition: svpe_molecule_colloid.h:309
Definition: mpreal.h:3066
Vector< double, 3 > coord_3d
Definition: funcplot.h:634
const double epsilon_0
Definition: dielectric.cc:189
Definition: molecularmask.h:131
std::vector< double > colloid_radii(const double &R)
Definition: svpe_molecule_colloid.h:90
Defines interfaces for optimization and non-linear equation solvers.
Computes the reciprocal of MolecularVolumeExponentialSwitch.
Definition: molecularmask.h:233
std::vector< real_function_3d > vector_real_function_3d
Definition: functypedefs.h:79
std::vector< Vector< double, 3 > > vector_coord_3d
Definition: functypedefs.h:58
Implements most functionality of separated operators.
World & world() const
Returns the world.
Definition: mra.h:622
real_function_3d make_Laplace_surface_charge(const real_function_3d &u, std::vector< double > E=std::vector< double >(3, 0.0)) const
Definition: svpe_molecule_colloid.h:183
double norm2() const
Returns the 2-norm of the function ... global sum ... works in either basis.
Definition: mra.h:650
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
Example implementation of Krylov-subspace nonlinear equation solver.
T trace() const
Returns global value of int(f(x),x) ... global comm required.
Definition: mra.h:1034
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
const double cc
Definition: navstokes_cosines.cc:108
Tensor< double > real_tensor
Definition: functypedefs.h:40
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
enable_if_c< is_serializable< T >::value &&is_output_archive< Archive >::value >::type serialize(const Archive &ar, const T *t, unsigned int n)
Definition: archive.h:615
double norm2(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norm of a vector of functions.
Definition: vmra.h:325
vector_real_function_3d make_electric_field(const real_function_3d &u) const
Definition: svpe_molecule_colloid.h:195
const int maxiter
Definition: gygi_soltion.cc:69
A multiresolution adaptive numerical function.
Definition: derivative.h:61
Definition: svpe_molecule_colloid.h:98
real_function_3d make_surface_charge(const real_function_3d &u) const
Definition: svpe_molecule_colloid.h:168
ProcessID rank() const
Returns the process rank in this world (same as MPI_Comm_rank()))
Definition: worldfwd.h:526
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
std::vector< double > vector_real
Definition: functypedefs.h:53
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
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
const double c
Definition: gfit.cc:200
Function< TENSOR_RESULT_TYPE(L, R), NDIM > binary_op(const Function< L, NDIM > &left, const Function< R, NDIM > &right, const opT &op, bool fence=true)
Generate new function = op(left,right) where op acts on the function values.
Definition: mra.h:1593
double wall_time()
Returns the wall time in seconds relative to arbitrary origin.
Definition: world.cc:248
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
SVPEColloidSolver(World &world, double sigma, double epsilon_0, double epsilon_1, const vector_real &atomic_radii, const vector_coord_3d &atomic_coords, const double minlen, double L, const int maxiter)
Definition: svpe_molecule_colloid.h:133