diff --git a/src/examples/dielectric.cc b/src/examples/dielectric.cc index 20c1504f099..1fbabc76086 100644 --- a/src/examples/dielectric.cc +++ b/src/examples/dielectric.cc @@ -256,11 +256,11 @@ int main(int argc, char **argv) { print("coords", atomic_coords); // Functors for mask related quantities - real_functor_3d volume_functor(new MolecularVolumeMask(sigma, atomic_radii, atomic_coords)); - real_functor_3d gradx_functor(new MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 0)); - real_functor_3d grady_functor(new MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 1)); - real_functor_3d gradz_functor(new MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 2)); - real_functor_3d surface_functor(new MolecularSurface(sigma, atomic_radii, atomic_coords)); + auto volume_functor = MolecularVolumeMask(sigma, atomic_radii, atomic_coords); + auto gradx_functor = MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 0); + auto grady_functor = MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 1); + auto gradz_functor = MolecularVolumeMaskGrad(sigma, atomic_radii, atomic_coords, 2); + auto surface_functor = MolecularSurface(sigma, atomic_radii, atomic_coords); // Make the actual functions TIME("make volume ", real_function_3d volume = real_factory_3d(world).functor(volume_functor)); diff --git a/src/examples/dielectric_external_field.cc b/src/examples/dielectric_external_field.cc index 178a399473e..63424d9072b 100644 --- a/src/examples/dielectric_external_field.cc +++ b/src/examples/dielectric_external_field.cc @@ -147,12 +147,12 @@ int main(int argc, char **argv) { FunctionDefaults<3>::set_bc(BC_FREE); // The Coulomb operator (this is just 1/r ... whereas the notes are -1/4pir) - real_convolution_3d op = CoulombOperator(world, sigma*0.001, thresh*0.1); + auto op = CoulombOperator(world, sigma*0.001, thresh*0.1); // Derivative operators - real_derivative_3d Dx = free_space_derivative(world, 0); - real_derivative_3d Dy = free_space_derivative(world, 1); - real_derivative_3d Dz = free_space_derivative(world, 2); + auto Dx = free_space_derivative(world, 0); + auto Dy = free_space_derivative(world, 1); + auto Dz = free_space_derivative(world, 2); // We will have one sphere of radius R centered at the origin vector atomic_radii(1,R-delta); @@ -169,9 +169,9 @@ int main(int argc, char **argv) { print(MolecularVolumeExponentialSwitchLogGrad(sigma,epsilon_1,epsilon_0, atomic_radii, atomic_coords,0).special_points()); // Log derivative of the dielectric function - real_function_3d logdx = real_factory_3d(world).functor(real_functor_3d(new MolecularVolumeExponentialSwitchLogGrad(sigma,epsilon_1,epsilon_0, atomic_radii, atomic_coords,0))); - real_function_3d logdy = real_factory_3d(world).functor(real_functor_3d(new MolecularVolumeExponentialSwitchLogGrad(sigma,epsilon_1,epsilon_0, atomic_radii, atomic_coords,1))); - real_function_3d logdz = real_factory_3d(world).functor(real_functor_3d(new MolecularVolumeExponentialSwitchLogGrad(sigma,epsilon_1,epsilon_0, atomic_radii, atomic_coords,2))); + std::vector logd(3); + for (int i = 0; i < 3; i++) + logd.emplace_back(real_factory_3d(world).functor(MolecularVolumeExponentialSwitchLogGrad(sigma,epsilon_1,epsilon_0, atomic_radii, atomic_coords,i))); //double area = 4*madness::constants::pi*R*R; //double simulation_volume = 8*L*L*L; @@ -186,7 +186,7 @@ int main(int argc, char **argv) { real_function_3d surface_charge, old_surface_charge(world); for (int iter=0; iter<20; iter++) { // Scale with 1/4pi AFTER applying operator to get one more digit of accuracy - surface_charge = (logdx*Dx(u) + logdy*Dy(u) + logdz*(-Ez+Dz(u))).truncate(); + surface_charge = (logd[0]*Dx(u) + logd[1]*Dy(u) + logd[2]*(-Ez+Dz(u))).truncate(); real_function_3d r = (u - op(surface_charge).scale(rfourpi)).truncate(thresh*0.032); surface_charge.scale(rfourpi); diff --git a/src/examples/dirac-hatom.cc b/src/examples/dirac-hatom.cc index 98a11b22f89..b1ea1b73219 100644 --- a/src/examples/dirac-hatom.cc +++ b/src/examples/dirac-hatom.cc @@ -961,12 +961,12 @@ struct ExactSpinor : public FunctionFunctorInterface { } void set_ansatz(const AnsatzBase& ansatz) { - compute_F = (ansatz.iansatz==3) ? true : false; + compute_F = (ansatz.iansatz == 3); cusp_a=ansatz.get_cusp_a(); - regularized= (ansatz.iansatz==0) ? false : true; + regularized= !(ansatz.iansatz == 0); } - int l_char_to_int(const char lc) const { + static int l_char_to_int(const char lc) { int ll=0; if (lc=='S') ll=0; else if (lc=='P') ll=1; @@ -1323,10 +1323,10 @@ void run(World& world, ansatzT ansatz, const int nuclear_charge, const commandli guess= schrodinger2dirac(wf,ansatz,nuclear_charge); } else { print("\nUsing exact spinor guess\n"); - for (int i=0; i void FunctionImpl::diff(const DerivativeBase* D, const implT* f, bool fence) { typedef std::pair argT; - typename dcT::const_iterator end = f->coeffs.end(); - for (typename dcT::const_iterator it=f->coeffs.begin(); it!=end; ++it) { - const keyT& key = it->first; - const nodeT& node = it->second; + for (const auto& [key, node]: f->coeffs) { if (node.has_coeff()) { Future left = D->find_neighbor(f, key,-1); argT center(key,node.coeff());