mistake in the derivative of the bessel function?

Documentation, Web site and code modifications

Moderators: baguetl, routerov

Locked
ppy
Posts: 24
Joined: Wed May 19, 2010 6:28 pm

mistake in the derivative of the bessel function?

Post by ppy » Thu Sep 02, 2010 10:22 am

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

ppy
Posts: 24
Joined: Wed May 19, 2010 6:28 pm

Re: mistake in the derivative of the bessel function?

Post by ppy » Thu Sep 02, 2010 10:48 am

ok sorry, this is my mistake, the spline doesn't involve the first but the second derivative.
Sorry again for this message
PYP

ppy
Posts: 24
Joined: Wed May 19, 2010 6:28 pm

Re: mistake in the derivative of the bessel function?

Post by ppy » Fri Sep 03, 2010 10:46 am

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

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: mistake in the derivative of the bessel function?

Post by mverstra » Sat Sep 04, 2010 9:11 am

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
Matthieu Verstraete
University of Liege, Belgium

ppy
Posts: 24
Joined: Wed May 19, 2010 6:28 pm

Re: mistake in the derivative of the bessel function?

Post by ppy » Sun Sep 05, 2010 5:33 pm

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

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: mistake in the derivative of the bessel function?

Post by mverstra » Mon Sep 06, 2010 8:32 am

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
Matthieu Verstraete
University of Liege, Belgium

ppy
Posts: 24
Joined: Wed May 19, 2010 6:28 pm

Re: mistake in the derivative of the bessel function?

Post by ppy » Mon Sep 06, 2010 11:15 am

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

Locked