Skip to content

Commit

Permalink
Remove use for flipFunction in Permittivity
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielgerez committed Nov 20, 2023
1 parent 3c98000 commit e10e8b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/environment/Permittivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ Permittivity::Permittivity(std::shared_ptr<mrchem::Cavity> cavity, double epsilo

double Permittivity::evalf(const mrcpp::Coord<3> &r) const {
auto c_pin = this->cavity;
auto epsilon = this->in * std::exp(std::log(this->out / this->in) * (1 - c_pin->evalf(r)));
return (this->inverse) ? 1.0 / epsilon : epsilon;
return this->in * std::exp(std::log(this->out / this->in) * (1 - c_pin->evalf(r)));
}

void Permittivity::printHeader() const {
Expand Down
5 changes: 0 additions & 5 deletions src/environment/Permittivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,10 @@ class Permittivity final : public StepFunction {
*/
double evalf(const mrcpp::Coord<3> &r) const override;

void flipFunction(bool is_inverse) { this->inverse = is_inverse; }
auto isInverse() const { return this->inverse; }

void printHeader() const override;

private:
std::string formulation = "exponential";
bool inverse = false; //!< State of #evalf. When this is false, evalf returns the standard value, but when it is true,
//!< evalf returns 1/epsilon.
};

} // namespace mrchem
6 changes: 2 additions & 4 deletions src/environment/SCRF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ mrcpp::ComplexFunction SCRF::solvePoissonEquation(const mrcpp::ComplexFunction &
mrcpp::ComplexFunction Vr_np1;
Vr_np1.alloc(NUMBER::Real);

this->epsilon.flipFunction(true);

auto eps_inv_func = mrcpp::AnalyticFunction<3>([this](const mrcpp::Coord<3> &r) { return 1.0 / this->epsilon.evalf(r); });
Density rho_tot(false);
computeDensities(Phi, rho_tot);

mrcpp::cplxfunc::multiply(first_term, rho_tot, this->epsilon, this->apply_prec);
this->epsilon.flipFunction(false);
mrcpp::cplxfunc::multiply(first_term, rho_tot, eps_inv_func, this->apply_prec);

mrcpp::cplxfunc::add(rho_eff, 1.0, first_term, -1.0, rho_tot, -1.0);
rho_tot.free(NUMBER::Real);
Expand Down

0 comments on commit e10e8b0

Please sign in to comment.