//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= // Program rabi //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= #include "cip.h" #include "nxgraph.h" #include "complex.h" //---- experimental settings const double dT = 1.0/4096; // temporal step const int BASES = 4; // number of base waves //---- physical settings // setting about the well const double WEL_LEN = 1.0; // length of the well // setting about the wave function const int WAVE_MODE = 0; // initial mode // macros for eigen_values inline double eigen_moment( int mode ){ return M_PI/WEL_LEN*(mode+1); } inline double eigen_energy( int mode ){ return 0.5*sqr(M_PI/WEL_LEN*(mode+1)); } // setting about the electromagnetic-wave const double Eamp = 4.0; // amplitude of elecro-wave const double Omg = eigen_energy( WAVE_MODE+1 ) - eigen_energy( WAVE_MODE ); // angular frequency //---- graphics settings const int WIN_WIDTH = 512; const int WIN_HEIGHT = 256; const int BASE_Y = 128; // Y-coordinate of the origin const double WAVE_MAG = 64.0; // magnify factor for wave const double POTE_MAG = 16.0; // magnify factor for potential const int GRIDS = 64+1; // number of GRIDS for drawing //---- declaration of class Wave class Wave { // property of each base functions Complex C[BASES]; // coefficiences double E0[BASES], k0[BASES]; // eigen energy and momentum double d[BASES][BASES]; // matrix elements of dipole public: Wave( void ); void Evolve( void ); void Draw( void ); private: double Probability( void ); Complex Psi( double x ); }; //---- declaration of class EleMag class EleMag { double Ele; // Electro-field public: EleMag( void ){ Ele = 0.0; } inline double E( void ){ return Ele; } void Evolve( void ); void Draw( void ); }; //---- defintion of class Wave //---- initializes properties Wave::Wave( void ) { int n, m; for( n=0 ; n=0 ; m-- ){ for( n=0 ; n