Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write computer code which will find the energy and density function for an atom with $Z$ protons and $N$ electrons. I am working in 1D for simplicity and would like to make the overall code as simple as possible (I am using Hartree units aswell). I am using also using the Hartree approximation. This is my overall algorithm:

  1. Finds hydrogen like wave-functions (i.e. no electron-election interaction)

  2. Works out density function via $n(z) = \sum_i \left | \phi_i(z) \right |^2$

  3. Works out Hartree potential $ V_H(r) = \int_0^\infty \frac{n(\vec{s})}{\left | \vec{r}-\vec{s} \right |} d\vec{s} $

  4. Uses Kohn-Sham equation to find new individual wavefuncitons $\left (-\tfrac{1}{2}\bigtriangledown^2 + \frac{Z}{\left |r \right |} + V_H(\vec{r}) + V_{EX}(\vec{r}) \right )\phi_i = \varepsilon_i \phi_i$

  5. Go back to step 1. and repeat.

I am having a number of difficulty and would be very grateful for some help with any of my questions.

Firstly to compute the Hartree potential I need to turn it into a 1D problem, so we assume even spherical distribution of charge:

$ V_H(r) = \int_0^\infty 4\pi s^2 \frac{ n(s)}{\left |r-s\right |} ds $

However this blows up when $r = s$. I have been looking into Gauss's law but had no luck.

Additionally, I am unsure how to compute the exchange-correlation term. I am trying to find a function which I can easily implement.

Any help would be great.

share|cite|improve this question
Coss-posted to Scientific Computation. Please don't do that, it is strongly discouraged. You should take you best guess at the best fit and only try another site if you don't get satisfactory results from the first instance. – dmckee Mar 15 '12 at 20:31
About your last question regarding the Hartee potential, please refer to this post: Hartree_potential_spherical – Hui Zhang Nov 14 '13 at 19:33

The Hartree potential is typically calculated not through the integral you're giving, but by solving Poisson's equation. Look here or there for details about this calculation applied to DFT, and here for what I found to be a good lower-level introduction to Poisson solvers in general. Good luck for your quest, it's really a nontrivial thing to do!

As an aside: what basis set are you going to employ?

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.