25 #include "StdFace_vals.hpp"    43   fprintf(stdout, 
"\n\n #######  You DO NOT have to WORRY about the following MPI-ERROR MESSAGE.  #######\n\n");
    44   ierr = MPI_Abort(MPI_COMM_WORLD, errorcode);
    45   ierr = MPI_Finalize();
    47   if (ierr != 0) fprintf(stderr, 
"\n  MPI_Finalize() = %d\n\n", ierr);
    57   struct StdIntList *StdI,
    58   std::complex<double> trans0,
    65   StdI->trans[StdI->ntrans] = trans0;
    66   StdI->transindx[StdI->ntrans][0] = isite;
    67   StdI->transindx[StdI->ntrans][1] = ispin;
    68   StdI->transindx[StdI->ntrans][2] = jsite; 
    69   StdI->transindx[StdI->ntrans][3] = jspin;
    70   StdI->ntrans = StdI->ntrans + 1;
    77 struct StdIntList *StdI,
    78   std::complex<double> trans0,
    93   std::complex<double> coef;
    95   if (strcmp(StdI->method, 
"timeevolution") == 0 && StdI->PumpBody == 1) {
    96     for (it = 0; it < StdI->Lanczos_max; it++) {
    98       for (ii = 0; ii < 3; ii++) Cphase +=  StdI->At[it][ii] * dR[ii];
    99       coef = std::complex<double>(cos(Cphase), sin(-Cphase));
   100       for (ispin = 0; ispin < 2; ispin++) {
   101         StdI->pump[it][StdI->npump[it]] = coef * trans0;
   102         StdI->pumpindx[it][StdI->npump[it]][0] = isite;
   103         StdI->pumpindx[it][StdI->npump[it]][1] = ispin;
   104         StdI->pumpindx[it][StdI->npump[it]][2] = jsite;
   105         StdI->pumpindx[it][StdI->npump[it]][3] = ispin;
   106         StdI->npump[it] = StdI->npump[it] + 1;
   108         StdI->pump[it][StdI->npump[it]] = conj(coef * trans0);
   109         StdI->pumpindx[it][StdI->npump[it]][0] = jsite;
   110         StdI->pumpindx[it][StdI->npump[it]][1] = ispin;
   111         StdI->pumpindx[it][StdI->npump[it]][2] = isite;
   112         StdI->pumpindx[it][StdI->npump[it]][3] = ispin;
   113         StdI->npump[it] = StdI->npump[it] + 1;
   119     for (ispin = 0; ispin < 2; ispin++) {
   121       StdFace_trans(StdI, conj(trans0), isite, ispin, jsite, ispin);
   130   struct StdIntList *StdI,
   147   StdI->Cintra[StdI->NCintra] = U0;
   148   StdI->CintraIndx[StdI->NCintra][0] = isite;
   156   struct StdIntList *StdI,
   166   S = (double)S2 * 0.5;
   170   for (ispin = 0; ispin <= S2; ispin++){
   177     Sz = (double)ispin - S;
   190       StdFace_trans(StdI, -0.5 * Gamma * sqrt(S*(S + 1.0) - Sz*(Sz + 1.0)),
   191         isite, ispin + 1, isite, ispin);
   192       StdFace_trans(StdI, -0.5 * Gamma * sqrt(S*(S + 1.0) - Sz*(Sz + 1.0)),
   193         isite, ispin, isite, ispin + 1);
   204   struct StdIntList *StdI,
   205   std::complex<double> intr0,
   216   StdI->intr[StdI->nintr] = intr0;
   217   StdI->intrindx[StdI->nintr][0] = site1; StdI->intrindx[StdI->nintr][1] = spin1;
   218   StdI->intrindx[StdI->nintr][2] = site2; StdI->intrindx[StdI->nintr][3] = spin2;
   219   StdI->intrindx[StdI->nintr][4] = site3; StdI->intrindx[StdI->nintr][5] = spin3;
   220   StdI->intrindx[StdI->nintr][6] = site4; StdI->intrindx[StdI->nintr][7] = spin4;
   221   StdI->nintr = StdI->nintr + 1;
   228 struct StdIntList *StdI,
   236   int ispin, jspin, ZGeneral, ExGeneral;
   237   double Si, Sj, Siz, Sjz;
   238   std::complex<double> intr0;
   244   if (Si2 == 1 || Sj2 == 1) {
   253     StdI->Hund[StdI->NHund] = -0.5 * J[2][2];
   254     StdI->HundIndx[StdI->NHund][0] = isite;
   255     StdI->HundIndx[StdI->NHund][1] = jsite;
   258     StdI->Cinter[StdI->NCinter] = -0.25 * J[2][2];
   259     StdI->CinterIndx[StdI->NCinter][0] = isite;
   260     StdI->CinterIndx[StdI->NCinter][1] = jsite;
   263     if (fabs(J[0][1]) < 0.000001 && fabs(J[1][0]) < 0.000001
   265       && abs(J[0][0] - J[1][1]) < 0.000001
   277       StdI->Ex[StdI->NEx] = - 0.25 * (J[0][0] + J[1][1]);
   279       if (strcmp(StdI->model, 
"kondo") == 0)
   280         StdI->Ex[StdI->NEx] = -0.25 * (J[0][0] + J[1][1]);
   282         StdI->Ex[StdI->NEx] = 0.25 * (J[0][0] + J[1][1]);
   284       StdI->ExIndx[StdI->NEx][0] = isite;
   285       StdI->ExIndx[StdI->NEx][1] = jsite;
   288       StdI->PairLift[StdI->NPairLift] = 0.25 * (J[0][0] - J[1][1]);
   289       StdI->PLIndx[StdI->NPairLift][0] = isite;
   290       StdI->PLIndx[StdI->NPairLift][1] = jsite;
   291       StdI->NPairLift += 1;
   298   Si = 0.5 * (double)Si2;
   299   Sj = 0.5 * (double)Sj2;
   301   for (ispin = 0; ispin <= Si2; ispin++) {
   302     Siz = (double)ispin - Si;
   303     for (jspin = 0; jspin <= Sj2; jspin++) {
   304       Sjz = (double)jspin - Sj;
   313         intr0 = J[2][2] * Siz * Sjz;
   315           isite, ispin, isite, ispin, jsite, jspin, jsite, jspin);
   328       if ((ispin < Si2 && jspin < Sj2) && ExGeneral == 1) {
   329         intr0 = 0.25 * std::complex<double>(J[0][0] + J[1][1], J[0][1] - J[1][0])
   330           * sqrt(Si * (Si + 1.0) - Siz * (Siz + 1.0))
   331           * sqrt(Sj * (Sj + 1.0) - Sjz * (Sjz + 1.0));
   333           isite, ispin + 1, isite, ispin, jsite, jspin, jsite, jspin + 1);
   335           isite, ispin, isite, ispin + 1, jsite, jspin + 1, jsite, jspin);
   348       if ((ispin < Si2 && jspin < Sj2) && ExGeneral == 1) {
   349         intr0 = 0.5 * 0.5 * std::complex<double>(J[0][0] - J[1][1], - (J[0][1] + J[1][0]))
   350           * sqrt(Si * (Si + 1.0) - Siz * (Siz + 1.0))
   351           * sqrt(Sj * (Sj + 1.0) - Sjz * (Sjz + 1.0));
   353           isite, ispin + 1, isite, ispin, jsite, jspin + 1, jsite, jspin);
   355           isite, ispin, isite, ispin + 1, jsite, jspin, jsite, jspin + 1);
   368         intr0 = 0.5 * std::complex<double>(J[0][2], - J[1][2]) * sqrt(Si * (Si + 1.0) - Siz * (Siz + 1.0)) * Sjz;
   370           isite, ispin + 1, isite, ispin, jsite, jspin, jsite, jspin);
   372           jsite, jspin, jsite, jspin, isite, ispin, isite, ispin + 1);
   385         intr0 = 0.5 * std::complex<double>(J[2][0], - J[2][1]) * Siz * sqrt(Sj * (Sj + 1.0) - Sjz * (Sjz + 1.0));
   387           isite, ispin, isite, ispin, jsite, jspin + 1, jsite, jspin);
   389           jsite, jspin, jsite, jspin + 1, isite, ispin, isite, ispin);
   401 struct StdIntList *StdI,
   407   StdI->Cinter[StdI->NCinter] = V;
   408   StdI->CinterIndx[StdI->NCinter][0] = isite;
   409   StdI->CinterIndx[StdI->NCinter][1] = jsite;
   424   if (std::isnan(*val) == 1) {
   426     fprintf(stdout, 
"  %15s = %-10.5f  ######  DEFAULT VALUE IS USED  ######\n", valname, *val);
   428   else fprintf(stdout, 
"  %15s = %-10.5f\n", valname, *val);
   443   if (std::isnan(*val) == 1) {
   447     if (std::isnan(val0) == 1) *val = val1;
   449     fprintf(stdout, 
"  %15s = %-10.5f  ######  DEFAULT VALUE IS USED  ######\n", valname, *val);
   451   else fprintf(stdout, 
"  %15s = %-10.5f\n", valname, *val);
   461   std::complex<double> *val,
   462   std::complex<double> val0
   465   if (std::isnan(real(*val)) == 1) {
   467     fprintf(stdout, 
"  %15s = %-10.5f %-10.5f  ######  DEFAULT VALUE IS USED  ######\n", valname, real(*val), imag(*val));
   469   else fprintf(stdout, 
"  %15s = %-10.5f %-10.5f\n", valname, real(*val), imag(*val));
   483   int NaN_i = 2147483647;
   487     fprintf(stdout, 
"  %15s = %-10d  ######  DEFAULT VALUE IS USED  ######\n", valname, *val);
   489   else fprintf(stdout, 
"  %15s = %-10d\n", valname, *val);
   501   if (std::isnan(val) == 0) {
   502     fprintf(stdout, 
"\n Check !  %s is SPECIFIED but will NOT be USED. \n", valname);
   503     fprintf(stdout, 
"            Please COMMENT-OUT this line \n");
   504     fprintf(stdout, 
"            or check this input is REALLY APPROPRIATE for your purpose ! \n\n");
   515   std::complex<double> val
   518   if (std::isnan(real(val)) == 0) {
   519     fprintf(stdout, 
"\n Check !  %s is SPECIFIED but will NOT be USED. \n", valname);
   520     fprintf(stdout, 
"            Please COMMENT-OUT this line \n");
   521     fprintf(stdout, 
"            or check this input is REALLY APPROPRIATE for your purpose ! \n\n");
   537   char Jname[3][3][10];
   539   sprintf(Jname[0][0], 
"%sx", valname);
   540   sprintf(Jname[0][1], 
"%sxy", valname);
   541   sprintf(Jname[0][2], 
"%sxz", valname);
   542   sprintf(Jname[1][0], 
"%syx", valname);
   543   sprintf(Jname[1][1], 
"%sy", valname);
   544   sprintf(Jname[1][2], 
"%syz", valname);
   545   sprintf(Jname[2][0], 
"%szx", valname);
   546   sprintf(Jname[2][1], 
"%szy", valname);
   547   sprintf(Jname[2][2], 
"%sz", valname);
   551   for (i1 = 0; i1 < 3; i1++) {
   552     for (i2 = 0; i2 < 3; i2++) {
   567   int NaN_i = 2147483647;
   570     fprintf(stdout, 
"\n Check !  %s is SPECIFIED but will NOT be USED. \n", valname);
   571     fprintf(stdout, 
"            Please COMMENT-OUT this line \n");
   572     fprintf(stdout, 
"            or check this input is REALLY APPROPRIATE for your purpose ! \n\n");
   586   int NaN_i = 2147483647;
   589     fprintf(stdout, 
"ERROR ! %s is NOT specified !\n", valname);
   592   else fprintf(stdout, 
"  %15s = %-3d\n", valname, val);
   600   struct StdIntList *StdI,
   607   int ii, jj, iCellV_frac[3];
   611   for (ii = 0; ii < 3; ii++) {
   613     for (jj = 0; jj < 3; jj++)iCellV_frac[ii] += StdI->rbox[ii][jj] * iCellV[jj];
   618   for (ii = 0; ii < 3; ii++)
   619     nBox[ii] = (iCellV_frac[ii] + StdI->NCell * 1000) / StdI->NCell - 1000;
   623   for (ii = 0; ii < 3; ii++)
   624     iCellV_frac[ii] -= StdI->NCell*(nBox[ii]);
   626   for (ii = 0; ii < 3; ii++) {
   628     for (jj = 0; jj < 3; jj++) iCellV_fold[ii] += StdI->box[jj][ii] * iCellV_frac[jj];
   629     iCellV_fold[ii] = (iCellV_fold[ii] + StdI->NCell * 1000) / StdI->NCell - 1000;
   637   struct StdIntList *StdI,
   642   int bound[3][2], edge, ii, jj;
   644   int nBox[3], iCellV_fold[3], iCellV[3];
   645   double pos[4][2], xmin, xmax;
   647   fprintf(stdout, 
"\n  @ Super-Lattice setting\n\n");
   652     (StdI->L != StdI->NaN_i || StdI->W != StdI->NaN_i || StdI->Height != StdI->NaN_i)
   654     (StdI->box[0][0] != StdI->NaN_i || StdI->box[0][1] != StdI->NaN_i || StdI->box[0][2] != StdI->NaN_i ||
   655      StdI->box[1][0] != StdI->NaN_i || StdI->box[1][1] != StdI->NaN_i || StdI->box[1][2] != StdI->NaN_i ||
   656      StdI->box[2][0] != StdI->NaN_i || StdI->box[2][1] != StdI->NaN_i || StdI->box[2][2] != StdI->NaN_i)
   659     fprintf(stdout, 
"\nERROR ! (L, W, Height) and (a0W, ..., a2H) conflict !\n\n");
   662   else if (StdI->L != StdI->NaN_i || StdI->W != StdI->NaN_i || StdI->Height != StdI->NaN_i)
   667     for (ii = 0; ii < 3; ii++) 
for (jj = 0; jj < 3; jj++)
   668       StdI->box[ii][jj] = 0;
   669     StdI->box[0][0] = StdI->W;
   670     StdI->box[1][1] = StdI->L;
   671     StdI->box[2][2] = StdI->Height;
   689     StdI->direct[0][2] = 0.0;
   690     StdI->direct[1][2] = 0.0;
   691     StdI->direct[2][0] = 0.0;
   692     StdI->direct[2][1] = 0.0;
   693     StdI->direct[2][2] = 1.0;
   699   if (dim == 2) StdI->phase[2] = 0.0;
   700   for (ii = 0; ii < 3; ii++) {
   701     StdI->ExpPhase[ii] = std::complex<double>(cos(StdI->pi180 * StdI->phase[ii]), sin(StdI->pi180 * StdI->phase[ii]));
   702     if (abs(StdI->ExpPhase[ii] + 1.0) < 0.000001) StdI->AntiPeriod[ii] = 1;
   703     else StdI->AntiPeriod[ii] = 0;
   708   StdI->tau = (
double **)malloc(
sizeof(
double*) * StdI->NsiteUC);
   709   for (ii = 0; ii < StdI->NsiteUC; ii++) {
   710     StdI->tau[ii] = (
double *)malloc(
sizeof(
double) * 3);
   717   for (ii = 0; ii < 3; ii++) {
   718     StdI->NCell += StdI->box[0][ii]
   719       * StdI->box[1][(ii + 1) % 3]
   720       * StdI->box[2][(ii + 2) % 3]
   722       * StdI->box[1][(ii + 2) % 3]
   723       * StdI->box[2][(ii + 1) % 3];
   725   printf(
"   Number of Cell = %d\n", abs(StdI->NCell));
   726   if (StdI->NCell == 0) {
   730   for (ii = 0; ii < 3; ii++) {
   731     for (jj = 0; jj < 3; jj++) {
   732       StdI->rbox[ii][jj] = StdI->box[(ii + 1) % 3][(jj + 1) % 3] * StdI->box[(ii + 2) % 3][(jj + 2) % 3]
   733                          - StdI->box[(ii + 1) % 3][(jj + 2) % 3] * StdI->box[(ii + 2) % 3][(jj + 1) % 3];
   736   if (StdI->NCell < 0) {
   737     for (ii = 0; ii < 3; ii++)
   738       for (jj = 0; jj < 3; jj++)
   739         StdI->rbox[ii][jj] *= -1;
   746   for (ii = 0; ii < 3; ii++) {
   749     for (nBox[2] = 0; nBox[2] < 2; nBox[2]++) {
   750       for (nBox[1] = 0; nBox[1] < 2; nBox[1]++) {
   751         for (nBox[0] = 0; nBox[0] < 2; nBox[0]++) {
   753           for (jj = 0; jj < 3; jj++) edge += nBox[jj] * StdI->box[jj][ii];
   754           if (edge < bound[ii][0]) bound[ii][0] = edge;
   755           if (edge > bound[ii][1]) bound[ii][1] = edge;
   763   StdI->Cell = (
int **)malloc(
sizeof(
int*) * StdI->NCell);
   764   for (ii = 0; ii < StdI->NCell; ii++) {
   765     StdI->Cell[ii] = (
int *)malloc(
sizeof(
int) * 3);
   768   for (iCellV[2] = bound[2][0]; iCellV[2] <= bound[2][1]; iCellV[2]++) {
   769     for (iCellV[1] = bound[1][0]; iCellV[1] <= bound[1][1]; iCellV[1]++) {
   770       for (iCellV[0] = bound[0][0]; iCellV[0] <= bound[0][1]; iCellV[0]++) {
   772         if (nBox[0] == 0 && nBox[1] == 0 && nBox[2] == 0) {
   773           for (ii = 0; ii < 3; ii++)
   774             StdI->Cell[jj][ii] = iCellV[ii];
   786     pos[1][0] = StdI->direct[0][0] * (double)StdI->box[0][0] + StdI->direct[1][0] * (
double)StdI->box[0][1];
   787     pos[1][1] = StdI->direct[0][1] * (double)StdI->box[0][0] + StdI->direct[1][1] * (
double)StdI->box[0][1];
   788     pos[2][0] = StdI->direct[0][0] * (double)StdI->box[1][0] + StdI->direct[1][0] * (
double)StdI->box[1][1];
   789     pos[2][1] = StdI->direct[0][1] * (double)StdI->box[1][0] + StdI->direct[1][1] * (
double)StdI->box[1][1];
   790     pos[3][0] = pos[1][0] + pos[2][0];
   791     pos[3][1] = pos[1][1] + pos[2][1];
   795     for (ipos = 0; ipos < 4; ipos++) {
   796       if (pos[ipos][0] < xmin) xmin = pos[ipos][0];
   797       if (pos[ipos][0] > xmax) xmax = pos[ipos][0];
   798       if (pos[ipos][1] < xmin) xmin = pos[ipos][1];
   799       if (pos[ipos][1] > xmax) xmax = pos[ipos][1];
   804     fprintf(fp, 
"#set terminal pdf color enhanced \\\n");
   805     fprintf(fp, 
"#dashed dl 1.0 size 20.0cm, 20.0cm \n");
   806     fprintf(fp, 
"#set output \"lattice.pdf\"\n");
   807     fprintf(fp, 
"set xrange [%f: %f]\n", xmin, xmax);
   808     fprintf(fp, 
"set yrange [%f: %f]\n", xmin, xmax);
   809     fprintf(fp, 
"set size square\n");
   810     fprintf(fp, 
"unset key\n");
   811     fprintf(fp, 
"unset tics\n");
   812     fprintf(fp, 
"unset border\n");
   814     fprintf(fp, 
"set style line 1 lc 1 lt 1\n");
   815     fprintf(fp, 
"set style line 2 lc 5 lt 1\n");
   816     fprintf(fp, 
"set style line 3 lc 0 lt 1\n");
   818     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead front ls 3\n", pos[0][0], pos[0][1], pos[1][0], pos[1][1]);
   819     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead front ls 3\n", pos[1][0], pos[1][1], pos[3][0], pos[3][1]);
   820     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead front ls 3\n", pos[3][0], pos[3][1], pos[2][0], pos[2][1]);
   821     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead front ls 3\n", pos[2][0], pos[2][1], pos[0][0], pos[0][1]);
   828   struct StdIntList *StdI,
   839   std::complex<double> *Cphase,
   843   int iCell, jCell, kCell, ii;
   844   int nBox[3], jCellV[3];
   846   dR[0] = - (double)diW + StdI->tau[isiteUC][0] - StdI->tau[jsiteUC][0];
   847   dR[1] = - (
double)diL + StdI->tau[isiteUC][1] - StdI->tau[jsiteUC][1];
   848   dR[2] = - (double)diH + StdI->tau[isiteUC][2] - StdI->tau[jsiteUC][2];
   850   jCellV[0] = iW + diW;
   851   jCellV[1] = iL + diL;
   852   jCellV[2] = iH + diH;
   855   for (ii = 0; ii < 3; ii++) *Cphase *= pow(StdI->ExpPhase[ii], (
double)nBox[ii]);
   857   for (kCell = 0; kCell < StdI->NCell; kCell++) {
   858     if (jCellV[0] == StdI->Cell[kCell][0] &&
   859         jCellV[1] == StdI->Cell[kCell][1] &&
   860         jCellV[2] == StdI->Cell[kCell][2]) 
   864     if (iW == StdI->Cell[kCell][0] &&
   865         iL == StdI->Cell[kCell][1] &&
   866         iH == StdI->Cell[kCell][2])
   871   *isite = iCell * StdI->NsiteUC + isiteUC;
   872   *jsite = jCell * StdI->NsiteUC + jsiteUC;
   873   if (strcmp(StdI->model, 
"kondo") == 0) {
   874     *isite += StdI->NCell * StdI->NsiteUC;
   875     *jsite += StdI->NCell * StdI->NsiteUC;
   882   struct StdIntList *StdI,
   893   std::complex<double> *Cphase,
   897   double xi, yi, xj, yj;
   901   StdFace_FindSite(StdI, iW, iL, 0, -diW, -diL, 0, jsiteUC, isiteUC, isite, jsite, Cphase, dR);
   903   xi = StdI->direct[0][0] * ((double)iW + StdI->tau[jsiteUC][0])
   904      + StdI->direct[1][0] * ((double)iL + StdI->tau[jsiteUC][1]);
   905   yi = StdI->direct[0][1] * ((double)iW + StdI->tau[jsiteUC][0])
   906      + StdI->direct[1][1] * ((double)iL + StdI->tau[jsiteUC][1]);
   908   xj = StdI->direct[0][0] * ((double)(iW - diW) + StdI->tau[isiteUC][0])
   909      + StdI->direct[1][0] * ((
double)(iL - diL) + StdI->tau[isiteUC][1]);
   910   yj = StdI->direct[0][1] * ((double)(iW - diW) + StdI->tau[isiteUC][0])
   911      + StdI->direct[1][1] * ((
double)(iL - diL) + StdI->tau[isiteUC][1]);
   913   if (*isite < 10)fprintf(fp, 
"set label \"%1d\" at %f, %f center front\n", *isite, xi, yi);
   914   else            fprintf(fp, 
"set label \"%2d\" at %f, %f center front\n", *isite, xi, yi);
   915   if (*jsite < 10)fprintf(fp, 
"set label \"%1d\" at %f, %f center front\n", *jsite, xj, yj);
   916   else            fprintf(fp, 
"set label \"%2d\" at %f, %f center front\n", *jsite, xj, yj);
   918     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead ls %d\n", xi, yi, xj, yj, connect);
   922   StdFace_FindSite(StdI, iW, iL, 0, diW, diL, 0, isiteUC, jsiteUC, isite, jsite, Cphase, dR);
   924   xi = StdI->direct[1][0] * ((double)iL + StdI->tau[isiteUC][1])
   925      + StdI->direct[0][0] * ((double)iW + StdI->tau[isiteUC][0]);
   926   yi = StdI->direct[1][1] * ((double)iL + StdI->tau[isiteUC][1])
   927      + StdI->direct[0][1] * ((double)iW + StdI->tau[isiteUC][0]);
   929   xj = StdI->direct[0][0] * ((double)(iW + diW) + StdI->tau[jsiteUC][0])
   930      + StdI->direct[1][0] * ((
double)(iL + diL) + StdI->tau[jsiteUC][1]);
   931   yj = StdI->direct[0][1] * ((double)(iW + diW) + StdI->tau[jsiteUC][0])
   932      + StdI->direct[1][1] * ((
double)(iL + diL) + StdI->tau[jsiteUC][1]);
   934   if (*isite < 10)fprintf(fp, 
"set label \"%1d\" at %f, %f center front\n", *isite, xi, yi);
   935   else            fprintf(fp, 
"set label \"%2d\" at %f, %f center front\n", *isite, xi, yi);
   936   if (*jsite < 10)fprintf(fp, 
"set label \"%1d\" at %f, %f center front\n", *jsite, xj, yj);
   937   else            fprintf(fp, 
"set label \"%2d\" at %f, %f center front\n", *jsite, xj, yj);
   939     fprintf(fp, 
"set arrow from %f, %f to %f, %f nohead ls %d\n", xi, yi, xj, yj, connect);
   946   int ii, jj, kk, isite, iCell;
   949   fp = fopen(
"lattice.xsf", 
"w");
   950   fprintf(fp, 
"CRYSTAL\n");
   951   fprintf(fp, 
"PRIMVEC\n");
   952   for (ii = 0; ii < 3; ii++) {
   953     for (jj = 0; jj < 3; jj++) {
   955       for (kk = 0; kk < 3; kk++)
   956         vec[jj] += (
double)StdI->box[ii][kk] * StdI->direct[kk][jj];
   958     fprintf(fp, 
"%15.5f %15.5f %15.5f\n", vec[0], vec[1], vec[2]);
   960   fprintf(fp, 
"PRIMCOORD\n");
   961   fprintf(fp, 
"%d 1\n", StdI->NCell * StdI->NsiteUC);
   962   for (iCell = 0; iCell < StdI->NCell; iCell++) {
   963     for (isite = 0; isite < StdI->NsiteUC; isite++) {
   964       for (jj = 0; jj < 3; jj++) {
   966         for (kk = 0; kk < 3; kk++)
   967           vec[jj] += ((
double)StdI->Cell[iCell][kk] + StdI->tau[isite][kk])
   968           * StdI->direct[kk][jj];
   970       fprintf(fp, 
"H %15.5f %15.5f %15.5f\n", vec[0], vec[1], vec[2]);
   988   char Jname[3][3][10]; 
   990   strcpy(Jname[0][0], 
"x\0");
   991   strcpy(Jname[0][1], 
"xy\0");
   992   strcpy(Jname[0][2], 
"xz\0");
   993   strcpy(Jname[1][0], 
"yx\0");
   994   strcpy(Jname[1][1], 
"y\0");
   995   strcpy(Jname[1][2], 
"yz\0");
   996   strcpy(Jname[2][0], 
"zx\0");
   997   strcpy(Jname[2][1], 
"zy\0");
   998   strcpy(Jname[2][2], 
"z\0");
  1000   if (std::isnan(JAll) == 0 && std::isnan(J0All)  == 0) {
  1001     fprintf(stdout, 
"\n ERROR! %s conflict !\n\n", J0name);
  1004   for (i1 = 0; i1 < 3; i1++) {
  1005     for (i2 = 0; i2 < 3; i2++) {
  1006       if (std::isnan(JAll) == 0 && std::isnan(J[i1][i2]) == 0) {
  1007         fprintf(stdout, 
"\n ERROR! J%s conflict !\n\n", Jname[i1][i2]);
  1010       else if (std::isnan(J0All) == 0 && std::isnan(J[i1][i2]) == 0) {
  1011         fprintf(stdout, 
"\n ERROR! %s and J%s conflict !\n\n",
  1012           J0name, Jname[i1][i2]);
  1015       else if (std::isnan(J0All) == 0 && std::isnan(J0[i1][i2]) == 0) {
  1016         fprintf(stdout, 
"\n ERROR! %s and %s%s conflict !\n\n", J0name,
  1017           J0name, Jname[i1][i2]);
  1020       else if (std::isnan(J0[i1][i2]) == 0 && std::isnan(JAll) == 0) {
  1021         fprintf(stdout, 
"\n ERROR! %s%s conflict !\n\n",
  1022           J0name, Jname[i1][i2]);
  1028   for (i1 = 0; i1 < 3; i1++) {
  1029     for (i2 = 0; i2 < 3; i2++) {
  1030       for (i3 = 0; i3 < 3; i3++) {
  1031         for (i4 = 0; i4 < 3; i4++) {
  1032           if (std::isnan(J0[i1][i2]) == 0 && std::isnan(J[i3][i4]) == 0) {
  1033             fprintf(stdout, 
"\n ERROR! %s%s and J%s conflict !\n\n", 
  1034               J0name, Jname[i1][i2], Jname[i3][i4]);
  1042   for (i1 = 0; i1 < 3; i1++) {
  1043     for (i2 = 0; i2 < 3; i2++) {
  1044       if (std::isnan(J0[i1][i2]) == 0)
  1045         fprintf(stdout, 
"  %14s%s = %-10.5f\n", J0name, Jname[i1][i2], J0[i1][i2]);
  1046       else if (std::isnan(J[i1][i2]) == 0) {
  1047         J0[i1][i2] = J[i1][i2];
  1048         fprintf(stdout, 
"  %14s%s = %-10.5f\n", J0name, Jname[i1][i2], J0[i1][i2]);
  1050       else if (i1 == i2 && std::isnan(J0All) == 0) {
  1052         fprintf(stdout, 
"  %14s%s = %-10.5f\n", J0name, Jname[i1][i2], J0[i1][i2]);
  1054       else if (i1 == i2 && std::isnan(JAll) == 0) {
  1056         fprintf(stdout, 
"  %14s%s = %-10.5f\n", J0name, Jname[i1][i2], J0[i1][i2]);
  1074   char Jname[3][3][10];
  1076   strcpy(Jname[0][0], 
"x\0");
  1077   strcpy(Jname[0][1], 
"xy\0");
  1078   strcpy(Jname[0][2], 
"xz\0");
  1079   strcpy(Jname[1][0], 
"yx\0");
  1080   strcpy(Jname[1][1], 
"y\0");
  1081   strcpy(Jname[1][2], 
"yz\0");
  1082   strcpy(Jname[2][0], 
"zx\0");
  1083   strcpy(Jname[2][1], 
"zy\0");
  1084   strcpy(Jname[2][2], 
"z\0");
  1086   for (i1 = 0; i1 < 3; i1++) {
  1087     for (i2 = 0; i2 < 3; i2++) {
  1088       if (std::isnan(JpAll) == 0 && std::isnan(Jp[i1][i2]) == 0) {
  1089         fprintf(stdout, 
"\n ERROR! %s and %s%s conflict !\n\n", Jpname,
  1090           Jpname, Jname[i1][i2]);
  1096   for (i1 = 0; i1 < 3; i1++) {
  1097     for (i2 = 0; i2 < 3; i2++) {
  1098       if (std::isnan(Jp[i1][i2]) == 0)
  1099         fprintf(stdout, 
"  %14s%s = %-10.5f\n", Jpname, Jname[i1][i2], Jp[i1][i2]);
  1100       else if (i1 == i2 && std::isnan(JpAll) == 0) {
  1102         fprintf(stdout, 
"  %14s%s = %-10.5f\n", Jpname, Jname[i1][i2], Jp[i1][i2]);
  1121   if (std::isnan(V) == 0 && std::isnan(*V0) == 0) {
  1122     fprintf(stdout, 
"\n ERROR! %s conflicts !\n\n", V0name);
  1125   else if (std::isnan(*V0) == 0)
  1126     fprintf(stdout, 
"  %15s = %-10.5f\n", V0name, *V0);
  1127   else if (std::isnan(V) == 0) {
  1129     fprintf(stdout, 
"  %15s = %-10.5f\n", V0name, *V0);
  1141   std::complex<double> t,
  1142   std::complex<double> *t0,
  1146   if (std::isnan(real(t)) == 0 && std::isnan(real(*t0)) == 0) {
  1147     fprintf(stdout, 
"\n ERROR! %s conflicts !\n\n", t0name);
  1150   else if (std::isnan(real(*t0)) == 0)
  1151     fprintf(stdout, 
"  %15s = %-10.5f %-10.5f\n", t0name, real(*t0), imag(*t0));
  1152   else if (std::isnan(real(t)) == 0) {
  1154     fprintf(stdout, 
"  %15s = %-10.5f %-10.5f\n", t0name, real(*t0), imag(*t0));
  1165   int isite, iCell, ii;
  1167   fp = fopen(
"geometry.dat", 
"w");
  1169   for (ii = 0; ii < 3; ii++) 
  1170     fprintf(fp, 
"%25.15e %25.15e %25.15e\n", 
  1171       StdI->direct[ii][0], StdI->direct[ii][1], StdI->direct[ii][2]);
  1172   fprintf(fp, 
"%25.15e %25.15e %25.15e\n", 
  1173     StdI->phase[0], StdI->phase[1], StdI->phase[2]);
  1174   for (ii = 0; ii < 3; ii++)
  1175     fprintf(fp, 
"%d %d %d\n",
  1176       StdI->box[ii][0], StdI->box[ii][1], StdI->box[ii][2]);
  1178   for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1179     for (isite = 0; isite < StdI->NsiteUC; isite++) {
  1180       fprintf(fp, 
"%d %d %d %d\n",
  1181         StdI->Cell[iCell][0] - StdI->Cell[0][0],
  1182         StdI->Cell[iCell][1] - StdI->Cell[0][1],
  1183         StdI->Cell[iCell][2] - StdI->Cell[0][2],
  1187   if (strcmp(StdI->model, 
"kondo") == 0) {
  1188     for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1189       for (isite = 0; isite < StdI->NsiteUC; isite++) {
  1190         fprintf(fp, 
"%d %d %d %d\n",
  1191           StdI->Cell[iCell][0] - StdI->Cell[0][0],
  1192           StdI->Cell[iCell][1] - StdI->Cell[0][1],
  1193           StdI->Cell[iCell][2] - StdI->Cell[0][2],
  1194           isite + StdI->NsiteUC);
  1205   struct StdIntList *StdI,
  1216   StdI->transindx = (
int **)malloc(
sizeof(
int*) * ntransMax);
  1217   StdI->trans = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * ntransMax);
  1218   for (ii = 0; ii < ntransMax; ii++) {
  1219     StdI->transindx[ii] = (
int *)malloc(
sizeof(
int) * 4);
  1223   if (strcmp(StdI->method, 
"timeevolution") == 0 && StdI->PumpBody == 1) {
  1224     StdI->npump = (
int *)malloc(
sizeof(
int) * StdI->Lanczos_max);
  1225     StdI->pumpindx = (
int ***)malloc(
sizeof(
int**) * StdI->Lanczos_max);
  1226     StdI->pump = (std::complex<double> **)malloc(
sizeof(std::complex<double>*) * StdI->Lanczos_max);
  1227     for (it = 0; it < StdI->Lanczos_max; it++) {
  1228       StdI->npump[it] = 0;
  1229       StdI->pumpindx[it] = (
int **)malloc(
sizeof(
int*) * ntransMax);
  1230       StdI->pump[it] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * ntransMax);
  1231       for (ii = 0; ii < ntransMax; ii++) {
  1232         StdI->pumpindx[it][ii] = (
int *)malloc(
sizeof(
int) * 4);
  1240   StdI->intrindx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1241   StdI->intr = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * nintrMax);
  1242   for (ii = 0; ii < nintrMax; ii++) {
  1243     StdI->intrindx[ii] = (
int *)malloc(
sizeof(
int) * 8);
  1249   StdI->CintraIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1250   StdI->Cintra = (
double *)malloc(
sizeof(
double) * nintrMax);
  1251   for (ii = 0; ii < nintrMax; ii++) {
  1252     StdI->CintraIndx[ii] = (
int *)malloc(
sizeof(
int) * 1);
  1258   StdI->CinterIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1259   StdI->Cinter = (
double *)malloc(
sizeof(
double) * nintrMax);
  1260   for (ii = 0; ii < nintrMax; ii++) {
  1261     StdI->CinterIndx[ii] = (
int *)malloc(
sizeof(
int) * 2);
  1267   StdI->HundIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1268   StdI->Hund = (
double *)malloc(
sizeof(
double) * nintrMax);
  1269   for (ii = 0; ii < nintrMax; ii++) {
  1270     StdI->HundIndx[ii] = (
int *)malloc(
sizeof(
int) * 2);
  1276   StdI->ExIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1277   StdI->Ex = (
double *)malloc(
sizeof(
double) * nintrMax);
  1278   for (ii = 0; ii < nintrMax; ii++) {
  1279     StdI->ExIndx[ii] = (
int *)malloc(
sizeof(
int) * 2);
  1285   StdI->PLIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1286   StdI->PairLift = (
double *)malloc(
sizeof(
double) * nintrMax);
  1287   for (ii = 0; ii < nintrMax; ii++) {
  1288     StdI->PLIndx[ii] = (
int *)malloc(
sizeof(
int) * 2);
  1290   StdI->NPairLift = 0;
  1294   StdI->PHIndx = (
int **)malloc(
sizeof(
int*) * nintrMax);
  1295   StdI->PairHopp = (
double *)malloc(
sizeof(
double) * nintrMax);
  1296   for (ii = 0; ii < nintrMax; ii++) {
  1297     StdI->PHIndx[ii] = (
int *)malloc(
sizeof(
int) * 2);
  1299   StdI->NPairHopp = 0;
  1306 static void StdFace_FoldSiteSub(
  1307   struct StdIntList *StdI,
  1313   int ii, jj, iCellV_frac[3];
  1317   for (ii = 0; ii < 3; ii++) {
  1318     iCellV_frac[ii] = 0;
  1319     for (jj = 0; jj < 3; jj++)iCellV_frac[ii] += StdI->rboxsub[ii][jj] * iCellV[jj];
  1324   for (ii = 0; ii < 3; ii++)
  1325     nBox[ii] = (iCellV_frac[ii] + StdI->NCellsub * 1000) / StdI->NCellsub - 1000;
  1329   for (ii = 0; ii < 3; ii++)
  1330     iCellV_frac[ii] -= StdI->NCellsub*(nBox[ii]);
  1332   for (ii = 0; ii < 3; ii++) {
  1333     iCellV_fold[ii] = 0;
  1334     for (jj = 0; jj < 3; jj++) iCellV_fold[ii] += StdI->boxsub[jj][ii] * iCellV_frac[jj];
  1335     iCellV_fold[ii] = (iCellV_fold[ii] + StdI->NCellsub * 1000) / StdI->NCellsub - 1000;
  1342 void StdFace_Proj(
struct StdIntList *StdI)
  1345   int jsite, iCell, jCell, kCell;
  1346   int nBox[3], iCellV[3], jCellV[3], ii;
  1350   Sym = (
int **)malloc(
sizeof(
int*) * StdI->nsite);
  1351   Anti = (
int **)malloc(
sizeof(
int*) * StdI->nsite);
  1352   for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1353     Sym[jsite] = (
int *)malloc(
sizeof(
int) * StdI->nsite);
  1354     Anti[jsite] = (
int *)malloc(
sizeof(
int) * StdI->nsite);
  1360   for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1362     StdFace_FoldSiteSub(StdI, StdI->Cell[iCell], nBox, iCellV);
  1366     if (iCellV[0] == StdI->Cell[iCell][0] && 
  1367         iCellV[1] == StdI->Cell[iCell][1] && 
  1368         iCellV[2] == StdI->Cell[iCell][2]) {
  1372       for (jCell = 0; jCell < StdI->NCell; jCell++) {
  1374         for (ii = 0; ii < 3; ii++)jCellV[ii] = StdI->Cell[jCell][ii] + iCellV[ii];
  1377         for (kCell = 0; kCell < StdI->NCell; kCell++) {
  1378           if (jCellV[0] == StdI->Cell[kCell][0] && 
  1379               jCellV[1] == StdI->Cell[kCell][1] &&
  1380               jCellV[2] == StdI->Cell[kCell][2]) 
  1383             for (jsite = 0; jsite < StdI->NsiteUC; jsite++) {
  1385               Sym[StdI->NSym][jCell*StdI->NsiteUC + jsite] = kCell*StdI->NsiteUC + jsite;
  1386               Anti[StdI->NSym][jCell*StdI->NsiteUC + jsite]
  1387                 = StdI->AntiPeriod[0] * nBox[0]
  1388                 + StdI->AntiPeriod[1] * nBox[1]
  1389                 + StdI->AntiPeriod[2] * nBox[2];
  1391               if (strcmp(StdI->model, 
"kondo") == 0) {
  1392                 Sym[StdI->NSym][StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite] = StdI->nsite / 2 + kCell*StdI->NsiteUC + jsite;
  1393                 Anti[StdI->NSym][StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite]
  1394                   = StdI->AntiPeriod[0] * nBox[0]
  1395                   + StdI->AntiPeriod[1] * nBox[1]
  1396                   + StdI->AntiPeriod[2] * nBox[2];
  1408   fp = fopen(
"qptransidx.def", 
"w");
  1409   fprintf(fp, 
"=============================================\n");
  1410   fprintf(fp, 
"NQPTrans %10d\n", StdI->NSym);
  1411   fprintf(fp, 
"=============================================\n");
  1412   fprintf(fp, 
"======== TrIdx_TrWeight_and_TrIdx_i_xi ======\n");
  1413   fprintf(fp, 
"=============================================\n");
  1414   for (iSym = 0; iSym < StdI->NSym; iSym++) {
  1415     fprintf(fp, 
"%d %10.5f\n", iSym, 1.0);
  1417   for (iSym = 0; iSym < StdI->NSym; iSym++) {
  1418     for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1419       if (Anti[iSym][jsite] % 2 == 0) Anti[iSym][jsite] = 1;
  1420       else Anti[iSym][jsite] = -1;
  1421       if (StdI->AntiPeriod[0] == 1 || StdI->AntiPeriod[1] == 1 || StdI->AntiPeriod[2] == 1) {
  1422         fprintf(fp, 
"%5d  %5d  %5d  %5d\n", iSym, jsite, Sym[iSym][jsite], Anti[iSym][jsite]);
  1425         fprintf(fp, 
"%5d  %5d  %5d\n", iSym, jsite, Sym[iSym][jsite]);
  1431   fprintf(stdout, 
"    qptransidx.def is written.\n");
  1433   for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1444 static void StdFace_InitSiteSub(
struct StdIntList *StdI)
  1446   int ii, jj, kk, prod;
  1450   if ((StdI->Lsub != StdI->NaN_i || StdI->Wsub != StdI->NaN_i || StdI->Hsub != StdI->NaN_i)
  1451     && (StdI->boxsub[0][0] != StdI->NaN_i || StdI->boxsub[0][1] != StdI->NaN_i || StdI->boxsub[0][2] != StdI->NaN_i ||
  1452         StdI->boxsub[1][0] != StdI->NaN_i || StdI->boxsub[1][1] != StdI->NaN_i || StdI->boxsub[1][2] != StdI->NaN_i ||
  1453         StdI->boxsub[2][0] != StdI->NaN_i || StdI->boxsub[2][1] != StdI->NaN_i || StdI->boxsub[2][2] != StdI->NaN_i))
  1455     fprintf(stdout, 
"\nERROR ! (Lsub, Wsub, Hsub) and (a0Wsub, ..., a2Hsub) conflict !\n\n");
  1458   else if (StdI->Wsub != StdI->NaN_i || StdI->Lsub != StdI->NaN_i || StdI->Hsub != StdI->NaN_i) {
  1462     for (ii = 0; ii < 3; ii++) 
for (jj = 0; jj < 3; jj++)
  1463       StdI->boxsub[ii][jj] = 0;
  1464     StdI->boxsub[0][0] = StdI->Wsub;
  1465     StdI->boxsub[1][1] = StdI->Lsub;
  1466     StdI->boxsub[2][2] = StdI->Hsub;
  1483   for (ii = 0; ii < 3; ii++) {
  1484     StdI->NCellsub += StdI->boxsub[0][ii]
  1485                     * StdI->boxsub[1][(ii + 1) % 3]
  1486                     * StdI->boxsub[2][(ii + 2) % 3]
  1487                     - StdI->boxsub[0][ii]
  1488                     * StdI->boxsub[1][(ii + 2) % 3]
  1489                     * StdI->boxsub[2][(ii + 1) % 3];
  1491   printf(
"         Number of Cell in the sublattice: %d\n", abs(StdI->NCellsub));
  1492   if (StdI->NCellsub == 0) {
  1496   for (ii = 0; ii < 3; ii++) {
  1497     for (jj = 0; jj < 3; jj++) {
  1498       StdI->rboxsub[ii][jj] = StdI->boxsub[(ii + 1) % 3][(jj + 1) % 3] * StdI->boxsub[(ii + 2) % 3][(jj + 2) % 3]
  1499                             - StdI->boxsub[(ii + 1) % 3][(jj + 2) % 3] * StdI->boxsub[(ii + 2) % 3][(jj + 1) % 3];
  1502   if (StdI->NCellsub < 0) {
  1503     for (ii = 0; ii < 3; ii++)
  1504       for (jj = 0; jj < 3; jj++)
  1505         StdI->rboxsub[ii][jj] *= -1;
  1506     StdI->NCellsub *= -1;
  1511   for (ii = 0; ii < 3; ii++) {
  1512     for (jj = 0; jj < 3; jj++) {
  1514       for (kk = 0; kk < 3; kk++) prod += StdI->rboxsub[ii][kk] * (
double)StdI->box[jj][kk];
  1515       if (prod % StdI->NCellsub != 0) {
  1516         printf(
"\n ERROR ! Sublattice is INCOMMENSURATE !\n\n");
  1525 void StdFace_generate_orb(
struct StdIntList *StdI) {
  1526   int iCell, jCell, kCell, iCell2, jCell2, iOrb, isite, jsite, Anti;
  1527   int nBox[3], iCellV[3], jCellV[3], dCellV[3], ii;
  1530   StdFace_InitSiteSub(StdI);
  1532   StdI->Orb = (
int **)malloc(
sizeof(
int*) * StdI->nsite);
  1533   StdI->AntiOrb = (
int **)malloc(
sizeof(
int*) * StdI->nsite);
  1534   for (isite = 0; isite < StdI->nsite; isite++) {
  1535     StdI->Orb[isite] = (
int *)malloc(
sizeof(
int) * StdI->nsite);
  1536     StdI->AntiOrb[isite] = (
int *)malloc(
sizeof(
int) * StdI->nsite);
  1538   CellDone = (
int **)malloc(
sizeof(
int*) * StdI->NCell);
  1539   for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1540     CellDone[iCell] = (
int *)malloc(
sizeof(
int) * StdI->NCell);
  1541     for (jCell = 0; jCell < StdI->NCell; jCell++) {
  1542       CellDone[iCell][jCell] = 0;
  1547   for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1549     StdFace_FoldSiteSub(StdI, StdI->Cell[iCell], nBox, iCellV);
  1553     for (kCell = 0; kCell < StdI->NCell; kCell++) {
  1554       if (iCellV[0] == StdI->Cell[kCell][0] && 
  1555           iCellV[1] == StdI->Cell[kCell][1] &&
  1556           iCellV[2] == StdI->Cell[kCell][2]) 
  1562     for (jCell = 0; jCell < StdI->NCell; jCell++) {
  1564       for (ii = 0; ii < 3; ii++)
  1565         jCellV[ii] = StdI->Cell[jCell][ii] + iCellV[ii] - StdI->Cell[iCell][ii];
  1569       for (kCell = 0; kCell < StdI->NCell; kCell++) {
  1570         if (jCellV[0] == StdI->Cell[kCell][0] &&
  1571             jCellV[1] == StdI->Cell[kCell][1] &&
  1572             jCellV[2] == StdI->Cell[kCell][2]) 
  1580       for (ii = 0; ii < 3; ii++)
  1581         dCellV[ii] = StdI->Cell[jCell][ii] - StdI->Cell[iCell][ii];
  1584       for (ii = 0; ii < 3; ii++)Anti += StdI->AntiPeriod[ii] * nBox[ii];
  1585       if (Anti % 2 == 0) Anti = 1;
  1588       for (isite = 0; isite < StdI->NsiteUC; isite++) {
  1589         for (jsite = 0; jsite < StdI->NsiteUC; jsite++) {
  1591           if (CellDone[iCell2][jCell2] == 0) {
  1592             StdI->Orb[iCell2*StdI->NsiteUC + isite][jCell2*StdI->NsiteUC + jsite] = iOrb;
  1593             StdI->AntiOrb[iCell2*StdI->NsiteUC + isite][jCell2*StdI->NsiteUC + jsite] = Anti;
  1596           StdI->Orb[iCell*StdI->NsiteUC + isite][jCell*StdI->NsiteUC + jsite]
  1597             = StdI->Orb[iCell2*StdI->NsiteUC + isite][jCell2*StdI->NsiteUC + jsite];
  1598           StdI->AntiOrb[iCell*StdI->NsiteUC + isite][jCell*StdI->NsiteUC + jsite] = Anti;
  1600           if (strcmp(StdI->model, 
"kondo") == 0) {
  1601             if (CellDone[iCell2][jCell2] == 0) {
  1602               StdI->Orb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1603                        [                  jCell2*StdI->NsiteUC + jsite] = iOrb;
  1604               StdI->AntiOrb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1605                            [                  jCell2*StdI->NsiteUC + jsite] = Anti;
  1607               StdI->Orb[                  iCell2*StdI->NsiteUC + isite]
  1608                        [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite] = iOrb;
  1609               StdI->AntiOrb[                  iCell2*StdI->NsiteUC + isite]
  1610                            [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite] = Anti;
  1612               StdI->Orb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1613                        [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite] = iOrb;
  1614               StdI->AntiOrb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1615                            [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite] = Anti;
  1618             StdI->Orb[StdI->nsite / 2 + iCell*StdI->NsiteUC + isite]
  1619                      [                  jCell*StdI->NsiteUC + jsite]
  1620             = StdI->Orb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1621                        [                  jCell2*StdI->NsiteUC + jsite];
  1622             StdI->AntiOrb[StdI->nsite / 2 + iCell*StdI->NsiteUC + isite]
  1623                          [                  jCell*StdI->NsiteUC + jsite] = Anti;
  1624             StdI->Orb[                  iCell*StdI->NsiteUC + isite]
  1625                      [StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite]
  1626             = StdI->Orb[                  iCell2*StdI->NsiteUC + isite]
  1627                        [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite];
  1628             StdI->AntiOrb[iCell*StdI->NsiteUC + isite]
  1629                          [StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite] = Anti;
  1630             StdI->Orb[StdI->nsite / 2 + iCell*StdI->NsiteUC + isite]
  1631                      [StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite]
  1632               = StdI->Orb[StdI->nsite / 2 + iCell2*StdI->NsiteUC + isite]
  1633                          [StdI->nsite / 2 + jCell2*StdI->NsiteUC + jsite];
  1634               StdI->AntiOrb[StdI->nsite / 2 + iCell*StdI->NsiteUC + isite]
  1635                            [StdI->nsite / 2 + jCell*StdI->NsiteUC + jsite] = Anti;
  1640       CellDone[iCell2][jCell2] = 1;
  1646   for (iCell = 0; iCell < StdI->NCell; iCell++) free(CellDone[iCell]);
  1653 void PrintJastrow(
struct StdIntList *StdI) {
  1655   int isite, jsite, isiteUC, jsiteUC, revarsal, isite1, jsite1, iorb;
  1656   int NJastrow, iJastrow;
  1659   std::complex<double> Cphase;
  1662   Jastrow = (
int **)malloc(
sizeof(
int*) * StdI->nsite);
  1663   for (isite = 0; isite < StdI->nsite; isite++) 
  1664     Jastrow[isite] = (
int *)malloc(
sizeof(
int) * StdI->nsite);
  1666   if (abs(StdI->NMPTrans) == 1 || StdI->NMPTrans == StdI->NaN_i) {
  1670     for (isite = 0; isite < StdI->nsite; isite++) {
  1671       for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1672         Jastrow[isite][jsite] = StdI->Orb[isite][jsite];
  1678     for (iorb = 0; iorb < StdI->NOrb; iorb++) {
  1679       for (isite = 0; isite < StdI->nsite; isite++) {
  1680         for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1681           if (Jastrow[isite][jsite] == iorb) {
  1682             Jastrow[jsite][isite] = Jastrow[isite][jsite];
  1688     if (strcmp(StdI->model, 
"hubbard") == 0) NJastrow = 0;
  1690     for (isite = 0; isite < StdI->nsite; isite++) {
  1694       if (StdI->locspinflag[isite] != 0) {
  1695         for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1696           Jastrow[isite][jsite] = -1;
  1697           Jastrow[jsite][isite] = -1;
  1702       for (jsite = 0; jsite < isite; jsite++) {
  1703         if (Jastrow[isite][jsite] >= 0) {
  1704           iJastrow = Jastrow[isite][jsite];
  1706           for (isite1 = 0; isite1 < StdI->nsite; isite1++) {
  1707             for (jsite1 = 0; jsite1 < StdI->nsite; jsite1++) {
  1708               if (Jastrow[isite1][jsite1] == iJastrow)
  1709                 Jastrow[isite1][jsite1] = NJastrow;
  1716     NJastrow = -NJastrow;
  1717     for (isite = 0; isite < StdI->nsite; isite++) {
  1718       for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1719         Jastrow[isite][jsite] = -1 - Jastrow[isite][jsite];
  1725     if (strcmp(StdI->model, 
"spin") == 0) {
  1728       for (isite = 0; isite < StdI->nsite; isite++) {
  1729         for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1730           Jastrow[isite][jsite] = 0;
  1738       if (strcmp(StdI->model, 
"kondo") == 0) {
  1742         for (isite = 0; isite < StdI->nsite; isite++) {
  1743           for (jsite = 0; jsite < StdI->nsite / 2; jsite++) {
  1744             Jastrow[isite][jsite] = 0;
  1745             Jastrow[jsite][isite] = 0;
  1752       for (dCell = 0; dCell < StdI->NCell; dCell++) {
  1755           -StdI->Cell[dCell][0], -StdI->Cell[dCell][1], -StdI->Cell[dCell][2],
  1756           0, 0, &isite, &jsite, &Cphase, dR);
  1757         if (strcmp(StdI->model, 
"kondo") == 0) jsite += -StdI->NCell * StdI->NsiteUC;
  1758         iCell = jsite / StdI->NsiteUC;
  1759         if (iCell < dCell) {
  1765         else if (iCell == dCell) {
  1773         for (isiteUC = 0; isiteUC < StdI->NsiteUC; isiteUC++) {
  1774           for (jsiteUC = 0; jsiteUC < StdI->NsiteUC; jsiteUC++) {
  1775             if (revarsal == 1 && jsiteUC > isiteUC) 
continue;
  1776             if (isiteUC == jsiteUC &&
  1777               StdI->Cell[dCell][0] == 0 &&
  1778               StdI->Cell[dCell][1] == 0 &&
  1779               StdI->Cell[dCell][2] == 0) 
continue;
  1781             for (iCell = 0; iCell < StdI->NCell; iCell++) {
  1783                 StdI->Cell[iCell][0], StdI->Cell[iCell][1], StdI->Cell[iCell][2],
  1784                 StdI->Cell[dCell][0], StdI->Cell[dCell][1], StdI->Cell[dCell][2],
  1785                 isiteUC, jsiteUC, &isite, &jsite, &Cphase, dR);
  1787               Jastrow[isite][jsite] = NJastrow;
  1788               Jastrow[jsite][isite] = NJastrow;
  1800   fp = fopen(
"jastrowidx.def", 
"w");
  1801   fprintf(fp, 
"=============================================\n");
  1802   fprintf(fp, 
"NJastrowIdx %10d\n", NJastrow);
  1803   fprintf(fp, 
"ComplexType %10d\n", 0);
  1804   fprintf(fp, 
"=============================================\n");
  1805   fprintf(fp, 
"=============================================\n");
  1807   for (isite = 0; isite < StdI->nsite; isite++) {
  1808     for (jsite = 0; jsite < StdI->nsite; jsite++) {
  1809       if (isite == jsite) 
continue;
  1810       fprintf(fp, 
"%5d  %5d  %5d\n", isite, jsite, Jastrow[isite][jsite]);
  1814   for (iJastrow = 0; iJastrow < NJastrow; iJastrow++){
  1815     if (strcmp(StdI->model, 
"hubbard") == 0 || iJastrow > 0)
  1816       fprintf(fp, 
"%5d  %5d\n", iJastrow, 1);
  1818       fprintf(fp, 
"%5d  %5d\n", iJastrow, 0);
  1822   fprintf(stdout, 
"    jastrowidx.def is written.\n");
  1824   for (isite = 0; isite < StdI->nsite; isite++) free(Jastrow[isite]);
 void StdFace_InputHopp(std::complex< double > t, std::complex< double > *t0, const char *t0name)
Input hopping integral from the input file, if it is not specified, use the default value(0 or the is...
 
void StdFace_SetLabel(struct StdIntList *StdI, FILE *fp, int iW, int iL, int diW, int diL, int isiteUC, int jsiteUC, int *isite, int *jsite, int connect, std::complex< double > *Cphase, double *dR)
Set Label in the gnuplot display (Only used in 2D system) 
 
void StdFace_Coulomb(struct StdIntList *StdI, double V, int isite, int jsite)
Add onsite/offsite Coulomb term to the list StdIntList::Cinter and StdIntList::CinterIndx, and increase the number of them (StdIntList::NCinter). 
 
void StdFace_GeneralJ(struct StdIntList *StdI, double J[3][3], int Si2, int Sj2, int isite, int jsite)
Treat J as a 3*3 matrix [(6S + 1)*(6S' + 1) interactions]. 
 
void StdFace_InputSpin(double Jp[3][3], double JpAll, const char *Jpname)
Input spin-spin interaction other than nearest-neighbor. 
 
void StdFace_PrintVal_d(const char *valname, double *val, double val0)
Print a valiable (real) read from the input file if it is not specified in the input file (=NaN)...
 
void StdFace_intr(struct StdIntList *StdI, std::complex< double > intr0, int site1, int spin1, int site2, int spin2, int site3, int spin3, int site4, int spin4)
Add interaction (InterAll) to the list Set StdIntList::intr and StdIntList::intrindx and increase the...
 
void StdFace_RequiredVal_i(const char *valname, int val)
Stop HPhi if a variable (integer) which must be specified is absent in the input file (=2147483647...
 
void StdFace_FindSite(struct StdIntList *StdI, int iW, int iL, int iH, int diW, int diL, int diH, int isiteUC, int jsiteUC, int *isite, int *jsite, std::complex< double > *Cphase, double *dR)
Find the index of transfer and interaction. 
 
void StdFace_exit(int errorcode)
MPI Abortation wrapper. 
 
void StdFace_Hopping(struct StdIntList *StdI, std::complex< double > trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin. 
 
void StdFace_NotUsed_c(const char *valname, std::complex< double > val)
Stop HPhi if a variable (complex) not used is specified in the input file (!=NaN). 
 
void StdFace_HubbardLocal(struct StdIntList *StdI, double mu0, double h0, double Gamma0, double U0, int isite)
Add intra-Coulomb, magnetic field, chemical potential for the itenerant electron. ...
 
void StdFace_NotUsed_J(const char *valname, double JAll, double J[3][3])
Stop HPhi if variables (real) not used is specified in the input file (!=NaN). 
 
static void StdFace_FoldSite(struct StdIntList *StdI, int iCellV[3], int nBox[3], int iCellV_fold[3])
Move a site into the original supercell if it is outside the original supercell. 
 
void StdFace_MagField(struct StdIntList *StdI, int S2, double h, double Gamma, int isite)
Add longitudinal and transvars magnetic field to the list. 
 
void StdFace_PrintGeometry(struct StdIntList *StdI)
Print geometry of sites for the pos-process of correlation function. 
 
void StdFace_PrintXSF(struct StdIntList *StdI)
Print lattice.xsf (XCrysDen format) 
 
void StdFace_InputCoulombV(double V, double *V0, const char *V0name)
Input off-site Coulomb interaction from the input file, if it is not specified, use the default value...
 
void StdFace_trans(struct StdIntList *StdI, std::complex< double > trans0, int isite, int ispin, int jsite, int jspin)
Add transfer to the list set StdIntList::trans and StdIntList::transindx and increment StdIntList::nt...
 
void StdFace_MallocInteractions(struct StdIntList *StdI, int ntransMax, int nintrMax)
Malloc Arrays for interactions. 
 
void StdFace_NotUsed_i(const char *valname, int val)
Stop HPhi if a variable (integer) not used is specified in the input file (!=2147483647, the upper limt of Int). 
 
void StdFace_PrintVal_i(const char *valname, int *val, int val0)
Print a valiable (integer) read from the input file if it is not specified in the input file (=214748...
 
void StdFace_PrintVal_dd(char *valname, double *val, double val0, double val1)
Print a valiable (real) read from the input file if it is not specified in the input file (=NaN)...
 
void StdFace_InitSite(struct StdIntList *StdI, FILE *fp, int dim)
Initialize the super-cell where simulation is performed. 
 
void StdFace_PrintVal_c(const char *valname, std::complex< double > *val, std::complex< double > val0)
Print a valiable (complex) read from the input file if it is not specified in the input file (=NaN)...
 
void StdFace_InputSpinNN(double J[3][3], double JAll, double J0[3][3], double J0All, const char *J0name)
Input nearest-neighbor spin-spin interaction. 
 
void StdFace_NotUsed_d(const char *valname, double val)
Stop HPhi if a variable (real) not used is specified in the input file (!=NaN).