//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= // Program scatt //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= #include "cip.h" #include "nxgraph.h" #include "complex.h" //---- experimental settings const double dT = 1.0/4096; // temporal step const int GRIDS = 256+1; // number of GRIDS points //---- physical settings // settings about the system const double SYS_LEN = 8.0; // length of the system const double dX = SYS_LEN/(GRIDS-1); // length of a cell, dont edit // settings about initial conditions of the Gaussian wave packet const double PAC_POS = 2.5; // initial position const double PAC_DX = 1.0/4; // initial width const double PAC_MOM = 24.0; // initial momentum const double PAC_ENE = sqr(PAC_MOM)/2; // kinetic energy, dont edit // settings about the potential barrier const double BAR_POS = 4.0; // position const double BAR_LEN = 1.0/8; // length const double BAR_HIG = PAC_ENE*1.25; // height or barrier energy //---- graphics settings const int WIN_WIDTH = 512; const int WIN_HEIGHT = 256; const int BASE_Y = 228; // Y-coordinate of the origin const double WAVE_MAG = 64.0; // magnify factor for wave const double POTE_MAG = 1.0/4; // magnify factor for potential //---- declaration of class Wave class Wave { Complex Psi[GRIDS]; public: Wave( void ); void Evolve( void ); void Draw( void ); private: void TriDiagEQ( Complex A[], Complex x[], Complex b[] ); double Probability( void ); double Energy( void ); }; //---- declaration of class Potential class Potential { double V[GRIDS]; public: Potential( void ); inline double operator [] ( int i ){ return V[i]; } void Draw( void ); }; //---- defintion of class Wave //---- sets Gaussian wave packet Wave::Wave( void ) { const double Amp = pow( 2*M_PI*sqr(PAC_DX), -0.25 ); for( int i=1 ; i=1 ; i-- ){ x[i] -= x[i+1]*u[i]; } } //---- calculates integral of probability density double Wave::Probability( void ) { double prob=0.0; for( int i=0 ; i