Thing Thing::create_object( int id = -1 ) { int chance = random_range(100); if ( chance < GROT_CHANCE ) { return Grot(); } else { int chance = random_range(NUM_THING_OBJS); switch ( chance ) { case 1: return GarageDoorOpener(); default: return Grot(); } } return Thing(); }
void set_GMchi() { static int wc_max=int_value("number_of_Matsubara_frequencies_for_Gamma4"); static ComplexType *** MR [n_zone]; static int K_max[n_zone]; {for (int z=0; z<n_zone; z++) K_max[z]=-1;} static int f=0; if (f==0) { for (int z=0; z<n_zone; z++) { MR[z]=new ComplexType ** [2*wc_max]; for (int w=0; w<2*wc_max; w++) { MR[z][w]=new ComplexType * [n_part]; for (int n=0; n<n_part; n++) MR[z][w][n]=new ComplexType [1]; ;} ;} f=1; ;} { for (int z=0; z<n_zone; z++) if (NumberOfPoints[z]>K_max[z]) { for (int w=0; w<2*wc_max; w++) for (int n=0; n<n_part; n++) { delete MR[z][w][n]; MR[z][w][n]=new ComplexType [NumberOfPoints[z]]; ;} K_max[z]=NumberOfPoints[z]; ;} ;} for (int z=0; z<n_zone; z++) { { for (int i=0; i<NumberOfPoints[z]; i++) for (int w=0; w<wc_max; w++) for (int n=0;n<n_part;n++) { int W2=w-wc_max/2; MR[z][w][n][i]=0; static Matrix grot(0); if (W2>=0) grot=(*Grot(z,W2,-1)); else grot=(*Grot(z,-W2-1,-1)); int kk=-1; for (int j=0;j<NumberOfPoints[z];j++) { next(z,kk); ComplexType EW; if (W2>=0) EW=ewt[kk][W2]*grot.x[n][p_[kk].i]; else EW=conj(ewt[kk][-W2-1]*grot.x[n][p_[kk].i]); MR[z][w][n][i]+=EW*M[z][j][i];//ewt[kk][w] ;} ;} ;} { for (int w=0; w<wc_max; w++) for (int n=0;n<n_part;n++) for (int w2=0; w2<wc_max; w2++) for (int n2=0;n2<n_part;n2++) { int W2=w2-wc_max/2; GMchi_matrix[z][w][w2][n][n2]=0; static Matrix grot(0); if (W2>=0) grot=(*Grot(z,W2,1)); else grot=(*Grot(z,-W2-1,1)); if (w==w2 && W2>=0) GMchi_matrix[z][w][w2][n][n2]=(*Grot(z,W2,0)).x[n][n2]; if (w==w2 && W2<0) GMchi_matrix[z][w][w2][n][n2]=conj((*Grot(z,-W2-1,0)).x[n][n2]); int kk=-1; for (int j=0;j<NumberOfPoints[z];j++) { next(z,kk); ComplexType EW; if (W2>=0) EW=ewt_[kk][W2]*grot.x[p[kk].i][n2]; else EW=conj(ewt_[kk][-W2-1]*grot.x[p[kk].i][n2]); GMchi_matrix[z][w][w2][n][n2]-=MR[z][w][n][j]*EW/beta;//ewt_[kk][w2] ;} ;} ;} ;} ;}