Re: Is outputted wave function Bloch? ( No.1 ) |
- Date: 2015/10/16 19:40
- Name: Artem Pulkin
- Hi,
You can plot and check whether it is periodic or not. AFAIK the "actual wave function" is plotted by OpenMX.
Since those two are connected through an exponent it is easy to get one from another in real space. However I do not see any single point of having the Bloch function in real space.
Regards,
Artem
|
Re: Is an output wave function Bloch? ( No.2 ) |
- Date: 2015/10/17 14:41
- Name: M. Yamada
- Hi, Artem,
Thank you for your kind reply to my stupid question, I have seen that an output file is non-periodic and written up a simple program to convert from non-periodic to periodic. Finally, I managed to get a periodic Bloch wave function.
#define _USE_MATH_DEFINES #include <math.h> #include <complex> #include <iostream> #include <fstream> #include <string> using namespace std;
int main(int argc,char* argv[]){ complex<double> c,d; double ka,kb,kc; int na,nb,nc; int i,j,k,a; double x,y,z; string re,im; double rea,ima; if(argc!=3){ cout << "Use ./a.out realpartfile imaginarypartfile."<< endl; return 0; } cout << "real part:" <<argv[1]<<endl; cout << "imag part:" <<argv[2]<<endl; ifstream real(argv[1]); ifstream imag(argv[2]); if(real.fail()||imag.fail()){ cout << "Unreadable file."<<endl; return 0; } ofstream oreal("out_r.cube"); ofstream oimag("out_i.cube"); getline(real,re); oreal <<re<<endl; getline(real,re); oreal <<re<<endl; real>>a>>x>>y>>z; oreal <<a<<" "<<x<<" "<<y<<" "<<z<<endl; real>>na>>x>>y>>z; oreal <<na<<" "<<x<<" "<<y<<" "<<z<<endl; real>>nb>>x>>y>>z; oreal <<nb<<" "<<x<<" "<<y<<" "<<z<<endl; real>>nc>>x>>y>>z; oreal <<nc<<" "<<x<<" "<<y<<" "<<z; for(i=0;i<a;i++){ getline(real,re); oreal <<re<<endl; } getline(imag,im); oimag <<im<<endl; getline(imag,im); oimag <<im<<endl; imag>>a>>x>>y>>z; oimag <<a<<" "<<x<<" "<<y<<" "<<z; for(i=0;i<a+3;i++){ getline(imag,im); oimag <<im<<endl; }
cout << "k?" << endl; cin >>ka>>kb>>kc; for(i=0;i<na;i++) for(j=0;j<nb;j++) for(k=0;k<nc;k++){ real >>rea; imag >>ima; c=complex<double>(rea,ima); d=c*polar(1.0,-(2.0*M_PI*ka*i/na+2.0*M_PI*kb*j/nb+2.0*M_PI*kc*k/nc)); oreal <<d.real()<<" "; oimag <<d.imag()<<" "; } return 0; }
Regards,
Masahiko
|
Re: Is an output wave function Bloch? ( No.3 ) |
- Date: 2015/10/18 00:35
- Name: M. Yamada
- There was a stupid mistake in my code
: : for(i=0;i<a+1;i++){ getline(real,re); oreal <<re<<endl; } getline(imag,im); oimag <<im<<endl; getline(imag,im); oimag <<im<<endl; imag>>a>>x>>y>>z; oimag <<a<<" "<<x<<" "<<y<<" "<<z; for(i=0;i<a+4;i++){ getline(imag,im); oimag <<im<<endl; } : :
is correct.
|
|