- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
// https://github.com/QWalk/mainline/blob/b12ea3652226caef23c2f5fc7b168746c89096f2/src/system/Pseudopotential_so.cpp#L36
doublevar legendre_so(doublevar x, int n)
{
switch(n)
{
case 0:
return 1;
case 1:
return x;
case 2:
return .5*(3*x*x-1);
case 3:
return .5*(5*x*x*x - 3*x);
case 4:
return 0.125*(35*x*x*x*x -30*x*x +3);
case 5:
return 0.125*(63*x*x*x*x*x - 70*x*x*x + 15*x);
default:
error("Do not have legendre polynomial of order ", n);
return 0; //shouldn't get here, but gets rid of a compiler message
}
}