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
Vh[int] eV1 (nev);
real sigma= 0.0;
int k=EigenValue(K,M,sym=true, sigma=sigma, value=ev,vector=eV1,tol=1e-10,maxit=0,ncv=0);
cout << "First eigenvalue : " << ev << endl;
cout << "Second eigenvalue : " << ev << endl;
cout << "Third eigenvalue : " << ev<< endl;
cout << "Fourth eigenvalue : " << ev << endl;
cout << "Fifth eigenvalue : " << ev << endl;
Surprisingly, it seems that the code misses the lowest eigenvalue (ev \simeq E_2).
Does someone know how to fix this problem?
Thank you in advance!