HΦ  3.2.0
readdef.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 /*-------------------------------------------------------------
17  *[ver.2008.11.4]
18  * Read Definition files
19  *-------------------------------------------------------------
20  * Copyright (C) 2007-2009 Daisuke Tahara. All rights reserved.
21  *-------------------------------------------------------------*/
22 
23 
24 /*=================================================================================================*/
25 
35 #include "Common.h"
36 #include "readdef.h"
37 #include <ctype.h>
38 #include "LogMessage.h"
39 #include "wrapperMPI.h"
40 #include "common/setmemory.h"
41 
46 static char cKWListOfFileNameList[][D_CharTmpReadDef]={
47  "CalcMod",
48  "ModPara",
49  "LocSpin",
50  "Trans",
51  "CoulombIntra",
52  "CoulombInter",
53  "Hund",
54  "PairHop",
55  "Exchange",
56  "InterAll",
57  "OneBodyG",
58  "TwoBodyG",
59  "PairLift",
60  "Ising",
61  "Boost",
62  "SingleExcitation",
63  "PairExcitation",
64  "SpectrumVec",
65  "Laser",
66  "TEOneBody",
67  "TETwoBody"
68 };
69 
71 
75 static char (*cFileNameListFile)[D_CharTmpReadDef];
76 
78  const int NTETrans,
79  const int idx);
80 
81 
83  int iCalcModel,
84  int Nsite,
85  int iFlgGeneralSpin,
86  int *iLocSpin,
87  int isite1, int isigma1,
88  int isite2, int isigma2,
89  int isite3, int isigma3,
90  int isite4, int isigma4
91 );
92 
94  int *icnt_interall,
95  int **iInterAllInfo,
96  double complex *cInterAllValue,
97  int isite1, int isigma1,
98  int isite2, int isigma2,
99  int isite3, int isigma3,
100  int isite4, int isigma4,
101  double re_value, double im_value
102 );
103 
104 
113  const char *defname
114  ){
115  fprintf(stdoutMPI, cErrReadDefFile, defname);
116  return (-1);
117 }
118 
131  const int icheckValue,
132  const int ilowestValue,
133  const int iHighestValue
134  ){
135 
136  if(icheckValue < ilowestValue || icheckValue > iHighestValue){
137  return(-1);
138  }
139  return 0;
140 }
141 
155  const char* cKW,
156  char cKWList[][D_CharTmpReadDef],
157  int iSizeOfKWidx,
158  int* iKWidx
159  ){
160  *iKWidx=-1;
161  int itmpKWidx;
162  int iret=-1;
163  for(itmpKWidx=0; itmpKWidx<iSizeOfKWidx; itmpKWidx++){
164  if(strcmp(cKW,"")==0){
165  break;
166  }
167  else if(CheckWords(cKW, cKWList[itmpKWidx])==0){
168  iret=0;
169  *iKWidx=itmpKWidx;
170  }
171  }
172  return iret;
173 }
174 
188  char *ctmpLine,
189  char *ctmp,
190  int *itmp
191  )
192 {
193  char *ctmpRead;
194  char *cerror;
195  char csplit[] = " ,.\t\n";
196  if(*ctmpLine=='\n') return 1;
197  ctmpRead = strtok(ctmpLine, csplit);
198  if(strncmp(ctmpRead, "=", 1)==0 || strncmp(ctmpRead, "#", 1)==0 || ctmpRead==NULL){
199  return 1;
200  }
201  strcpy(ctmp, ctmpRead);
202 
203  ctmpRead = strtok( NULL, csplit );
204  *itmp = strtol(ctmpRead, &cerror, 0);
205  //if ctmpRead is not integer type
206  if(*cerror != '\0'){
207  fprintf(stdoutMPI, cErrDefFileFormat, cerror);
208  return(-1);
209  }
210 
211  ctmpRead = strtok( NULL, csplit );
212  if(ctmpRead != NULL){
213  fprintf(stdoutMPI, cErrDefFileFormat, ctmpRead);
214  return(-1);
215  }
216 
217  return 0;
218 }
219 
231  const char *defname,
232  struct DefineList *X
233  )
234 {
235  FILE *fp;
236  int itmp, iret;
237  char ctmpLine[D_CharTmpReadDef+D_CharKWDMAX];
238  char ctmp[D_CharKWDMAX];
239  X->iCalcType=0;
241  X->iCalcModel=0;
242  X->iOutputMode=0;
243  X->iCalcEigenVec=0;
244  X->iInitialVecType=0;
245  X->iOutputEigenVec=0;
246  X->iInputEigenVec=0;
247  X->iOutputHam=0;
248  X->iInputHam=0;
249  X->iOutputExVec = 0;
250  X->iFlgCalcSpec=0;
251  X->iReStart=0;
252  X->iFlgMPI=0;
253  X->iFlgScaLAPACK=0;
254 #ifdef _MAGMA
255  X->iNGPU=2;
256 #else
257  X->iNGPU=0;
258 #endif
259  /*=======================================================================*/
260  fp = fopenMPI(defname, "r");
261  if(fp==NULL) return ReadDefFileError(defname);
262  /* read Parameters from calcmod.def*/
263  while( fgetsMPI(ctmpLine, D_CharTmpReadDef+D_CharKWDMAX, fp)!=NULL ){
264  if( (iret=GetKWWithIdx(ctmpLine, ctmp, &itmp)) !=0){
265  if(iret==1) continue;
266  return(-1);
267  }
268  if(CheckWords(ctmp, "CalcType")==0){
269  X->iCalcType=itmp;
270  }
271  else if(CheckWords(ctmp, "FlgFiniteTemperature")==0){
272  X->iFlgFiniteTemperature = itmp;
273  }
274  else if(CheckWords(ctmp, "CalcModel")==0){
275  X->iCalcModel=itmp;
276  }
277  else if(CheckWords(ctmp, "OutputMode")==0){
278  X->iOutputMode=itmp;
279  }
280  else if(CheckWords(ctmp, "CalcEigenVec")==0){
281  X->iCalcEigenVec=itmp;
282  }
283  else if(CheckWords(ctmp, "InitialVecType")==0){
284  X->iInitialVecType=itmp;
285  }
286  else if(CheckWords(ctmp, "OutputEigenVec")==0 || CheckWords(ctmp, "OEV")==0){
287  X->iOutputEigenVec=itmp;
288  }
289  else if(CheckWords(ctmp, "InputEigenVec")==0 || CheckWords(ctmp, "IEV")==0){
290  X->iInputEigenVec=itmp;
291  }
292  else if(CheckWords(ctmp, "OutputHam")==0){
293  X->iOutputHam=itmp;
294  }
295  else if(CheckWords(ctmp, "InputHam")==0){
296  X->iInputHam=itmp;
297  }
298  else if(CheckWords(ctmp, "OutputExcitedVec")==0|| CheckWords(ctmp, "OutputExVec")==0){
299  X->iOutputExVec=itmp;
300  }
301  else if(CheckWords(ctmp, "CalcSpec")==0 || CheckWords(ctmp, "CalcSpectrum")==0){
302  X->iFlgCalcSpec=itmp;
303  }
304  else if(CheckWords(ctmp, "ReStart")==0){
305  X->iReStart=itmp;
306  }
307  else if(CheckWords(ctmp, "NGPU")==0){
308  X->iNGPU=itmp;
309  }
310  else if(CheckWords(ctmp, "ScaLAPACK")==0){
311 #ifdef _SCALAPACK
312  X->iFlgScaLAPACK=itmp;
313 #endif
314  }
315  else{
316  fprintf(stdoutMPI, cErrDefFileParam, defname, ctmp);
317  return(-1);
318  }
319  }
320  fclose(fp);
321 
322  /* Check values*/
323  if(ValidateValue(X->iCalcModel, 0, NUM_CALCMODEL-1)){
324  fprintf(stdoutMPI, cErrCalcType, defname);
325  return (-1);
326  }
327  if(ValidateValue(X->iCalcType, 0, NUM_CALCTYPE-1)){
328  fprintf(stdoutMPI, cErrCalcType, defname);
329  return (-1);
330  }
331  if(ValidateValue(X->iOutputMode, 0, NUM_OUTPUTMODE-1)){
332  fprintf(stdoutMPI, cErrOutputMode, defname);
333  return (-1);
334  }
335 
336  if(ValidateValue(X->iCalcEigenVec, -1, NUM_CALCEIGENVEC-1)){
337  fprintf(stdoutMPI, cErrCalcEigenVec, defname);
338  return (-1);
339  }
340 
341  if(ValidateValue(X->iInitialVecType, 0, NUM_SETINITAILVEC-1)){
342  fprintf(stdoutMPI, cErrSetIniVec, defname);
343  return (-1);
344  }
345 
346  if(ValidateValue(X->iOutputHam, 0, NUM_OUTPUTHAM-1)){
347  fprintf(stdoutMPI, cErrOutputHam, defname);
348  return (-1);
349  }
350  if(ValidateValue(X->iInputHam, 0, NUM_INPUTHAM-1)){
351  fprintf(stdoutMPI, cErrInputHam, defname);
352  return (-1);
353  }
354  if(X->iInputHam == 1 && X->iOutputHam==1){
355  fprintf(stdoutMPI, cErrInputOutputHam, defname);
356  return (-1);
357  }
358  if(ValidateValue(X->iReStart, 0, NUM_RESTART-1)){
359  fprintf(stdoutMPI, cErrRestart, defname);
360  return (-1);
361  }
362  if(X->iNGPU < 0){
363  fprintf(stdoutMPI, cErrCUDA, defname);
364  return (-1);
365  }
366  if(ValidateValue(X->iFlgScaLAPACK, 0, 1)){
367  fprintf(stdoutMPI, cErrCUDA, defname);
368  return (-1);
369  }
370 
371  /* In the case of Full Diagonalization method(iCalcType=2)*/
372  if(X->iCalcType==2 && ValidateValue(X->iFlgFiniteTemperature, 0, 1)){
373  fprintf(stdoutMPI, cErrFiniteTemp, defname);
374  return (-1);
375  }
376 
377  if(X->iCalcType !=2 && X->iOutputHam ==TRUE) {
378  fprintf(stdoutMPI, cErrOutputHamForFullDiag, defname);
379  return (-1);
380  }
381 
382  return 0;
383 }
384 
396  const char* cFileListNameFile,
397  char cFileNameList[][D_CharTmpReadDef]
398  )
399 {
400  FILE *fplist;
401  int itmpKWidx=-1;
402  char ctmpFileName[D_FileNameMaxReadDef];
403  char ctmpKW[D_CharTmpReadDef], ctmp2[256];
404  int i;
405  for(i=0; i< D_iKWNumDef; i++){
406  strcpy(cFileNameList[i],"");
407  }
408 
409  fplist = fopenMPI(cFileListNameFile, "r");
410  if(fplist==NULL) return ReadDefFileError(cFileListNameFile);
411 
412  while(fgetsMPI(ctmp2, 256, fplist) != NULL){
413  memset(ctmpKW, '\0', strlen(ctmpKW));
414  memset(ctmpFileName, '\0', strlen(ctmpFileName));
415  sscanf(ctmp2,"%s %s\n", ctmpKW, ctmpFileName);
416 
417  if(strncmp(ctmpKW, "#", 1)==0 || *ctmp2=='\n' || (strcmp(ctmpKW, "")&&strcmp(ctmpFileName,""))==0){
418  continue;
419  }
420  else if(strcmp(ctmpKW, "")*strcmp(ctmpFileName, "")==0){
421  fprintf(stdoutMPI, cErrKW_InCorPair, cFileListNameFile);
422  fclose(fplist);
423  return(-1);
424  }
426  if( CheckKW(ctmpKW, cKWListOfFileNameList, D_iKWNumDef, &itmpKWidx)!=0 ){
427  fprintf(stdoutMPI, cErrKW, ctmpKW, cFileListNameFile);
428  fprintf(stdoutMPI, "%s", cErrKW_ShowList);
429  for(i=0; i<D_iKWNumDef;i++){
430  fprintf(stdoutMPI, "%s \n", cKWListOfFileNameList[i]);
431  }
432  fclose(fplist);
433  return(-1);
434  }
436  if(strcmp(cFileNameList[itmpKWidx], "") !=0){
437  fprintf(stdoutMPI, cErrKW_Same, cFileListNameFile);
438  fclose(fplist);
439  return(-1);
440  }
441 
443  strcpy(cFileNameList[itmpKWidx], ctmpFileName);
444  }
445  fclose(fplist);
446  return 0;
447 }
448 
461  char *xNameListFile,
462  struct DefineList *X,
463  struct BoostList *xBoost
464  )
465 {
466  FILE *fp;
467  char defname[D_FileNameMaxReadDef];
468  char ctmp[D_CharTmpReadDef], ctmp2[256];
469  int i,itmp;
470  unsigned int iline=0;
471  X->nvec=0;
475  X->iNOmega=1000;
476  X->NCond=0;
478  X->dcOmegaOrg=0;
479  int iReadNCond=FALSE;
480  xBoost->flgBoost=FALSE;
482  NumAve=1;
483  X->Param.ExpecInterval=1;
484  cFileNameListFile = malloc(sizeof(char)*D_CharTmpReadDef*D_iKWNumDef);
485 
486  fprintf(stdoutMPI, cReadFileNamelist, xNameListFile);
487  if(GetFileName(xNameListFile, cFileNameListFile)!=0){
488  return(-1);
489  }
490 
491  /*=======================================================================*/
492  int iKWidx=0;
493  //Check the existence of Essensial Files.
494  X->READ=0;
495  X->WRITE=0;
496 
497  for(iKWidx=0; iKWidx< D_iKWNumDef; iKWidx++){
498  strcpy(defname, cFileNameListFile[iKWidx]);
499  if(strcmp(defname,"")==0){
500  switch (iKWidx){
501  case KWCalcMod:
502  case KWModPara:
503  case KWLocSpin:
504  fprintf(stdoutMPI, cErrMakeDef, cKWListOfFileNameList[iKWidx]);
505  return(-1);
506  default:
507  break;
508  }
509  }
510  }
511 
512 
513  for(iKWidx=0; iKWidx< D_iKWNumDef; iKWidx++) {
514  strcpy(defname, cFileNameListFile[iKWidx]);
515 
516  if (strcmp(defname, "") == 0) continue;
517  if(iKWidx==KWSpectrumVec){
518  continue;
519  }
520  fprintf(stdoutMPI, cReadFile, defname, cKWListOfFileNameList[iKWidx]);
521  fp = fopenMPI(defname, "r");
522  if (fp == NULL) return ReadDefFileError(defname);
523  switch (iKWidx) {
524  case KWCalcMod:
525  /* Read calcmod.def---------------------------------------*/
526  if (ReadcalcmodFile(defname, X) != 0) {
527  fclose(fp);
528  return ReadDefFileError(defname);
529  }
530  break;
531 
532  case KWModPara:
533  /* Read modpara.def---------------------------------------*/
534  //TODO: add error procedure here when parameters are not enough.
536  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
537  fgetsMPI(ctmp2, 256, fp);
538  sscanf(ctmp2, "%s %d\n", ctmp, &itmp); //2
539  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //3
540  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //4
541  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //5
543  fgetsMPI(ctmp2, 256, fp);
544  sscanf(ctmp2, "%s %s\n", ctmp, X->CDataFileHead); //6
546  fgetsMPI(ctmp2, 256, fp);
547  sscanf(ctmp2, "%s %s\n", ctmp, X->CParaFileHead); //7
549  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //8
550  double dtmp, dtmp2;
551  X->read_hacker = 1;
553  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
554  if (*ctmp2 == '\n') continue;
555  sscanf(ctmp2, "%s %lf %lf\n", ctmp, &dtmp, &dtmp2);
556  if (CheckWords(ctmp, "Nsite") == 0) {
557  X->Nsite = (int) dtmp;
558  }
559  else if (CheckWords(ctmp, "Nup") == 0) {
560  X->Nup = (int) dtmp;
561  }
562  else if (CheckWords(ctmp, "Ndown") == 0) {
563  X->Ndown = (int) dtmp;
564  X->Total2Sz = X->Nup - X->Ndown;
565  }
566  else if (CheckWords(ctmp, "2Sz") == 0) {
567  X->Total2Sz = (int) dtmp;
568  X->iFlgSzConserved = TRUE;
569  }
570  else if (CheckWords(ctmp, "Ncond") == 0) {
571  if((int) dtmp <0) {
572  fprintf(stdoutMPI, cErrNcond, defname);
573  return (-1);
574  }
575  X->NCond = (int) dtmp;
576  iReadNCond = TRUE;
577  }
578  else if (CheckWords(ctmp, "Lanczos_max") == 0) {
579  X->Lanczos_max = (int) dtmp;
580  }
581  else if (CheckWords(ctmp, "initial_iv") == 0) {
582  X->initial_iv = (int) dtmp;
583  }
584  else if (CheckWords(ctmp, "nvec") == 0) {
585  X->nvec = (int) dtmp;
586  }
587  else if (CheckWords(ctmp, "exct") == 0) {
588  X->k_exct = (int) dtmp;
589  }
590  else if (CheckWords(ctmp, "LanczosEps") == 0) {
591  X->LanczosEps = (int) dtmp;
592  }
593  else if (CheckWords(ctmp, "LanczosTarget") == 0) {
594  X->LanczosTarget = (int) dtmp;
595  }
596  else if (CheckWords(ctmp, "LargeValue") == 0) {
597  LargeValue = dtmp;
598  }
599  else if (CheckWords(ctmp, "NumAve") == 0) {
600  NumAve = (int) dtmp;
601  }
602  else if(strcmp(ctmp, "TimeSlice")==0){
603  X->Param.TimeSlice=dtmp;
604  }
605  else if(strcmp(ctmp, "ExpandCoef")==0){
606  X->Param.ExpandCoef=(int)dtmp;
607  }
608  else if(strcmp(ctmp, "OutputInterval")==0){
609  X->Param.OutputInterval=(int)dtmp;
610  }
611  else if (CheckWords(ctmp, "ExpecInterval") == 0) {
612  X->Param.ExpecInterval = (int) dtmp;
613  }
614  else if(strcmp(ctmp, "Tinit")==0){
615  X->Param.Tinit=dtmp;
616  }
617  else if (CheckWords(ctmp, "CalcHS") == 0) {
618  X->read_hacker = (int) dtmp;
619  }
620  else if(CheckWords(ctmp, "OmegaMax")==0){
621  X->dcOmegaMax=dtmp+dtmp2*I;
623  }
624  else if(CheckWords(ctmp, "OmegaMin")==0){
625  X->dcOmegaMin =dtmp+dtmp2*I;
627  }
628  else if(CheckWords(ctmp, "OmegaIm")==0){
629  X->dcOmegaOrg +=dtmp*I;
631  }
632  else if(CheckWords(ctmp, "OmegaOrg")==0){
633  X->dcOmegaOrg +=dtmp+dtmp2*I;
635  }
636  else if(CheckWords(ctmp, "NOmega")==0){
637  X->iNOmega=(int)dtmp;
638  }
639  else if(CheckWords(ctmp, "TargetTPQRand")==0) {
640  X->irand=(int)dtmp;
641  }
642  else {
643  return (-1);
644  }
645  }
646  break;
647 
648  case KWLocSpin:
649  // Read locspn.def
650  X->iFlgGeneralSpin = FALSE;
651  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
652  fgetsMPI(ctmp2, 256, fp);
653  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NLocSpn));
654  break;
655  case KWTrans:
656  // Read transfer.def
657  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
658  fgetsMPI(ctmp2, 256, fp);
659  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NTransfer));
660  break;
661  case KWCoulombIntra:
662  /* Read coulombintra.def----------------------------------*/
663  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
664  fgetsMPI(ctmp2, 256, fp);
665  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCoulombIntra));
666  break;
667  case KWCoulombInter:
668  /* Read coulombinter.def----------------------------------*/
669  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
670  fgetsMPI(ctmp2, 256, fp);
671  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCoulombInter));
672  break;
673  case KWHund:
674  /* Read hund.def------------------------------------------*/
675  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
676  fgetsMPI(ctmp2, 256, fp);
677  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NHundCoupling));
678  break;
679  case KWPairHop:
680  /* Read pairhop.def---------------------------------------*/
681  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
682  fgetsMPI(ctmp2, 256, fp);
683  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NPairHopping));
684  X->NPairHopping*=2;
685  break;
686  case KWExchange:
687  /* Read exchange.def--------------------------------------*/
688  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
689  fgetsMPI(ctmp2, 256, fp);
690  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NExchangeCoupling));
691  break;
692  case KWIsing:
693  /* Read ising.def--------------------------------------*/
694  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
695  fgetsMPI(ctmp2, 256, fp);
696  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NIsingCoupling));
697  break;
698  case KWPairLift:
699  /* Read exchange.def--------------------------------------*/
700  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
701  fgetsMPI(ctmp2, 256, fp);
702  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NPairLiftCoupling));
703  break;
704  case KWInterAll:
705  /* Read InterAll.def--------------------------------------*/
706  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
707  fgetsMPI(ctmp2, 256, fp);
708  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NInterAll));
709  break;
710  case KWOneBodyG:
711  /* Read cisajs.def----------------------------------------*/
712  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
713  fgetsMPI(ctmp2, 256, fp);
714  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCisAjt));
715  break;
716  case KWTwoBodyG:
717  /* Read cisajscktaltdc.def--------------------------------*/
718  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
719  fgetsMPI(ctmp2, 256, fp);
720  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCisAjtCkuAlvDC));
721  break;
722  case KWLaser:
723  /* Read laser.def--------------------------------*/
724  fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
725  fgetsMPI(ctmp2, 256, fp);
726  sscanf(ctmp2,"%s %d\n", ctmp, &(X->NLaser));
727  break;
728 
729  case KWTEOneBody:
730  if(X->iCalcType != TimeEvolution) break;
731  /* Read TEOnebody.def--------------------------------*/
732  fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
733  fgetsMPI(ctmp2, 256, fp);
734  sscanf(ctmp2,"%s %d\n", ctmp, &(X->NTETimeSteps));
735  fgetsMPI(ctmp2, 256, fp);
736  fgetsMPI(ctmp2, 256, fp);
737  fgetsMPI(ctmp2, 256, fp);
738  int iTETransMax=0;
739  if(X->NTETimeSteps>0) {
740  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
741  sscanf(ctmp2, "%lf %d \n", &dtmp, &itmp);
742  for (i = 0; i < itmp; ++i) {
743  fgetsMPI(ctmp2, 256, fp);
744  }
745  if(iTETransMax < itmp) iTETransMax=itmp;
746  }
747  }
748  X->NTETransferMax=iTETransMax;
749  break;
750 
751  case KWTETwoBody:
752  if(X->iCalcType != TimeEvolution) break;
753  /* Read TETwobody.def--------------------------------*/
754  fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
755  fgetsMPI(ctmp2, 256, fp);
756  sscanf(ctmp2,"%s %d\n", ctmp, &(X->NTETimeSteps));
757  fgetsMPI(ctmp2, 256, fp);
758  fgetsMPI(ctmp2, 256, fp);
759  fgetsMPI(ctmp2, 256, fp);
760  int iTEInterAllMax=0;
761  if(X->NTETimeSteps>0) {
762  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
763  sscanf(ctmp2, "%lf %d \n", &dtmp, &itmp);
764  for (i = 0; i < itmp; ++i) {
765  fgetsMPI(ctmp2, 256, fp);
766  }
767  if(iTEInterAllMax < itmp) iTEInterAllMax=itmp;
768  }
769  }
770  X->NTEInterAllMax=iTEInterAllMax;
771  break;
772 
773 
774  case KWBoost:
775  /* Read boost.def--------------------------------*/
776  xBoost->NumarrayJ = 0;
777  xBoost->W0 = 0;
778  xBoost->R0 = 0;
779  xBoost->num_pivot = 0;
780  xBoost->ishift_nspin = 0;
781  xBoost->flgBoost = TRUE;
782  //first line is skipped
783  fgetsMPI(ctmp2, 256, fp);
784  //read numarrayJ
785  fgetsMPI(ctmp2, 256, fp);
786  sscanf(ctmp2, "%d\n", &(xBoost->NumarrayJ));
787  //skipp arrayJ
788  for (iline = 0; iline < xBoost->NumarrayJ * 3; iline++) {
789  fgetsMPI(ctmp2, 256, fp);
790  }
791  //read W0 R0 num_pivot ishift_nspin
792  fgetsMPI(ctmp2, 256, fp);
793  sscanf(ctmp2, "%ld %ld %ld %ld\n", &(xBoost->W0), &(xBoost->R0), &(xBoost->num_pivot),
794  &(xBoost->ishift_nspin));
795 
796  break;
797 
798  case KWSingleExcitation:
799  /* Read singleexcitation.def----------------------------------------*/
800  fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
801  fgetsMPI(ctmp2, 256, fp);
802  sscanf(ctmp2,"%s %d\n", ctmp, &(X->NSingleExcitationOperator));
803  break;
804 
805  case KWPairExcitation:
806  /* Read pairexcitation.def----------------------------------------*/
807  fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
808  fgetsMPI(ctmp2, 256, fp);
809  sscanf(ctmp2,"%s %d\n", ctmp, &(X->NPairExcitationOperator));
810  break;
811 
812  default:
813  fprintf(stdoutMPI, "%s", cErrIncorrectDef);
814  fclose(fp);
815  return (-1);
816  }
817  /*=======================================================================*/
818  fclose(fp);
819  }
820 
821  //Sz, Ncond
822  switch(X->iCalcModel){
823  case Spin:
824  case Hubbard:
825  case Kondo:
826  case SpinlessFermion:
827 
828  if(iReadNCond==TRUE){
829  if(X->iCalcModel==Spin){
830  fprintf(stdoutMPI, "For Spin, Ncond should not be defined.\n");
831  return(-1);
832  }
833  else{
834  if(X->iFlgSzConserved==TRUE){
835  if(X->iCalcModel==SpinlessFermion){
836  fprintf(stdoutMPI, " Warning: For Spinless fermion, 2Sz should not be defined.\n");
837  X->Ne=X->NCond;
838  X->Nup=X->NCond;
839  X->Ndown=0;
840  break;
841  }
842  X->Nup=X->NLocSpn+X->NCond+X->Total2Sz;
843  X->Ndown=X->NLocSpn+X->NCond-X->Total2Sz;
844  X->Nup/=2;
845  X->Ndown/=2;
846  }
847  else{
848  if(X->iCalcModel == Hubbard){
849  X->Ne=X->NCond;
850  if(X->Ne <1){
851  fprintf(stdoutMPI, "Ncond is incorrect.\n");
852  return(-1);
853  }
854  X->iCalcModel=HubbardNConserved;
855  }
856  else if(X->iCalcModel ==SpinlessFermion){
857  X->Ne=X->NCond;
858  X->Nup=X->NCond;
859  X->Ndown=0;
860  }
861  else{
862  fprintf(stdoutMPI, " 2Sz is not defined.\n");
863  return(-1);
864  }
865  }
866  }
867  }
868  else if(iReadNCond == FALSE && X->iFlgSzConserved==TRUE){
869  if(X->iCalcModel != Spin){
870  fprintf(stdoutMPI, " NCond is not defined.\n");
871  return(-1);
872  }
873  X->Nup=X->NLocSpn+X->Total2Sz;
874  X->Ndown=X->NLocSpn-X->Total2Sz;
875  X->Nup /= 2;
876  X->Ndown /= 2;
877  }
878  else{
879  if(X->Nup==0 && X->Ndown==0){
880  if(X->iCalcModel == Spin){
881  fprintf(stdoutMPI, " 2Sz is not defined.\n");
882  return(-1);
883  }
884  else{
885  fprintf(stdoutMPI, " NCond is not defined.\n");
886  return(-1);
887  }
888  }
889  }
890 
891  if(X->iCalcModel == Spin){
892  X->Ne=X->Nup;
893  }
894  else{
895  if(X->Ne==0) {
896  X->Ne = X->Nup + X->Ndown;
897  }
898  if(X->NLocSpn>X->Ne){
899  fprintf(stdoutMPI, "%s", cErrNLoc);
900  fprintf(stdoutMPI, "NLocalSpin=%d, Ne=%d\n", X->NLocSpn, X->Ne);
901  return(-1);
902  }
903  }
904  break;
905  case SpinGC:
906  case KondoGC:
907  case HubbardGC:
908  case SpinlessFermionGC:
909  if(iReadNCond == TRUE || X->iFlgSzConserved ==TRUE){
910  fprintf(stdoutMPI, "\n Warning: For GC, both Ncond and 2Sz should not be defined.\n");
911  //return(-1);
912  }
913  break;
914  default:
915  break;
916  }
917 
918  /* Check values (Positive)*/
919  if(X->Nsite<=0) {// Nsite must be positve
920  fprintf(stdoutMPI, cErrNsite, defname);
921  return (-1);
922  }
923  if(X->Lanczos_max<=0) {// Lanczos_max must be positive
924  fprintf(stdoutMPI, cErrLanczos_max, defname);
925  return (-1);
926  }
927  if(X->LanczosEps<=0) {// Lanczos_eps must be positive
928  fprintf(stdoutMPI, cErrLanczos_eps, defname);
929  return (-1);
930  }
931  if(NumAve<=0) { // Average number must be positive
932  fprintf(stdoutMPI, cErrNumAve, defname);
933  return (-1);
934  }
935  if(X->Param.ExpecInterval<=0){// Interval to calculate expected values must be positive
936  fprintf(stdoutMPI, cErrExpecInterval, defname);
937  return (-1);
938  }
939  if(X->nvec==0){
940  X->nvec=X->Lanczos_max;
941  }
942 
943  if(X->nvec < X->k_exct){
944  X->nvec=X->k_exct;
945  }
946  if (X->LanczosTarget < X->k_exct) X->LanczosTarget = X->k_exct;
947 
948  if(ValidateValue(X->k_exct, 1, X->nvec)) {
949  fprintf(stdoutMPI, cErrLanczosExct, defname, X->nvec);
950  return (-1);
951  }
952 
953  if( X->k_exct>X->LanczosTarget ){
954  fprintf(stdoutMPI, cErrLanczosTarget, defname, X->LanczosTarget, X->k_exct);
955  return (-1);
956  }
957 
958 
959  X->fidx = 0;
960  X->NeMPI=X->Ne;
961  X->NupMPI=X->Nup;
962  X->NdownMPI=X->Ndown;
963  X->NupOrg=X->Nup;
964  X->NdownOrg=X->Ndown;
965  return 0;
966 }
967 
981  struct DefineList *X,
982  struct BoostList *xBoost
983  )
984 {
985  FILE *fp;
986  char defname[D_FileNameMaxReadDef];
987  char ctmp[D_CharTmpReadDef], ctmp2[256];
988 
989  unsigned int i,j, idx, itype;
990  int xitmp[8];
991  int iKWidx=0;
992  int iboolLoc=0;
993  int isite1, isite2, isite3, isite4;
994  int isigma1, isigma2, isigma3, isigma4;
995  double dvalue_re, dvalue_im;
996  double dArrayValue_re[3];
997  int icnt_diagonal=0;
998  int ieps_CheckImag0=-12;
999  eps_CheckImag0=pow(10.0, ieps_CheckImag0);
1000  unsigned int iline=0;
1001  int ilineIn=0;
1002  int ilineIn2=0;
1003  int itmp=0;
1004  int icnt_trans=0;
1005  int iflg_trans=0;
1006  int icnt_interall=0;
1007  int iflg_interall=0;
1008 
1009  unsigned int iloop=0;
1010 
1011  for(iKWidx=KWLocSpin; iKWidx< D_iKWNumDef; iKWidx++){
1012  strcpy(defname, cFileNameListFile[iKWidx]);
1013  if(strcmp(defname,"")==0 || iKWidx==KWSpectrumVec) continue;
1014  fprintf(stdoutMPI, cReadFileNamelist, defname);
1015  fp = fopenMPI(defname, "r");
1016  if(fp==NULL) return ReadDefFileError(defname);
1017  if(iKWidx != KWBoost){
1018  for(i=0;i<IgnoreLinesInDef;i++) fgetsMPI(ctmp, sizeof(ctmp)/sizeof(char), fp);
1019  }
1020 
1021  idx=0;
1022  /*=======================================================================*/
1023  switch(iKWidx){
1024  case KWLocSpin:
1025  /* Read locspn.def----------------------------------------*/
1026  while( fgetsMPI(ctmp2, 256, fp) != NULL){
1027  if(idx==X->Nsite){
1028  fclose(fp);
1029  return ReadDefFileError(defname);
1030  }
1031 
1032  sscanf(ctmp2, "%d %d\n", &(xitmp[0]), &(xitmp[1]) );
1033  X->LocSpn[xitmp[0]] = xitmp[1];
1034  X->SiteToBit[xitmp[0]]=(X->LocSpn[xitmp[0]]+1);//2S+1
1035  if(CheckSite(xitmp[0], X->Nsite) !=0){
1036  fclose(fp);
1037  return ReadDefFileError(defname);
1038  }
1039  idx++;
1040  }
1041  if(CheckLocSpin(X)==FALSE){
1042  fclose(fp);
1043  return ReadDefFileError(defname);
1044  }
1045 
1046  break;
1047 
1048  case KWTrans:
1049  /* transfer.def--------------------------------------*/
1050  if(X->NTransfer>0){
1051  icnt_trans=0;
1052  while( fgetsMPI(ctmp2, 256, fp) != NULL )
1053  {
1054  if(idx==X->NTransfer){
1055  fclose(fp);
1056  return ReadDefFileError(defname);
1057  }
1058 
1059  sscanf(ctmp2, "%d %d %d %d %lf %lf\n",
1060  &isite1,
1061  &isigma1,
1062  &isite2,
1063  &isigma2,
1064  &dvalue_re,
1065  &dvalue_im
1066  );
1067 
1068  if(CheckPairSite(isite1, isite2,X->Nsite) !=0){
1069  fclose(fp);
1070  return ReadDefFileError(defname);
1071  }
1072 
1073  if(isite1==isite2 && isigma1==isigma2){
1074  if(fabs(dvalue_im)> eps_CheckImag0){
1075  //NonHermite
1076  fprintf(stdoutMPI, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, dvalue_re, dvalue_im);
1077  fclose(fp);
1078  return ReadDefFileError(defname);
1079  }
1080  }
1081 
1082  if(X->iCalcModel==Spin){
1083  if(isite1 != isite2){
1084  iboolLoc=1;
1085  fprintf(stdoutMPI, cWarningIncorrectFormatForSpin2, isite1, isite2);
1086  }
1087  }
1088  else if(X->iCalcModel==Kondo){
1089  if(X->LocSpn[isite1]!=ITINERANT || X->LocSpn[isite2] !=ITINERANT){
1090  if(isite1 != isite2){
1091  iboolLoc=1;
1092  fprintf(stdoutMPI, cErrIncorrectFormatForKondoTrans, isite1, isite2);
1093  }
1094  }
1095  }
1096  else if(X->iCalcModel==SpinlessFermion || X->iCalcModel==SpinlessFermionGC){
1097  if(isigma1 != 0 || isigma2 !=0){
1098  //Not allowed
1099  fprintf(stderr, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, dvalue_re, dvalue_im);
1100  fclose(fp);
1101  return ReadDefFileError(defname);
1102  }
1103  }
1104 
1105  iflg_trans=0;
1106  for( i=0; i < icnt_trans; i++){
1107  if(isite1 ==X->GeneralTransfer[i][0] && isite2 == X->GeneralTransfer[i][2]
1108  && isigma1 == X->GeneralTransfer[i][1] && isigma2 == X->GeneralTransfer[i][3])
1109  {
1110  X->ParaGeneralTransfer[i] += dvalue_re+dvalue_im*I;
1111  iflg_trans=1;
1112  continue;
1113  }
1114  }
1115 
1116  if(iflg_trans == 0){
1117  X->GeneralTransfer[icnt_trans][0]=isite1;
1118  X->GeneralTransfer[icnt_trans][1]=isigma1;
1119  X->GeneralTransfer[icnt_trans][2]=isite2;
1120  X->GeneralTransfer[icnt_trans][3]=isigma2;
1121  X->ParaGeneralTransfer[icnt_trans] = dvalue_re+dvalue_im*I;
1122  icnt_trans++;
1123  }
1124  idx++;
1125  }
1126 
1127  if(iboolLoc ==1){
1128  fclose(fp);
1129  return(-1);
1130  }
1131  }
1132 
1133  X->NTransfer = icnt_trans;
1134 
1135  if(CheckSpinIndexForTrans(X)==FALSE){
1136  fclose(fp);
1137  return(-1);
1138  }
1139 
1140  if(CheckTransferHermite(X) !=0){
1141  fprintf(stdoutMPI, "%s", cErrNonHermiteTransForAll);
1142  fclose(fp);
1143  return(-1);
1144  }
1145  break;
1146 
1147  case KWCoulombIntra:
1148  /*coulombintra.def----------------------------------*/
1149  if(X->NCoulombIntra>0){
1150  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1151  if(idx==X->NCoulombIntra){
1152  fclose(fp);
1153  return ReadDefFileError(defname);
1154  }
1155  sscanf(ctmp2, "%d %lf\n",
1156  &(X->CoulombIntra[idx][0]),
1157  &(X->ParaCoulombIntra[idx])
1158  );
1159 
1160  if(CheckSite(X->CoulombIntra[idx][0], X->Nsite) !=0){
1161  fclose(fp);
1162  return ReadDefFileError(defname);
1163  }
1164  idx++;
1165  }
1166  }
1167  break;
1168 
1169  case KWCoulombInter:
1170  /*coulombinter.def----------------------------------*/
1171  if(X->NCoulombInter>0){
1172  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1173  if(idx==X->NCoulombInter){
1174  fclose(fp);
1175  return ReadDefFileError(defname);
1176  }
1177 
1178  sscanf(ctmp2, "%d %d %lf\n",
1179  &(X->CoulombInter[idx][0]),
1180  &(X->CoulombInter[idx][1]),
1181  &(X->ParaCoulombInter[idx])
1182  );
1183 
1184  if(CheckPairSite(X->CoulombInter[idx][0], X->CoulombInter[idx][1],X->Nsite) !=0){
1185  fclose(fp);
1186  return ReadDefFileError(defname);
1187  }
1188 
1189  idx++;
1190  }
1191  }
1192  break;
1193 
1194  case KWHund:
1195  /*hund.def------------------------------------------*/
1196  if(X->NHundCoupling>0){
1197  while(fgetsMPI(ctmp2,256,fp) != NULL)
1198  {
1199  if(idx==X->NHundCoupling){
1200  fclose(fp);
1201  return ReadDefFileError(defname);
1202  }
1203 
1204  sscanf(ctmp2, "%d %d %lf\n",
1205  &(X->HundCoupling[idx][0]),
1206  &(X->HundCoupling[idx][1]),
1207  &(X->ParaHundCoupling[idx])
1208  );
1209 
1210  if(CheckPairSite(X->HundCoupling[idx][0], X->HundCoupling[idx][1],X->Nsite) !=0){
1211  fclose(fp);
1212  return ReadDefFileError(defname);
1213  }
1214 
1215  idx++;
1216  }
1217  }
1218  break;
1219  case KWPairHop:
1220  /*pairhop.def---------------------------------------*/
1221  if(X->iCalcModel == Spin || X->iCalcModel == SpinGC){
1222  fprintf(stdoutMPI, "PairHop is not active in Spin and SpinGC.\n");
1223  return(-1);
1224  }
1225 
1226  if(X->NPairHopping>0){
1227  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1228  if(idx==X->NPairHopping/2){
1229  fclose(fp);
1230  return ReadDefFileError(defname);
1231  }
1232  sscanf(ctmp2, "%d %d %lf\n",
1233  &(X->PairHopping[2*idx][0]),
1234  &(X->PairHopping[2*idx][1]),
1235  &(X->ParaPairHopping[2*idx])
1236  );
1237 
1238  if(CheckPairSite(X->PairHopping[2*idx][0], X->PairHopping[2*idx][1],X->Nsite) !=0){
1239  fclose(fp);
1240  return ReadDefFileError(defname);
1241  }
1242  X->PairHopping[2*idx+1][0]=X->PairHopping[2*idx][1];
1243  X->PairHopping[2*idx+1][1]=X->PairHopping[2*idx][0];
1244  X->ParaPairHopping[2*idx+1]=X->ParaPairHopping[2*idx];
1245  idx++;
1246  }
1247  }
1248  break;
1249 
1250  case KWExchange:
1251  /*exchange.def--------------------------------------*/
1252  if(X->NExchangeCoupling>0){
1253  while(fgetsMPI(ctmp2,256,fp) != NULL){
1254  if(idx==X->NExchangeCoupling){
1255  fclose(fp);
1256  return ReadDefFileError(defname);
1257  }
1258 
1259  sscanf(ctmp2, "%d %d %lf\n",
1260  &(X->ExchangeCoupling[idx][0]),
1261  &(X->ExchangeCoupling[idx][1]),
1262  &(X->ParaExchangeCoupling[idx])
1263  );
1264 
1265  if(CheckPairSite(X->ExchangeCoupling[idx][0], X->ExchangeCoupling[idx][1],X->Nsite) !=0){
1266  fclose(fp);
1267  return ReadDefFileError(defname);
1268  }
1269 
1270  idx++;
1271  }
1272  }
1273  break;
1274 
1275  case KWIsing:
1276  /*ising.def--------------------------------------*/
1277  if(X->NIsingCoupling>0){
1278  while(fgetsMPI(ctmp2,256,fp) != NULL){
1279  if(idx==X->NIsingCoupling){
1280  fclose(fp);
1281  return ReadDefFileError(defname);
1282  }
1283 
1284  sscanf(ctmp2, "%d %d %lf\n",
1285  &isite1,
1286  &isite2,
1287  &dvalue_re
1288  );
1289 
1290  if(CheckPairSite(isite1,isite2,X->Nsite) !=0){
1291  fclose(fp);
1292  return ReadDefFileError(defname);
1293  }
1294 
1295  //input into exchange couplings
1296  X->HundCoupling[X->NHundCoupling+idx][0]=isite1;
1297  X->HundCoupling[X->NHundCoupling+idx][1]=isite2;
1298  X->ParaHundCoupling[X->NHundCoupling+idx]= -dvalue_re/2.0;
1299  //input into inter Coulomb
1300  X->CoulombInter[X->NCoulombInter+idx][0]=isite1;
1301  X->CoulombInter[X->NCoulombInter+idx][1]=isite2;
1302  X->ParaCoulombInter[X->NCoulombInter+idx]=-dvalue_re/4.0;
1303  idx++;
1304  }
1305  }
1306  break;
1307 
1308  case KWPairLift:
1309  /*pairlift.def--------------------------------------*/
1310  if(X->NPairLiftCoupling>0){
1311  if(X->iCalcModel != SpinGC){
1312  fprintf(stdoutMPI, "PairLift is active only in SpinGC.\n");
1313  return(-1);
1314  }
1315  while(fgetsMPI(ctmp2,256,fp) != NULL)
1316  {
1317  if(idx==X->NPairLiftCoupling){
1318  fclose(fp);
1319  return ReadDefFileError(defname);
1320  }
1321 
1322  sscanf(ctmp2, "%d %d %lf\n",
1323  &(X->PairLiftCoupling[idx][0]),
1324  &(X->PairLiftCoupling[idx][1]),
1325  &(X->ParaPairLiftCoupling[idx])
1326  );
1327 
1328  if(CheckPairSite(X->PairLiftCoupling[idx][0], X->PairLiftCoupling[idx][1],X->Nsite) !=0){
1329  fclose(fp);
1330  return ReadDefFileError(defname);
1331  }
1332 
1333  idx++;
1334  }
1335  }
1336  break;
1337 
1338  case KWInterAll:
1339  /*interall.def---------------------------------------*/
1340  X->NInterAll_Diagonal=0;
1341  X->NInterAll_OffDiagonal=0;
1342  if(X->NInterAll>0) {
1343  icnt_interall =0;
1344  icnt_diagonal=0;
1345  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1346  if (idx == X->NInterAll) {
1347  fclose(fp);
1348  return ReadDefFileError(defname);
1349  }
1350  sscanf(ctmp2, "%d %d %d %d %d %d %d %d %lf %lf\n",
1351  &isite1,
1352  &isigma1,
1353  &isite2,
1354  &isigma2,
1355  &isite3,
1356  &isigma3,
1357  &isite4,
1358  &isigma4,
1359  &dvalue_re,
1360  &dvalue_im
1361  );
1362 
1364  isite1, isigma1, isite2, isigma2,
1365  isite3, isigma3, isite4, isigma4) != 0) {
1366  fclose(fp);
1367  return ReadDefFileError(defname);
1368  }
1369 
1370  if (InputInterAllInfo(&icnt_interall,
1371  X->InterAll,
1372  X->ParaInterAll,
1373  isite1, isigma1,
1374  isite2, isigma2,
1375  isite3, isigma3,
1376  isite4, isigma4,
1377  dvalue_re, dvalue_im
1378  ) != 0) {
1379  icnt_diagonal += 1;
1380  }
1381  idx++;
1382  }
1383  }
1384 
1385  X->NInterAll = icnt_interall;
1386  X->NInterAll_Diagonal=icnt_diagonal;
1388 
1389 /*
1390  setmem_IntAll_Diagonal(
1391  X->InterAll_OffDiagonal, X->ParaInterAll_OffDiagonal,
1392  X->InterAll_Diagonal, X->ParaInterAll_Diagonal, NInterAllSet);
1393 */
1395  X->InterAll, X->ParaInterAll, X->NInterAll,
1398  X->EDChemi, X->EDSpinChemi, X->EDParaChemi, &X->EDNChemi,
1399  X->iCalcModel
1400  )!=0){
1401  fclose(fp);
1402  return(-1);
1403  }
1404 
1406  X->InterAll, X->ParaInterAll,
1409  )!=0) {
1410  fprintf(stdoutMPI, "%s", cErrNonHermiteInterAllForAll);
1411  fclose(fp);
1412  return (-1);
1413  }
1414  break;
1415 
1416  case KWOneBodyG:
1417  /*cisajs.def----------------------------------------*/
1418  if(X->NCisAjt>0){
1419  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1420  if(idx==X->NCisAjt){
1421  fclose(fp);
1422  return ReadDefFileError(defname);
1423  }
1424  sscanf(ctmp2, "%d %d %d %d\n",
1425  &isite1,
1426  &isigma1,
1427  &isite2,
1428  &isigma2);
1429 
1430  if(X->iCalcModel == Spin){
1431  if(isite1 != isite2){
1432  fprintf(stdoutMPI, cWarningIncorrectFormatForSpin2, isite1, isite2);
1433  X->NCisAjt--;
1434  continue;
1435  }
1436  }
1437 
1438  X->CisAjt[ idx ][0] = isite1;
1439  X->CisAjt[ idx ][1] = isigma1;
1440  X->CisAjt[ idx ][2] = isite2;
1441  X->CisAjt[ idx ][3] = isigma2;
1442 
1443  if(CheckPairSite(isite1, isite2,X->Nsite) !=0){
1444  fclose(fp);
1445  return ReadDefFileError(defname);
1446  }
1447 
1448  idx++;
1449  }
1450  }
1451  break;
1452 
1453  case KWTwoBodyG:
1454  /*cisajscktaltdc.def--------------------------------*/
1455  if(X->NCisAjtCkuAlvDC>0){
1456  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1457  if(idx==X->NCisAjtCkuAlvDC){
1458  fclose(fp);
1459  return ReadDefFileError(defname);
1460  }
1461 
1462  sscanf(ctmp2, "%d %d %d %d %d %d %d %d\n",
1463  &isite1,
1464  &isigma1,
1465  &isite2,
1466  &isigma2,
1467  &isite3,
1468  &isigma3,
1469  &isite4,
1470  &isigma4
1471  );
1472 
1473  if(X->iCalcModel == Spin || X->iCalcModel == SpinGC){
1474  if(CheckFormatForSpinInt(isite1, isite2, isite3, isite4)!=0){
1475  exitMPI(-1);
1476  //X->NCisAjtCkuAlvDC--;
1477  //continue;
1478  }
1479  }
1480 
1481 
1482  X->CisAjtCkuAlvDC[idx][0] = isite1;
1483  X->CisAjtCkuAlvDC[idx][1] = isigma1;
1484  X->CisAjtCkuAlvDC[idx][2] = isite2;
1485  X->CisAjtCkuAlvDC[idx][3] = isigma2;
1486  X->CisAjtCkuAlvDC[idx][4] = isite3;
1487  X->CisAjtCkuAlvDC[idx][5] = isigma3;
1488  X->CisAjtCkuAlvDC[idx][6] = isite4;
1489  X->CisAjtCkuAlvDC[idx][7] = isigma4;
1490 
1491  if(CheckQuadSite(isite1, isite2, isite3, isite4,X->Nsite) !=0){
1492  fclose(fp);
1493  return ReadDefFileError(defname);
1494  }
1495  idx++;
1496  }
1497  }
1498  break;
1499 
1500  case KWLaser:
1501  //printf("KWLaser\n");
1502  /*laser.def----------------------------------*/
1503  if(X->NLaser>0){
1504  //printf("Read Start\n");
1505  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1506  sscanf(ctmp2, "%s %lf\n", &(ctmp), &(X->ParaLaser[idx]));
1507  //printf("[%d]:%f\n",idx,X->ParaLaser[idx]);
1508  idx++;
1509  }
1510  if(idx!=X->NLaser){
1511  fclose(fp);
1512  return ReadDefFileError(defname);
1513  }
1514  }
1515  break;
1516 
1517  case KWTEOneBody:
1518  if(X->NTETimeSteps>0){
1519  idx=0;
1520  while(fgetsMPI(ctmp2, 256, fp) != NULL){
1521  sscanf(ctmp2, "%lf %d\n", &(X->TETime[idx]), &(X->NTETransfer[idx]));
1522  for(i=0; i<X->NTETransfer[idx]; ++i ){
1523  fgetsMPI(ctmp2, 256, fp);
1524  sscanf(ctmp2, "%d %d %d %d %lf %lf\n",
1525  &isite1,
1526  &isigma1,
1527  &isite2,
1528  &isigma2,
1529  &dvalue_re,
1530  &dvalue_im
1531  );
1532  X->TETransfer[idx][i][0]= isite1;
1533  X->TETransfer[idx][i][1]= isigma1;
1534  X->TETransfer[idx][i][2]= isite2;
1535  X->TETransfer[idx][i][3] = isigma2;
1536  X->ParaTETransfer[idx][i]=dvalue_re+dvalue_im*I;
1537  }
1538  //check Transfer Hermite
1539  if(CheckTETransferHermite(X, X->NTETransfer[idx], idx)!=0){
1540  fclose(fp);
1541  return ReadDefFileError(defname);
1542  }
1543  idx++;
1544  }
1545  if(idx!=X->NTETimeSteps){
1546  fclose(fp);
1547  return ReadDefFileError(defname);
1548  }
1549  }
1550  break;
1551 
1552  case KWTETwoBody:
1553  if(X->NTETimeSteps>0){
1554  idx=0;
1555  while(fgetsMPI(ctmp2, 256, fp) != NULL) {
1556  sscanf(ctmp2, "%lf %d\n", &(X->TETime[idx]), &(X->NTEInterAll[idx]));
1557  icnt_interall =0;
1558  icnt_diagonal=0;
1559  for (i = 0; i < X->NTEInterAll[idx]; ++i) {
1560  fgetsMPI(ctmp2, 256, fp);
1561  sscanf(ctmp2, "%d %d %d %d %d %d %d %d %lf %lf\n",
1562  &isite1,
1563  &isigma1,
1564  &isite2,
1565  &isigma2,
1566  &isite3,
1567  &isigma3,
1568  &isite4,
1569  &isigma4,
1570  &dvalue_re,
1571  &dvalue_im
1572  );
1574  isite1, isigma1, isite2, isigma2,
1575  isite3, isigma3, isite4, isigma4) != 0) {
1576  fclose(fp);
1577  return ReadDefFileError(defname);
1578  }
1579  if (InputInterAllInfo(&icnt_interall,
1580  X->TEInterAll[idx],
1581  X->ParaTEInterAll[idx],
1582  isite1, isigma1,
1583  isite2, isigma2,
1584  isite3, isigma3,
1585  isite4, isigma4,
1586  dvalue_re, dvalue_im
1587  ) != 0) {
1588  icnt_diagonal += 1;
1589  }
1590  }
1591 
1592  X->NTEInterAll[idx] = icnt_interall;
1593  X->NTEInterAllDiagonal[idx] = icnt_diagonal;
1594  X->NTEInterAllOffDiagonal[idx] = icnt_interall - icnt_diagonal;
1595  //Diagonal -> OffDiagonal -> search pair -> hermite
1597  X->TEInterAllOffDiagonal[idx], X->ParaTEInterAllOffDiagonal[idx], X->TEChemi[idx], X->SpinTEChemi[idx], X->ParaTEChemi[idx], &X->NTEChemi[idx], X->iCalcModel) != 0)
1598  {
1599  fclose(fp);
1600  return (-1);
1601  }
1602 
1604  X->TEInterAll[idx], X->ParaTEInterAll[idx],
1607  )!=0) {
1608  fprintf(stdoutMPI, "%s", cErrNonHermiteInterAllForAll);
1609  fclose(fp);
1610  return (-1);
1611  }
1612  idx++;
1613  }
1614 
1615  if(idx!=X->NTETimeSteps){
1616  fclose(fp);
1617  return ReadDefFileError(defname);
1618  }
1619  }
1620  break;
1621 
1622  case KWBoost:
1623  /* boost.def--------------------------------*/
1624  //input magnetic field
1625  fgetsMPI(ctmp2, 256, fp);
1626  sscanf(ctmp2, "%lf %lf %lf\n",
1627  &dArrayValue_re[0],
1628  &dArrayValue_re[1],
1629  &dArrayValue_re[2]);
1630  for(iline=0; iline<3; iline++){
1631  xBoost->vecB[iline]= dArrayValue_re[iline];
1632  }
1633 
1634  //this line is skipped;
1635  fgetsMPI(ctmp2, 256, fp);
1636 
1637  //input arrayJ
1638  if(xBoost->NumarrayJ>0){
1639  for(iline=0; iline<xBoost->NumarrayJ; iline++){
1640  for(ilineIn=0; ilineIn<3; ilineIn++){
1641  fgetsMPI(ctmp2, 256, fp);
1642  sscanf(ctmp2, "%lf %lf %lf\n",
1643  &dArrayValue_re[0],
1644  &dArrayValue_re[1],
1645  &dArrayValue_re[2]);
1646  for(ilineIn2=0; ilineIn2<3; ilineIn2++){
1647  xBoost->arrayJ[iline][ilineIn][ilineIn2]= dArrayValue_re[ilineIn2];
1648  }
1649  }
1650  }
1651  }
1652 
1653  //this line is skipped;
1654  fgetsMPI(ctmp2, 256, fp);
1655 
1656  //read list_6spin_star
1657  if(xBoost->num_pivot>0){
1658  for(iline=0; iline<xBoost->num_pivot; iline++){
1659  //input
1660  fgetsMPI(ctmp2, 256, fp);
1661  sscanf(ctmp2, "%d %d %d %d %d %d %d\n",
1662  &xBoost->list_6spin_star[iline][0],
1663  &xBoost->list_6spin_star[iline][1],
1664  &xBoost->list_6spin_star[iline][2],
1665  &xBoost->list_6spin_star[iline][3],
1666  &xBoost->list_6spin_star[iline][4],
1667  &xBoost->list_6spin_star[iline][5],
1668  &xBoost->list_6spin_star[iline][6]
1669  );
1670  //copy
1671  for(iloop=0; iloop<xBoost->R0; iloop++){
1672  for(itmp=0; itmp<7; itmp++){
1673  xBoost->list_6spin_star[iloop*xBoost->num_pivot+iline][itmp]=xBoost->list_6spin_star[iline][itmp];
1674  }
1675  }
1676  }
1677  }
1678 
1679  //read list_6spin_pair
1680  if(xBoost->num_pivot>0){
1681  for(iline=0; iline<xBoost->num_pivot; iline++){
1682  //input
1683  for(ilineIn2=0; ilineIn2<xBoost->list_6spin_star[iline][0]; ilineIn2++){
1684  fgetsMPI(ctmp2, 256, fp);
1685  sscanf(ctmp2, "%d %d %d %d %d %d %d\n",
1686  &xBoost->list_6spin_pair[iline][0][ilineIn2],
1687  &xBoost->list_6spin_pair[iline][1][ilineIn2],
1688  &xBoost->list_6spin_pair[iline][2][ilineIn2],
1689  &xBoost->list_6spin_pair[iline][3][ilineIn2],
1690  &xBoost->list_6spin_pair[iline][4][ilineIn2],
1691  &xBoost->list_6spin_pair[iline][5][ilineIn2],
1692  &xBoost->list_6spin_pair[iline][6][ilineIn2]
1693  );
1694 
1695  //copy
1696  for(iloop=0; iloop<xBoost->R0; iloop++){
1697  for(itmp=0; itmp<7; itmp++){
1698  xBoost->list_6spin_pair[iloop*xBoost->num_pivot+iline][itmp][ilineIn2]=xBoost->list_6spin_pair[iline][itmp][ilineIn2];
1699  }
1700  }
1701  }
1702  }
1703 
1704  }
1705 
1706  break;
1707 
1708  case KWSingleExcitation:
1709  /*singleexcitation.def----------------------------------------*/
1710  if(X->NSingleExcitationOperator>0) {
1711  if(X->iCalcModel == Spin || X->iCalcModel == SpinGC) {
1712  fprintf(stderr, "SingleExcitation is not allowed for spin system.\n");
1713  fclose(fp);
1714  return ReadDefFileError(defname);
1715  }
1716  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1717  sscanf(ctmp2, "%d %d %d %lf %lf\n",
1718  &isite1,
1719  &isigma1,
1720  &itype,
1721  &dvalue_re,
1722  &dvalue_im
1723  );
1724 
1725  if (CheckSite(isite1, X->Nsite) != 0) {
1726  fclose(fp);
1727  return ReadDefFileError(defname);
1728  }
1729 
1730  X->SingleExcitationOperator[idx][0] = isite1;
1731  X->SingleExcitationOperator[idx][1] = isigma1;
1732  X->SingleExcitationOperator[idx][2] = itype;
1733  X->ParaSingleExcitationOperator[idx] = dvalue_re + I * dvalue_im;
1734  idx++;
1735  }
1736  if (idx != X->NSingleExcitationOperator) {
1737  fclose(fp);
1738  return ReadDefFileError(defname);
1739  }
1740  }
1741  break;
1742 
1743  case KWPairExcitation:
1744  /*pairexcitation.def----------------------------------------*/
1745  if(X->NPairExcitationOperator>0) {
1746  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1747  sscanf(ctmp2, "%d %d %d %d %d %lf %lf\n",
1748  &isite1,
1749  &isigma1,
1750  &isite2,
1751  &isigma2,
1752  &itype,
1753  &dvalue_re,
1754  &dvalue_im
1755  );
1756  if (CheckPairSite(isite1, isite2, X->Nsite) != 0) {
1757  fclose(fp);
1758  return ReadDefFileError(defname);
1759  }
1760 
1761  if(itype==1){
1762  X->PairExcitationOperator[idx][0] = isite1;
1763  X->PairExcitationOperator[idx][1] = isigma1;
1764  X->PairExcitationOperator[idx][2] = isite2;
1765  X->PairExcitationOperator[idx][3] = isigma2;
1766  X->PairExcitationOperator[idx][4] = itype;
1767  X->ParaPairExcitationOperator[idx] = dvalue_re + I * dvalue_im;
1768  }
1769  else{
1770  X->PairExcitationOperator[idx][0] = isite2;
1771  X->PairExcitationOperator[idx][1] = isigma2;
1772  X->PairExcitationOperator[idx][2] = isite1;
1773  X->PairExcitationOperator[idx][3] = isigma1;
1774  X->PairExcitationOperator[idx][4] = itype;
1775  X->ParaPairExcitationOperator[idx] = -(dvalue_re + I * dvalue_im);
1776  }
1777 
1778  idx++;
1779  }
1780  if (idx != X->NPairExcitationOperator) {
1781  fclose(fp);
1782  return ReadDefFileError(defname);
1783  }
1784  }
1785  break;
1786 
1787  default:
1788  break;
1789  }
1790  fclose(fp);
1791 
1792  switch(iKWidx){
1793  case KWCoulombIntra:
1794  case KWCoulombInter:
1795  case KWHund:
1796  case KWPairHop:
1797  case KWExchange:
1798  case KWIsing:
1799  case KWPairLift:
1800  if(X->iFlgGeneralSpin==TRUE){
1801  fprintf(stdoutMPI, "%s", cErrIncorrectFormatInter);
1802  return(-1);
1803  }
1804  break;
1805  default:
1806  break;
1807  }
1808  }
1809 
1811  /*=======================================================================*/
1812  return 0;
1813 }
1814 
1826  const int iSite,
1827  const int iMaxNum
1828  )
1829 {
1830  if(iSite>=iMaxNum) return(-1);
1831  return 0;
1832 }
1833 
1846  const int iSite1,
1847  const int iSite2,
1848  const int iMaxNum
1849  )
1850 {
1851  if(CheckSite(iSite1, iMaxNum)!=0){
1852  return(-1);
1853  }
1854  if(CheckSite(iSite2, iMaxNum)!=0){
1855  return(-1);
1856  }
1857  return 0;
1858 }
1859 
1874  const int iSite1,
1875  const int iSite2,
1876  const int iSite3,
1877  const int iSite4,
1878  const int iMaxNum
1879  )
1880 {
1881  if(CheckPairSite(iSite1, iSite2, iMaxNum)!=0){
1882  return(-1);
1883  }
1884  if(CheckPairSite(iSite3, iSite4, iMaxNum)!=0){
1885  return(-1);
1886  }
1887  return 0;
1888 }
1889 
1903  struct DefineList *X
1904  )
1905 {
1906  unsigned int i,j;
1907  int isite1, isite2;
1908  int isigma1, isigma2;
1909  int itmpsite1, itmpsite2;
1910  int itmpsigma1, itmpsigma2;
1911  int itmperrsite1, itmperrsite2;
1912  int itmperrsigma1, itmperrsigma2;
1913  double complex dcerrTrans;
1914  int icheckHermiteCount=FALSE;
1915  int iCount=0;
1916 
1917  double complex ddiff_trans;
1918  unsigned int itmpIdx, icntHermite, icntchemi;
1919  icntHermite=0;
1920  icntchemi=0;
1921 
1922  for(i=0; i<X->NTransfer; i++){
1923  isite1=X->GeneralTransfer[i][0];
1924  isigma1=X->GeneralTransfer[i][1];
1925  isite2=X->GeneralTransfer[i][2];
1926  isigma2=X->GeneralTransfer[i][3];
1927  icheckHermiteCount=FALSE;
1928  // fprintf(stdoutMPI, "Debug: isite1=%d, isigma1=%d, isite2=%d, isigma2=%d, reTrans=%lf, imTrans = %lf\n",
1929  // isite1, isigma1, isite2, isigma2, creal(X->ParaGeneralTransfer[i]), cimag((X->ParaGeneralTransfer[i])));
1930  for(j=0; j<X->NTransfer; j++){
1931  itmpsite1=X->GeneralTransfer[j][0];
1932  itmpsigma1=X->GeneralTransfer[j][1];
1933  itmpsite2=X->GeneralTransfer[j][2];
1934  itmpsigma2=X->GeneralTransfer[j][3];
1935  if(isite1 == itmpsite2 && isite2 == itmpsite1){
1936  if(isigma1 == itmpsigma2 && isigma2 == itmpsigma1){
1937 
1938  ddiff_trans = X->ParaGeneralTransfer[i]-conj(X->ParaGeneralTransfer[j]);
1939  if(cabs(ddiff_trans) > eps_CheckImag0 ){
1940  itmperrsite1=itmpsite1;
1941  itmperrsigma1=itmpsigma1;
1942  itmperrsite2=itmpsite2;
1943  itmperrsigma2=itmpsigma2;
1944  dcerrTrans=X->ParaGeneralTransfer[j];
1945  fprintf(stdoutMPI, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, creal(X->ParaGeneralTransfer[i]), cimag(X->ParaGeneralTransfer[i]));
1946  fprintf(stdoutMPI, cErrNonHermiteTrans, itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, creal(dcerrTrans), cimag(dcerrTrans));
1947  iCount++;
1948  }
1949  else{
1950  if (icheckHermiteCount == FALSE) {
1951  if(i<=j){
1952  if(2*icntHermite >= X->NTransfer){
1953  fprintf(stderr, "Elements of Transfers are incorrect.\n");
1954  return(-1);
1955  }
1956  if(isite1 !=isite2 || isigma1 !=isigma2){
1957  for(itmpIdx=0; itmpIdx<4; itmpIdx++){
1958  X->EDGeneralTransfer[2*icntHermite][itmpIdx]=X->GeneralTransfer[i][itmpIdx];
1959  X->EDGeneralTransfer[2*icntHermite+1][itmpIdx]=X->GeneralTransfer[j][itmpIdx];
1960  }
1961  X->EDParaGeneralTransfer[2*icntHermite]=X->ParaGeneralTransfer[i];
1962  X->EDParaGeneralTransfer[2*icntHermite+1]=X->ParaGeneralTransfer[j];
1963  icntHermite++;
1964  }
1965  else{
1966  X->EDChemi[icntchemi] = X->GeneralTransfer[i][0];
1967  X->EDSpinChemi[icntchemi] = X->GeneralTransfer[i][1];
1968  X->EDParaChemi[icntchemi] = creal(X->ParaGeneralTransfer[i]);
1969  icntchemi+=1;
1970  }
1971  }
1972  icheckHermiteCount = TRUE;
1973  }
1974  }
1975  }
1976 
1977  }
1978  }
1979 
1980  //if counterpart for satisfying hermite conjugate does not exist.
1981  if(icheckHermiteCount == FALSE){
1982  fprintf(stdoutMPI, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, creal(X->ParaGeneralTransfer[i]), cimag(X->ParaGeneralTransfer[i]));
1983  iCount++;
1984  }
1985  }
1986 
1987  if(iCount !=0){
1988  return -1;
1989  }
1990  X->EDNTransfer=2*icntHermite;
1991  X->EDNChemi=icntchemi;
1992 
1993  //To realize ido-san's result
1994  for(i=0; i<X->EDNTransfer; i++){
1995  for(itmpIdx=0; itmpIdx<4; itmpIdx++){
1996  X->GeneralTransfer[i][itmpIdx]=X->EDGeneralTransfer[i][itmpIdx];
1997  }
1999  }
2000 
2001 
2002  return 0;
2003 }
2004 
2005 
2023  (
2024  int **InterAll,
2025  double complex* ParaInterAll,
2026  int **InterAllOffDiagonal,
2027  double complex*ParaInterAllOffDiagonal,
2028  const int NInterAllOffDiagonal,
2029  const int iCalcModel
2030  ) {
2031  unsigned int i, j, icntincorrect, itmpret;
2032  int isite1, isite2, isite3, isite4;
2033  int isigma1, isigma2, isigma3, isigma4;
2034  int itmpsite1, itmpsite2, itmpsite3, itmpsite4;
2035  int itmpsigma1, itmpsigma2, itmpsigma3, itmpsigma4;
2036  unsigned int itmpIdx, icntHermite;
2037  int icheckHermiteCount = FALSE;
2038  double complex ddiff_intall;
2039  icntincorrect = 0;
2040  icntHermite = 0;
2041  for (i = 0; i < NInterAllOffDiagonal; i++) {
2042  itmpret = 0;
2043  isite1 = InterAllOffDiagonal[i][0];
2044  isigma1 = InterAllOffDiagonal[i][1];
2045  isite2 = InterAllOffDiagonal[i][2];
2046  isigma2 = InterAllOffDiagonal[i][3];
2047  isite3 = InterAllOffDiagonal[i][4];
2048  isigma3 = InterAllOffDiagonal[i][5];
2049  isite4 = InterAllOffDiagonal[i][6];
2050  isigma4 = InterAllOffDiagonal[i][7];
2051  icheckHermiteCount = FALSE;
2052 
2053  for (j = 0; j < NInterAllOffDiagonal; j++) {
2054  itmpsite1 = InterAllOffDiagonal[j][0];
2055  itmpsigma1 = InterAllOffDiagonal[j][1];
2056  itmpsite2 = InterAllOffDiagonal[j][2];
2057  itmpsigma2 = InterAllOffDiagonal[j][3];
2058  itmpsite3 = InterAllOffDiagonal[j][4];
2059  itmpsigma3 = InterAllOffDiagonal[j][5];
2060  itmpsite4 = InterAllOffDiagonal[j][6];
2061  itmpsigma4 = InterAllOffDiagonal[j][7];
2062 
2063  if (isite1 == itmpsite4 && isite2 == itmpsite3 && isite3 == itmpsite2 && isite4 == itmpsite1) {
2064  if (isigma1 == itmpsigma4 && isigma2 == itmpsigma3 && isigma3 == itmpsigma2 && isigma4 == itmpsigma1) {
2065  ddiff_intall = cabs(ParaInterAllOffDiagonal[i] - conj(ParaInterAllOffDiagonal[j]));
2066 
2067  if (cabs(ddiff_intall) < eps_CheckImag0) {
2068  itmpret = 1;
2069  if (icheckHermiteCount == FALSE) {
2070  icheckHermiteCount = TRUE; //for not double counting
2071  if (i <= j) {
2072  if (2 * icntHermite >= NInterAllOffDiagonal) {
2073  fprintf(stdoutMPI, "Elements of InterAll are incorrect.\n");
2074  return (-1);
2075  }
2076 
2077  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
2078  InterAll[2 * icntHermite][itmpIdx] = InterAllOffDiagonal[i][itmpIdx];
2079  InterAll[2 * icntHermite + 1][itmpIdx] = InterAllOffDiagonal[j][itmpIdx];
2080  }
2081 
2082  ParaInterAll[2 * icntHermite] = ParaInterAllOffDiagonal[i];
2083  ParaInterAll[2 * icntHermite + 1] = ParaInterAllOffDiagonal[j];
2084  icntHermite++;
2085  }
2086  break;
2087  }
2088  }
2089  }
2090  } else if (isite1 == itmpsite2 && isite2 == itmpsite1 && isite3 == itmpsite4 &&
2091  isite4 == itmpsite3) { //for spin and Kondo
2092  if (iCalcModel == Kondo || iCalcModel == KondoGC || iCalcModel == Spin || iCalcModel == SpinGC) {
2093  if (isigma1 == itmpsigma2 && isigma2 == itmpsigma1 && isigma3 == itmpsigma4 && isigma4 == itmpsigma3) {
2094  ddiff_intall = ParaInterAllOffDiagonal[i] - conj(ParaInterAllOffDiagonal[j]);
2095  if (cabs(ddiff_intall) < eps_CheckImag0) {
2096  itmpret = 1;
2097  if (icheckHermiteCount == FALSE) {
2098  icheckHermiteCount = TRUE; // for not double-counting
2099  if (i <= j) {
2100  if (2 * icntHermite >= NInterAllOffDiagonal) {
2101  fprintf(stdoutMPI, "Elements of InterAll are incorrect.\n");
2102  return (-1);
2103  }
2104  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
2105  InterAll[2 * icntHermite][itmpIdx] = InterAllOffDiagonal[i][itmpIdx];
2106  }
2107  for (itmpIdx = 0; itmpIdx < 4; itmpIdx++) {
2108  InterAll[2 * icntHermite + 1][2 * itmpIdx] = InterAllOffDiagonal[i][6 -
2109  2 *
2110  itmpIdx];
2111  InterAll[2 * icntHermite + 1][2 * itmpIdx + 1] = InterAllOffDiagonal[i][7 - 2 *
2112  itmpIdx];
2113 
2114  }
2115  ParaInterAll[2 * icntHermite] = ParaInterAllOffDiagonal[i];
2116  ParaInterAll[2 * icntHermite + 1] = ParaInterAllOffDiagonal[j];
2117  icntHermite++;
2118  }
2119  break;
2120  }
2121  }
2122  }
2123  }
2124  }
2125  }
2126  //if counterpart for satisfying hermite conjugate does not exist.
2127  if (itmpret != 1) {
2128  fprintf(stdoutMPI, cErrNonHermiteInterAll, isite1, isigma1, isite2, isigma2, isite3, isigma3, isite4, isigma4,
2129  creal(ParaInterAllOffDiagonal[i]), cimag(ParaInterAllOffDiagonal[i]));
2130  icntincorrect++;
2131  }
2132  }
2133 
2134  if (icntincorrect != 0) {
2135  return (-1);
2136  }
2137 
2138  for (i = 0; i < NInterAllOffDiagonal; i++) {
2139  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
2140  InterAllOffDiagonal[i][itmpIdx] = InterAll[i][itmpIdx];
2141  }
2142  ParaInterAllOffDiagonal[i] = ParaInterAll[i];
2143  }
2144 
2145  return 0;
2146 }
2147 
2166  (
2167  int **InterAll,
2168  complex double *ParaInterAll,
2169  const int NInterAll,
2170  int **InterAllDiagonal,
2171  double *ParaInterAllDiagonal,
2172  int **InterAllOffDiagonal,
2173  complex double *ParaInterAllOffDiagonal,
2174  int *Chemi,
2175  int *SpinChemi,
2176  double *ParaChemi,
2177  unsigned int *NChemi,
2178  const int iCalcModel
2179  )
2180 {
2181  unsigned int i,icnt_diagonal, icnt_offdiagonal, tmp_i;
2182  int isite1, isite2, isite3, isite4;
2183  int isigma1, isigma2, isigma3, isigma4;
2184  int iret=0;
2185  icnt_diagonal=0;
2186  icnt_offdiagonal=0;
2187 
2188  for(i=0; i<NInterAll; i++){
2189  isite1=InterAll[i][0];
2190  isigma1=InterAll[i][1];
2191  isite2=InterAll[i][2];
2192  isigma2=InterAll[i][3];
2193  isite3=InterAll[i][4];
2194  isigma3=InterAll[i][5];
2195  isite4=InterAll[i][6];
2196  isigma4=InterAll[i][7];
2197 
2198  //Get Diagonal term
2199  if(isite1 == isite2 && isite3 == isite4 &&
2200  isigma1 == isigma2 && isigma3 == isigma4)
2201  {
2202  InterAllDiagonal[icnt_diagonal][0]=isite1;
2203  InterAllDiagonal[icnt_diagonal][1]=isigma1;
2204  InterAllDiagonal[icnt_diagonal][2]=isite3;
2205  InterAllDiagonal[icnt_diagonal][3]=isigma3;
2206  ParaInterAllDiagonal[icnt_diagonal] = creal(ParaInterAll[i]);
2207  icnt_diagonal++;
2208  continue;
2209  }
2210  else if(isite1 == isite4 && isite2 ==isite3 &&
2211  isigma1 == isigma4 && isigma2 ==isigma3)
2212  {
2213  InterAllDiagonal[icnt_diagonal][0]=isite1;
2214  InterAllDiagonal[icnt_diagonal][1]=isigma1;
2215  InterAllDiagonal[icnt_diagonal][2]=isite2;
2216  InterAllDiagonal[icnt_diagonal][3]=isigma2;
2217  ParaInterAllDiagonal[icnt_diagonal] = -creal(ParaInterAll[i]);
2218  Chemi[*NChemi] = isite1;
2219  SpinChemi[*NChemi] = isigma1;
2220  //transfer integral has minus sign for default setting
2221  ParaChemi[*NChemi] = -creal(ParaInterAll[i]);
2222  icnt_diagonal++;
2223  *NChemi +=1;
2224  continue;
2225  }
2226  else{
2227  //Get Off-Diagonal term
2228  switch(iCalcModel){
2229  case Hubbard:
2230  case HubbardNConserved:
2231  case Kondo:
2232  case KondoGC:
2233  case HubbardGC:
2234  if(isigma1 == isigma2 && isigma3 == isigma4){
2235  for(tmp_i=0; tmp_i<8; tmp_i++){
2236  InterAllOffDiagonal[icnt_offdiagonal][tmp_i]=InterAll[i][tmp_i];
2237  }
2238  ParaInterAllOffDiagonal[icnt_offdiagonal] = ParaInterAll[i];
2239  }
2240  else if(isigma1==isigma4 && isigma2 == isigma3){
2241  InterAllOffDiagonal[icnt_offdiagonal][0]=isite1;
2242  InterAllOffDiagonal[icnt_offdiagonal][1]=isigma1;
2243  InterAllOffDiagonal[icnt_offdiagonal][2]=isite4;
2244  InterAllOffDiagonal[icnt_offdiagonal][3]=isigma1;
2245  InterAllOffDiagonal[icnt_offdiagonal][4]=isite3;
2246  InterAllOffDiagonal[icnt_offdiagonal][5]=isigma2;
2247  InterAllOffDiagonal[icnt_offdiagonal][6]=isite2;
2248  InterAllOffDiagonal[icnt_offdiagonal][7]=isigma2;
2249  ParaInterAllOffDiagonal[icnt_offdiagonal] = -ParaInterAll[i];
2250  }
2251  else{
2252  // Sz symmetry is assumed
2253  if(iCalcModel==Hubbard || iCalcModel==Kondo){
2255  isite1,
2256  isigma1,
2257  isite2,
2258  isigma2,
2259  isite3,
2260  isigma3,
2261  isite4,
2262  isigma4,
2263  creal(ParaInterAll[i]),
2264  cimag(ParaInterAll[i])
2265  );
2266  iret=-1;
2267  }
2268  else{
2269  for(tmp_i=0; tmp_i<8; tmp_i++){
2270  InterAllOffDiagonal[icnt_offdiagonal][tmp_i]=InterAll[i][tmp_i];
2271  }
2272  ParaInterAllOffDiagonal[icnt_offdiagonal] = ParaInterAll[i];
2273  }
2274  }
2275  break;
2276  case Spin:
2277  case SpinGC:
2278  if(isite1 == isite2 && isite3 == isite4){
2279  for(tmp_i=0; tmp_i<8; tmp_i++){
2280  InterAllOffDiagonal[icnt_offdiagonal][tmp_i]=InterAll[i][tmp_i];
2281  }
2282  ParaInterAllOffDiagonal[icnt_offdiagonal] =ParaInterAll[i];
2283  }
2284  break;
2285  default:
2286  return(-1);
2287  }
2288  if(iret != -1){
2289  icnt_offdiagonal++;
2290  }
2291  }
2292 
2293  if(iret !=0){
2294  return(-1);
2295  }
2296  }
2297 
2298  return 0;
2299 }
2300 
2301 
2315 int JudgeDefType
2317  const int argc,
2318  char *argv[],
2319  int *mode
2320  )
2321 {
2322  int ver_maj =
2323 #include "version_major.h"
2324 ;
2325  int ver_min =
2326 #include "version_minor.h"
2327 ;
2328  int ver_pat =
2329 #include "version_patch.h"
2330 ;
2331 
2332  if(argc == 3 &&
2333  (CheckWords(argv[1], "-e") == 0 ||
2334  CheckWords(argv[1], "--Expert") == 0)){
2335  *mode=EXPERT_MODE;
2336  }
2337  else if (argc == 3 &&
2338  (CheckWords(argv[1], "-s") ==0 ||
2339  CheckWords(argv[1], "--Standard") == 0 )){
2340  *mode=STANDARD_MODE;
2341  }
2342  else if (argc == 3 &&
2343  (CheckWords(argv[1], "-sdry") == 0 ||
2344  CheckWords(argv[1], "-s-dry") == 0)
2345  ){
2346  *mode = STANDARD_DRY_MODE;
2347  }
2348  else if (argc >= 2 &&
2349  (CheckWords(argv[1], "-v") == 0
2350  || CheckWords(argv[1], "--version") == 0)
2351  ) {
2352  fprintf(stdoutMPI, "\nHPhi version %d.%d.%d \n\n", ver_maj, ver_min, ver_pat);
2353  exit(-1);
2354  }
2355  else{
2356  /*fprintf(stdoutMPI, cErrArgv, argv[1]);*/
2357  fprintf(stdoutMPI, "\n[Usage] \n");
2358  fprintf(stdoutMPI, "* Expert mode \n");
2359  fprintf(stdoutMPI, " $ HPhi -e {namelist_file} \n");
2360  fprintf(stdoutMPI, "* Standard mode \n");
2361  fprintf(stdoutMPI, " $ HPhi -s {input_file} \n");
2362  fprintf(stdoutMPI, "* Standard DRY mode \n");
2363  fprintf(stdoutMPI, " $ HPhi -sdry {input_file} \n");
2364  fprintf(stdoutMPI, " In this mode, Hphi stops after it generats expert input files. \n");
2365  fprintf(stdoutMPI, "* Print the version \n");
2366  fprintf(stdoutMPI, " $ HPhi -v \n\n");
2367  exit(-1);
2368  }
2369 
2370  return 0;
2371 }
2372 
2389  const int site1,
2390  const int site2,
2391  const int site3,
2392  const int site4
2393  ){
2394  if(site1==site2 && site3==site4){
2395  return 0;
2396  }
2397 
2398  fprintf(stdoutMPI, cWarningIncorrectFormatForSpin, site1, site2, site3, site4);
2399  return(-1);
2400 
2401 }
2402 
2403 
2416  (
2417  const int isite1, const int isite2,
2418  const int isite3, const int isite4,
2419  int* iLocInfo
2420  )
2421 {
2422  if (iLocInfo[isite1] != ITINERANT || iLocInfo[isite2] != ITINERANT) {
2423  if (isite1 != isite2) {
2424  fprintf(stdoutMPI, cErrIncorrectFormatForKondoInt, isite1, isite2, isite3, isite4);
2425  return -1;
2426  }
2427  }
2428  if (iLocInfo[isite3] != ITINERANT || iLocInfo[isite4] != ITINERANT) {
2429  if (isite3 != isite4) {
2430  fprintf(stdoutMPI, cErrIncorrectFormatForKondoInt, isite1, isite2, isite3, isite4);
2431  return -1;
2432  }
2433  }
2434  return 0;
2435 }
2436 
2447  struct DefineList *X
2448  )
2449 {
2450  //In future, convergence facator can be set by a def file.
2451  int neps = -8;
2452  int nepsCG =-8;
2453  int nbisec =-14;
2454  int nEnergy = -12;
2455  int nShiftBeta=8;
2456  int nepsvec12=-14;
2457  eps=pow(10.0, neps);
2458  eps_CG=pow(10.0, nepsCG);
2459  eps_Lanczos = pow(10,-X->LanczosEps);
2460  eps_Energy = pow(10.0, nEnergy);
2461 }
2462 
2474 int CheckLocSpin
2476  struct DefineList *X
2477  )
2478 {
2479 
2480  unsigned int i=0;
2481  switch(X->iCalcModel){
2482  case Hubbard:
2483  case HubbardNConserved:
2484  case HubbardGC:
2485  case SpinlessFermion:
2486  case SpinlessFermionGC:
2487  for(i=0; i<X->Nsite; i++){
2488  if(X->LocSpn[i]!=ITINERANT){
2489  return FALSE;
2490  }
2491  }
2492  break;
2493 
2494  case Kondo:
2495  case KondoGC:
2496  for(i=0; i<X->Nsite; i++){
2497  if(X->LocSpn[i]>LOCSPIN){
2498  X->iFlgGeneralSpin=TRUE;
2499  }
2500  else if(X->LocSpn[i]<ITINERANT){
2501  return FALSE;
2502  }
2503  }
2504  break;
2505 
2506  case Spin:
2507  case SpinGC:
2508  for(i=0; i<X->Nsite; i++){
2509  if(X->LocSpn[i]>LOCSPIN){
2510  X->iFlgGeneralSpin=TRUE;
2511  }
2512  else if(X->LocSpn[i]<LOCSPIN){
2513  return FALSE;
2514  }
2515  }
2516  break;
2517 
2518  default:
2519  return FALSE;
2520  //break;
2521  }
2522 
2523  if(CheckTotal2Sz(X) != TRUE){
2524  return FALSE;
2525  }
2526  return TRUE;
2527 }
2528 
2540  struct DefineList *X
2541  )
2542 {
2543  X->NHundCoupling += X->NIsingCoupling;
2544  X->NCoulombInter += X->NIsingCoupling;
2545 }
2546 
2557  struct DefineList *X
2558  )
2559 {
2560  X->NTransfer=0;
2561  X->NCoulombIntra=0;
2562  X->NCoulombInter=0;
2563  X->NIsingCoupling=0;
2564  X->NPairLiftCoupling=0;
2565  X->NInterAll=0;
2566  X->NCisAjt=0;
2567  X->NCisAjtCkuAlvDC=0;
2570  //[s] Time Evolution
2571  X->NTETimeSteps=0;
2572  X->NLaser=0;
2573  X->NTEInterAll=0;
2574  X->NTETransfer=0;
2575  //[e] Time Evolution
2576 
2577 }
2578 
2579 
2598  const int isite1, const int isigma1,
2599  const int isite2, const int isigma2,
2600  const int isite3, const int isigma3,
2601  const int isite4, const int isigma4,
2602  int* iLocInfo
2603  )
2604 {
2605  if( isigma1 > iLocInfo[isite1] || isigma2 >iLocInfo[isite2]
2606  ||isigma3 > iLocInfo[isite3] || isigma4 >iLocInfo[isite4]){
2607  fprintf(stdoutMPI, "%s", cErrIncorrectSpinIndexForInter);
2608  return FALSE;
2609  }
2610  return TRUE;
2611 }
2612 
2625  struct DefineList *X
2626  )
2627 {
2628  unsigned int i=0;
2629  int isite1, isite2;
2630  int isigma1, isigma2;
2631  if(X->iFlgGeneralSpin==TRUE){
2632  for(i=0; i<X->NTransfer; i++){
2633  isite1 =X->GeneralTransfer[i][0];
2634  isigma1=X->GeneralTransfer[i][1];
2635  isite2 =X->GeneralTransfer[i][2];
2636  isigma2=X->GeneralTransfer[i][3];
2637  if(isigma1 > X->LocSpn[isite1] || isigma2 >X->LocSpn[isite2]){
2638  fprintf(stdoutMPI, "%s", cErrIncorrectSpinIndexForTrans);
2639  return FALSE;
2640  }
2641  }
2642  }
2643  return TRUE;
2644 }
2645 
2656 int CheckTotal2Sz
2658  struct DefineList *X
2659  )
2660 {
2661  if(X->iFlgSzConserved==TRUE && X->iFlgGeneralSpin==FALSE){
2662  int tmp_Nup=X->NLocSpn+X->NCond+X->Total2Sz;
2663  int tmp_Ndown=X->NLocSpn+X->NCond-X->Total2Sz;
2664  if(tmp_Nup%2 != 0 && tmp_Ndown%2 !=0){
2665  printf("Nup=%d, Ndown=%d\n",X->Nup,X->Ndown);
2666  fprintf(stdoutMPI, "2Sz is incorrect.\n");
2667  return FALSE;
2668  }
2669  }
2670  return TRUE;
2671 }
2672 
2685  const char* ctmp,
2686  const char* cKeyWord
2687  )
2688 {
2689  unsigned int i=0;
2690 
2691  char ctmp_small[256]={0};
2692  char cKW_small[256]={0};
2693  unsigned int n;
2694  n=strlen(cKeyWord);
2695  strncpy(cKW_small, cKeyWord, n);
2696 
2697  for(i=0; i<n; i++){
2698  cKW_small[i]=tolower(cKW_small[i]);
2699  }
2700  n=strlen(ctmp);
2701  strncpy(ctmp_small, ctmp, n);
2702  for(i=0; i<n; i++){
2703  ctmp_small[i]=tolower(ctmp_small[i]);
2704  }
2705  if(n<strlen(cKW_small)) n=strlen(cKW_small);
2706  return(strncmp(ctmp_small, cKW_small, n));
2707 }
2708 
2716  int iKWidx,
2717  char **FileName
2718 ){
2719  if(cFileNameListFile == NULL){
2720  return -1;
2721  }
2722  *FileName=cFileNameListFile[iKWidx];
2723  return 0;
2724 }
2725 
2726 
2747  int iCalcModel,
2748  int Nsite,
2749  int iFlgGeneralSpin,
2750  int *iLocInfo,
2751  int isite1, int isigma1,
2752  int isite2, int isigma2,
2753  int isite3, int isigma3,
2754  int isite4, int isigma4
2755 ){
2756  if(CheckQuadSite(isite1, isite2, isite3, isite4, Nsite) !=0){
2757  fprintf(stderr, "%s", "Error: Site index of InterAll is incorrect.\n");
2758  return(-1);
2759  }
2760 
2761  if(iCalcModel == Spin || iCalcModel ==SpinGC){
2762  if(CheckFormatForSpinInt(isite1, isite2, isite3, isite4)!=0){
2763  fprintf(stderr, "%s", "Error: Spin index of InterAll is incorrect.\n");
2764  return(-1);
2765  }
2766  }
2767  else if(iCalcModel == SpinlessFermion || iCalcModel==SpinlessFermionGC){
2768  if(isigma1 !=0 || isigma2 != 0 || isigma3 != 0 || isigma4 !=0){
2769  fprintf(stderr, "%s", "Error: Spin index of InterAll is incorrect.\n");
2770  return -1;
2771  }
2772  }
2773  else if(iCalcModel == Kondo){
2774  if(CheckFormatForKondoInt(isite1, isite2, isite3, isite4, iLocInfo)!=0){
2775  return -1;
2776  }
2777  }
2778 
2779  if(iFlgGeneralSpin ==TRUE) {
2780  if(CheckGeneralSpinIndexForInterAll(isite1, isigma1, isite2, isigma2, isite3, isigma3, isite4, isigma4, iLocInfo)!=TRUE){
2781  return -1;
2782  }
2783  }
2784  return 0;
2785 }
2786 
2805  int *icnt_interall,
2806  int **iInterAllInfo,
2807  double complex *cInterAllValue,
2808  int isite1, int isigma1,
2809  int isite2, int isigma2,
2810  int isite3, int isigma3,
2811  int isite4, int isigma4,
2812  double dvalue_re, double dvalue_im
2813 ) {
2814  int i = 0;
2815  int iflg_interall = 0;
2816  //Collect and sum same components of InterAll interactions
2817  for (i = 0; i < *icnt_interall; i++) {
2818  if (isite1 == iInterAllInfo[i][0] && isite2 == iInterAllInfo[i][2] &&
2819  isite3 == iInterAllInfo[i][4] && isite4 == iInterAllInfo[i][6] &&
2820  isigma1 == iInterAllInfo[i][1] && isigma2 == iInterAllInfo[i][3] &&
2821  isigma3 == iInterAllInfo[i][5] && isigma4 == iInterAllInfo[i][7]) {
2822  cInterAllValue[i] += dvalue_re + dvalue_im * I;
2823  iflg_interall = 1;
2824  return 0;
2825  }
2826  }
2827 
2828  //Input all InterAll interactions
2829  if (iflg_interall == 0) {
2830  iInterAllInfo[*icnt_interall][0] = isite1;
2831  iInterAllInfo[*icnt_interall][1] = isigma1;
2832  iInterAllInfo[*icnt_interall][2] = isite2;
2833  iInterAllInfo[*icnt_interall][3] = isigma2;
2834  iInterAllInfo[*icnt_interall][4] = isite3;
2835  iInterAllInfo[*icnt_interall][5] = isigma3;
2836  iInterAllInfo[*icnt_interall][6] = isite4;
2837  iInterAllInfo[*icnt_interall][7] = isigma4;
2838  cInterAllValue[*icnt_interall] = dvalue_re + I * dvalue_im;
2839  *icnt_interall+=1;
2840  //Check Diagonal part or not
2841  if (isite1 == isite2 && isite3 == isite4 &&
2842  isigma1 == isigma2 && isigma3 == isigma4) { //normal diagonal part
2843  return 1;
2844  } else if (isite1 == isite4 && isite2 == isite3 &&
2845  isigma1 == isigma4 && isigma2 == isigma3) { //hund term
2846  return 1;
2847  }
2848  }
2849  return 0;
2850 }
2851 
2852 
2853 
2863  (
2864  struct DefineList *X,
2865  const int NTETransfer,
2866  const int idx
2867  )
2868 {
2869  unsigned int i,j;
2870  int isite1, isite2;
2871  int isigma1, isigma2;
2872  int itmpsite1, itmpsite2;
2873  int itmpsigma1, itmpsigma2;
2874  int itmperrsite1, itmperrsite2;
2875  int itmperrsigma1, itmperrsigma2;
2876  double complex dcerrTrans;
2877  int icheckHermiteCount;
2878  int iCount=0;
2879 
2880  double complex ddiff_trans;
2881  unsigned int itmpIdx, icntHermite, icntchemi;
2882  icntHermite=0;
2883  icntchemi=0;
2884 
2885  int** tmp_TETransfer = i_2d_allocate(NTETransfer, 4);
2886  double complex*tmp_paraTETransfer = (double complex*)malloc((NTETransfer)*sizeof(double complex));
2887 
2888  //copy
2889  for(i=0; i<NTETransfer; i++){
2890  for(j=0; j<4; j++){
2891  tmp_TETransfer[i][j]=X->TETransfer[idx][i][j];
2892  X->TETransfer[idx][i][j]=0;
2893  }
2894  tmp_paraTETransfer[i] = X->ParaTETransfer[idx][i];
2895  X->ParaTETransfer[idx][i]=0.0;
2896  }
2897 
2898  for(i=0; i<NTETransfer; i++){
2899  isite1=tmp_TETransfer[i][0];
2900  isigma1=tmp_TETransfer[i][1];
2901  isite2=tmp_TETransfer[i][2];
2902  isigma2=tmp_TETransfer[i][3];
2903  icheckHermiteCount=FALSE;
2904  for(j=0; j<NTETransfer; j++){
2905  itmpsite1=tmp_TETransfer[j][0];
2906  itmpsigma1=tmp_TETransfer[j][1];
2907  itmpsite2=tmp_TETransfer[j][2];
2908  itmpsigma2=tmp_TETransfer[j][3];
2909  if(isite1 == itmpsite2 && isite2 == itmpsite1){
2910  if(isigma1 == itmpsigma2 && isigma2 == itmpsigma1){
2911 
2912  ddiff_trans = tmp_paraTETransfer[i]-conj(tmp_paraTETransfer[j]);
2913  if(cabs(ddiff_trans) > eps_CheckImag0 ){
2914  itmperrsite1=itmpsite1;
2915  itmperrsigma1=itmpsigma1;
2916  itmperrsite2=itmpsite2;
2917  itmperrsigma2=itmpsigma2;
2918  dcerrTrans=tmp_paraTETransfer[j];
2919  fprintf(stdoutMPI, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, creal(tmp_paraTETransfer[i]), cimag(tmp_paraTETransfer[i]));
2920  fprintf(stdoutMPI, cErrNonHermiteTrans, itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, creal(dcerrTrans), cimag(dcerrTrans));
2921  iCount++;
2922  }
2923  else{
2924  if (icheckHermiteCount == FALSE) {
2925  if(i<=j){
2926  if(2*icntHermite >= NTETransfer){
2927  fprintf(stderr, "Elements of Transfers are incorrect.\n");
2928  return(-1);
2929  }
2930  if(isite1 !=isite2 || isigma1 !=isigma2){
2931  for(itmpIdx=0; itmpIdx<4; itmpIdx++){
2932  X->TETransfer[idx][2*icntHermite][itmpIdx]=tmp_TETransfer[i][itmpIdx];
2933  X->TETransfer[idx][2*icntHermite+1][itmpIdx]=tmp_TETransfer[j][itmpIdx];
2934  }
2935  X->ParaTETransfer[idx][2*icntHermite]=tmp_paraTETransfer[i];
2936  X->ParaTETransfer[idx][2*icntHermite+1]=tmp_paraTETransfer[j];
2937  icntHermite++;
2938  }
2939  else{
2940  X->TETransferDiagonal[idx][icntchemi][0] = tmp_TETransfer[i][0];
2941  X->TETransferDiagonal[idx][icntchemi][1] = tmp_TETransfer[i][1];
2942  X->ParaTETransferDiagonal[idx][icntchemi] = creal(tmp_paraTETransfer[i]);
2943  icntchemi+=1;
2944  }
2945  }
2946  icheckHermiteCount = TRUE;
2947  }
2948  }
2949  }
2950  }
2951  }
2952 
2953  //if counterpart for satisfying hermite conjugate does not exist.
2954  if(icheckHermiteCount == FALSE){
2955  fprintf(stdoutMPI, cErrNonHermiteTrans, isite1, isigma1, isite2, isigma2, creal(tmp_paraTETransfer[i]), cimag(tmp_paraTETransfer[i]));
2956  iCount++;
2957  //fprintf(stdoutMPI, cErrNonHermiteTrans, itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, creal(dcerrTrans), cimag(dcerrTrans));
2958  //return(-1);
2959  }
2960  }
2961 
2962  if(iCount !=0){
2963  return -1;
2964  }
2965 
2966  X->NTETransfer[idx]=2*icntHermite;
2967  X->NTETransferDiagonal[idx]=icntchemi;
2968 
2969 
2970  free_i_2d_allocate(tmp_TETransfer);
2971  free(tmp_paraTETransfer);
2972  return 0;
2973 }
3106 
3113 
3116 
3119 
const char * cReadFile
Definition: LogMessage.c:28
unsigned int NTETimeSteps
Definition: struct.h:246
char * cErrDefFileFormat
Definition: ErrorMessage.c:40
unsigned int NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.h:182
int iInputHam
Definition: struct.h:205
int irand
Input keyword TargetTPQRand ???
Definition: struct.h:79
unsigned int * NTEInterAllOffDiagonal
Definition: struct.h:273
int LanczosEps
log(10 base) of the convergence threshold. Read from Calcmod in readdef.h
Definition: struct.h:48
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
int iFlgSpecOmegaMin
Whether DefineList::dcOmegaMin is input or not.
Definition: struct.h:214
int CheckFormatForKondoInt(const int isite1, const int isite2, const int isite3, const int isite4, int *iLocInfo)
function of checking format of Kondo interactions
Definition: readdef.c:2416
unsigned int NHundCoupling
Number of Hund coupling.
Definition: struct.h:133
char * cErrIncorrectFormatForKondoTrans
Definition: ErrorMessage.c:80
long unsigned int W0
Definition: struct.h:397
int *** TEInterAll
Definition: struct.h:278
char * cErrIncorrectSpinIndexForInter
Definition: ErrorMessage.c:87
int CheckInterAllHermite(int **InterAll, double complex *ParaInterAll, int **InterAllOffDiagonal, double complex *ParaInterAllOffDiagonal, const int NInterAllOffDiagonal, const int iCalcModel)
function of checking hermite conditions about interall interactions
Definition: readdef.c:2023
int JudgeDefType(const int argc, char *argv[], int *mode)
function of judging a type of define files.
Definition: readdef.c:2316
int * EDSpinChemi
[DefineList::Nsite]
Definition: struct.h:99
int ** list_6spin_star
Definition: struct.h:403
int ** SpinTEChemi
Definition: struct.h:295
unsigned int NTEInterAllMax
Definition: struct.h:270
unsigned int NLocSpn
Number of local spins.
Definition: struct.h:84
void SetConvergenceFactor(struct DefineList *X)
function to set convergence factors
Definition: readdef.c:2446
int iFlgSzConserved
Flag whether Sz is conserved.
Definition: struct.h:87
char * cErrReadDefFile
Error Message in readdef.c.
Definition: ErrorMessage.c:39
int GetKWWithIdx(char *ctmpLine, char *ctmp, int *itmp)
Function of Getting keyword and it&#39;s variable from characters.
Definition: readdef.c:187
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
Definition: struct.h:146
int iReStart
Definition: struct.h:221
int GetFileName(const char *cFileListNameFile, char cFileNameList[][D_CharTmpReadDef])
Function of Fitting FileName.
Definition: readdef.c:395
char * cErrNsite
Definition: ErrorMessage.c:58
double * ParaInterAll_Diagonal
[DefineList::NInterAll_Diagonal] Coupling constant of diagonal inter-all term. malloc in setmem_def()...
Definition: struct.h:168
#define ITINERANT
Definition: global.h:31
unsigned int NLaser
Definition: struct.h:250
void InitializeInteractionNum(struct DefineList *X)
function of initializing interactions
Definition: readdef.c:2556
int fidx
Always 0, it is not used ???
Definition: struct.h:89
int Total2Sz
Total in this process.
Definition: struct.h:69
int *** TETransferDiagonal
Definition: struct.h:262
double complex dcOmegaMax
Upper limit of the frequency for the spectrum.
Definition: struct.h:209
int CheckLocSpin(struct DefineList *X)
function of checking indexies of localized spin
Definition: readdef.c:2475
char * cErrLanczosExct
Definition: ErrorMessage.c:63
int NumAve
Definition: global.h:65
unsigned int NdownMPI
Total number of spin-down electrons across processes. Deffer from DefineList::Ndown. Read from modpara in readdef.h.
Definition: struct.h:62
char * cErrMakeDef
Definition: ErrorMessage.c:72
int iOutputEigenVec
ASwitch for outputting an eigenvector. 0: no output, 1:output.
Definition: struct.h:202
double * TETime
Definition: struct.h:247
int ** TEChemi
Definition: struct.h:293
int CheckInterAllCondition(int iCalcModel, int Nsite, int iFlgGeneralSpin, int *iLocSpin, int isite1, int isigma1, int isite2, int isigma2, int isite3, int isigma3, int isite4, int isigma4)
Check InterAll condition.
Definition: readdef.c:2746
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
Definition: struct.h:82
int ** CisAjtCkuAlvDC
[DefineList::NCisAjtCkuAlvDC][4] Indices of two-body correlation function. malloc in setmem_def()...
Definition: struct.h:177
unsigned int Nup
Number of spin-up electrons in this process.
Definition: struct.h:58
char * cErrIncorrectDef
Definition: ErrorMessage.c:73
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
char * cErrLanczos_max
Definition: ErrorMessage.c:61
long unsigned int num_pivot
Definition: struct.h:398
int iNGPU
GPU mode ( only for FullDiag )
Definition: struct.h:230
int ReadDefFileIdxPara(struct DefineList *X, struct BoostList *xBoost)
function of reading def files to get keyword index
Definition: readdef.c:980
int ReadDefFileError(const char *defname)
Error Function of reading def files.
Definition: readdef.c:112
double complex * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
Definition: struct.h:170
unsigned int NPairLiftCoupling
Number of pair-lift term.
Definition: struct.h:153
int *** list_6spin_pair
Definition: struct.h:404
char * cErrKW_ShowList
Definition: ErrorMessage.c:68
char * cErrIncorrectFormatInter
Definition: ErrorMessage.c:86
int iFlgScaLAPACK
ScaLAPACK mode ( only for FullDiag )
Definition: struct.h:235
unsigned int nvec
Read from Calcmod in readdef.h.
Definition: struct.h:46
double * ParaLaser
Definition: struct.h:251
int ReadDefFileNInt(char *xNameListFile, struct DefineList *X, struct BoostList *xBoost)
Function of reading information about "ModPara" file and total number of parameters from other def fi...
Definition: readdef.c:460
double complex ** ParaTETransfer
Definition: struct.h:264
#define TRUE
Definition: global.h:26
double ** ParaTEChemi
Definition: struct.h:296
int ValidateValue(const int icheckValue, const int ilowestValue, const int iHighestValue)
Function of Validating value.
Definition: readdef.c:130
unsigned int NInterAll_OffDiagonal
Number of interall term (off-diagonal)
Definition: struct.h:165
unsigned int * NTETransfer
Definition: struct.h:256
int InputInterAllInfo(int *icnt_interall, int **iInterAllInfo, double complex *cInterAllValue, int isite1, int isigma1, int isite2, int isigma2, int isite3, int isigma3, int isite4, int isigma4, double re_value, double im_value)
Input InterAll Interactions (Operators of the same kinds are grouped together).
Definition: readdef.c:2804
int CheckKW(const char *cKW, char cKWList[][D_CharTmpReadDef], int iSizeOfKWidx, int *iKWidx)
Function of Checking keyword in NameList file.
Definition: readdef.c:154
unsigned int * NTEChemi
Definition: struct.h:294
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.h:161
int ** InterAll_Diagonal
[DefineList::NinterAll_Diagonal][4] Interacted quartet
Definition: struct.h:162
char * cErrKW_Same
Definition: ErrorMessage.c:69
#define LOCSPIN
Definition: global.h:32
int ** GeneralTransfer
Index of transfer integrals obtained by a def file. malloc in setmem_def(). Data Format [DefineList::...
Definition: struct.h:106
int ** PairHopping
[DefineList::NPairHopping][2] Index of pair-hopping. malloc in setmem_def().
Definition: struct.h:140
unsigned int NupOrg
Number of spin-up electrons before exitation. Used only in the spectrum calculation. Read from modpara in readdef.h.
Definition: struct.h:64
unsigned int NeMPI
Total number of electrons across process. Differ from DefineList::Ne .
Definition: struct.h:72
unsigned int Ndown
Number of spin-down electrons in this process.
Definition: struct.h:59
double ** ParaTETransferDiagonal
Definition: struct.h:266
static char(* cFileNameListFile)[D_CharTmpReadDef]
Definition: readdef.c:75
int CheckQuadSite(const int iSite1, const int iSite2, const int iSite3, const int iSite4, const int iMaxNum)
Check Site Number for a quad -> (siteA, siteB, siteC, siteD).
Definition: readdef.c:1873
int ** PairLiftCoupling
[DefineList::NPairHopping][2] Index of pair-lift term. malloc in setmem_def().
Definition: struct.h:154
int ExpecInterval
Definition: struct.h:36
int ** HundCoupling
[DefineList::NHundCoupling][2] Index of Hund coupling. malloc in setmem_def().
Definition: struct.h:134
int iFlgFiniteTemperature
???
Definition: struct.h:197
unsigned int NInterAll_Diagonal
Number of interall term (diagonal)
Definition: struct.h:164
double complex ** ParaTEInterAll
Definition: struct.h:286
double complex * ParaInterAll
[DefineList::NInterAll] Coupling constant of inter-all term. malloc in setmem_def().
Definition: struct.h:166
double complex * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:113
double eps_CG
Definition: global.h:154
char * cWarningIncorrectFormatForSpin
Definition: ErrorMessage.c:84
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
Definition: struct.h:148
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
char * cErrLanczos_eps
Definition: ErrorMessage.c:62
int iFlgMPI
MPI mode.
Definition: struct.h:225
double * ParaCoulombInter
[DefineList::NCoulombInter]Coupling constant of off-site Coulomb interaction. malloc in setmem_def()...
Definition: struct.h:130
int READ
It is ALWAYS 0 ???
Definition: struct.h:53
int read_hacker
Whether use an efficient method (=1) in sz.c or not (=0)
Definition: struct.h:52
int CheckTransferHermite(struct DefineList *X)
Check Hermite for Transfer integrals.
Definition: readdef.c:1902
int CheckFormatForSpinInt(const int site1, const int site2, const int site3, const int site4)
function of checking format of spin interactions
Definition: readdef.c:2388
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
double * ParaPairLiftCoupling
[DefineList::NPairHopping] Coupling constant of pair-lift term. malloc in setmem_def().
Definition: struct.h:156
char * cErrSetIniVec
Definition: ErrorMessage.c:52
int CheckSpinIndexForTrans(struct DefineList *X)
function of checking spin index for transfers
Definition: readdef.c:2624
char * cErrDefFileParam
Definition: ErrorMessage.c:42
int CheckWords(const char *ctmp, const char *cKeyWord)
function of checking whether ctmp is same as cKeyWord or not
Definition: readdef.c:2684
double eps_Energy
Definition: global.h:156
double TimeSlice
Definition: struct.h:33
double complex * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
char * cErrNumAve
Definition: ErrorMessage.c:59
int ** CoulombInter
Definition: struct.h:128
unsigned int NCoulombIntra
Definition: struct.h:121
double complex *** arrayJ
Definition: struct.h:401
double eps
Definition: global.h:153
double complex ** ParaTEInterAllOffDiagonal
Definition: struct.h:288
unsigned int NIsingCoupling
Number of Ising term.
Definition: struct.h:151
char * cErrCalcEigenVec
Definition: ErrorMessage.c:45
int ** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.h:180
char * cErrNonConservedInterAll
Definition: ErrorMessage.c:77
int ReadcalcmodFile(const char *defname, struct DefineList *X)
Function of Reading calcmod file.
Definition: readdef.c:230
char * cErrOutputHamForFullDiag
Definition: ErrorMessage.c:47
char * cErrIncorrectFormatForKondoInt
Definition: ErrorMessage.c:79
char * cErrNonHermiteInterAll
Definition: ErrorMessage.c:76
double * EDParaChemi
[DefineList::Nsite] On-site potential parameter. malloc in setmem_def().
Definition: struct.h:100
char * cErrKW
Definition: ErrorMessage.c:67
long unsigned int R0
Definition: struct.h:396
char * cErrFiniteTemp
Definition: ErrorMessage.c:51
char * cErrNonHermiteTrans
Definition: ErrorMessage.c:74
char * cErrRestart
Definition: ErrorMessage.c:53
int *** TETransfer
Definition: struct.h:260
long unsigned int ishift_nspin
Definition: struct.h:399
struct ParamList Param
Definition: struct.h:241
char * CParaFileHead
Read from Calcmod in readdef.h. It is not used. Just for the compatibility to mVMC.
Definition: struct.h:44
unsigned int NExchangeCoupling
Number of exchange term.
Definition: struct.h:145
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.h:86
char * cErrIncorrectSpinIndexForTrans
Definition: ErrorMessage.c:88
int iNOmega
Number of frequencies for spectrum.
Definition: struct.h:212
#define FALSE
Definition: global.h:25
int D_iKWNumDef
Definition: readdef.c:70
int iCalcEigenVec
Switch for method to calculate eigenvectors. 0:Lanczos+CG, 1: Lanczos. default value is set as 0 in r...
Definition: struct.h:193
char * cErrInputHam
Definition: ErrorMessage.c:48
unsigned int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.h:178
unsigned int NPairHopping
Number of pair-hopping term.
Definition: struct.h:139
char * cErrCalcType
Definition: ErrorMessage.c:43
int iFlgSpecOmegaOrg
Whether DefineList::dcOmegaOrg is input or not.
Definition: struct.h:215
double complex vecB[3]
Definition: struct.h:402
int CheckTETransferHermite(struct DefineList *X, const int NTETrans, const int idx)
Check Hermite for TETransfer integrals.
Definition: readdef.c:2863
char * cWarningIncorrectFormatForSpin2
Definition: ErrorMessage.c:85
char * cErrOutputMode
Definition: ErrorMessage.c:44
char * cErrInputOutputHam
Definition: ErrorMessage.c:49
unsigned int NCisAjt
Number of indices of two-body correlation function.
Definition: struct.h:175
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
double Tinit
Definition: struct.h:32
int GetDiagonalInterAll(int **InterAll, complex double *ParaInterAll, const int NInterAll, int **InterAllDiagonal, double *ParaInterAllDiagonal, int **InterAllOffDiagonal, complex double *ParaInterAllOffDiagonal, int *Chemi, int *SpinChemi, double *ParaChemi, unsigned int *NChemi, const int iCalcModel)
function of getting diagonal components
Definition: readdef.c:2166
unsigned int * NTEInterAllDiagonal
Definition: struct.h:276
int ** CisAjt
[DefineList::NCisAjt][4] Indices of one-body correlation function. malloc in setmem_def().
Definition: struct.h:174
char * cErrNonHermiteInterAllForAll
Definition: ErrorMessage.c:78
unsigned int NupMPI
Total number of spin-up electrons across processes. Deffer from DefineList::Nup. Read from modpara in...
Definition: struct.h:60
double ** ParaTEInterAllDiagonal
Definition: struct.h:291
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
unsigned int NdownOrg
Number of spin-down electrons before exitation. Used only in the spectrum calculation. Read from modpara in readdef.h.
Definition: struct.h:66
double eps_CheckImag0
Definition: global.h:157
int OutputInterval
Definition: struct.h:34
unsigned int Ne
Number of electrons in this process.
Definition: struct.h:71
double * ParaPairHopping
[DefineList::NPairHopping] Coupling constant of pair-hopping term. malloc in setmem_def().
Definition: struct.h:142
int iOutputExVec
Definition: struct.h:206
char * cErrNonHermiteTransForAll
Definition: ErrorMessage.c:75
int ExpandCoef
Definition: struct.h:35
unsigned int NInterAll
Total Number of Interacted quartet.
Definition: struct.h:163
int ** CoulombIntra
Definition: struct.h:122
char * cErrExpecInterval
Definition: ErrorMessage.c:60
char * cErrOutputHam
Definition: ErrorMessage.c:46
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105
double complex dcOmegaOrg
Origin limit of the frequency for the spectrum.
Definition: struct.h:211
unsigned int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.h:104
For Boost.
Definition: struct.h:394
double * ParaHundCoupling
[DefineList::NHundCoupling] Hund coupling constant. malloc in setmem_def().
Definition: struct.h:136
char * cErrLanczosTarget
Definition: ErrorMessage.c:64
int iFlgSpecOmegaMax
Whether DefineList::dcOmegaMax is input or not.
Definition: struct.h:213
char * cErrKW_InCorPair
Definition: ErrorMessage.c:70
struct EDMainCalStruct X
Definition: struct.h:432
int CheckSite(const int iSite, const int iMaxNum)
Check Site Number.
Definition: readdef.c:1825
static char cKWListOfFileNameList[][D_CharTmpReadDef]
Definition: readdef.c:46
int LanczosTarget
Which eigenstate is used to check convergence. Read from Calcmod in readdef.h.
Definition: struct.h:50
int CheckGeneralSpinIndexForInterAll(const int isite1, const int isigma1, const int isite2, const int isigma2, const int isite3, const int isigma3, const int isite4, const int isigma4, int *iLocInfo)
function of checking spin index for all interactions
Definition: readdef.c:2597
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.h:198
double complex dcOmegaMin
Lower limit of the frequency for the spectrum.
Definition: struct.h:210
int *** TEInterAllOffDiagonal
Definition: struct.h:281
unsigned int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.h:127
char * cErrCUDA
Definition: ErrorMessage.c:54
long int initial_iv
Seed of random number for initial guesss of wavefunctions.
Definition: struct.h:76
double * ParaCoulombIntra
Definition: struct.h:124
int WRITE
It is ALWAYS 0 ???
Definition: struct.h:54
unsigned int EDNChemi
Number of on-site term.
Definition: struct.h:97
int flgBoost
Flag whether use CMA algorithm.
Definition: struct.h:395
int *** TEInterAllDiagonal
Definition: struct.h:284
char * cErrNcond
Definition: ErrorMessage.c:57
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
Definition: struct.h:216
char * cErrNLoc
Definition: ErrorMessage.c:41
double complex * ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.h:183
int iOutputMode
Switch for output mode. 0: OneBodyG and TwoBodyG. 1: OneBodyG and TwoBodyG and correlations for charg...
Definition: struct.h:200
void ResetInteractionNum(struct DefineList *X)
function of resetting number of interactions
Definition: readdef.c:2539
const char * cReadFileNamelist
Definition: LogMessage.c:27
unsigned int NCond
Number of itinerant electrons.
Definition: struct.h:85
int GetFileNameByKW(int iKWidx, char **FileName)
function of getting file name labeled by the keyword
Definition: readdef.c:2715
int iInitialVecType
Switch for type of inital vectors. 0:complex type, 1: real type. default value is set as 0 in readdef...
Definition: struct.h:195
int ** InterAll
[DefineList::NinterAll][8] Interacted quartet
Definition: struct.h:160
unsigned int NumarrayJ
Definition: struct.h:400
int CheckPairSite(const int iSite1, const int iSite2, const int iMaxNum)
Check Site Number for a pair -> (siteA, siteB).
Definition: readdef.c:1845
char * fgetsMPI(char *InputString, int maxcount, FILE *fp)
MPI file I/O (get a line, fgets) wrapper. Only the root node (myrank = 0) reads and broadcast string...
Definition: wrapperMPI.c:122
int * EDChemi
[DefineList::Nsite] Chemical potential. malloc in setmem_def().
Definition: struct.h:98
unsigned int NTETransferMax
Definition: struct.h:255
int iInputEigenVec
Switch for reading an eigenvector. 0: no input, 1:input.
Definition: struct.h:203
unsigned int * NTEInterAll
Definition: struct.h:271
int iOutputHam
Definition: struct.h:204
unsigned int * NTETransferDiagonal
Definition: struct.h:258
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.h:42
FILE * fopenMPI(const char *FileName, const char *mode)
MPI file I/O (open) wrapper. Only the root node (myrank = 0) should be open/read/write (small) parame...
Definition: wrapperMPI.c:105
double LargeValue
Definition: global.h:64
double eps_Lanczos
Definition: global.h:155
int CheckTotal2Sz(struct DefineList *X)
function of checking an input data of total2Sz
Definition: readdef.c:2657
Definision of system (Hamiltonian) etc.
Definition: struct.h:41
unsigned int Lanczos_max
Maximum number of iterations.
Definition: struct.h:74
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.h:192
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
unsigned int k_exct
Read from Calcmod in readdef.h.
Definition: struct.h:47