bool SIAM::Run(double mu, complex<double>* Delta, //input complex<double>* G_out, complex<double>* Sigma_out, double &n_out) //output { if (!Initialized) exit(1); Clipped = false; this->mu = mu; this->Delta = Delta; if ((mu==0)&&(epsilon==-U/2.0)) SymmetricCase = true; else SymmetricCase = false; printf(" -------%s SIAM: mu=%.3f, U=%.3f, T=%.3f, epsilon=%.3f -------\n", (SymmetricCase) ? "Symmetric" : "",mu, U, T, epsilon); //----- initial guess ------// n = 0.5; mu0 = 0.0; if ((!SymmetricCase)and(UseMPT_Bs)) MPT_B = epsilon; else MPT_B = 0.0; complex<double>* V = new complex<double>[2]; V[0] = mu0; V[1] = MPT_B; //---------------------------// //------ SOLVE SIAM ---------// if (SymmetricCase) //mu0 and n are known => there's no solving of system of equations SolveSiam(V); else //use broyden to solve system of two equations UseBroyden<SIAM>(2, MAX_ITS, Accr, &SIAM::SolveSiam, this, V); delete [] V; //----------------------------// //output spectral weight if optioned if (CheckSpectralWeight) { printf(" Spectral weight G: %fe\n", -imag(TrapezIntegral(N,G,omega))/pi); printf(" Spectral weight G0: %fe\n", -imag(TrapezIntegral(N,G0,omega))/pi); } //-------- OUTPUT ---------// for (int i=0; i<N; i++) { G_out[i] = G[i]; Sigma_out[i] = Sigma[i]; } n_out = n; //-------------------------// return Clipped; }
bool SIAM::Run(Result* r) //output { this->r = r; N = r->grid->get_N(); grid = r->grid; get_fermi(); Clipped = false; if ((r->mu==0)&&(epsilon==-U/2.0)) SymmetricCase = true; else SymmetricCase = false; printf(" -------%s SIAM: mu=%.3f, U=%.3f, T=%.3f, epsilon=%.3f -------\n", (SymmetricCase) ? "Symmetric" : "Asymmetric", r->mu, U, T, epsilon); //----- initial guess ------// r->n = 0.5; mu0 = r->mu0; if ((!SymmetricCase)and(UseMPT_Bs)) MPT_B = epsilon; else MPT_B = 0.0; complex<double>* V = new complex<double>[2]; V[0] = mu0; V[1] = MPT_B; //---------------------------// //------ SOLVE SIAM ---------// double mu0inits [] = {0.0, 1.0, -1.0, -0.8, 2.0, 1.5, -1.5, 2.5, -2.5, -2.0, 0.05, 0.8, 0.1, -0.1, 0.3, -0.3, 0.5, -0.5, -0.05, 0.4, -0.4, 0.6, -0.6, 2.3, -2.3, 2.8, -2.8, 1.8, -1.8 }; if (SymmetricCase) //mu0 and n are known => there's no solving of system of equations SolveSiam(V); else { int c = 0; while ( UseBroyden<SIAM>(2, MAX_ITS, Accr, &SIAM::SolveSiam, this, V) != 1 ) { c++; if ( c > sizeof(mu0inits)/sizeof(double) - 1 ) { printf("\n\n\n\n==== ERROR ====: SIAM Failed to converge!!!\n\n\n\n"); return true; } V[0] = mu0inits[c]; V[1] = MPT_B; printf("==================== ====================== ========== TRYING new mu0 int!!! c = %d, mu0init = %f\n\n\n",c, mu0inits[c]); }; //use broyden to solve system of two equations } delete [] V; //----------------------------// //output spectral weight if optioned if (CheckSpectralWeight) { printf(" Spectral weight G: %fe\n", -imag(TrapezIntegralMP(N, r->G, r->omega))/pi); printf(" Spectral weight G0: %fe\n", -imag(TrapezIntegralMP(N, r->G0, r->omega))/pi); } r->mu0 = mu0; return Clipped; }