Hello !
I’m currectly using FreeFEM++ to compute electronic structures.
I wrote a FreeFREM++ code supposed to compute the lowest eigenvalues and eigenfunctions of the Schrödinger equation in 2D, that is to solve the elliptic eigenvalue problem
- \frac 12 \Delta u(x) + V(x) u(x) = E u(x) on a square with periodic boundary, where V is a given function.
The eigenvalues (E_n) are ranked in nondecreasing order : E_1 \le E_2 \le E_3 …
Following the example of acoustics I found in Acoustics , I used the following code lines to solve the resulting generalized eigenvalue problem:
matrix K= rigidite(Vh,Vh,solver=Crout,factorize=1);
matrix M= masse(Vh,Vh,solver=CG,eps=1e-20);
// Computation of the 5 lowest eigenvalues
int nev=5;
real[int] ev(nev);
Vh[int] eV1 (nev);
real sigma= 0.0;
real scale=10;
int k=EigenValue(K,M,sym=true, sigma=sigma, value=ev,vector=eV1,tol=1e-10,maxit=0,ncv=0);
cout << "First eigenvalue : " << ev[0] << endl;
cout << "Second eigenvalue : " << ev[1] << endl;
cout << "Third eigenvalue : " << ev[2]<< endl;
cout << "Fourth eigenvalue : " << ev[3] << endl;
cout << "Fifth eigenvalue : " << ev[4] << endl;
Surprisingly, it seems that the code misses the lowest eigenvalue (ev[0] \simeq E_2).
Does someone know how to fix this problem?
Thank you in advance!
Grégoire