3
$\begingroup$

I am currently implementing classical density functional theory for a radially symmetric system. In mathematical terms, I am searching for a function $f(r)$ that minimizes a functional $\Omega[f]$. The simplest part of $\Omega$ looks like this: $\int\limits_0^R r^2 f(r)(\ln(f(r))-1)\mathrm{d}r$, but there are others that involve convolutions of $f$. I am trying to minimize a numerical implementation of $\Omega$ using nlopt, which works fine in planar coordinates for the same functional.

$f(r)$ is represented as a vector $f_i$ which represents samples of $f$ at evenly spaced points $r_i$. The points start at $Δr$ and go up to $R$. $f(0)$ is irrelevant. There is a constant boundary condition $f(r>R)=f_∞$.

However, in radial coordinates, the convergence for small $r$ is way worse than for large $r$, because of the factor $r^2$ (the Jacobian determinant). If I only cared about the value of $\Omega$, this would not be a problem, but in this case, $\Omega$ is only a vehicle to obtain $f$.

Are there libraries that are better suited for this kind of problem? Or is there a different way to fix the problem and keep using nlopt?

$\endgroup$
  • $\begingroup$ Do you have any conditions on $f$, e.g., any condition on $f(0)$ and/or $f(R)$ ? Since you are doing this numerically, how do you represent $f(r)$ ? By some polynomial or piecewise polynomial ? Maybe you should add this information to your question. $\endgroup$ – cpraveen Oct 9 '18 at 11:48
  • $\begingroup$ Since I can't figure out how to edit the original question: $f(r)$ is represented as a vector $f_i$ which represents samples of $f$ at evenly spaced points $r_i$. The points start at $\Delta r$ and go up to $R$. $f(0)$ is irrelevant. There is a constant boundary condition $f(r > R) = f_\infty$. $\endgroup$ – Lucas L. Treffenstädt Oct 9 '18 at 12:57
  • $\begingroup$ If you approximate $f(r)$ by piecewise linear polynomial, atleast you can exactly integrate to get $\Omega$ and you will need the value $f(0)$. Your $f(r)$ must remain positive. You can do change of variable $z(r) = \log f(r)$ and approximate $z(r)$ by piecewise linear polynomial. Once you get $z(r)$ you get $f(r)=\exp(z(r))$ and now positivity of $f(r)$ is not a problem. $\endgroup$ – cpraveen Oct 9 '18 at 14:10
  • $\begingroup$ Have you tried using something other than equally spaced $r$ values? $\endgroup$ – Brian Borchers Oct 9 '18 at 14:39
  • $\begingroup$ @PraveenChandrashekar I could try the transform, but as I said, $\Omega$ consists of more than the given integral and the other parts do not contain forms like $\ln(f)$. Also, in my experience, you do not have to impose positivity because the gradients are extreme enough that a gradient-based optimizer will not go there. And yes, I have experimented with uneven spacings. The ones I've tried make the problem worse. I cannot really make the spacing larger near the origin, since I need the resolution I have now. $\endgroup$ – Lucas L. Treffenstädt Oct 10 '18 at 8:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.