Page 1 of 1

mistake in the derivative of the bessel function?

Posted: Thu Sep 02, 2010 10:22 am
by ppy
Hi,
I am not sure but it seems to me that there is a mistake in the derivative of the bessel function during the settlement of the kleinman-bylander projector of the pseudopotential, in the file 65_psp/psp5nl.F90.
The mistake would be at the lines :
316
396
473
The derivative of the Bessel function should be :
$dj_n(qr)/dx = 2\pi r [ j_{n-1}(2\pi q r) - \frac{n}{2\pi q r} j_n(2\pi q r) dr]$
whereas the following formula is used :
$dj_n(qr)/dx = 2\pi r [ j_{n-1}(2\pi q r) - \frac{n+1}{2\pi q r} j_n(2\pi q r) dr]$
n+1 is used instead of n in the fraction.

Also lignes 300 and 303, I don't understand the division by 3.0?

Thanks in advance for your answer
Best Regards
PYP

Re: mistake in the derivative of the bessel function?

Posted: Thu Sep 02, 2010 10:48 am
by ppy
ok sorry, this is my mistake, the spline doesn't involve the first but the second derivative.
Sorry again for this message
PYP

Re: mistake in the derivative of the bessel function?

Posted: Fri Sep 03, 2010 10:46 am
by ppy
Sorry for my second post, this is what happen when making several things at a time. But finally I am still thinking that my first post is right,

ppy wrote:The derivative of the Bessel function should be :
$dj_n(qr)/dx = 2\pi r [ j_{n-1}(2\pi q r) - \frac{n}{2\pi q r} j_n(2\pi q r) dr]$
whereas the following formula is used :
$dj_n(qr)/dx = 2\pi r [ j_{n-1}(2\pi q r) - \frac{n+1}{2\pi q r} j_n(2\pi q r) dr]$
n+1 is used instead of n in the fraction.


so maybe somebody would have some suggestions...

Thanks for your answers

Re: mistake in the derivative of the bessel function?

Posted: Sat Sep 04, 2010 9:11 am
by mverstra
Hello,

could you supply a patch file with some context lines around the ones you think are wrong? The line numbers change all the time so I don't know which ones you are looking at.

How did you come upon this? Do you have an erroneous result or some failing test of your own?

thanks

Matthieu

Re: mistake in the derivative of the bessel function?

Posted: Sun Sep 05, 2010 5:33 pm
by ppy
Thanks for your answer, I understood MY mistake, I was using the Bessel function of the first kind instead of the spherical ones.
To answer your question I am trying to implement a pseudo empirical code, and I am trying to calculate the Kleinman-Bylander form of the pseudopotential, since I am a fortunate user of Abinit and I like this code, I am checking step by step if what I am doing is fine and my understanding fairly well. This proves that it was necessary.
Best Regards!
PYP

Re: mistake in the derivative of the bessel function?

Posted: Mon Sep 06, 2010 8:32 am
by mverstra
So the formulas in psp5nl are fine?

If you are looking for a pseudopotential code, the bits of abinit are quite limited. You could look at fhi98pp, APE, or OPIUM for more complete codes with all of the trappings.

cheers

Matthieu

Re: mistake in the derivative of the bessel function?

Posted: Mon Sep 06, 2010 11:15 am
by ppy
Yes I think every thing is fine is the routine pspnl.f90.
Thanks for the advice, actually I am also looking at the fhi98pp code in the same time, but I probably did it too fast and I didn't notice my mistake.
Best Regards