HPhi++  3.1.0
readdef.cpp File Reference

File to define functions of reading input files. More...

#include "Common.hpp"
#include "readdef.hpp"
#include <cctype>
#include "wrapperMPI.hpp"
#include "common/setmemory.hpp"
#include <iostream>
#include "version_major.hpp"
#include "version_miner.hpp"
#include "version_patch.hpp"

Go to the source code of this file.

Functions

int CheckInterAllCondition (int iCalcModel, int Nsite, int iFlgGeneralSpin, int *iLocInfo, int isite1, int isigma1, int isite2, int isigma2, int isite3, int isigma3, int isite4, int isigma4)
 Check InterAll condition. More...
 
int InputInterAllInfo (int *icnt_interall, int **iInterAllInfo, std::complex< double > *cInterAllValue, int isite1, int isigma1, int isite2, int isigma2, int isite3, int isigma3, int isite4, int isigma4, double dvalue_re, double dvalue_im)
 Input InterAll Interactions (Operators of the same kinds are grouped together). More...
 
int ReadDefFileError (const char *defname)
 Error Function of reading def files. More...
 
int ValidateValue (const int icheckValue, const int ilowestValue, const int iHighestValue)
 Function of Validating value. More...
 
int CheckKW (const char *cKW, char cKWList[][D_CharTmpReadDef], int iSizeOfKWidx, int *iKWidx)
 Function of Checking keyword in NameList file. More...
 
int GetKWWithIdx (char *ctmpLine, char *ctmp, int *itmp)
 Function of Getting keyword and it's variable from characters. More...
 
int ReadcalcmodFile (const char *defname, struct DefineList *X)
 Function of Reading calcmod file. More...
 
int GetFileName (const char *cFileListNameFile, char **cFileNameList)
 Function of Fitting FileName. More...
 
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 files. More...
 
static int CheckInterAllHermite (int **InterAll, std::complex< double > *ParaInterAll, int **InterAllOffDiagonal, std::complex< double > *ParaInterAllOffDiagonal, const int NInterAllOffDiagonal, const int iCalcModel)
 function of checking hermite conditions about interall interactions More...
 
int GetDiagonalInterAll (int **InterAll, std::complex< double > *ParaInterAll, const int NInterAll, int **InterAllDiagonal, double *ParaInterAllDiagonal, int **InterAllOffDiagonal, std::complex< double > *ParaInterAllOffDiagonal, int *Chemi, int *SpinChemi, double *ParaChemi, int *NChemi, const int iCalcModel)
 function of getting diagonal components More...
 
static int CheckTETransferHermite (struct DefineList *X, const int NTETransfer, const int idx)
 Check Hermite for TETransfer integrals. More...
 
int ReadDefFileIdxPara (struct DefineList *X, struct BoostList *xBoost)
 function of reading def files to get keyword index More...
 
int CheckSite (const int iSite, const int iMaxNum)
 Check Site Number. More...
 
int CheckPairSite (const int iSite1, const int iSite2, const int iMaxNum)
 Check Site Number for a pair -> (siteA, siteB). More...
 
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). More...
 
int CheckTransferHermite (struct DefineList *X)
 Check Hermite for Transfer integrals. More...
 
int JudgeDefType (const int argc, char *argv[], int *mode)
 function of judging a type of define files. More...
 
int CheckFormatForSpinInt (const int site1, const int site2, const int site3, const int site4)
 function of checking format of spin interactions More...
 
int CheckFormatForKondoInt (const int isite1, const int isite2, const int isite3, const int isite4, int *iLocInfo)
 function of checking format of Kondo interactions More...
 
void SetConvergenceFactor (struct DefineList *X)
 function to set convergence factors More...
 
int CheckLocSpin (struct DefineList *X)
 function of checking indexies of localized spin More...
 
void ResetInteractionNum (struct DefineList *X)
 function of resetting number of interactions More...
 
void InitializeInteractionNum (struct DefineList *X)
 function of initializing interactions More...
 
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 More...
 
int CheckSpinIndexForTrans (struct DefineList *X)
 function of checking spin index for transfers More...
 
int CheckTotal2Sz (struct DefineList *X)
 function of checking an input data of total2Sz More...
 
int CheckWords (const char *ctmp, const char *cKeyWord)
 function of checking whether ctmp is same as cKeyWord or not More...
 
int GetFileNameByKW (int iKWidx, char **FileName)
 function of getting file name labeled by the keyword More...
 

Variables

static char cKWListOfFileNameList [][D_CharTmpReadDef]
 Keyword List in NameListFile. More...
 
int D_iKWNumDef = sizeof(cKWListOfFileNameList)/sizeof(cKWListOfFileNameList[0])
 
static char ** cFileNameListFile
 

Detailed Description

File to define functions of reading input files.

Definition in file readdef.cpp.

Function Documentation

◆ CheckFormatForKondoInt()

int CheckFormatForKondoInt ( const int  isite1,
const int  isite2,
const int  isite3,
const int  isite4,
int *  iLocInfo 
)

function of checking format of Kondo interactions

Parameters
isite1a site number on site1
isite2a site number on site2
isite3a site number on site3
isite4a site number on site4
iLocInfoAn array with the value of S at each site.
Return values
0format is correct
-1format is incorrect
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2554 of file readdef.cpp.

References SetConvergenceFactor(), and stdoutMPI.

Referenced by CheckFormatForSpinInt(), and CheckInterAllCondition().

2559 {
2560  if (iLocInfo[isite1] != ITINERANT || iLocInfo[isite2] != ITINERANT) {
2561  if (isite1 != isite2) {
2562  fprintf(stdoutMPI, "Error: Site component of (i, j, k, l) =(%d, %d, %d, %d) is incorrect.\n", isite1, isite2, isite3, isite4);
2563  return -1;
2564  }
2565  }
2566  if (iLocInfo[isite3] != ITINERANT || iLocInfo[isite4] != ITINERANT) {
2567  if (isite3 != isite4) {
2568  fprintf(stdoutMPI, "Error: Site component of (i, j, k, l) =(%d, %d, %d, %d) is incorrect.\n", isite1, isite2, isite3, isite4);
2569  return -1;
2570  }
2571  }
2572  return 0;
2573 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ CheckFormatForSpinInt()

int CheckFormatForSpinInt ( const int  site1,
const int  site2,
const int  site3,
const int  site4 
)

function of checking format of spin interactions

Parameters
[in]site1a site number on site1.
[in]site2a site number on site2.
[in]site3a site number on site3.
[in]site4a site number on site4.
Return values
0format is correct
-1format is incorrect
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2524 of file readdef.cpp.

References CheckFormatForKondoInt(), and stdoutMPI.

Referenced by CheckInterAllCondition(), JudgeDefType(), and ReadDefFileIdxPara().

2529  {
2530  if(site1==site2 && site3==site4){
2531  return 0;
2532  }
2533 
2534  fprintf(stdoutMPI,
2535  "Warning: Site component of (i, j, k, l) =(%d, %d, %d, %d) is not correct; i=j and k=l must be satisfied. \n",
2536  site1, site2, site3, site4);
2537  return(-1);
2538 
2539 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ CheckGeneralSpinIndexForInterAll()

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

Parameters
isite1a site number on site1
isigma1a spin index on site1
isite2a site number on site2
isigma2a spin index on site2
isite3a site number on site3
isigma3a spin index on site3
isite4a site number on site4
isigma4a spin index on site4
iLocInfoAn array with the value of S at each site.
Return values
TRUEspin index is correct
FALSEspin index is incorrect
Version
0.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2737 of file readdef.cpp.

References CheckSpinIndexForTrans(), and stdoutMPI.

Referenced by CheckInterAllCondition(), and InitializeInteractionNum().

2744 {
2745  if( isigma1 > iLocInfo[isite1] || isigma2 >iLocInfo[isite2]
2746  ||isigma3 > iLocInfo[isite3] || isigma4 >iLocInfo[isite4]){
2747  fprintf(stdoutMPI, "%s", "Error: Spin index is incorrect for interactions defined in InterAll file.\n");
2748  return FALSE;
2749  }
2750  return TRUE;
2751 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ CheckInterAllCondition()

int CheckInterAllCondition ( int  iCalcModel,
int  Nsite,
int  iFlgGeneralSpin,
int *  iLocInfo,
int  isite1,
int  isigma1,
int  isite2,
int  isigma2,
int  isite3,
int  isigma3,
int  isite4,
int  isigma4 
)

Check InterAll condition.

Parameters
[in]iCalcModelTarget Model defined in CalcMod file (ex. Spin, SpinGC etc.).
[in]NsiteA total number of site.
[in]iFlgGeneralSpinFlag for general spin (TRUE: General Spin, FALSE: Spin-1/2).
[in]iLocInfoAn array with the value of S at each site
[in]isite1a site number on the site A.
[in]isigma1a spin index on the site A.
[in]isite2a site number on the site B.
[in]isigma2a spin index on the site B.
[in]isite3a site number on the site C.
[in]isigma3a spin index on the site C.
[in]isite4a site number on the site D.
[in]isigma4a spin index on the site D.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
2.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2884 of file readdef.cpp.

References CheckFormatForKondoInt(), CheckFormatForSpinInt(), CheckGeneralSpinIndexForInterAll(), and CheckQuadSite().

Referenced by ReadDefFileIdxPara().

2893  {
2894  if(CheckQuadSite(isite1, isite2, isite3, isite4, Nsite) !=0){
2895  fprintf(stderr, "%s", "Error: Site index of InterAll is incorrect.\n");
2896  return(-1);
2897  }
2898 
2899  if(iCalcModel == Spin || iCalcModel ==SpinGC){
2900  if(CheckFormatForSpinInt(isite1, isite2, isite3, isite4)!=0){
2901  fprintf(stderr, "%s", "Error: Spin index of InterAll is incorrect.\n");
2902  return(-1);
2903  }
2904  }
2905  else if(iCalcModel == SpinlessFermion || iCalcModel==SpinlessFermionGC){
2906  if(isigma1 !=0 || isigma2 != 0 || isigma3 != 0 || isigma4 !=0){
2907  fprintf(stderr, "%s", "Error: Spin index of InterAll is incorrect.\n");
2908  return -1;
2909  }
2910  }
2911  else if(iCalcModel == Kondo){
2912  if(CheckFormatForKondoInt(isite1, isite2, isite3, isite4, iLocInfo)!=0){
2913  return -1;
2914  }
2915  }
2916 
2917  if(iFlgGeneralSpin ==TRUE) {
2918  if(CheckGeneralSpinIndexForInterAll(isite1, isigma1, isite2, isigma2, isite3, isigma3, isite4, isigma4, iLocInfo)!=TRUE){
2919  return -1;
2920  }
2921  }
2922  return 0;
2923 }
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.cpp:2737
int CheckFormatForSpinInt(const int site1, const int site2, const int site3, const int site4)
function of checking format of spin interactions
Definition: readdef.cpp:2524
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.cpp:2554
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.cpp:2310

◆ CheckInterAllHermite()

static int CheckInterAllHermite ( int **  InterAll,
std::complex< double > *  ParaInterAll,
int **  InterAllOffDiagonal,
std::complex< double > *  ParaInterAllOffDiagonal,
const int  NInterAllOffDiagonal,
const int  iCalcModel 
)
static

function of checking hermite conditions about interall interactions

Parameters
InterAllarrays of information of interall interactions
ParaInterAllarrays of values of interall interactions
InterAllOffDiagonalarrays of information of off-diagonal part of interall interactions
ParaInterAllOffDiagonalarrays of values of off-diagonal part of interall interactions
NInterAllOffDiagonaltotal number of off-diagonal part of interall interactions
iCalcModelTarget Model defined in CalcMod file (ex. Spin, SpinGC etc.)
Return values
0Hermite condition is satisfied
-1Hermite condition is not satisfied
Version
0.2

rearray a InterAll_OffDiagonal array to satisfy a condition of hermite conjugation between 2*i and 2*i+1 components.

Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 982 of file readdef.cpp.

References eps_CheckImag0, GetDiagonalInterAll(), and stdoutMPI.

Referenced by ReadDefFileIdxPara(), and ReadDefFileNInt().

989  {
990  int i, j, icntincorrect, itmpret;
991  int isite1, isite2, isite3, isite4;
992  int isigma1, isigma2, isigma3, isigma4;
993  int itmpsite1, itmpsite2, itmpsite3, itmpsite4;
994  int itmpsigma1, itmpsigma2, itmpsigma3, itmpsigma4;
995  int itmpIdx, icntHermite;
996  int icheckHermiteCount = FALSE;
997  std::complex<double> ddiff_intall;
998  icntincorrect = 0;
999  icntHermite = 0;
1000  for (i = 0; i < NInterAllOffDiagonal; i++) {
1001  itmpret = 0;
1002  isite1 = InterAllOffDiagonal[i][0];
1003  isigma1 = InterAllOffDiagonal[i][1];
1004  isite2 = InterAllOffDiagonal[i][2];
1005  isigma2 = InterAllOffDiagonal[i][3];
1006  isite3 = InterAllOffDiagonal[i][4];
1007  isigma3 = InterAllOffDiagonal[i][5];
1008  isite4 = InterAllOffDiagonal[i][6];
1009  isigma4 = InterAllOffDiagonal[i][7];
1010  icheckHermiteCount = FALSE;
1011 
1012  for (j = 0; j < NInterAllOffDiagonal; j++) {
1013  itmpsite1 = InterAllOffDiagonal[j][0];
1014  itmpsigma1 = InterAllOffDiagonal[j][1];
1015  itmpsite2 = InterAllOffDiagonal[j][2];
1016  itmpsigma2 = InterAllOffDiagonal[j][3];
1017  itmpsite3 = InterAllOffDiagonal[j][4];
1018  itmpsigma3 = InterAllOffDiagonal[j][5];
1019  itmpsite4 = InterAllOffDiagonal[j][6];
1020  itmpsigma4 = InterAllOffDiagonal[j][7];
1021 
1022  if (isite1 == itmpsite4 && isite2 == itmpsite3 && isite3 == itmpsite2 && isite4 == itmpsite1) {
1023  if (isigma1 == itmpsigma4 && isigma2 == itmpsigma3 && isigma3 == itmpsigma2 && isigma4 == itmpsigma1) {
1024  ddiff_intall = abs(ParaInterAllOffDiagonal[i] - conj(ParaInterAllOffDiagonal[j]));
1025 
1026  if (abs(ddiff_intall) < eps_CheckImag0) {
1027  itmpret = 1;
1028  if (icheckHermiteCount == FALSE) {
1029  icheckHermiteCount = TRUE; //for not double counting
1030  if (i <= j) {
1031  if (2 * icntHermite >= NInterAllOffDiagonal) {
1032  fprintf(stdoutMPI, "Elements of InterAll are incorrect.\n");
1033  return (-1);
1034  }
1035 
1036  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
1037  InterAll[2 * icntHermite][itmpIdx] = InterAllOffDiagonal[i][itmpIdx];
1038  InterAll[2 * icntHermite + 1][itmpIdx] = InterAllOffDiagonal[j][itmpIdx];
1039  }
1040 
1041  ParaInterAll[2 * icntHermite] = ParaInterAllOffDiagonal[i];
1042  ParaInterAll[2 * icntHermite + 1] = ParaInterAllOffDiagonal[j];
1043  icntHermite++;
1044  }
1045  break;
1046  }
1047  }
1048  }
1049  }
1050  else if (isite1 == itmpsite2 && isite2 == itmpsite1 && isite3 == itmpsite4 &&
1051  isite4 == itmpsite3) { //for spin and Kondo
1052  if (iCalcModel == Kondo || iCalcModel == KondoGC || iCalcModel == Spin || iCalcModel == SpinGC) {
1053  if (isigma1 == itmpsigma2 && isigma2 == itmpsigma1 && isigma3 == itmpsigma4 && isigma4 == itmpsigma3) {
1054  ddiff_intall = ParaInterAllOffDiagonal[i] - conj(ParaInterAllOffDiagonal[j]);
1055  if (abs(ddiff_intall) < eps_CheckImag0) {
1056  itmpret = 1;
1057  if (icheckHermiteCount == FALSE) {
1058  icheckHermiteCount = TRUE; // for not double-counting
1059  if (i <= j) {
1060  if (2 * icntHermite >= NInterAllOffDiagonal) {
1061  fprintf(stdoutMPI, "Elements of InterAll are incorrect.\n");
1062  return (-1);
1063  }
1064  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
1065  InterAll[2 * icntHermite][itmpIdx] = InterAllOffDiagonal[i][itmpIdx];
1066  }
1067  for (itmpIdx = 0; itmpIdx < 4; itmpIdx++) {
1068  InterAll[2 * icntHermite + 1][2 * itmpIdx] = InterAllOffDiagonal[i][6 -
1069  2 *
1070  itmpIdx];
1071  InterAll[2 * icntHermite + 1][2 * itmpIdx + 1] = InterAllOffDiagonal[i][7 - 2 *
1072  itmpIdx];
1073 
1074  }
1075  ParaInterAll[2 * icntHermite] = ParaInterAllOffDiagonal[i];
1076  ParaInterAll[2 * icntHermite + 1] = ParaInterAllOffDiagonal[j];
1077  icntHermite++;
1078  }
1079  break;
1080  }
1081  }
1082  }
1083  }
1084  }
1085  }
1086  //if counterpart for satisfying hermite conjugate does not exist.
1087  if (itmpret != 1) {
1088  fprintf(stdoutMPI, "Error: NonHermite (i, spni, j, spnj, k, spnk, l, spnl) = (%d, %d, %d, %d, %d, %d, %d, %d), InterAll_re= %lf, InterAll_im= %lf . \n", isite1, isigma1, isite2, isigma2, isite3, isigma3, isite4, isigma4,
1089  real(ParaInterAllOffDiagonal[i]), imag(ParaInterAllOffDiagonal[i]));
1090  icntincorrect++;
1091  }
1092  }
1093 
1094  if (icntincorrect != 0) {
1095  return (-1);
1096  }
1097 
1098  for (i = 0; i < NInterAllOffDiagonal; i++) {
1099  for (itmpIdx = 0; itmpIdx < 8; itmpIdx++) {
1100  InterAllOffDiagonal[i][itmpIdx] = InterAll[i][itmpIdx];
1101  }
1102  ParaInterAllOffDiagonal[i] = ParaInterAll[i];
1103  }
1104 
1105  return 0;
1106 }/*CheckInterAllHermite*/
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
double eps_CheckImag0
Definition: global.cpp:67

◆ CheckKW()

int CheckKW ( const char *  cKW,
char  cKWList[][D_CharTmpReadDef],
int  iSizeOfKWidx,
int *  iKWidx 
)

Function of Checking keyword in NameList file.

Parameters
[in]cKWkeyword candidate
[in]cKWListReffercnce of keyword List
[in]iSizeOfKWidxnumber of keyword
[out]iKWidxindex of keyword
Return values
0keyword is correct.
-1keyword is incorrect.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 139 of file readdef.cpp.

References CheckWords().

Referenced by GetFileName().

144  {
145  *iKWidx=-1;
146  int itmpKWidx;
147  int iret=-1;
148  for(itmpKWidx=0; itmpKWidx<iSizeOfKWidx; itmpKWidx++){
149  if(strcmp(cKW,"")==0){
150  break;
151  }
152  else if(CheckWords(cKW, cKWList[itmpKWidx])==0){
153  iret=0;
154  *iKWidx=itmpKWidx;
155  }
156  }
157  return iret;
158 }
int CheckWords(const char *ctmp, const char *cKeyWord)
function of checking whether ctmp is same as cKeyWord or not
Definition: readdef.cpp:2824

◆ CheckLocSpin()

int CheckLocSpin ( struct DefineList X)

function of checking indexies of localized spin

Parameters
[in,out]XDefine list to get and put information of localized spin
Returns
TURE Indecies of localizes spin is correct
FALSE Indecies of localizes spin is incorrect
Version
0.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2610 of file readdef.cpp.

References CheckTotal2Sz(), DefineList::iCalcModel, DefineList::iFlgGeneralSpin, DefineList::LocSpn, DefineList::Nsite, and ResetInteractionNum().

Referenced by ReadDefFileIdxPara(), and SetConvergenceFactor().

2613 {
2614 
2615  int i=0;
2616  switch(X->iCalcModel){
2617  case Hubbard:
2618  case HubbardNConserved:
2619  case HubbardGC:
2620  case SpinlessFermion:
2621  case SpinlessFermionGC:
2622  for(i=0; i<X->Nsite; i++){
2623  if(X->LocSpn[i]!=ITINERANT){
2624  return FALSE;
2625  }
2626  }
2627  break;
2628 
2629  case Kondo:
2630  case KondoGC:
2631  for(i=0; i<X->Nsite; i++){
2632  if(X->LocSpn[i]>LOCSPIN){
2633  X->iFlgGeneralSpin=TRUE;
2634  }
2635  else if(X->LocSpn[i]<ITINERANT){
2636  return FALSE;
2637  }
2638  }
2639  break;
2640 
2641  case Spin:
2642  case SpinGC:
2643  for(i=0; i<X->Nsite; i++){
2644  if(X->LocSpn[i]>LOCSPIN){
2645  X->iFlgGeneralSpin=TRUE;
2646  }
2647  else if(X->LocSpn[i]<LOCSPIN){
2648  return FALSE;
2649  }
2650  }
2651  break;
2652 
2653  default:
2654  return FALSE;
2655  //break;
2656  }
2657 
2658  if(CheckTotal2Sz(X) != TRUE){
2659  return FALSE;
2660  }
2661  return TRUE;
2662 }
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
int CheckTotal2Sz(struct DefineList *X)
function of checking an input data of total2Sz
Definition: readdef.cpp:2797
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
Definition: struct.hpp:82
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200

◆ CheckPairSite()

int CheckPairSite ( const int  iSite1,
const int  iSite2,
const int  iMaxNum 
)

Check Site Number for a pair -> (siteA, siteB).

Parameters
[in]iSite1a site number on a site A.
[in]iSite2a site number on a site B.
[in]iMaxNumMax site number.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2282 of file readdef.cpp.

References CheckSite().

Referenced by CheckQuadSite(), and ReadDefFileIdxPara().

2287 {
2288  if(CheckSite(iSite1, iMaxNum)!=0){
2289  return(-1);
2290  }
2291  if(CheckSite(iSite2, iMaxNum)!=0){
2292  return(-1);
2293  }
2294  return 0;
2295 }
int CheckSite(const int iSite, const int iMaxNum)
Check Site Number.
Definition: readdef.cpp:2263

◆ CheckQuadSite()

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).

Parameters
[in]iSite1a site number on site A.
[in]iSite2a site number on site B.
[in]iSite3a site number on site C.
[in]iSite4a site number on site D.
[in]iMaxNumMax site number.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2310 of file readdef.cpp.

References CheckPairSite(), and CheckTransferHermite().

Referenced by CheckInterAllCondition(), and ReadDefFileIdxPara().

2317 {
2318  if(CheckPairSite(iSite1, iSite2, iMaxNum)!=0){
2319  return(-1);
2320  }
2321  if(CheckPairSite(iSite3, iSite4, iMaxNum)!=0){
2322  return(-1);
2323  }
2324  return 0;
2325 }
int CheckPairSite(const int iSite1, const int iSite2, const int iMaxNum)
Check Site Number for a pair -> (siteA, siteB).
Definition: readdef.cpp:2282

◆ CheckSite()

int CheckSite ( const int  iSite,
const int  iMaxNum 
)

Check Site Number.

Parameters
[in]iSitea site number.
[in]iMaxNumMax site number.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2263 of file readdef.cpp.

Referenced by CheckPairSite(), and ReadDefFileIdxPara().

2267 {
2268  if (iSite >= iMaxNum) return(-1);
2269  return 0;
2270 }

◆ CheckSpinIndexForTrans()

int CheckSpinIndexForTrans ( struct DefineList X)

function of checking spin index for transfers

Parameters
[in]XDefine list to get informations of transfers
Return values
TRUEspin index is correct
FALSEspin index is incorrect
Version
0.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2764 of file readdef.cpp.

References CheckTotal2Sz(), DefineList::GeneralTransfer, DefineList::iFlgGeneralSpin, DefineList::LocSpn, DefineList::NTransfer, and stdoutMPI.

Referenced by CheckGeneralSpinIndexForInterAll(), and ReadDefFileIdxPara().

2767 {
2768  int i=0;
2769  int isite1, isite2;
2770  int isigma1, isigma2;
2771  if(X->iFlgGeneralSpin==TRUE){
2772  for(i=0; i<X->NTransfer; i++){
2773  isite1 =X->GeneralTransfer[i][0];
2774  isigma1=X->GeneralTransfer[i][1];
2775  isite2 =X->GeneralTransfer[i][2];
2776  isigma2=X->GeneralTransfer[i][3];
2777  if(isigma1 > X->LocSpn[isite1] || isigma2 >X->LocSpn[isite2]){
2778  fprintf(stdoutMPI, "%s", "Error: Spin index is incorrect for transfers defined in Trans file.\n");
2779  return FALSE;
2780  }
2781  }
2782  }
2783  return TRUE;
2784 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
Definition: struct.hpp:82
int ** GeneralTransfer
Index of transfer integrals obtained by a def file. malloc in setmem_def(). Data Format [DefineList::...
Definition: struct.hpp:106
int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.hpp:104
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86

◆ CheckTETransferHermite()

static int CheckTETransferHermite ( struct DefineList X,
const int  NTETransfer,
const int  idx 
)
static

Check Hermite for TETransfer integrals.

Parameters
[in]XDefine List for getting transfer integrals.
[in]NTETransfertotal number of transfer integrals
[in]idxindex for time step.
Return values
0Hermite.
-1NonHermite.

Definition at line 1269 of file readdef.cpp.

References eps_CheckImag0, DefineList::NTETransfer, DefineList::NTETransferDiagonal, DefineList::ParaTETransfer, DefineList::ParaTETransferDiagonal, stdoutMPI, DefineList::TETransfer, and DefineList::TETransferDiagonal.

Referenced by GetDiagonalInterAll(), and ReadDefFileIdxPara().

1274 {
1275  int i, j;
1276  int isite1, isite2;
1277  int isigma1, isigma2;
1278  int itmpsite1, itmpsite2;
1279  int itmpsigma1, itmpsigma2;
1280  int itmperrsite1, itmperrsite2;
1281  int itmperrsigma1, itmperrsigma2;
1282  std::complex<double> dcerrTrans;
1283  int icheckHermiteCount;
1284  int iCount = 0;
1285 
1286  std::complex<double> ddiff_trans;
1287  int itmpIdx, icntHermite, icntchemi;
1288  icntHermite = 0;
1289  icntchemi = 0;
1290 
1291  int** tmp_TETransfer = i_2d_allocate(NTETransfer, 4);
1292  std::complex<double>*tmp_paraTETransfer = (std::complex<double>*)malloc((NTETransfer) * sizeof(std::complex<double>));
1293 
1294  //copy
1295  for (i = 0; i < NTETransfer; i++) {
1296  for (j = 0; j < 4; j++) {
1297  tmp_TETransfer[i][j] = X->TETransfer[idx][i][j];
1298  X->TETransfer[idx][i][j] = 0;
1299  }
1300  tmp_paraTETransfer[i] = X->ParaTETransfer[idx][i];
1301  X->ParaTETransfer[idx][i] = 0.0;
1302  }
1303 
1304  for (i = 0; i < NTETransfer; i++) {
1305  isite1 = tmp_TETransfer[i][0];
1306  isigma1 = tmp_TETransfer[i][1];
1307  isite2 = tmp_TETransfer[i][2];
1308  isigma2 = tmp_TETransfer[i][3];
1309  icheckHermiteCount = FALSE;
1310  for (j = 0; j < NTETransfer; j++) {
1311  itmpsite1 = tmp_TETransfer[j][0];
1312  itmpsigma1 = tmp_TETransfer[j][1];
1313  itmpsite2 = tmp_TETransfer[j][2];
1314  itmpsigma2 = tmp_TETransfer[j][3];
1315  if (isite1 == itmpsite2 && isite2 == itmpsite1) {
1316  if (isigma1 == itmpsigma2 && isigma2 == itmpsigma1) {
1317 
1318  ddiff_trans = tmp_paraTETransfer[i] - conj(tmp_paraTETransfer[j]);
1319  if (abs(ddiff_trans) > eps_CheckImag0) {
1320  itmperrsite1 = itmpsite1;
1321  itmperrsigma1 = itmpsigma1;
1322  itmperrsite2 = itmpsite2;
1323  itmperrsigma2 = itmpsigma2;
1324  dcerrTrans = tmp_paraTETransfer[j];
1325  fprintf(stdoutMPI,
1326  "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
1327  isite1, isigma1, isite2, isigma2, real(tmp_paraTETransfer[i]), imag(tmp_paraTETransfer[i]));
1328  fprintf(stdoutMPI,
1329  "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
1330  itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, real(dcerrTrans), imag(dcerrTrans));
1331  iCount++;
1332  }
1333  else {
1334  if (icheckHermiteCount == FALSE) {
1335  if (i <= j) {
1336  if (2 * icntHermite >= NTETransfer) {
1337  fprintf(stderr, "Elements of Transfers are incorrect.\n");
1338  return(-1);
1339  }
1340  if (isite1 != isite2 || isigma1 != isigma2) {
1341  for (itmpIdx = 0; itmpIdx < 4; itmpIdx++) {
1342  X->TETransfer[idx][2 * icntHermite][itmpIdx] = tmp_TETransfer[i][itmpIdx];
1343  X->TETransfer[idx][2 * icntHermite + 1][itmpIdx] = tmp_TETransfer[j][itmpIdx];
1344  }
1345  X->ParaTETransfer[idx][2 * icntHermite] = tmp_paraTETransfer[i];
1346  X->ParaTETransfer[idx][2 * icntHermite + 1] = tmp_paraTETransfer[j];
1347  icntHermite++;
1348  }
1349  else {
1350  X->TETransferDiagonal[idx][icntchemi][0] = tmp_TETransfer[i][0];
1351  X->TETransferDiagonal[idx][icntchemi][1] = tmp_TETransfer[i][1];
1352  X->ParaTETransferDiagonal[idx][icntchemi] = real(tmp_paraTETransfer[i]);
1353  icntchemi += 1;
1354  }
1355  }
1356  icheckHermiteCount = TRUE;
1357  }
1358  }
1359  }
1360  }
1361  }
1362 
1363  //if counterpart for satisfying hermite conjugate does not exist.
1364  if (icheckHermiteCount == FALSE) {
1365  fprintf(stdoutMPI,
1366  "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
1367  isite1, isigma1, isite2, isigma2,
1368  real(tmp_paraTETransfer[i]), imag(tmp_paraTETransfer[i]));
1369  iCount++;
1370  //fprintf(stdoutMPI, "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n", itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, real(dcerrTrans), imag(dcerrTrans));
1371  //return(-1);
1372  }
1373  }
1374 
1375  if (iCount != 0) {
1376  return -1;
1377  }
1378 
1379  X->NTETransfer[idx] = 2 * icntHermite;
1380  X->NTETransferDiagonal[idx] = icntchemi;
1381 
1382 
1383  free_i_2d_allocate(tmp_TETransfer);
1384  free(tmp_paraTETransfer);
1385  return 0;
1386 }/*CheckTETransferHermite*/
int * NTETransferDiagonal
Definition: struct.hpp:260
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
std::complex< double > ** ParaTETransfer
Definition: struct.hpp:266
int *** TETransferDiagonal
Definition: struct.hpp:264
double ** ParaTETransferDiagonal
Definition: struct.hpp:268
int * NTETransfer
Definition: struct.hpp:258
int *** TETransfer
Definition: struct.hpp:262
double eps_CheckImag0
Definition: global.cpp:67

◆ CheckTotal2Sz()

int CheckTotal2Sz ( struct DefineList X)

function of checking an input data of total2Sz

Parameters
[in]XDefine list to get informations of transfers
Return values
TRUEspin index is correct
FALSEspin index is incorrect
Version
0.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2797 of file readdef.cpp.

References DefineList::iFlgGeneralSpin, DefineList::iFlgSzConserved, DefineList::NCond, DefineList::Ndown, DefineList::NLocSpn, DefineList::Nup, stdoutMPI, and DefineList::Total2Sz.

Referenced by CheckLocSpin(), and CheckSpinIndexForTrans().

2800 {
2801  if(X->iFlgSzConserved==TRUE && X->iFlgGeneralSpin==FALSE){
2802  int tmp_Nup=X->NLocSpn+X->NCond+X->Total2Sz;
2803  int tmp_Ndown=X->NLocSpn+X->NCond-X->Total2Sz;
2804  if(tmp_Nup%2 != 0 && tmp_Ndown%2 !=0){
2805  printf("Nup=%d, Ndown=%d\n",X->Nup,X->Ndown);
2806  fprintf(stdoutMPI, "2Sz is incorrect.\n");
2807  return FALSE;
2808  }
2809  }
2810  return TRUE;
2811 }
int Nup
Number of spin-up electrons in this process.
Definition: struct.hpp:58
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int iFlgSzConserved
Flag whether Sz is conserved.
Definition: struct.hpp:87
int Total2Sz
Total in this process.
Definition: struct.hpp:69
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
int Ndown
Number of spin-down electrons in this process.
Definition: struct.hpp:59
int NCond
Number of itinerant electrons.
Definition: struct.hpp:85
int NLocSpn
Number of local spins.
Definition: struct.hpp:84

◆ CheckTransferHermite()

int CheckTransferHermite ( struct DefineList X)

Check Hermite for Transfer integrals.

Parameters
[in]XDefine List for getting transfer integrals.
Return values
0Hermite.
-1NonHermite.
Version
0.2

rearray a GeneralTransfer array to satisfy a condition of hermite conjugation between 2*i and 2*i+1 components.

Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2339 of file readdef.cpp.

References DefineList::EDChemi, DefineList::EDGeneralTransfer, DefineList::EDNChemi, DefineList::EDNTransfer, DefineList::EDParaChemi, DefineList::EDParaGeneralTransfer, DefineList::EDSpinChemi, eps_CheckImag0, DefineList::GeneralTransfer, JudgeDefType(), DefineList::NTransfer, DefineList::ParaGeneralTransfer, and stdoutMPI.

Referenced by CheckQuadSite(), and ReadDefFileIdxPara().

2342 {
2343  int i, j;
2344  int isite1, isite2;
2345  int isigma1, isigma2;
2346  int itmpsite1, itmpsite2;
2347  int itmpsigma1, itmpsigma2;
2348  int itmperrsite1, itmperrsite2;
2349  int itmperrsigma1, itmperrsigma2;
2350  std::complex<double> dcerrTrans;
2351  int icheckHermiteCount = FALSE;
2352  int iCount = 0;
2353 
2354  std::complex<double> ddiff_trans;
2355  int itmpIdx, icntHermite, icntchemi;
2356  icntHermite = 0;
2357  icntchemi = 0;
2358 
2359  for (i = 0; i < X->NTransfer; i++) {
2360  isite1 = X->GeneralTransfer[i][0];
2361  isigma1 = X->GeneralTransfer[i][1];
2362  isite2 = X->GeneralTransfer[i][2];
2363  isigma2 = X->GeneralTransfer[i][3];
2364  icheckHermiteCount = FALSE;
2365  for (j = 0; j < X->NTransfer; j++) {
2366  itmpsite1 = X->GeneralTransfer[j][0];
2367  itmpsigma1 = X->GeneralTransfer[j][1];
2368  itmpsite2 = X->GeneralTransfer[j][2];
2369  itmpsigma2 = X->GeneralTransfer[j][3];
2370  if (isite1 == itmpsite2 && isite2 == itmpsite1) {
2371  if (isigma1 == itmpsigma2 && isigma2 == itmpsigma1) {
2372 
2373  ddiff_trans = X->ParaGeneralTransfer[i] - conj(X->ParaGeneralTransfer[j]);
2374  if (abs(ddiff_trans) > eps_CheckImag0) {
2375  itmperrsite1 = itmpsite1;
2376  itmperrsigma1 = itmpsigma1;
2377  itmperrsite2 = itmpsite2;
2378  itmperrsigma2 = itmpsigma2;
2379  dcerrTrans = X->ParaGeneralTransfer[j];
2380  fprintf(stdoutMPI, "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
2381  isite1, isigma1, isite2, isigma2, real(X->ParaGeneralTransfer[i]), imag(X->ParaGeneralTransfer[i]));
2382  fprintf(stdoutMPI, "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
2383  itmperrsite1, itmperrsigma1, itmperrsite2, itmperrsigma2, real(dcerrTrans), imag(dcerrTrans));
2384  iCount++;
2385  }
2386  else {
2387  if (icheckHermiteCount == FALSE) {
2388  if (i <= j) {
2389  if (2 * icntHermite >= X->NTransfer) {
2390  fprintf(stderr, "Elements of Transfers are incorrect.\n");
2391  return(-1);
2392  }
2393  if (isite1 != isite2 || isigma1 != isigma2) {
2394  for (itmpIdx = 0; itmpIdx < 4; itmpIdx++) {
2395  X->EDGeneralTransfer[2 * icntHermite][itmpIdx] = X->GeneralTransfer[i][itmpIdx];
2396  X->EDGeneralTransfer[2 * icntHermite + 1][itmpIdx] = X->GeneralTransfer[j][itmpIdx];
2397  }
2398  X->EDParaGeneralTransfer[2 * icntHermite] = X->ParaGeneralTransfer[i];
2399  X->EDParaGeneralTransfer[2 * icntHermite + 1] = X->ParaGeneralTransfer[j];
2400  icntHermite++;
2401  }
2402  else {
2403  X->EDChemi[icntchemi] = X->GeneralTransfer[i][0];
2404  X->EDSpinChemi[icntchemi] = X->GeneralTransfer[i][1];
2405  X->EDParaChemi[icntchemi] = real(X->ParaGeneralTransfer[i]);
2406  icntchemi += 1;
2407  }
2408  }
2409  icheckHermiteCount = TRUE;
2410  }
2411  }
2412  }
2413 
2414  }
2415  }
2416 
2417  //if counterpart for satisfying hermite conjugate does not exist.
2418  if (icheckHermiteCount == FALSE) {
2419  fprintf(stdoutMPI, "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n", isite1, isigma1, isite2, isigma2, real(X->ParaGeneralTransfer[i]), imag(X->ParaGeneralTransfer[i]));
2420  iCount++;
2421  }
2422  }
2423 
2424  if (iCount != 0) {
2425  return -1;
2426  }
2427  X->EDNTransfer = 2 * icntHermite;
2428  X->EDNChemi = icntchemi;
2429 
2430  //To realize ido-san's result
2431  for (i = 0; i < X->EDNTransfer; i++) {
2432  for (itmpIdx = 0; itmpIdx < 4; itmpIdx++) {
2433  X->GeneralTransfer[i][itmpIdx] = X->EDGeneralTransfer[i][itmpIdx];
2434  }
2436  }
2437  return 0;
2438 }
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int * EDSpinChemi
[DefineList::Nsite]
Definition: struct.hpp:99
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
int EDNChemi
Number of on-site term.
Definition: struct.hpp:97
int ** GeneralTransfer
Index of transfer integrals obtained by a def file. malloc in setmem_def(). Data Format [DefineList::...
Definition: struct.hpp:106
int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.hpp:105
double * EDParaChemi
[DefineList::Nsite] On-site potential parameter. malloc in setmem_def().
Definition: struct.hpp:100
int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.hpp:104
std::complex< double > * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:113
double eps_CheckImag0
Definition: global.cpp:67
int * EDChemi
[DefineList::Nsite] Chemical potential. malloc in setmem_def().
Definition: struct.hpp:98

◆ CheckWords()

int CheckWords ( const char *  ctmp,
const char *  cKeyWord 
)

function of checking whether ctmp is same as cKeyWord or not

Parameters
[in]ctmpA word to be checked whether it matches the registerd keyword or not.
[in]cKeyWordRegistered keyword name
Returns
0 ctmp is same as cKeyWord
Version
1.1.0
Author
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2824 of file readdef.cpp.

Referenced by CheckKW(), JudgeDefType(), ReadcalcmodFile(), and ReadDefFileNInt().

2828 {
2829  int i = 0;
2830  char ctmp_small[256] = { 0 };
2831  char cKW_small[256] = { 0 };
2832  int NcKeyWord, Nctmp;
2833  NcKeyWord = strlen(cKeyWord);
2834  strncpy(cKW_small, cKeyWord, NcKeyWord);
2835 
2836  for (i = 0; i < NcKeyWord; i++) {
2837  cKW_small[i] = tolower(cKW_small[i]);
2838  }
2839  Nctmp = strlen(ctmp);
2840  strncpy(ctmp_small, ctmp, Nctmp);
2841  for (i = 0; i < Nctmp; i++) {
2842  ctmp_small[i] = tolower(ctmp_small[i]);
2843  }
2844  if (Nctmp < NcKeyWord) Nctmp = NcKeyWord;
2845  return(strncmp(ctmp_small, cKW_small, Nctmp));
2846 }

◆ GetDiagonalInterAll()

int GetDiagonalInterAll ( int **  InterAll,
std::complex< double > *  ParaInterAll,
const int  NInterAll,
int **  InterAllDiagonal,
double *  ParaInterAllDiagonal,
int **  InterAllOffDiagonal,
std::complex< double > *  ParaInterAllOffDiagonal,
int *  Chemi,
int *  SpinChemi,
double *  ParaChemi,
int *  NChemi,
const int  iCalcModel 
)

function of getting diagonal components

Parameters
InterAllarrays of information of interall interactions
ParaInterAllarrays of values of interall interactions
NInterAlltotal number of interall interactions
InterAllDiagonalarrays of information of diagonal part of interall interactions
ParaInterAllDiagonalarrays of values of diagonal part of interall interactions
InterAllOffDiagonalarrays of information of off-diagonal part of interall interactions
ParaInterAllOffDiagonalarrays of values of off-diagonal part of interall interactions
Chemiarrays of the site of chemical potential
SpinChemiarrays of the spin of chemical potential
ParaChemiarrays of the value of chemical potential
NChemitotal number of chemical potential
iCalcModelTarget Model defined in CalcMod file (ex. Spin, SpinGC etc.)
Return values
0succeed to get diagonal interactions.
-1format of interall interactions is incorrect.
Version
2.1
Author
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 1125 of file readdef.cpp.

References CheckTETransferHermite(), and stdoutMPI.

Referenced by CheckInterAllHermite(), and ReadDefFileIdxPara().

1139 {
1140  int i, icnt_diagonal, icnt_offdiagonal, tmp_i;
1141  int isite1, isite2, isite3, isite4;
1142  int isigma1, isigma2, isigma3, isigma4;
1143  int iret = 0;
1144  icnt_diagonal = 0;
1145  icnt_offdiagonal = 0;
1146 
1147  for (i = 0; i < NInterAll; i++) {
1148  isite1 = InterAll[i][0];
1149  isigma1 = InterAll[i][1];
1150  isite2 = InterAll[i][2];
1151  isigma2 = InterAll[i][3];
1152  isite3 = InterAll[i][4];
1153  isigma3 = InterAll[i][5];
1154  isite4 = InterAll[i][6];
1155  isigma4 = InterAll[i][7];
1156 
1157  //Get Diagonal term
1158  if (isite1 == isite2 && isite3 == isite4 &&
1159  isigma1 == isigma2 && isigma3 == isigma4)
1160  {
1161  InterAllDiagonal[icnt_diagonal][0] = isite1;
1162  InterAllDiagonal[icnt_diagonal][1] = isigma1;
1163  InterAllDiagonal[icnt_diagonal][2] = isite3;
1164  InterAllDiagonal[icnt_diagonal][3] = isigma3;
1165  ParaInterAllDiagonal[icnt_diagonal] = real(ParaInterAll[i]);
1166  icnt_diagonal++;
1167  continue;
1168  }
1169  else if (isite1 == isite4 && isite2 == isite3 &&
1170  isigma1 == isigma4 && isigma2 == isigma3)
1171  {
1172  InterAllDiagonal[icnt_diagonal][0] = isite1;
1173  InterAllDiagonal[icnt_diagonal][1] = isigma1;
1174  InterAllDiagonal[icnt_diagonal][2] = isite2;
1175  InterAllDiagonal[icnt_diagonal][3] = isigma2;
1176  ParaInterAllDiagonal[icnt_diagonal] = -real(ParaInterAll[i]);
1177  Chemi[*NChemi] = isite1;
1178  SpinChemi[*NChemi] = isigma1;
1179  //transfer integral has minus sign for default setting
1180  ParaChemi[*NChemi] = -real(ParaInterAll[i]);
1181  icnt_diagonal++;
1182  *NChemi += 1;
1183  continue;
1184  }
1185  else {
1186  //Get Off-Diagonal term
1187  switch (iCalcModel) {
1188  case Hubbard:
1189  case HubbardNConserved:
1190  case Kondo:
1191  case KondoGC:
1192  case HubbardGC:
1193  if (isigma1 == isigma2 && isigma3 == isigma4) {
1194  for (tmp_i = 0; tmp_i < 8; tmp_i++) {
1195  InterAllOffDiagonal[icnt_offdiagonal][tmp_i] = InterAll[i][tmp_i];
1196  }
1197  ParaInterAllOffDiagonal[icnt_offdiagonal] = ParaInterAll[i];
1198  }
1199  else if (isigma1 == isigma4 && isigma2 == isigma3) {
1200  InterAllOffDiagonal[icnt_offdiagonal][0] = isite1;
1201  InterAllOffDiagonal[icnt_offdiagonal][1] = isigma1;
1202  InterAllOffDiagonal[icnt_offdiagonal][2] = isite4;
1203  InterAllOffDiagonal[icnt_offdiagonal][3] = isigma1;
1204  InterAllOffDiagonal[icnt_offdiagonal][4] = isite3;
1205  InterAllOffDiagonal[icnt_offdiagonal][5] = isigma2;
1206  InterAllOffDiagonal[icnt_offdiagonal][6] = isite2;
1207  InterAllOffDiagonal[icnt_offdiagonal][7] = isigma2;
1208  ParaInterAllOffDiagonal[icnt_offdiagonal] = -ParaInterAll[i];
1209  }
1210  else {
1211  // Sz symmetry is assumed
1212  if (iCalcModel == Hubbard || iCalcModel == Kondo) {
1213  fprintf(stdoutMPI,
1214  "Error: This operator breaks Sz Symmetry (i, spni, j, spnj, k, spnk, l, spnl) = (%d, %d, %d, %d, %d, %d, %d, %d), InterAll_re= %lf, InterAll_im= %lf . \n",
1215  isite1,
1216  isigma1,
1217  isite2,
1218  isigma2,
1219  isite3,
1220  isigma3,
1221  isite4,
1222  isigma4,
1223  real(ParaInterAll[i]),
1224  imag(ParaInterAll[i])
1225  );
1226  iret = -1;
1227  }
1228  else {
1229  for (tmp_i = 0; tmp_i < 8; tmp_i++) {
1230  InterAllOffDiagonal[icnt_offdiagonal][tmp_i] = InterAll[i][tmp_i];
1231  }
1232  ParaInterAllOffDiagonal[icnt_offdiagonal] = ParaInterAll[i];
1233  }
1234  }
1235  break;
1236  case Spin:
1237  case SpinGC:
1238  if (isite1 == isite2 && isite3 == isite4) {
1239  for (tmp_i = 0; tmp_i < 8; tmp_i++) {
1240  InterAllOffDiagonal[icnt_offdiagonal][tmp_i] = InterAll[i][tmp_i];
1241  }
1242  ParaInterAllOffDiagonal[icnt_offdiagonal] = ParaInterAll[i];
1243  }
1244  break;
1245  default:
1246  return(-1);
1247  }
1248  if (iret != -1) {
1249  icnt_offdiagonal++;
1250  }
1251  }
1252 
1253  if (iret != 0) {
1254  return(-1);
1255  }
1256  }
1257 
1258  return 0;
1259 }/*GetDiagonalInterAll*/
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ GetFileName()

int GetFileName ( const char *  cFileListNameFile,
char **  cFileNameList 
)

Function of Fitting FileName.

Parameters
[in]cFileListNameFilefile for getting names of input files.
[out]cFileNameListarrays for getting names of input files.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 389 of file readdef.cpp.

References CheckKW(), cKWListOfFileNameList, D_iKWNumDef, fgetsMPI(), fopenMPI(), ReadDefFileError(), and stdoutMPI.

Referenced by ReadDefFileNInt().

393 {
394  FILE *fplist;
395  int itmpKWidx=-1;
396  char ctmpFileName[D_FileNameMaxReadDef];
397  char ctmpKW[D_CharTmpReadDef], ctmp2[256];
398  int i;
399  for(i=0; i< D_iKWNumDef; i++){
400  strcpy(cFileNameList[i],"");
401  }
402 
403  fplist = fopenMPI(cFileListNameFile, "r");
404  if(fplist==NULL) return ReadDefFileError(cFileListNameFile);
405 
406  while(fgetsMPI(ctmp2, 256, fplist) != NULL){
407  memset(ctmpKW, '\0', strlen(ctmpKW));
408  memset(ctmpFileName, '\0', strlen(ctmpFileName));
409  sscanf(ctmp2,"%s %s\n", ctmpKW, ctmpFileName);
410 
411  if(strncmp(ctmpKW, "#", 1)==0 || *ctmp2=='\n' || (strcmp(ctmpKW, "")&&strcmp(ctmpFileName,""))==0){
412  continue;
413  }
414  else if(strcmp(ctmpKW, "")*strcmp(ctmpFileName, "")==0){
415  fprintf(stdoutMPI,
416  "Error: keyword and filename must be set as a pair in %s.\n",
417  cFileListNameFile);
418  fclose(fplist);
419  return(-1);
420  }
422  if( CheckKW(ctmpKW, cKWListOfFileNameList, D_iKWNumDef, &itmpKWidx)!=0 ){
423  fprintf(stdoutMPI, "Error: Wrong keywords %s in %s.\n", ctmpKW, cFileListNameFile);
424  fprintf(stdoutMPI, "%s", "Choose Keywords as follows: \n");
425  for(i=0; i<D_iKWNumDef;i++){
426  fprintf(stdoutMPI, "%s \n", cKWListOfFileNameList[i]);
427  }
428  fclose(fplist);
429  return(-1);
430  }
432  if(strcmp(cFileNameList[itmpKWidx], "") !=0){
433  fprintf(stdoutMPI, "Error: Same keywords exist in %s.\n", cFileListNameFile);
434  fclose(fplist);
435  return(-1);
436  }
437 
439  strcpy(cFileNameList[itmpKWidx], ctmpFileName);
440  }
441  fclose(fplist);
442  return 0;
443 }
int CheckKW(const char *cKW, char cKWList[][D_CharTmpReadDef], int iSizeOfKWidx, int *iKWidx)
Function of Checking keyword in NameList file.
Definition: readdef.cpp:139
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int ReadDefFileError(const char *defname)
Error Function of reading def files.
Definition: readdef.cpp:97
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.cpp:105
int D_iKWNumDef
Definition: readdef.cpp:60
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.cpp:122
static char cKWListOfFileNameList[][D_CharTmpReadDef]
Keyword List in NameListFile.
Definition: readdef.cpp:36

◆ GetFileNameByKW()

int GetFileNameByKW ( int  iKWidx,
char **  FileName 
)

function of getting file name labeled by the keyword

Parameters
iKWidxindex of keyword
FileNamefilename
Return values
0normally finished getting file name.
-1unnormally finished getting file name.

Definition at line 2853 of file readdef.cpp.

Referenced by CalcByTEM(), and CalcSpectrum().

2856  {
2857  if(cFileNameListFile == NULL){
2858  return -1;
2859  }
2860  *FileName=cFileNameListFile[iKWidx];
2861  return 0;
2862 }
static char ** cFileNameListFile
Definition: readdef.cpp:65

◆ GetKWWithIdx()

int GetKWWithIdx ( char *  ctmpLine,
char *  ctmp,
int *  itmp 
)

Function of Getting keyword and it's variable from characters.

Parameters
[in]ctmpLinecharacters including keyword and it's variable
[out]ctmpkeyword
[out]itmpvariable for a keyword
Return values
0keyword and it's variable are obtained.
1ctmpLine is a comment line.
-1format of ctmpLine is incorrect.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 172 of file readdef.cpp.

References stdoutMPI.

Referenced by ReadcalcmodFile().

177 {
178  char *ctmpRead;
179  char *cerror;
180  char csplit[] = " ,.\t\n";
181  if(*ctmpLine=='\n') return 1;
182  ctmpRead = strtok(ctmpLine, csplit);
183  if(strncmp(ctmpRead, "=", 1)==0 || strncmp(ctmpRead, "#", 1)==0 || ctmpRead==NULL){
184  return 1;
185  }
186  strcpy(ctmp, ctmpRead);
187 
188  ctmpRead = strtok( NULL, csplit );
189  *itmp = strtol(ctmpRead, &cerror, 0);
190  //if ctmpRead is not integer type
191  if(*cerror != '\0'){
192  fprintf(stdoutMPI, "Error: incorrect format= %s. \n", cerror);
193  return(-1);
194  }
195 
196  ctmpRead = strtok( NULL, csplit );
197  if(ctmpRead != NULL){
198  fprintf(stdoutMPI, "Error: incorrect format= %s. \n", ctmpRead);
199  return(-1);
200  }
201 
202  return 0;
203 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ InitializeInteractionNum()

void InitializeInteractionNum ( struct DefineList X)

function of initializing interactions

Parameters
[out]XDefine list to initialize number of interactions
Version
0.1
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2691 of file readdef.cpp.

References CheckGeneralSpinIndexForInterAll(), DefineList::NCisAjt, DefineList::NCisAjtCkuAlvDC, DefineList::NCoulombInter, DefineList::NCoulombIntra, DefineList::NExchangeCoupling, DefineList::NHundCoupling, DefineList::NInterAll, DefineList::NInterAll_Diagonal, DefineList::NInterAll_OffDiagonal, DefineList::NIsingCoupling, DefineList::NLaser, DefineList::NNPairExcitationOperator, DefineList::NNSingleExcitationOperator, DefineList::NPairHopping, DefineList::NPairLiftCoupling, DefineList::NTEInterAll, DefineList::NTETimeSteps, DefineList::NTETransfer, and DefineList::NTransfer.

Referenced by ReadDefFileNInt(), and ResetInteractionNum().

2694 {
2695  X->NTransfer=0;
2696  X->NCoulombIntra=0;
2697  X->NCoulombInter=0;
2698  X->NHundCoupling = 0;
2699  X->NExchangeCoupling = 0;
2700  X->NPairHopping = 0;
2701  X->NIsingCoupling=0;
2702  X->NPairLiftCoupling=0;
2703  X->NInterAll=0;
2704  X->NInterAll_Diagonal = 0;
2705  X->NInterAll_OffDiagonal = 0;
2706  X->NCisAjt=0;
2707  X->NCisAjtCkuAlvDC=0;
2710  //[s] Time Evolution
2711  X->NTETimeSteps=0;
2712  X->NLaser=0;
2713  X->NTEInterAll=0;
2714  X->NTETransfer=0;
2715  //[e] Time Evolution
2716 
2717 }
int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.hpp:127
int NPairLiftCoupling
Number of pair-lift term.
Definition: struct.hpp:153
int NHundCoupling
Number of Hund coupling.
Definition: struct.hpp:133
int NIsingCoupling
Number of Ising term.
Definition: struct.hpp:151
int NInterAll
Total Number of Interacted quartet.
Definition: struct.hpp:163
int NNSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:182
int * NTEInterAll
Definition: struct.hpp:273
int NCisAjt
Number of indices of two-body correlation function.
Definition: struct.hpp:175
int NLaser
Definition: struct.hpp:252
int * NTETransfer
Definition: struct.hpp:258
int NExchangeCoupling
Number of exchange term.
Definition: struct.hpp:145
int NInterAll_Diagonal
Number of interall term (diagonal)
Definition: struct.hpp:164
int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.hpp:104
int NInterAll_OffDiagonal
Number of interall term (off-diagonal)
Definition: struct.hpp:165
int NPairHopping
Number of pair-hopping term.
Definition: struct.hpp:139
int NCoulombIntra
Definition: struct.hpp:121
int NTETimeSteps
Definition: struct.hpp:248
int NNPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:189
int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.hpp:178

◆ InputInterAllInfo()

int InputInterAllInfo ( int *  icnt_interall,
int **  iInterAllInfo,
std::complex< double > *  cInterAllValue,
int  isite1,
int  isigma1,
int  isite2,
int  isigma2,
int  isite3,
int  isigma3,
int  isite4,
int  isigma4,
double  dvalue_re,
double  dvalue_im 
)

Input InterAll Interactions (Operators of the same kinds are grouped together).

Parameters
icnt_interalltotal number of interall interactions
iInterAllInfoarrays of information of interall interactions
cInterAllValuearrays of values of interall interactions
[in]isite1a site number on the site 1.
[in]isigma1a spin index on the site 1.
[in]isite2a site number on the site 2.
[in]isigma2a spin index on the site 2.
[in]isite3a site number on the site 3.
[in]isigma3a spin index on the site 3.
[in]isite4a site number on the site 4.
[in]isigma4a spin index on the site 4.
dvalue_re
dvalue_im
Returns
0 Interaction is off-diagonal
1 Interaction is diagonal

Definition at line 2942 of file readdef.cpp.

References I().

Referenced by ReadDefFileIdxPara().

2951  {
2952  int i = 0;
2953  int iflg_interall = 0;
2954  //Collect and sum same components of InterAll interactions
2955  for (i = 0; i < *icnt_interall; i++) {
2956  if (isite1 == iInterAllInfo[i][0] && isite2 == iInterAllInfo[i][2] &&
2957  isite3 == iInterAllInfo[i][4] && isite4 == iInterAllInfo[i][6] &&
2958  isigma1 == iInterAllInfo[i][1] && isigma2 == iInterAllInfo[i][3] &&
2959  isigma3 == iInterAllInfo[i][5] && isigma4 == iInterAllInfo[i][7]) {
2960  cInterAllValue[i] += dvalue_re + dvalue_im * I;
2961  iflg_interall = 1;
2962  return 0;
2963  }
2964  }
2965 
2966  //Input all InterAll interactions
2967  if (iflg_interall == 0) {
2968  iInterAllInfo[*icnt_interall][0] = isite1;
2969  iInterAllInfo[*icnt_interall][1] = isigma1;
2970  iInterAllInfo[*icnt_interall][2] = isite2;
2971  iInterAllInfo[*icnt_interall][3] = isigma2;
2972  iInterAllInfo[*icnt_interall][4] = isite3;
2973  iInterAllInfo[*icnt_interall][5] = isigma3;
2974  iInterAllInfo[*icnt_interall][6] = isite4;
2975  iInterAllInfo[*icnt_interall][7] = isigma4;
2976  cInterAllValue[*icnt_interall] = dvalue_re + I * dvalue_im;
2977  *icnt_interall+=1;
2978  //Check Diagonal part or not
2979  if (isite1 == isite2 && isite3 == isite4 &&
2980  isigma1 == isigma2 && isigma3 == isigma4) { //normal diagonal part
2981  return 1;
2982  } else if (isite1 == isite4 && isite2 == isite3 &&
2983  isigma1 == isigma4 && isigma2 == isigma3) { //hund term
2984  return 1;
2985  }
2986  }
2987  return 0;
2988 }
std::complex< double > I(0.0, 1.0)

◆ JudgeDefType()

int JudgeDefType ( const int  argc,
char *  argv[],
int *  mode 
)

function of judging a type of define files.

Parameters
[in]argcargument count
[in]argvargument vector
[out]modea number to show a type of a define file
Return values
0format is correct
-1format is incorrect
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2453 of file readdef.cpp.

References CheckFormatForSpinInt(), CheckWords(), and stdoutMPI.

Referenced by CheckTransferHermite(), and main().

2458 {
2459  int ver_maj =
2460 #include "version_major.hpp"
2461 ;
2462  int ver_min =
2463 #include "version_miner.hpp"
2464 ;
2465  int ver_pat =
2466 #include "version_patch.hpp"
2467 ;
2468 
2469  if(argc == 3 &&
2470  (CheckWords(argv[1], "-e") == 0 ||
2471  CheckWords(argv[1], "--Expert") == 0)){
2472  *mode=EXPERT_MODE;
2473  }
2474  else if (argc == 3 &&
2475  (CheckWords(argv[1], "-s") ==0 ||
2476  CheckWords(argv[1], "--Standard") == 0 )){
2477  *mode=STANDARD_MODE;
2478  }
2479  else if (argc == 3 &&
2480  (CheckWords(argv[1], "-sdry") == 0 ||
2481  CheckWords(argv[1], "-s-dry") == 0)
2482  ){
2483  *mode = STANDARD_DRY_MODE;
2484  }
2485  else if (argc >= 2 &&
2486  (CheckWords(argv[1], "-v") == 0
2487  || CheckWords(argv[1], "--version") == 0)
2488  ) {
2489  fprintf(stdoutMPI, "\nHPhi version %d.%d.%d \n\n", ver_maj, ver_min, ver_pat);
2490  exit(-1);
2491  }
2492  else{
2493  fprintf(stdoutMPI, "\n[Usage] \n");
2494  fprintf(stdoutMPI, "* Expert mode \n");
2495  fprintf(stdoutMPI, " $ HPhi -e {namelist_file} \n");
2496  fprintf(stdoutMPI, "* Standard mode \n");
2497  fprintf(stdoutMPI, " $ HPhi -s {input_file} \n");
2498  fprintf(stdoutMPI, "* Standard DRY mode \n");
2499  fprintf(stdoutMPI, " $ HPhi -sdry {input_file} \n");
2500  fprintf(stdoutMPI, " In this mode, Hphi stops after it generats expert input files. \n");
2501  fprintf(stdoutMPI, "* Print the version \n");
2502  fprintf(stdoutMPI, " $ HPhi -v \n\n");
2503  exit(-1);
2504  }
2505 
2506  return 0;
2507 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int CheckWords(const char *ctmp, const char *cKeyWord)
function of checking whether ctmp is same as cKeyWord or not
Definition: readdef.cpp:2824

◆ ReadcalcmodFile()

int ReadcalcmodFile ( const char *  defname,
struct DefineList X 
)

Function of Reading calcmod file.

Parameters
[in]defnamefile name to read.
[out]XDefine List for getting flags of calc-mode.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 215 of file readdef.cpp.

References CheckWords(), fgetsMPI(), fopenMPI(), GetKWWithIdx(), DefineList::iCalcEigenVec, DefineList::iCalcModel, DefineList::iCalcType, DefineList::iFlgCalcSpec, DefineList::iFlgFiniteTemperature, DefineList::iFlgMPI, DefineList::iFlgScaLAPACK, DefineList::iInitialVecType, DefineList::iInputEigenVec, DefineList::iInputHam, DefineList::iNGPU, DefineList::iOutputEigenVec, DefineList::iOutputExVec, DefineList::iOutputHam, DefineList::iOutputMode, DefineList::iReStart, ReadDefFileError(), stdoutMPI, and ValidateValue().

Referenced by ReadDefFileNInt().

219 {
220  FILE *fp;
221  int itmp, iret;
222  char ctmpLine[D_CharTmpReadDef+D_CharKWDMAX];
223  char ctmp[D_CharKWDMAX];
224  X->iCalcType=0;
226  X->iCalcModel=0;
227  X->iOutputMode=0;
228  X->iCalcEigenVec=0;
229  X->iInitialVecType=0;
230  X->iOutputEigenVec=0;
231  X->iInputEigenVec=0;
232  X->iOutputHam=0;
233  X->iInputHam=0;
234  X->iOutputExVec = 0;
235  X->iFlgCalcSpec=0;
236  X->iReStart=0;
237  X->iFlgMPI=0;
238  X->iFlgScaLAPACK=0;
239 #ifdef _MAGMA
240  X->iNGPU=2;
241 #else
242  X->iNGPU=0;
243 #endif
244  /*=======================================================================*/
245  fp = fopenMPI(defname, "r");
246  if(fp==NULL) return ReadDefFileError(defname);
247  /* read Parameters from calcmod.def*/
248  while( fgetsMPI(ctmpLine, D_CharTmpReadDef+D_CharKWDMAX, fp)!=NULL ){
249  if( (iret=GetKWWithIdx(ctmpLine, ctmp, &itmp)) !=0){
250  if(iret==1) continue;
251  return(-1);
252  }
253  if(CheckWords(ctmp, "CalcType")==0){
254  X->iCalcType=itmp;
255  if (X->iCalcType == Lanczos) {
256  fprintf(stdoutMPI, " LOBPCG is used alternative to Lanczos.\n");
257  X->iCalcType = CG;
258  }
259  }
260  else if(CheckWords(ctmp, "FlgFiniteTemperature")==0){
261  X->iFlgFiniteTemperature = itmp;
262  }
263  else if(CheckWords(ctmp, "CalcModel")==0){
264  X->iCalcModel=itmp;
265  }
266  else if(CheckWords(ctmp, "OutputMode")==0){
267  X->iOutputMode=itmp;
268  }
269  else if(CheckWords(ctmp, "CalcEigenVec")==0){
270  X->iCalcEigenVec=itmp;
271  }
272  else if(CheckWords(ctmp, "InitialVecType")==0){
273  X->iInitialVecType=itmp;
274  }
275  else if(CheckWords(ctmp, "OutputEigenVec")==0 || CheckWords(ctmp, "OEV")==0){
276  X->iOutputEigenVec=itmp;
277  }
278  else if(CheckWords(ctmp, "InputEigenVec")==0 || CheckWords(ctmp, "IEV")==0){
279  X->iInputEigenVec=itmp;
280  }
281  else if(CheckWords(ctmp, "OutputHam")==0){
282  X->iOutputHam=itmp;
283  }
284  else if(CheckWords(ctmp, "InputHam")==0){
285  X->iInputHam=itmp;
286  }
287  else if(CheckWords(ctmp, "OutputExcitedVec")==0|| CheckWords(ctmp, "OutputExVec")==0){
288  X->iOutputExVec=itmp;
289  }
290  else if(CheckWords(ctmp, "CalcSpec")==0 || CheckWords(ctmp, "CalcSpectrum")==0){
291  X->iFlgCalcSpec=itmp;
292  }
293  else if(CheckWords(ctmp, "ReStart")==0){
294  X->iReStart=itmp;
295  }
296  else if(CheckWords(ctmp, "NGPU")==0){
297  X->iNGPU=itmp;
298  }
299  else if(CheckWords(ctmp, "ScaLAPACK")==0){
300 #ifdef _SCALAPACK
301  X->iFlgScaLAPACK=itmp;
302 #endif
303  }
304  else{
305  fprintf(stdoutMPI, "Error: In %s, wrong parameter name:%s \n", defname, ctmp);
306  return(-1);
307  }
308  }
309  fclose(fp);
310 
311  /* Check values*/
312  if(ValidateValue(X->iCalcModel, 0, NUM_CALCMODEL-1)){
313  fprintf(stdoutMPI, "Error in %s\n CalcType: 0: Lanczos Method, 1: Thermal Pure Quantum State Method, 2: Full Diagonalization Method, 3: Calculation Spectrum mode.\n", defname);
314  return (-1);
315  }
316  if(ValidateValue(X->iCalcType, 0, NUM_CALCTYPE-1)){
317  fprintf(stdoutMPI, "Error in %s\n CalcType: 0: Lanczos Method, 1: Thermal Pure Quantum State Method, 2: Full Diagonalization Method, 3: Calculation Spectrum mode.\n", defname);
318  return (-1);
319  }
320  if(ValidateValue(X->iOutputMode, 0, NUM_OUTPUTMODE-1)){
321  fprintf(stdoutMPI, "Error in %s\n OutputMode: \n 0: calc one body green function and two body green functions,\n 1: calc one body green function and two body green functions and correlatinos for charge and spin.\n", defname);
322  return (-1);
323  }
324 
325  if(ValidateValue(X->iCalcEigenVec, -1, NUM_CALCEIGENVEC-1)){
326  fprintf(stdoutMPI, "Error in %s\n CalcEigenVec: \n 0: Lanczos+CG method,\n 1: Lanczos method.\n", defname);
327  return (-1);
328  }
329 
330  if(ValidateValue(X->iInitialVecType, 0, NUM_SETINITAILVEC-1)){
331  fprintf(stdoutMPI, "Error in %s\n InitialVecType: \n 0: complex type,\n 1: real type.\n", defname);
332  return (-1);
333  }
334 
335  if(ValidateValue(X->iOutputHam, 0, NUM_OUTPUTHAM-1)){
336  fprintf(stdoutMPI, "Error in %s\n OutputHam: \n 0: not output Hamiltonian,\n 1: output Hamiltonian.\n", defname);
337  return (-1);
338  }
339  if(ValidateValue(X->iInputHam, 0, NUM_INPUTHAM-1)){
340  fprintf(stdoutMPI, "Error in %s\n InputHam: 0: not input Hamiltonian,\n 1: input Hamiltonian.\n", defname);
341  return (-1);
342  }
343  if(X->iInputHam == 1 && X->iOutputHam==1){
344  fprintf(stdoutMPI,
345  "Error in %s\n OutputHam=1 and InputHam=1.\n", defname);
346  return (-1);
347  }
348  if(ValidateValue(X->iReStart, 0, NUM_RESTART-1)){
349  fprintf(stdoutMPI, "Error in %s Restart: \n 0: not restart (default).\n 1: output a restart vector.\n 2: input a restart vector and output a new restart vector.\n 3: input a restart vector.\n", defname);
350  return (-1);
351  }
352  if(X->iNGPU < 0){
353  fprintf(stdoutMPI, "Error in %s\n NGPU: NGPU must be greater than 0.\n", defname);
354  return (-1);
355  }
356  if(ValidateValue(X->iFlgScaLAPACK, 0, 1)){
357  fprintf(stdoutMPI, "Error in %s\n NGPU: NGPU must be greater than 0.\n", defname);
358  return (-1);
359  }
360 
361  /* In the case of Full Diagonalization method(iCalcType=2)*/
362  if(X->iCalcType==2 && ValidateValue(X->iFlgFiniteTemperature, 0, 1)){
363  fprintf(stdoutMPI,
364  "Error in %s\n FlgFiniteTemperature: Finite Temperature, 1: Zero Temperature.\n",
365  defname);
366  return (-1);
367  }
368 
369  if(X->iCalcType !=2 && X->iOutputHam ==TRUE) {
370  fprintf(stdoutMPI,
371  "Error in %s\n OutputHam is only defined for FullDiag mode, CalcType=2.\n",
372  defname);
373  return (-1);
374  }
375 
376  return 0;
377 }
int iInputHam
Definition: struct.hpp:207
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int iReStart
Definition: struct.hpp:223
int ReadDefFileError(const char *defname)
Error Function of reading def files.
Definition: readdef.cpp:97
int ValidateValue(const int icheckValue, const int ilowestValue, const int iHighestValue)
Function of Validating value.
Definition: readdef.cpp:115
int iOutputEigenVec
ASwitch for outputting an eigenvector. 0: no output, 1:output.
Definition: struct.hpp:204
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.cpp:105
int iNGPU
GPU mode ( only for FullDiag )
Definition: struct.hpp:232
int iFlgScaLAPACK
ScaLAPACK mode ( only for FullDiag )
Definition: struct.hpp:237
int CheckWords(const char *ctmp, const char *cKeyWord)
function of checking whether ctmp is same as cKeyWord or not
Definition: readdef.cpp:2824
int iFlgFiniteTemperature
???
Definition: struct.hpp:199
int iFlgMPI
MPI mode.
Definition: struct.hpp:227
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.cpp:122
int iCalcEigenVec
Switch for method to calculate eigenvectors. 0:Lanczos+CG, 1: Lanczos. default value is set as 0 in r...
Definition: struct.hpp:195
int GetKWWithIdx(char *ctmpLine, char *ctmp, int *itmp)
Function of Getting keyword and it&#39;s variable from characters.
Definition: readdef.cpp:172
int iOutputExVec
Definition: struct.hpp:208
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
Definition: struct.hpp:218
int iOutputMode
Switch for output mode. 0: OneBodyG and TwoBodyG. 1: OneBodyG and TwoBodyG and correlations for charg...
Definition: struct.hpp:202
int iInitialVecType
Switch for type of inital vectors. 0:complex type, 1: real type. default value is set as 0 in readdef...
Definition: struct.hpp:197
int iInputEigenVec
Switch for reading an eigenvector. 0: no input, 1:input.
Definition: struct.hpp:205
int iOutputHam
Definition: struct.hpp:206
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.hpp:194

◆ ReadDefFileError()

int ReadDefFileError ( const char *  defname)

Error Function of reading def files.

Parameters
[in]defnamename of def file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 97 of file readdef.cpp.

References stdoutMPI.

Referenced by GetFileName(), ReadcalcmodFile(), ReadDefFileIdxPara(), and ReadDefFileNInt().

99  {
100  fprintf(stdoutMPI, "Error: %s (Broken file or Not exist)\n", defname);
101  return (-1);
102 }
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75

◆ ReadDefFileIdxPara()

int ReadDefFileIdxPara ( struct DefineList X,
struct BoostList xBoost 
)

function of reading def files to get keyword index

Parameters
Xdefine list to get and put informations for calcuation
xBoostlist to get and put informations for Boost (CMA) calcuation
Return values
0normally finished reading file.
-1unnormally finished reading file.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 1399 of file readdef.cpp.

References BoostList::arrayJ, CheckFormatForSpinInt(), CheckInterAllCondition(), CheckInterAllHermite(), CheckLocSpin(), CheckPairSite(), CheckQuadSite(), CheckSite(), CheckSpinIndexForTrans(), CheckTETransferHermite(), CheckTransferHermite(), DefineList::CisAjt, DefineList::CisAjtCkuAlvDC, DefineList::CoulombInter, DefineList::CoulombIntra, D_iKWNumDef, DefineList::EDChemi, DefineList::EDNChemi, DefineList::EDParaChemi, DefineList::EDSpinChemi, eps_CheckImag0, DefineList::ExchangeCoupling, exitMPI(), fgetsMPI(), fopenMPI(), DefineList::GeneralTransfer, GetDiagonalInterAll(), DefineList::HundCoupling, I(), DefineList::iCalcModel, DefineList::iFlgGeneralSpin, InputInterAllInfo(), DefineList::InterAll, DefineList::InterAll_Diagonal, DefineList::InterAll_OffDiagonal, BoostList::list_6spin_pair, BoostList::list_6spin_star, DefineList::LocSpn, DefineList::NCisAjt, DefineList::NCisAjtCkuAlvDC, DefineList::NCoulombInter, DefineList::NCoulombIntra, DefineList::NExchangeCoupling, DefineList::NHundCoupling, DefineList::NInterAll, DefineList::NInterAll_Diagonal, DefineList::NInterAll_OffDiagonal, DefineList::NIsingCoupling, DefineList::NLaser, DefineList::NNPairExcitationOperator, DefineList::NNSingleExcitationOperator, DefineList::NPairExcitationOperator, DefineList::NPairHopping, DefineList::NPairLiftCoupling, DefineList::NSingleExcitationOperator, DefineList::Nsite, DefineList::NTEChemi, DefineList::NTEInterAll, DefineList::NTEInterAllDiagonal, DefineList::NTEInterAllOffDiagonal, DefineList::NTETimeSteps, DefineList::NTETransfer, DefineList::NTransfer, BoostList::num_pivot, BoostList::NumarrayJ, DefineList::PairExcitationOperator, DefineList::PairHopping, DefineList::PairLiftCoupling, DefineList::ParaCoulombInter, DefineList::ParaCoulombIntra, DefineList::ParaExchangeCoupling, DefineList::ParaGeneralTransfer, DefineList::ParaHundCoupling, DefineList::ParaInterAll, DefineList::ParaInterAll_Diagonal, DefineList::ParaInterAll_OffDiagonal, DefineList::ParaLaser, DefineList::ParaPairExcitationOperator, DefineList::ParaPairHopping, DefineList::ParaPairLiftCoupling, DefineList::ParaSingleExcitationOperator, DefineList::ParaTEChemi, DefineList::ParaTEInterAll, DefineList::ParaTEInterAllDiagonal, DefineList::ParaTEInterAllOffDiagonal, DefineList::ParaTETransfer, BoostList::R0, ReadDefFileError(), ResetInteractionNum(), DefineList::SingleExcitationOperator, DefineList::SiteToBit, DefineList::SpinTEChemi, stdoutMPI, DefineList::TEChemi, DefineList::TEInterAll, DefineList::TEInterAllDiagonal, DefineList::TEInterAllOffDiagonal, DefineList::TETime, DefineList::TETransfer, and BoostList::vecB.

Referenced by main().

1403 {
1404  FILE *fp;
1405  char defname[D_FileNameMaxReadDef];
1406  char ctmp[D_CharTmpReadDef], ctmp2[256];
1407 
1408  int i, idx, itype;
1409  int xitmp[8];
1410  int iKWidx = 0;
1411  int iboolLoc = 0;
1412  int isite1, isite2, isite3, isite4;
1413  int isigma1, isigma2, isigma3, isigma4;
1414  double dvalue_re, dvalue_im;
1415  double dArrayValue_re[3];
1416  int icnt_diagonal = 0;
1417  int ieps_CheckImag0 = -12;
1418  eps_CheckImag0 = pow(10.0, ieps_CheckImag0);
1419  int iline = 0;
1420  int ilineIn = 0;
1421  int ilineIn2 = 0;
1422  int itmp = 0;
1423  int icnt_trans = 0;
1424  int iflg_trans = 0;
1425  int icnt_interall = 0;
1426 
1427  int iloop = 0;
1428 
1429  for (iKWidx = KWLocSpin; iKWidx < D_iKWNumDef; iKWidx++) {
1430  strcpy(defname, cFileNameListFile[iKWidx]);
1431  if (strcmp(defname, "") == 0 || iKWidx == KWSpectrumVec) continue;
1432  fprintf(stdoutMPI, " Read File %s.\n", defname);
1433  fp = fopenMPI(defname, "r");
1434  if (fp == NULL) return ReadDefFileError(defname);
1435  if (iKWidx != KWBoost) {
1436  for (i = 0; i < IgnoreLinesInDef; i++) fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
1437  }
1438 
1439  idx = 0;
1440  /*=======================================================================*/
1441  switch (iKWidx) {
1442  case KWLocSpin:
1443  /* Read locspn.def----------------------------------------*/
1444  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1445  if (idx == X->Nsite) {
1446  fclose(fp);
1447  return ReadDefFileError(defname);
1448  }
1449 
1450  sscanf(ctmp2, "%d %d\n", &(xitmp[0]), &(xitmp[1]));
1451  X->LocSpn[xitmp[0]] = xitmp[1];
1452  X->SiteToBit[xitmp[0]] = (X->LocSpn[xitmp[0]] + 1);//2S+1
1453  if (CheckSite(xitmp[0], X->Nsite) != 0) {
1454  fclose(fp);
1455  return ReadDefFileError(defname);
1456  }
1457  idx++;
1458  }
1459  if (CheckLocSpin(X) == FALSE) {
1460  fclose(fp);
1461  return ReadDefFileError(defname);
1462  }
1463 
1464  break;
1465 
1466  case KWTrans:
1467  /* transfer.def--------------------------------------*/
1468  if (X->NTransfer > 0) {
1469  icnt_trans = 0;
1470  while (fgetsMPI(ctmp2, 256, fp) != NULL)
1471  {
1472  if (idx == X->NTransfer) {
1473  fclose(fp);
1474  return ReadDefFileError(defname);
1475  }
1476 
1477  sscanf(ctmp2, "%d %d %d %d %lf %lf\n",
1478  &isite1,
1479  &isigma1,
1480  &isite2,
1481  &isigma2,
1482  &dvalue_re,
1483  &dvalue_im
1484  );
1485 
1486  if (CheckPairSite(isite1, isite2, X->Nsite) != 0) {
1487  fclose(fp);
1488  return ReadDefFileError(defname);
1489  }
1490 
1491  if (isite1 == isite2 && isigma1 == isigma2) {
1492  if (fabs(dvalue_im) > eps_CheckImag0) {
1493  //NonHermite
1494  fprintf(stdoutMPI,
1495  "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
1496  isite1, isigma1, isite2, isigma2, dvalue_re, dvalue_im);
1497  fclose(fp);
1498  return ReadDefFileError(defname);
1499  }
1500  }
1501 
1502  if (X->iCalcModel == Spin) {
1503  if (isite1 != isite2) {
1504  iboolLoc = 1;
1505  fprintf(stdoutMPI, "Warning: Site component of (i, j) =(%d, %d) is ignored.\n",
1506  isite1, isite2);
1507  }
1508  }
1509  else if (X->iCalcModel == Kondo) {
1510  if (X->LocSpn[isite1] != ITINERANT || X->LocSpn[isite2] != ITINERANT) {
1511  if (isite1 != isite2) {
1512  iboolLoc = 1;
1513  fprintf(stdoutMPI, "Error: Site component of (i, j) =(%d, %d) is incorrect.\n", isite1, isite2);
1514  }
1515  }
1516  }
1517  else if (X->iCalcModel == SpinlessFermion || X->iCalcModel == SpinlessFermionGC) {
1518  if (isigma1 != 0 || isigma2 != 0) {
1519  //Not allowed
1520  fprintf(stderr,
1521  "Error: NonHermite (i, spni, j, spnj) = (%d, %d, %d, %d), trans_re= %lf, trans_im= %lf.\n",
1522  isite1, isigma1, isite2, isigma2, dvalue_re, dvalue_im);
1523  fclose(fp);
1524  return ReadDefFileError(defname);
1525  }
1526  }
1527 
1528  iflg_trans = 0;
1529  for (i = 0; i < icnt_trans; i++) {
1530  if (isite1 == X->GeneralTransfer[i][0] && isite2 == X->GeneralTransfer[i][2]
1531  && isigma1 == X->GeneralTransfer[i][1] && isigma2 == X->GeneralTransfer[i][3])
1532  {
1533  X->ParaGeneralTransfer[i] += dvalue_re + dvalue_im * I;
1534  iflg_trans = 1;
1535  continue;
1536  }
1537  }
1538 
1539  if (iflg_trans == 0) {
1540  X->GeneralTransfer[icnt_trans][0] = isite1;
1541  X->GeneralTransfer[icnt_trans][1] = isigma1;
1542  X->GeneralTransfer[icnt_trans][2] = isite2;
1543  X->GeneralTransfer[icnt_trans][3] = isigma2;
1544  X->ParaGeneralTransfer[icnt_trans] = dvalue_re + dvalue_im * I;
1545  icnt_trans++;
1546  }
1547  idx++;
1548  }
1549 
1550  if (iboolLoc == 1) {
1551  fclose(fp);
1552  return(-1);
1553  }
1554  }
1555 
1556  X->NTransfer = icnt_trans;
1557 
1558  if (CheckSpinIndexForTrans(X) == FALSE) {
1559  fclose(fp);
1560  return(-1);
1561  }
1562 
1563  if (CheckTransferHermite(X) != 0) {
1564  fprintf(stdoutMPI, "%s", "Error: NonHermite Pair exists in transfer integral. \n");
1565  fclose(fp);
1566  return(-1);
1567  }
1568  break;
1569 
1570  case KWCoulombIntra:
1571  /*coulombintra.def----------------------------------*/
1572  if (X->NCoulombIntra > 0) {
1573  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1574  if (idx == X->NCoulombIntra) {
1575  fclose(fp);
1576  return ReadDefFileError(defname);
1577  }
1578  sscanf(ctmp2, "%d %lf\n",
1579  &(X->CoulombIntra[idx][0]),
1580  &(X->ParaCoulombIntra[idx])
1581  );
1582 
1583  if (CheckSite(X->CoulombIntra[idx][0], X->Nsite) != 0) {
1584  fclose(fp);
1585  return ReadDefFileError(defname);
1586  }
1587  idx++;
1588  }
1589  }
1590  break;
1591 
1592  case KWCoulombInter:
1593  /*coulombinter.def----------------------------------*/
1594  if (X->NCoulombInter > 0) {
1595  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1596  if (idx == X->NCoulombInter) {
1597  fclose(fp);
1598  return ReadDefFileError(defname);
1599  }
1600 
1601  sscanf(ctmp2, "%d %d %lf\n",
1602  &(X->CoulombInter[idx][0]),
1603  &(X->CoulombInter[idx][1]),
1604  &(X->ParaCoulombInter[idx])
1605  );
1606 
1607  if (CheckPairSite(X->CoulombInter[idx][0], X->CoulombInter[idx][1], X->Nsite) != 0) {
1608  fclose(fp);
1609  return ReadDefFileError(defname);
1610  }
1611 
1612  idx++;
1613  }
1614  }
1615  break;
1616 
1617  case KWHund:
1618  /*hund.def------------------------------------------*/
1619  if (X->NHundCoupling > 0) {
1620  while (fgetsMPI(ctmp2, 256, fp) != NULL)
1621  {
1622  if (idx == X->NHundCoupling) {
1623  fclose(fp);
1624  return ReadDefFileError(defname);
1625  }
1626 
1627  sscanf(ctmp2, "%d %d %lf\n",
1628  &(X->HundCoupling[idx][0]),
1629  &(X->HundCoupling[idx][1]),
1630  &(X->ParaHundCoupling[idx])
1631  );
1632 
1633  if (CheckPairSite(X->HundCoupling[idx][0], X->HundCoupling[idx][1], X->Nsite) != 0) {
1634  fclose(fp);
1635  return ReadDefFileError(defname);
1636  }
1637 
1638  idx++;
1639  }
1640  }
1641  break;
1642  case KWPairHop:
1643  /*pairhop.def---------------------------------------*/
1644  if (X->iCalcModel == Spin || X->iCalcModel == SpinGC) {
1645  fprintf(stdoutMPI, "PairHop is not active in Spin and SpinGC.\n");
1646  return(-1);
1647  }
1648 
1649  if (X->NPairHopping > 0) {
1650  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1651  if (idx == X->NPairHopping / 2) {
1652  fclose(fp);
1653  return ReadDefFileError(defname);
1654  }
1655  sscanf(ctmp2, "%d %d %lf\n",
1656  &(X->PairHopping[2 * idx][0]),
1657  &(X->PairHopping[2 * idx][1]),
1658  &(X->ParaPairHopping[2 * idx])
1659  );
1660 
1661  if (CheckPairSite(X->PairHopping[2 * idx][0], X->PairHopping[2 * idx][1], X->Nsite) != 0) {
1662  fclose(fp);
1663  return ReadDefFileError(defname);
1664  }
1665  X->PairHopping[2 * idx + 1][0] = X->PairHopping[2 * idx][1];
1666  X->PairHopping[2 * idx + 1][1] = X->PairHopping[2 * idx][0];
1667  X->ParaPairHopping[2 * idx + 1] = X->ParaPairHopping[2 * idx];
1668  idx++;
1669  }
1670  }
1671  break;
1672 
1673  case KWExchange:
1674  /*exchange.def--------------------------------------*/
1675  if (X->NExchangeCoupling > 0) {
1676  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1677  if (idx == X->NExchangeCoupling) {
1678  fclose(fp);
1679  return ReadDefFileError(defname);
1680  }
1681 
1682  sscanf(ctmp2, "%d %d %lf\n",
1683  &(X->ExchangeCoupling[idx][0]),
1684  &(X->ExchangeCoupling[idx][1]),
1685  &(X->ParaExchangeCoupling[idx])
1686  );
1687 
1688  if (CheckPairSite(X->ExchangeCoupling[idx][0], X->ExchangeCoupling[idx][1], X->Nsite) != 0) {
1689  fclose(fp);
1690  return ReadDefFileError(defname);
1691  }
1692 
1693  idx++;
1694  }
1695  }
1696  break;
1697 
1698  case KWIsing:
1699  /*ising.def--------------------------------------*/
1700  if (X->NIsingCoupling > 0) {
1701  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1702  if (idx == X->NIsingCoupling) {
1703  fclose(fp);
1704  return ReadDefFileError(defname);
1705  }
1706 
1707  sscanf(ctmp2, "%d %d %lf\n",
1708  &isite1,
1709  &isite2,
1710  &dvalue_re
1711  );
1712 
1713  if (CheckPairSite(isite1, isite2, X->Nsite) != 0) {
1714  fclose(fp);
1715  return ReadDefFileError(defname);
1716  }
1717 
1718  //input into exchange couplings
1719  X->HundCoupling[X->NHundCoupling + idx][0] = isite1;
1720  X->HundCoupling[X->NHundCoupling + idx][1] = isite2;
1721  X->ParaHundCoupling[X->NHundCoupling + idx] = -dvalue_re / 2.0;
1722  //input into inter Coulomb
1723  X->CoulombInter[X->NCoulombInter + idx][0] = isite1;
1724  X->CoulombInter[X->NCoulombInter + idx][1] = isite2;
1725  X->ParaCoulombInter[X->NCoulombInter + idx] = -dvalue_re / 4.0;
1726  idx++;
1727  }
1728  }
1729  break;
1730 
1731  case KWPairLift:
1732  /*pairlift.def--------------------------------------*/
1733  if (X->NPairLiftCoupling > 0) {
1734  if (X->iCalcModel != SpinGC) {
1735  fprintf(stdoutMPI, "PairLift is active only in SpinGC.\n");
1736  return(-1);
1737  }
1738  while (fgetsMPI(ctmp2, 256, fp) != NULL)
1739  {
1740  if (idx == X->NPairLiftCoupling) {
1741  fclose(fp);
1742  return ReadDefFileError(defname);
1743  }
1744 
1745  sscanf(ctmp2, "%d %d %lf\n",
1746  &(X->PairLiftCoupling[idx][0]),
1747  &(X->PairLiftCoupling[idx][1]),
1748  &(X->ParaPairLiftCoupling[idx])
1749  );
1750 
1751  if (CheckPairSite(X->PairLiftCoupling[idx][0], X->PairLiftCoupling[idx][1], X->Nsite) != 0) {
1752  fclose(fp);
1753  return ReadDefFileError(defname);
1754  }
1755 
1756  idx++;
1757  }
1758  }
1759  break;
1760 
1761  case KWInterAll:
1762  /*interall.def---------------------------------------*/
1763  X->NInterAll_Diagonal = 0;
1764  X->NInterAll_OffDiagonal = 0;
1765  if (X->NInterAll > 0) {
1766  icnt_interall = 0;
1767  icnt_diagonal = 0;
1768  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1769  if (idx == X->NInterAll) {
1770  fclose(fp);
1771  return ReadDefFileError(defname);
1772  }
1773  sscanf(ctmp2, "%d %d %d %d %d %d %d %d %lf %lf\n",
1774  &isite1,
1775  &isigma1,
1776  &isite2,
1777  &isigma2,
1778  &isite3,
1779  &isigma3,
1780  &isite4,
1781  &isigma4,
1782  &dvalue_re,
1783  &dvalue_im
1784  );
1785 
1787  isite1, isigma1, isite2, isigma2,
1788  isite3, isigma3, isite4, isigma4) != 0) {
1789  fclose(fp);
1790  return ReadDefFileError(defname);
1791  }
1792 
1793  if (InputInterAllInfo(&icnt_interall,
1794  X->InterAll,
1795  X->ParaInterAll,
1796  isite1, isigma1,
1797  isite2, isigma2,
1798  isite3, isigma3,
1799  isite4, isigma4,
1800  dvalue_re, dvalue_im
1801  ) != 0) {
1802  icnt_diagonal += 1;
1803  }
1804  idx++;
1805  }
1806  }
1807 
1808  X->NInterAll = icnt_interall;
1809  X->NInterAll_Diagonal = icnt_diagonal;
1811 
1812  if (GetDiagonalInterAll(
1813  X->InterAll, X->ParaInterAll, X->NInterAll,
1816  X->EDChemi, X->EDSpinChemi, X->EDParaChemi, &X->EDNChemi,
1817  X->iCalcModel
1818  ) != 0) {
1819  fclose(fp);
1820  return(-1);
1821  }
1822 
1824  X->InterAll, X->ParaInterAll,
1827  ) != 0) {
1828  fprintf(stdoutMPI, "%s", "Error: NonHermite Pair exists in InterAll. \n");
1829  fclose(fp);
1830  return (-1);
1831  }
1832  break;
1833 
1834  case KWOneBodyG:
1835  /*cisajs.def----------------------------------------*/
1836  if (X->NCisAjt > 0) {
1837  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1838  if (idx == X->NCisAjt) {
1839  fclose(fp);
1840  return ReadDefFileError(defname);
1841  }
1842  sscanf(ctmp2, "%d %d %d %d\n",
1843  &isite1,
1844  &isigma1,
1845  &isite2,
1846  &isigma2);
1847 
1848  if (X->iCalcModel == Spin) {
1849  if (isite1 != isite2) {
1850  fprintf(stdoutMPI, "Warning: Site component of (i, j) =(%d, %d) is ignored.\n",
1851  isite1, isite2);
1852  X->NCisAjt--;
1853  continue;
1854  }
1855  }
1856 
1857  X->CisAjt[idx][0] = isite1;
1858  X->CisAjt[idx][1] = isigma1;
1859  X->CisAjt[idx][2] = isite2;
1860  X->CisAjt[idx][3] = isigma2;
1861 
1862  if (CheckPairSite(isite1, isite2, X->Nsite) != 0) {
1863  fclose(fp);
1864  return ReadDefFileError(defname);
1865  }
1866 
1867  idx++;
1868  }
1869  }
1870  break;
1871 
1872  case KWTwoBodyG:
1873  /*cisajscktaltdc.def--------------------------------*/
1874  if (X->NCisAjtCkuAlvDC > 0) {
1875  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1876  if (idx == X->NCisAjtCkuAlvDC) {
1877  fclose(fp);
1878  return ReadDefFileError(defname);
1879  }
1880 
1881  sscanf(ctmp2, "%d %d %d %d %d %d %d %d\n",
1882  &isite1,
1883  &isigma1,
1884  &isite2,
1885  &isigma2,
1886  &isite3,
1887  &isigma3,
1888  &isite4,
1889  &isigma4
1890  );
1891 
1892  if (X->iCalcModel == Spin || X->iCalcModel == SpinGC) {
1893  if (CheckFormatForSpinInt(isite1, isite2, isite3, isite4) != 0) {
1894  exitMPI(-1);
1895  //X->NCisAjtCkuAlvDC--;
1896  //continue;
1897  }
1898  }
1899 
1900 
1901  X->CisAjtCkuAlvDC[idx][0] = isite1;
1902  X->CisAjtCkuAlvDC[idx][1] = isigma1;
1903  X->CisAjtCkuAlvDC[idx][2] = isite2;
1904  X->CisAjtCkuAlvDC[idx][3] = isigma2;
1905  X->CisAjtCkuAlvDC[idx][4] = isite3;
1906  X->CisAjtCkuAlvDC[idx][5] = isigma3;
1907  X->CisAjtCkuAlvDC[idx][6] = isite4;
1908  X->CisAjtCkuAlvDC[idx][7] = isigma4;
1909 
1910  if (CheckQuadSite(isite1, isite2, isite3, isite4, X->Nsite) != 0) {
1911  fclose(fp);
1912  return ReadDefFileError(defname);
1913  }
1914  idx++;
1915  }
1916  }
1917  break;
1918 
1919  case KWLaser:
1920  //printf("KWLaser\n");
1921  /*laser.def----------------------------------*/
1922  if (X->NLaser > 0) {
1923  //printf("Read Start\n");
1924  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1925  sscanf(ctmp2, "%s %lf\n", ctmp, &(X->ParaLaser[idx]));
1926  //printf("[%d]:%f\n",idx,X->ParaLaser[idx]);
1927  idx++;
1928  }
1929  if (idx != X->NLaser) {
1930  fclose(fp);
1931  return ReadDefFileError(defname);
1932  }
1933  }
1934  break;
1935 
1936  case KWTEOneBody:
1937  if (X->NTETimeSteps > 0) {
1938  idx = 0;
1939  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1940  sscanf(ctmp2, "%lf %d\n", &(X->TETime[idx]), &(X->NTETransfer[idx]));
1941  for (i = 0; i < X->NTETransfer[idx]; ++i) {
1942  fgetsMPI(ctmp2, 256, fp);
1943  sscanf(ctmp2, "%d %d %d %d %lf %lf\n",
1944  &isite1,
1945  &isigma1,
1946  &isite2,
1947  &isigma2,
1948  &dvalue_re,
1949  &dvalue_im
1950  );
1951  X->TETransfer[idx][i][0] = isite1;
1952  X->TETransfer[idx][i][1] = isigma1;
1953  X->TETransfer[idx][i][2] = isite2;
1954  X->TETransfer[idx][i][3] = isigma2;
1955  X->ParaTETransfer[idx][i] = dvalue_re + dvalue_im * I;
1956  }
1957  //check Transfer Hermite
1958  if (CheckTETransferHermite(X, X->NTETransfer[idx], idx) != 0) {
1959  fclose(fp);
1960  return ReadDefFileError(defname);
1961  }
1962  idx++;
1963  }
1964  if (idx != X->NTETimeSteps) {
1965  fclose(fp);
1966  return ReadDefFileError(defname);
1967  }
1968  }
1969  break;
1970 
1971  case KWTETwoBody:
1972  if (X->NTETimeSteps > 0) {
1973  idx = 0;
1974  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
1975  sscanf(ctmp2, "%lf %d\n", &(X->TETime[idx]), &(X->NTEInterAll[idx]));
1976  icnt_interall = 0;
1977  icnt_diagonal = 0;
1978  for (i = 0; i < X->NTEInterAll[idx]; ++i) {
1979  fgetsMPI(ctmp2, 256, fp);
1980  sscanf(ctmp2, "%d %d %d %d %d %d %d %d %lf %lf\n",
1981  &isite1,
1982  &isigma1,
1983  &isite2,
1984  &isigma2,
1985  &isite3,
1986  &isigma3,
1987  &isite4,
1988  &isigma4,
1989  &dvalue_re,
1990  &dvalue_im
1991  );
1993  isite1, isigma1, isite2, isigma2,
1994  isite3, isigma3, isite4, isigma4) != 0) {
1995  fclose(fp);
1996  return ReadDefFileError(defname);
1997  }
1998  if (InputInterAllInfo(&icnt_interall,
1999  X->TEInterAll[idx],
2000  X->ParaTEInterAll[idx],
2001  isite1, isigma1,
2002  isite2, isigma2,
2003  isite3, isigma3,
2004  isite4, isigma4,
2005  dvalue_re, dvalue_im
2006  ) != 0) {
2007  icnt_diagonal += 1;
2008  }
2009  }
2010 
2011  X->NTEInterAll[idx] = icnt_interall;
2012  X->NTEInterAllDiagonal[idx] = icnt_diagonal;
2013  X->NTEInterAllOffDiagonal[idx] = icnt_interall - icnt_diagonal;
2014  //Diagonal -> OffDiagonal -> search pair -> hermite
2015  if (GetDiagonalInterAll(X->TEInterAll[idx], X->ParaTEInterAll[idx],
2016  X->NTEInterAll[idx], X->TEInterAllDiagonal[idx], X->ParaTEInterAllDiagonal[idx],
2017  X->TEInterAllOffDiagonal[idx], X->ParaTEInterAllOffDiagonal[idx], X->TEChemi[idx],
2018  X->SpinTEChemi[idx], X->ParaTEChemi[idx], &X->NTEChemi[idx], X->iCalcModel) != 0)
2019  {
2020  fclose(fp);
2021  return (-1);
2022  }
2023 
2025  X->TEInterAll[idx], X->ParaTEInterAll[idx],
2028  ) != 0) {
2029  fprintf(stdoutMPI, "%s", "Error: NonHermite Pair exists in InterAll. \n");
2030  fclose(fp);
2031  return (-1);
2032  }
2033  idx++;
2034  }
2035 
2036  if (idx != X->NTETimeSteps) {
2037  fclose(fp);
2038  return ReadDefFileError(defname);
2039  }
2040  }
2041  break;
2042 
2043  case KWBoost:
2044  /* boost.def--------------------------------*/
2045  //input magnetic field
2046  fgetsMPI(ctmp2, 256, fp);
2047  sscanf(ctmp2, "%lf %lf %lf\n",
2048  &dArrayValue_re[0],
2049  &dArrayValue_re[1],
2050  &dArrayValue_re[2]);
2051  for (iline = 0; iline < 3; iline++) {
2052  xBoost->vecB[iline] = dArrayValue_re[iline];
2053  }
2054 
2055  //this line is skipped;
2056  fgetsMPI(ctmp2, 256, fp);
2057 
2058  //input arrayJ
2059  if (xBoost->NumarrayJ > 0) {
2060  for (iline = 0; iline < xBoost->NumarrayJ; iline++) {
2061  for (ilineIn = 0; ilineIn < 3; ilineIn++) {
2062  fgetsMPI(ctmp2, 256, fp);
2063  sscanf(ctmp2, "%lf %lf %lf\n",
2064  &dArrayValue_re[0],
2065  &dArrayValue_re[1],
2066  &dArrayValue_re[2]);
2067  for (ilineIn2 = 0; ilineIn2 < 3; ilineIn2++) {
2068  xBoost->arrayJ[iline][ilineIn][ilineIn2] = dArrayValue_re[ilineIn2];
2069  }
2070  }
2071  }
2072  }
2073 
2074  //this line is skipped;
2075  fgetsMPI(ctmp2, 256, fp);
2076 
2077  //read list_6spin_star
2078  if (xBoost->num_pivot > 0) {
2079  for (iline = 0; iline < xBoost->num_pivot; iline++) {
2080  //input
2081  fgetsMPI(ctmp2, 256, fp);
2082  sscanf(ctmp2, "%d %d %d %d %d %d %d\n",
2083  &xBoost->list_6spin_star[iline][0],
2084  &xBoost->list_6spin_star[iline][1],
2085  &xBoost->list_6spin_star[iline][2],
2086  &xBoost->list_6spin_star[iline][3],
2087  &xBoost->list_6spin_star[iline][4],
2088  &xBoost->list_6spin_star[iline][5],
2089  &xBoost->list_6spin_star[iline][6]
2090  );
2091  //copy
2092  for (iloop = 0; iloop < xBoost->R0; iloop++) {
2093  for (itmp = 0; itmp < 7; itmp++) {
2094  xBoost->list_6spin_star[iloop*xBoost->num_pivot + iline][itmp]
2095  = xBoost->list_6spin_star[iline][itmp];
2096  }
2097  }
2098  }
2099  }
2100 
2101  //read list_6spin_pair
2102  if (xBoost->num_pivot > 0) {
2103  for (iline = 0; iline < xBoost->num_pivot; iline++) {
2104  //input
2105  for (ilineIn2 = 0; ilineIn2 < xBoost->list_6spin_star[iline][0]; ilineIn2++) {
2106  fgetsMPI(ctmp2, 256, fp);
2107  sscanf(ctmp2, "%d %d %d %d %d %d %d\n",
2108  &xBoost->list_6spin_pair[iline][0][ilineIn2],
2109  &xBoost->list_6spin_pair[iline][1][ilineIn2],
2110  &xBoost->list_6spin_pair[iline][2][ilineIn2],
2111  &xBoost->list_6spin_pair[iline][3][ilineIn2],
2112  &xBoost->list_6spin_pair[iline][4][ilineIn2],
2113  &xBoost->list_6spin_pair[iline][5][ilineIn2],
2114  &xBoost->list_6spin_pair[iline][6][ilineIn2]
2115  );
2116 
2117  //copy
2118  for (iloop = 0; iloop < xBoost->R0; iloop++) {
2119  for (itmp = 0; itmp < 7; itmp++) {
2120  xBoost->list_6spin_pair[iloop*xBoost->num_pivot + iline][itmp][ilineIn2]
2121  = xBoost->list_6spin_pair[iline][itmp][ilineIn2];
2122  }
2123  }
2124  }
2125  }
2126 
2127  }
2128 
2129  break;
2130 
2131  case KWSingleExcitation:
2132  /*singleexcitation.def----------------------------------------*/
2133  if (X->NNSingleExcitationOperator > 0) {
2134  if (X->iCalcModel == Spin || X->iCalcModel == SpinGC) {
2135  fprintf(stderr, "SingleExcitation is not allowed for spin system.\n");
2136  fclose(fp);
2137  return ReadDefFileError(defname);
2138  }
2139  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
2140  sscanf(ctmp2, "%d\n", &X->NSingleExcitationOperator[idx]);
2141  X->SingleExcitationOperator[idx] = (int**)malloc(sizeof(int*)*X->NSingleExcitationOperator[idx]);
2142  X->ParaSingleExcitationOperator[idx] = (std::complex<double>*)malloc(
2143  sizeof(std::complex<double>)*X->NSingleExcitationOperator[idx]);
2144  for (i = 0; i < X->NSingleExcitationOperator[idx]; ++i) {
2145  fgetsMPI(ctmp2, 256, fp);
2146  sscanf(ctmp2, "%d %d %d %lf %lf\n",
2147  &isite1,
2148  &isigma1,
2149  &itype,
2150  &dvalue_re,
2151  &dvalue_im
2152  );
2153 
2154  if (CheckSite(isite1, X->Nsite) != 0) {
2155  fclose(fp);
2156  return ReadDefFileError(defname);
2157  }
2158 
2159  X->SingleExcitationOperator[idx][i] = (int*)malloc(sizeof(int) * 3);
2160  X->SingleExcitationOperator[idx][i][0] = isite1;
2161  X->SingleExcitationOperator[idx][i][1] = isigma1;
2162  X->SingleExcitationOperator[idx][i][2] = itype;
2163  X->ParaSingleExcitationOperator[idx][i] = dvalue_re + I * dvalue_im;
2164  }/*for (i = 0; i < X->NSingleExcitationOperator[idx]; ++i)*/
2165  idx++;
2166  }
2167  if (idx != X->NNSingleExcitationOperator) {
2168  fclose(fp);
2169  return ReadDefFileError(defname);
2170  }
2171  }
2172  break;
2173 
2174  case KWPairExcitation:
2175  /*pairexcitation.def----------------------------------------*/
2176  if (X->NNPairExcitationOperator > 0) {
2177  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
2178  sscanf(ctmp2, "%d\n", &X->NPairExcitationOperator[idx]);
2179  X->PairExcitationOperator[idx] = (int**)malloc(sizeof(int*)*X->NPairExcitationOperator[idx]);
2180  X->ParaPairExcitationOperator[idx] = (std::complex<double>*)malloc(
2181  sizeof(std::complex<double>)*X->NPairExcitationOperator[idx]);
2182  for (i = 0; i < X->NPairExcitationOperator[idx]; ++i) {
2183  fgetsMPI(ctmp2, 256, fp);
2184  sscanf(ctmp2, "%d %d %d %d %d %lf %lf\n",
2185  &isite1,
2186  &isigma1,
2187  &isite2,
2188  &isigma2,
2189  &itype,
2190  &dvalue_re,
2191  &dvalue_im
2192  );
2193  if (CheckPairSite(isite1, isite2, X->Nsite) != 0) {
2194  fclose(fp);
2195  return ReadDefFileError(defname);
2196  }
2197 
2198  X->PairExcitationOperator[idx][i] = (int*)malloc(sizeof(int) * 5);
2199  if (itype == 1) {
2200  X->PairExcitationOperator[idx][i][0] = isite1;
2201  X->PairExcitationOperator[idx][i][1] = isigma1;
2202  X->PairExcitationOperator[idx][i][2] = isite2;
2203  X->PairExcitationOperator[idx][i][3] = isigma2;
2204  X->PairExcitationOperator[idx][i][4] = itype;
2205  X->ParaPairExcitationOperator[idx][i] = dvalue_re + I * dvalue_im;
2206  }
2207  else {
2208  X->PairExcitationOperator[idx][i][0] = isite2;
2209  X->PairExcitationOperator[idx][i][1] = isigma2;
2210  X->PairExcitationOperator[idx][i][2] = isite1;
2211  X->PairExcitationOperator[idx][i][3] = isigma1;
2212  X->PairExcitationOperator[idx][i][4] = itype;
2213  X->ParaPairExcitationOperator[idx][i] = -(dvalue_re + I * dvalue_im);
2214  }
2215  }/*for (i = 0; i < X->NPairExcitationOperator[idx]; ++i)*/
2216  idx++;
2217  }
2218  if (idx != X->NNPairExcitationOperator) {
2219  fclose(fp);
2220  return ReadDefFileError(defname);
2221  }
2222  }
2223  break;
2224 
2225  default:
2226  break;
2227  }
2228  fclose(fp);
2229 
2230  switch (iKWidx) {
2231  case KWCoulombIntra:
2232  case KWCoulombInter:
2233  case KWHund:
2234  case KWPairHop:
2235  case KWExchange:
2236  case KWIsing:
2237  case KWPairLift:
2238  if (X->iFlgGeneralSpin == TRUE) {
2239  fprintf(stdoutMPI, "%s",
2240  "Error: Use only InterAll for setteing interactions for general spin.\n");
2241  return(-1);
2242  }
2243  break;
2244  default:
2245  break;
2246  }
2247  }
2248 
2250  /*=======================================================================*/
2251  return 0;
2252 }
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.cpp:86
std::complex< double > * ParaInterAll
[DefineList::NInterAll] Coupling constant of inter-all term. malloc in setmem_def().
Definition: struct.hpp:166
int *** TEInterAll
Definition: struct.hpp:280
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.hpp:127
std::complex< double > ** ParaTETransfer
Definition: struct.hpp:266
int * EDSpinChemi
[DefineList::Nsite]
Definition: struct.hpp:99
int ** list_6spin_star
Definition: struct.hpp:388
int ** SpinTEChemi
Definition: struct.hpp:297
std::complex< double > ** ParaTEInterAll
Definition: struct.hpp:288
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
Definition: struct.hpp:146
double * ParaInterAll_Diagonal
[DefineList::NInterAll_Diagonal] Coupling constant of diagonal inter-all term. malloc in setmem_def()...
Definition: struct.hpp:168
int NPairLiftCoupling
Number of pair-lift term.
Definition: struct.hpp:153
std::complex< double > ** ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.hpp:184
int ReadDefFileError(const char *defname)
Error Function of reading def files.
Definition: readdef.cpp:97
int * NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:183
void ResetInteractionNum(struct DefineList *X)
function of resetting number of interactions
Definition: readdef.cpp:2674
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
int NumarrayJ
Definition: struct.hpp:385
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.cpp:2884
std::complex< double > I(0.0, 1.0)
double * TETime
Definition: struct.hpp:249
int ** TEChemi
Definition: struct.hpp:295
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.cpp:105
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
Definition: struct.hpp:82
int ** CisAjtCkuAlvDC
[DefineList::NCisAjtCkuAlvDC][4] Indices of two-body correlation function. malloc in setmem_def()...
Definition: struct.hpp:177
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
int EDNChemi
Number of on-site term.
Definition: struct.hpp:97
int *** list_6spin_pair
Definition: struct.hpp:389
int * NTEChemi
Definition: struct.hpp:296
double * ParaLaser
Definition: struct.hpp:253
double ** ParaTEChemi
Definition: struct.hpp:298
std::complex< double > vecB[3]
Definition: struct.hpp:387
int NHundCoupling
Number of Hund coupling.
Definition: struct.hpp:133
int NIsingCoupling
Number of Ising term.
Definition: struct.hpp:151
std::complex< double > ** ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:191
int NInterAll
Total Number of Interacted quartet.
Definition: struct.hpp:163
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.hpp:161
int ** InterAll_Diagonal
[DefineList::NinterAll_Diagonal][4] Interacted quartet
Definition: struct.hpp:162
int ** GeneralTransfer
Index of transfer integrals obtained by a def file. malloc in setmem_def(). Data Format [DefineList::...
Definition: struct.hpp:106
int * NTEInterAllOffDiagonal
Definition: struct.hpp:275
int ** PairHopping
[DefineList::NPairHopping][2] Index of pair-hopping. malloc in setmem_def().
Definition: struct.hpp:140
int D_iKWNumDef
Definition: readdef.cpp:60
int NNSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:182
int ** PairLiftCoupling
[DefineList::NPairHopping][2] Index of pair-lift term. malloc in setmem_def().
Definition: struct.hpp:154
int ** HundCoupling
[DefineList::NHundCoupling][2] Index of Hund coupling. malloc in setmem_def().
Definition: struct.hpp:134
int * NTEInterAll
Definition: struct.hpp:273
int NCisAjt
Number of indices of two-body correlation function.
Definition: struct.hpp:175
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
Definition: struct.hpp:148
double * ParaCoulombInter
[DefineList::NCoulombInter]Coupling constant of off-site Coulomb interaction. malloc in setmem_def()...
Definition: struct.hpp:130
int NLaser
Definition: struct.hpp:252
double * ParaPairLiftCoupling
[DefineList::NPairHopping] Coupling constant of pair-lift term. malloc in setmem_def().
Definition: struct.hpp:156
int * NTETransfer
Definition: struct.hpp:258
int ** CoulombInter
Definition: struct.hpp:128
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.cpp:122
double * EDParaChemi
[DefineList::Nsite] On-site potential parameter. malloc in setmem_def().
Definition: struct.hpp:100
int NExchangeCoupling
Number of exchange term.
Definition: struct.hpp:145
int * NTEInterAllDiagonal
Definition: struct.hpp:278
int CheckFormatForSpinInt(const int site1, const int site2, const int site3, const int site4)
function of checking format of spin interactions
Definition: readdef.cpp:2524
int *** TETransfer
Definition: struct.hpp:262
static int CheckInterAllHermite(int **InterAll, std::complex< double > *ParaInterAll, int **InterAllOffDiagonal, std::complex< double > *ParaInterAllOffDiagonal, const int NInterAllOffDiagonal, const int iCalcModel)
function of checking hermite conditions about interall interactions
Definition: readdef.cpp:982
int NInterAll_Diagonal
Number of interall term (diagonal)
Definition: struct.hpp:164
std::complex< double > * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
Definition: struct.hpp:170
int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.hpp:104
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
int NInterAll_OffDiagonal
Number of interall term (off-diagonal)
Definition: struct.hpp:165
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.hpp:94
int CheckPairSite(const int iSite1, const int iSite2, const int iMaxNum)
Check Site Number for a pair -> (siteA, siteB).
Definition: readdef.cpp:2282
int ** CisAjt
[DefineList::NCisAjt][4] Indices of one-body correlation function. malloc in setmem_def().
Definition: struct.hpp:174
double ** ParaTEInterAllDiagonal
Definition: struct.hpp:293
double * ParaPairHopping
[DefineList::NPairHopping] Coupling constant of pair-hopping term. malloc in setmem_def().
Definition: struct.hpp:142
int ** CoulombIntra
Definition: struct.hpp:122
long int num_pivot
Definition: struct.hpp:383
int CheckSpinIndexForTrans(struct DefineList *X)
function of checking spin index for transfers
Definition: readdef.cpp:2764
double * ParaHundCoupling
[DefineList::NHundCoupling] Hund coupling constant. malloc in setmem_def().
Definition: struct.hpp:136
std::complex< double > * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:113
double eps_CheckImag0
Definition: global.cpp:67
int NPairHopping
Number of pair-hopping term.
Definition: struct.hpp:139
int NCoulombIntra
Definition: struct.hpp:121
int NTETimeSteps
Definition: struct.hpp:248
static char ** cFileNameListFile
Definition: readdef.cpp:65
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
long int R0
Definition: struct.hpp:381
int *** TEInterAllOffDiagonal
Definition: struct.hpp:283
double * ParaCoulombIntra
Definition: struct.hpp:124
int *** TEInterAllDiagonal
Definition: struct.hpp:286
int CheckTransferHermite(struct DefineList *X)
Check Hermite for Transfer integrals.
Definition: readdef.cpp:2339
int ** InterAll
[DefineList::NinterAll][8] Interacted quartet
Definition: struct.hpp:160
int InputInterAllInfo(int *icnt_interall, int **iInterAllInfo, std::complex< double > *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.cpp:2942
static int CheckTETransferHermite(struct DefineList *X, const int NTETransfer, const int idx)
Check Hermite for TETransfer integrals.
Definition: readdef.cpp:1269
int * EDChemi
[DefineList::Nsite] Chemical potential. malloc in setmem_def().
Definition: struct.hpp:98
int CheckLocSpin(struct DefineList *X)
function of checking indexies of localized spin
Definition: readdef.cpp:2610
std::complex< double > *** arrayJ
Definition: struct.hpp:386
int NNPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:189
int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.hpp:178
int *** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.hpp:180
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.cpp:2310
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187
int GetDiagonalInterAll(int **InterAll, std::complex< double > *ParaInterAll, const int NInterAll, int **InterAllDiagonal, double *ParaInterAllDiagonal, int **InterAllOffDiagonal, std::complex< double > *ParaInterAllOffDiagonal, int *Chemi, int *SpinChemi, double *ParaChemi, int *NChemi, const int iCalcModel)
function of getting diagonal components
Definition: readdef.cpp:1125
std::complex< double > ** ParaTEInterAllOffDiagonal
Definition: struct.hpp:290
int CheckSite(const int iSite, const int iMaxNum)
Check Site Number.
Definition: readdef.cpp:2263

◆ ReadDefFileNInt()

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 files.

Parameters
[in]xNameListFileList of Input File names.
[out]XDefine List for getting flags of calc-mode.
[out]xBoostDefine List for getting flags of Boost calc-mode.
Return values
0normally finished reading file.
-1unnormally finished reading file.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Read Header (5 lines).

Read header name for files about data

Read header name for files about parameters

Read header (1 line).

Read lines.

Definition at line 456 of file readdef.cpp.

References DefineList::CDataFileHead, CheckInterAllHermite(), CheckWords(), cKWListOfFileNameList, DefineList::CParaFileHead, D_iKWNumDef, DefineList::dcOmegaMax, DefineList::dcOmegaMin, DefineList::dcOmegaOrg, ParamList::ExpandCoef, ParamList::ExpecInterval, fgetsMPI(), DefineList::fidx, BoostList::flgBoost, fopenMPI(), GetFileName(), I(), DefineList::iCalcModel, DefineList::iCalcType, DefineList::iFlgGeneralSpin, DefineList::iFlgSpecOmegaMax, DefineList::iFlgSpecOmegaMin, DefineList::iFlgSpecOmegaOrg, DefineList::iFlgSzConserved, DefineList::initial_iv, InitializeInteractionNum(), DefineList::iNOmega, DefineList::irand, BoostList::ishift_nspin, DefineList::k_exct, DefineList::Lanczos_max, DefineList::LanczosEps, DefineList::LanczosTarget, LargeValue, DefineList::NCisAjt, DefineList::NCisAjtCkuAlvDC, DefineList::NCond, DefineList::NCoulombInter, DefineList::NCoulombIntra, DefineList::Ndown, DefineList::NdownMPI, DefineList::NdownOrg, DefineList::Ne, DefineList::NeMPI, DefineList::NExchangeCoupling, DefineList::NHundCoupling, DefineList::NInterAll, DefineList::NIsingCoupling, DefineList::NLaser, DefineList::NLocSpn, DefineList::NNPairExcitationOperator, DefineList::NNSingleExcitationOperator, DefineList::NPairHopping, DefineList::NPairLiftCoupling, DefineList::Nsite, DefineList::NTEInterAllMax, DefineList::NTETimeSteps, DefineList::NTETransferMax, DefineList::NTransfer, BoostList::num_pivot, BoostList::NumarrayJ, NumAve, DefineList::Nup, DefineList::NupMPI, DefineList::NupOrg, DefineList::nvec, ParamList::OutputInterval, DefineList::Param, BoostList::R0, DefineList::READ, DefineList::read_hacker, ReadcalcmodFile(), ReadDefFileError(), stdoutMPI, ParamList::TimeSlice, ParamList::Tinit, DefineList::Total2Sz, ValidateValue(), BoostList::W0, and DefineList::WRITE.

Referenced by main().

461 {
462  FILE *fp;
463  char defname[D_FileNameMaxReadDef];
464  char ctmp[D_CharTmpReadDef], ctmp2[256];
465  int i, itmp;
466  int iline = 0;
467  X->nvec = 0;
468  X->iFlgSpecOmegaMax = FALSE;
469  X->iFlgSpecOmegaMin = FALSE;
470  X->iFlgSpecOmegaOrg = FALSE;
471  X->iNOmega = 1000;
472  X->NCond = 0;
473  X->iFlgSzConserved = FALSE;
474  X->dcOmegaOrg = 0;
475  int iReadNCond = FALSE;
476  xBoost->flgBoost = FALSE;
478  NumAve = 1;
479  X->Param.ExpecInterval = 1;
480  cFileNameListFile = (char**)malloc(sizeof(char*)*D_iKWNumDef);
481  for (i = 0; i < D_iKWNumDef; i++)
482  cFileNameListFile[i] = (char*)malloc(sizeof(char)*D_CharTmpReadDef);
483 
484  fprintf(stdoutMPI, " Read File %s.\n", xNameListFile);
485  if (GetFileName(xNameListFile, cFileNameListFile) != 0) {
486  return(-1);
487  }
488 
489  /*=======================================================================*/
490  int iKWidx = 0;
491  //Check the existence of Essensial Files.
492  X->READ = 0;
493  X->WRITE = 0;
494 
495  for (iKWidx = 0; iKWidx < D_iKWNumDef; iKWidx++) {
496  strcpy(defname, cFileNameListFile[iKWidx]);
497  if (strcmp(defname, "") == 0) {
498  switch (iKWidx) {
499  case KWCalcMod:
500  case KWModPara:
501  case KWLocSpin:
502  fprintf(stdoutMPI, "Error: Need to make a def file for %s.\n", cKWListOfFileNameList[iKWidx]);
503  return(-1);
504  default:
505  break;
506  }
507  }
508  }
509 
510  for (iKWidx = 0; iKWidx < D_iKWNumDef; iKWidx++) {
511  strcpy(defname, cFileNameListFile[iKWidx]);
512 
513  if (strcmp(defname, "") == 0) continue;
514  if (iKWidx == KWSpectrumVec) {
515  continue;
516  }
517  fprintf(stdoutMPI, " Read File %s for %s.\n", defname, cKWListOfFileNameList[iKWidx]);
518  fp = fopenMPI(defname, "r");
519  if (fp == NULL) return ReadDefFileError(defname);
520  switch (iKWidx) {
521  case KWCalcMod:
522  /* Read calcmod.def---------------------------------------*/
523  if (ReadcalcmodFile(defname, X) != 0) {
524  fclose(fp);
525  return ReadDefFileError(defname);
526  }
527  break;
528 
529  case KWModPara:
530  /* Read modpara.def---------------------------------------*/
531  //TODO: add error procedure here when parameters are not enough.
533  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
534  fgetsMPI(ctmp2, 256, fp);
535  sscanf(ctmp2, "%s %d\n", ctmp, &itmp); //2
536  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //3
537  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //4
538  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //5
540  fgetsMPI(ctmp2, 256, fp);
541  sscanf(ctmp2, "%s %s\n", ctmp, X->CDataFileHead); //6
543  fgetsMPI(ctmp2, 256, fp);
544  sscanf(ctmp2, "%s %s\n", ctmp, X->CParaFileHead); //7
546  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp); //8
547  double dtmp, dtmp2;
548  X->read_hacker = 1;
550  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
551  if (*ctmp2 == '\n') continue;
552  sscanf(ctmp2, "%s %lf %lf\n", ctmp, &dtmp, &dtmp2);
553  if (CheckWords(ctmp, "Nsite") == 0) {
554  X->Nsite = (int)dtmp;
555  }
556  else if (CheckWords(ctmp, "Nup") == 0) {
557  X->Nup = (int)dtmp;
558  }
559  else if (CheckWords(ctmp, "Ndown") == 0) {
560  X->Ndown = (int)dtmp;
561  X->Total2Sz = X->Nup - X->Ndown;
562  }
563  else if (CheckWords(ctmp, "2Sz") == 0) {
564  X->Total2Sz = (int)dtmp;
565  X->iFlgSzConserved = TRUE;
566  }
567  else if (CheckWords(ctmp, "Ncond") == 0) {
568  if ((int)dtmp < 0) {
569  fprintf(stdoutMPI, "Error in %s\n Ncond must be greater than 0.\n", defname);
570  return (-1);
571  }
572  X->NCond = (int)dtmp;
573  iReadNCond = TRUE;
574  }
575  else if (CheckWords(ctmp, "Lanczos_max") == 0) {
576  X->Lanczos_max = (int)dtmp;
577  }
578  else if (CheckWords(ctmp, "initial_iv") == 0) {
579  X->initial_iv = (int)dtmp;
580  }
581  else if (CheckWords(ctmp, "nvec") == 0) {
582  X->nvec = (int)dtmp;
583  }
584  else if (CheckWords(ctmp, "exct") == 0) {
585  X->k_exct = (int)dtmp;
586  }
587  else if (CheckWords(ctmp, "LanczosEps") == 0) {
588  X->LanczosEps = (int)dtmp;
589  }
590  else if (CheckWords(ctmp, "LanczosTarget") == 0) {
591  X->LanczosTarget = (int)dtmp;
592  }
593  else if (CheckWords(ctmp, "LargeValue") == 0) {
594  LargeValue = dtmp;
595  }
596  else if (CheckWords(ctmp, "NumAve") == 0) {
597  NumAve = (int)dtmp;
598  }
599  else if (strcmp(ctmp, "TimeSlice") == 0) {
600  X->Param.TimeSlice = dtmp;
601  }
602  else if (strcmp(ctmp, "ExpandCoef") == 0) {
603  X->Param.ExpandCoef = (int)dtmp;
604  }
605  else if (strcmp(ctmp, "OutputInterval") == 0) {
606  X->Param.OutputInterval = (int)dtmp;
607  }
608  else if (CheckWords(ctmp, "ExpecInterval") == 0) {
609  X->Param.ExpecInterval = (int)dtmp;
610  }
611  else if (strcmp(ctmp, "Tinit") == 0) {
612  X->Param.Tinit = dtmp;
613  }
614  else if (CheckWords(ctmp, "CalcHS") == 0) {
615  X->read_hacker = (int)dtmp;
616  }
617  else if (CheckWords(ctmp, "OmegaMax") == 0) {
618  X->dcOmegaMax = dtmp + dtmp2 * I;
619  X->iFlgSpecOmegaMax = TRUE;
620  }
621  else if (CheckWords(ctmp, "OmegaMin") == 0) {
622  X->dcOmegaMin = dtmp + dtmp2 * I;
623  X->iFlgSpecOmegaMin = TRUE;
624  }
625  else if (CheckWords(ctmp, "OmegaIm") == 0) {
626  X->dcOmegaOrg += dtmp * I;
627  X->iFlgSpecOmegaOrg = TRUE;
628  }
629  else if (CheckWords(ctmp, "OmegaOrg") == 0) {
630  X->dcOmegaOrg += dtmp + dtmp2 * I;
631  X->iFlgSpecOmegaOrg = TRUE;
632  }
633  else if (CheckWords(ctmp, "NOmega") == 0) {
634  X->iNOmega = (int)dtmp;
635  }
636  else if (CheckWords(ctmp, "TargetTPQRand") == 0) {
637  X->irand = (int)dtmp;
638  }
639  else {
640  return (-1);
641  }
642  }
643  break;
644 
645  case KWLocSpin:
646  // Read locspn.def
647  X->iFlgGeneralSpin = FALSE;
648  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
649  fgetsMPI(ctmp2, 256, fp);
650  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NLocSpn));
651  break;
652  case KWTrans:
653  // Read transfer.def
654  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
655  fgetsMPI(ctmp2, 256, fp);
656  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NTransfer));
657  break;
658  case KWCoulombIntra:
659  /* Read coulombintra.def----------------------------------*/
660  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
661  fgetsMPI(ctmp2, 256, fp);
662  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCoulombIntra));
663  break;
664  case KWCoulombInter:
665  /* Read coulombinter.def----------------------------------*/
666  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
667  fgetsMPI(ctmp2, 256, fp);
668  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCoulombInter));
669  break;
670  case KWHund:
671  /* Read hund.def------------------------------------------*/
672  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
673  fgetsMPI(ctmp2, 256, fp);
674  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NHundCoupling));
675  break;
676  case KWPairHop:
677  /* Read pairhop.def---------------------------------------*/
678  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
679  fgetsMPI(ctmp2, 256, fp);
680  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NPairHopping));
681  X->NPairHopping *= 2;
682  break;
683  case KWExchange:
684  /* Read exchange.def--------------------------------------*/
685  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
686  fgetsMPI(ctmp2, 256, fp);
687  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NExchangeCoupling));
688  break;
689  case KWIsing:
690  /* Read ising.def--------------------------------------*/
691  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
692  fgetsMPI(ctmp2, 256, fp);
693  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NIsingCoupling));
694  break;
695  case KWPairLift:
696  /* Read exchange.def--------------------------------------*/
697  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
698  fgetsMPI(ctmp2, 256, fp);
699  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NPairLiftCoupling));
700  break;
701  case KWInterAll:
702  /* Read InterAll.def--------------------------------------*/
703  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
704  fgetsMPI(ctmp2, 256, fp);
705  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NInterAll));
706  break;
707  case KWOneBodyG:
708  /* Read cisajs.def----------------------------------------*/
709  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
710  fgetsMPI(ctmp2, 256, fp);
711  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCisAjt));
712  break;
713  case KWTwoBodyG:
714  /* Read cisajscktaltdc.def--------------------------------*/
715  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
716  fgetsMPI(ctmp2, 256, fp);
717  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NCisAjtCkuAlvDC));
718  break;
719  case KWLaser:
720  /* Read laser.def--------------------------------*/
721  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
722  fgetsMPI(ctmp2, 256, fp);
723  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NLaser));
724  break;
725 
726  case KWTEOneBody: {
727  if (X->iCalcType != TimeEvolution) break;
728  /* Read TEOnebody.def--------------------------------*/
729  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
730  fgetsMPI(ctmp2, 256, fp);
731  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NTETimeSteps));
732  fgetsMPI(ctmp2, 256, fp);
733  fgetsMPI(ctmp2, 256, fp);
734  fgetsMPI(ctmp2, 256, fp);
735  int iTETransMax = 0;
736  if (X->NTETimeSteps > 0) {
737  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
738  sscanf(ctmp2, "%lf %d \n", &dtmp, &itmp);
739  for (i = 0; i < itmp; ++i) {
740  fgetsMPI(ctmp2, 256, fp);
741  }
742  if (iTETransMax < itmp) iTETransMax = itmp;
743  }
744  }
745  X->NTETransferMax = iTETransMax;
746  break;
747  }
748  case KWTETwoBody: {
749  if (X->iCalcType != TimeEvolution) break;
750  /* Read TETwobody.def--------------------------------*/
751  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
752  fgetsMPI(ctmp2, 256, fp);
753  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NTETimeSteps));
754  fgetsMPI(ctmp2, 256, fp);
755  fgetsMPI(ctmp2, 256, fp);
756  fgetsMPI(ctmp2, 256, fp);
757  int iTEInterAllMax = 0;
758  if (X->NTETimeSteps > 0) {
759  while (fgetsMPI(ctmp2, 256, fp) != NULL) {
760  sscanf(ctmp2, "%lf %d \n", &dtmp, &itmp);
761  for (i = 0; i < itmp; ++i) {
762  fgetsMPI(ctmp2, 256, fp);
763  }
764  if (iTEInterAllMax < itmp) iTEInterAllMax = itmp;
765  }
766  }
767  X->NTEInterAllMax = iTEInterAllMax;
768  break;
769  }
770 
771  case KWBoost:
772  /* Read boost.def--------------------------------*/
773  xBoost->NumarrayJ = 0;
774  xBoost->W0 = 0;
775  xBoost->R0 = 0;
776  xBoost->num_pivot = 0;
777  xBoost->ishift_nspin = 0;
778  xBoost->flgBoost = TRUE;
779  //first line is skipped
780  fgetsMPI(ctmp2, 256, fp);
781  //read numarrayJ
782  fgetsMPI(ctmp2, 256, fp);
783  sscanf(ctmp2, "%d\n", &(xBoost->NumarrayJ));
784  //skipp arrayJ
785  for (iline = 0; iline < xBoost->NumarrayJ * 3; iline++) {
786  fgetsMPI(ctmp2, 256, fp);
787  }
788  //read W0 R0 num_pivot ishift_nspin
789  fgetsMPI(ctmp2, 256, fp);
790  sscanf(ctmp2, "%ld %ld %ld %ld\n", &(xBoost->W0), &(xBoost->R0), &(xBoost->num_pivot),
791  &(xBoost->ishift_nspin));
792 
793  break;
794 
795  case KWSingleExcitation:
796  /* Read singleexcitation.def----------------------------------------*/
797  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
798  fgetsMPI(ctmp2, 256, fp);
799  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NNSingleExcitationOperator));
800  break;
801 
802  case KWPairExcitation:
803  /* Read pairexcitation.def----------------------------------------*/
804  fgetsMPI(ctmp, sizeof(ctmp) / sizeof(char), fp);
805  fgetsMPI(ctmp2, 256, fp);
806  sscanf(ctmp2, "%s %d\n", ctmp, &(X->NNPairExcitationOperator));
807  break;
808 
809  default:
810  fprintf(stdoutMPI, "%s", "Error: incorrect file.\n");
811  fclose(fp);
812  return (-1);
813  }
814  /*=======================================================================*/
815  fclose(fp);
816  }
817 
818  //Sz, Ncond
819  switch (X->iCalcModel) {
820  case Spin:
821  case Hubbard:
822  case Kondo:
823  case SpinlessFermion:
824 
825  if (iReadNCond == TRUE) {
826  if (X->iCalcModel == Spin) {
827  fprintf(stdoutMPI, "For Spin, Ncond should not be defined.\n");
828  return(-1);
829  }
830  else {
831  if (X->iFlgSzConserved == TRUE) {
832  if (X->iCalcModel == SpinlessFermion) {
833  fprintf(stdoutMPI, " Warning: For Spinless fermion, 2Sz should not be defined.\n");
834  X->Ne = X->NCond;
835  X->Nup = X->NCond;
836  X->Ndown = 0;
837  break;
838  }
839  X->Nup = X->NLocSpn + X->NCond + X->Total2Sz;
840  X->Ndown = X->NLocSpn + X->NCond - X->Total2Sz;
841  X->Nup /= 2;
842  X->Ndown /= 2;
843  X->Ne = X->Nup + X->Ndown;
844  }
845  else {
846  if (X->iCalcModel == Hubbard) {
847  X->Ne = X->NCond;
848  if (X->Ne < 1) {
849  fprintf(stdoutMPI, "Ncond is incorrect.\n");
850  return(-1);
851  }
852  X->iCalcModel = HubbardNConserved;
853  }
854  else if (X->iCalcModel == SpinlessFermion) {
855  X->Ne = X->NCond;
856  X->Nup = X->NCond;
857  X->Ndown = 0;
858  }
859  else {
860  fprintf(stdoutMPI, " 2Sz is not defined.\n");
861  return(-1);
862  }
863  }
864  }
865  }
866  else if (iReadNCond == FALSE && X->iFlgSzConserved == TRUE) {
867  if (X->iCalcModel != Spin) {
868  fprintf(stdoutMPI, " NCond is not defined.\n");
869  return(-1);
870  }
871  X->Nup = X->NLocSpn + X->Total2Sz;
872  X->Ndown = X->NLocSpn - X->Total2Sz;
873  X->Nup /= 2;
874  X->Ndown /= 2;
875  }
876  else {
877  if (X->Nup == 0 && X->Ndown == 0) {
878  if (X->iCalcModel == Spin) {
879  fprintf(stdoutMPI, " 2Sz is not defined.\n");
880  return(-1);
881  }
882  else {
883  fprintf(stdoutMPI, " NCond is not defined.\n");
884  return(-1);
885  }
886  }
887  }
888 
889  if (X->iCalcModel == Spin) {
890  X->Ne = X->Nup;
891  }
892  else {
893  if (X->Ne == 0) {
894  X->Ne = X->Nup + X->Ndown;
895  }
896  if (X->NLocSpn > X->Ne) {
897  fprintf(stdoutMPI, "%s", "Error: Ne=Nup+Ndown must be (Ne >= NLocalSpin).\n");
898  fprintf(stdoutMPI, "NLocalSpin=%d, Ne=%d\n", X->NLocSpn, X->Ne);
899  return(-1);
900  }
901  }
902  break;
903  case SpinGC:
904  case KondoGC:
905  case HubbardGC:
906  case SpinlessFermionGC:
907  if (iReadNCond == TRUE || X->iFlgSzConserved == TRUE) {
908  fprintf(stdoutMPI, "\n Warning: For GC, both Ncond and 2Sz should not be defined.\n");
909  //return(-1);
910  }
911  break;
912  default:
913  break;
914  }
915 
916  /* Check values (Positive)*/
917  if (X->Nsite <= 0) {// Nsite must be positve
918  fprintf(stdoutMPI, "Error in %s\n Nsite must be positive value.\n", defname);
919  return (-1);
920  }
921  if (X->Lanczos_max <= 0) {// Lanczos_max must be positive
922  fprintf(stdoutMPI, "Error in %s\n Lanczos_max must be positive value.\n", defname);
923  return (-1);
924  }
925  if (X->LanczosEps <= 0) {// Lanczos_eps must be positive
926  fprintf(stdoutMPI, "Error in %s\n Lanczos_eps must be positive value.\n", defname);
927  return (-1);
928  }
929  if (NumAve <= 0) { // Average number must be positive
930  fprintf(stdoutMPI, "Error in %s\n NumAve must be positive value.\n", defname);
931  return (-1);
932  }
933  if (X->Param.ExpecInterval <= 0) {// Interval to calculate expected values must be positive
934  fprintf(stdoutMPI, "Error in %s\n ExpecInterval must be positive value.\n", defname);
935  return (-1);
936  }
937  if (X->nvec == 0) {
938  X->nvec = X->Lanczos_max;
939  }
940 
941  if (X->nvec < X->k_exct) {
942  X->nvec = X->k_exct;
943  }
944  if (X->LanczosTarget < X->k_exct) X->LanczosTarget = X->k_exct;
945 
946  if (ValidateValue(X->k_exct, 1, X->nvec)) {
947  fprintf(stdoutMPI, "Error in %s \n exct=%d must be greater than 1 and smaller than nvec=%d.\n",
948  defname, X->k_exct, X->nvec);
949  return (-1);
950  }
951 
952  if (X->k_exct > X->LanczosTarget) {
953  fprintf(stdoutMPI, "Error in %s\n LanczosTarget=%d must be greater than exct=%d.\n", defname, X->LanczosTarget, X->k_exct);
954  return (-1);
955  }
956 
957  X->fidx = 0;
958  X->NeMPI = X->Ne;
959  X->NupMPI = X->Nup;
960  X->NdownMPI = X->Ndown;
961  X->NupOrg = X->Nup;
962  X->NdownOrg = X->Ndown;
963  return 0;
964 }
int Nup
Number of spin-up electrons in this process.
Definition: struct.hpp:58
int irand
Input keyword TargetTPQRand ???
Definition: struct.hpp:79
int LanczosEps
log(10 base) of the convergence threshold. Read from Calcmod in readdef.h
Definition: struct.hpp:48
int NeMPI
Total number of electrons across process. Differ from DefineList::Ne .
Definition: struct.hpp:72
int iFlgSpecOmegaMin
Whether DefineList::dcOmegaMin is input or not.
Definition: struct.hpp:216
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.hpp:127
int NupMPI
Total number of spin-up electrons across processes. Deffer from DefineList::Nup. Read from modpara in...
Definition: struct.hpp:60
int iFlgSzConserved
Flag whether Sz is conserved.
Definition: struct.hpp:87
int GetFileName(const char *cFileListNameFile, char **cFileNameList)
Function of Fitting FileName.
Definition: readdef.cpp:389
int NumAve
Definition: global.cpp:43
int NPairLiftCoupling
Number of pair-lift term.
Definition: struct.hpp:153
int ReadDefFileError(const char *defname)
Error Function of reading def files.
Definition: readdef.cpp:97
int fidx
Always 0, it is not used ???
Definition: struct.hpp:89
int Total2Sz
Total in this process.
Definition: struct.hpp:69
std::complex< double > dcOmegaMin
Lower limit of the frequency for the spectrum.
Definition: struct.hpp:212
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
int NumarrayJ
Definition: struct.hpp:385
int ValidateValue(const int icheckValue, const int ilowestValue, const int iHighestValue)
Function of Validating value.
Definition: readdef.cpp:115
std::complex< double > I(0.0, 1.0)
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.cpp:105
int nvec
Read from Calcmod in readdef.h.
Definition: struct.hpp:46
void InitializeInteractionNum(struct DefineList *X)
function of initializing interactions
Definition: readdef.cpp:2691
int NHundCoupling
Number of Hund coupling.
Definition: struct.hpp:133
int NIsingCoupling
Number of Ising term.
Definition: struct.hpp:151
int ReadcalcmodFile(const char *defname, struct DefineList *X)
Function of Reading calcmod file.
Definition: readdef.cpp:215
int NInterAll
Total Number of Interacted quartet.
Definition: struct.hpp:163
int CheckWords(const char *ctmp, const char *cKeyWord)
function of checking whether ctmp is same as cKeyWord or not
Definition: readdef.cpp:2824
int D_iKWNumDef
Definition: readdef.cpp:60
int NNSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:182
int ExpecInterval
Definition: struct.hpp:36
std::complex< double > dcOmegaOrg
Origin limit of the frequency for the spectrum.
Definition: struct.hpp:213
int Ne
Number of electrons in this process.
Definition: struct.hpp:71
int NCisAjt
Number of indices of two-body correlation function.
Definition: struct.hpp:175
int NLaser
Definition: struct.hpp:252
int READ
It is ALWAYS 0 ???
Definition: struct.hpp:53
int read_hacker
Whether use an efficient method (=1) in sz.c or not (=0)
Definition: struct.hpp:52
int NdownOrg
Number of spin-down electrons before exitation. Used only in the spectrum calculation. Read from modpara in readdef.h.
Definition: struct.hpp:66
double TimeSlice
Definition: struct.hpp:33
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.cpp:122
static char cKWListOfFileNameList[][D_CharTmpReadDef]
Keyword List in NameListFile.
Definition: readdef.cpp:36
int Lanczos_max
Maximum number of iterations.
Definition: struct.hpp:74
int NExchangeCoupling
Number of exchange term.
Definition: struct.hpp:145
struct ParamList Param
Definition: struct.hpp:243
char * CParaFileHead
Read from Calcmod in readdef.h. It is not used. Just for the compatibility to mVMC.
Definition: struct.hpp:44
int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.hpp:104
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
double LargeValue
Definition: global.cpp:42
int iNOmega
Number of frequencies for spectrum.
Definition: struct.hpp:214
std::complex< double > dcOmegaMax
Upper limit of the frequency for the spectrum.
Definition: struct.hpp:211
int NTETransferMax
Definition: struct.hpp:257
int iFlgSpecOmegaOrg
Whether DefineList::dcOmegaOrg is input or not.
Definition: struct.hpp:217
long int ishift_nspin
Definition: struct.hpp:384
double Tinit
Definition: struct.hpp:32
int OutputInterval
Definition: struct.hpp:34
int ExpandCoef
Definition: struct.hpp:35
long int num_pivot
Definition: struct.hpp:383
int NPairHopping
Number of pair-hopping term.
Definition: struct.hpp:139
int iFlgSpecOmegaMax
Whether DefineList::dcOmegaMax is input or not.
Definition: struct.hpp:215
int NCoulombIntra
Definition: struct.hpp:121
int NTETimeSteps
Definition: struct.hpp:248
static char ** cFileNameListFile
Definition: readdef.cpp:65
int LanczosTarget
Which eigenstate is used to check convergence. Read from Calcmod in readdef.h.
Definition: struct.hpp:50
long int W0
Definition: struct.hpp:382
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
long int R0
Definition: struct.hpp:381
long int initial_iv
Seed of random number for initial guesss of wavefunctions.
Definition: struct.hpp:76
int WRITE
It is ALWAYS 0 ???
Definition: struct.hpp:54
int flgBoost
Flag whether use CMA algorithm.
Definition: struct.hpp:380
int NdownMPI
Total number of spin-down electrons across processes. Deffer from DefineList::Ndown. Read from modpara in readdef.h.
Definition: struct.hpp:62
int k_exct
Read from Calcmod in readdef.h.
Definition: struct.hpp:47
int Ndown
Number of spin-down electrons in this process.
Definition: struct.hpp:59
int NCond
Number of itinerant electrons.
Definition: struct.hpp:85
int NLocSpn
Number of local spins.
Definition: struct.hpp:84
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.hpp:42
int NupOrg
Number of spin-up electrons before exitation. Used only in the spectrum calculation. Read from modpara in readdef.h.
Definition: struct.hpp:64
int NNPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:189
int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.hpp:178
int NTEInterAllMax
Definition: struct.hpp:272
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.hpp:194

◆ ResetInteractionNum()

void ResetInteractionNum ( struct DefineList X)

function of resetting number of interactions

Parameters
[out]XDefine list to add number of ising coulomnb interactions
Version
0.2
Author
Kazuyoshi Yoshimi (The University of Tokyo)
Takahiro Misawa (The University of Tokyo)

Definition at line 2674 of file readdef.cpp.

References InitializeInteractionNum(), DefineList::NCoulombInter, DefineList::NHundCoupling, and DefineList::NIsingCoupling.

Referenced by CheckLocSpin(), and ReadDefFileIdxPara().

2677 {
2678  X->NHundCoupling += X->NIsingCoupling;
2679  X->NCoulombInter += X->NIsingCoupling;
2680 }
int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.hpp:127
int NHundCoupling
Number of Hund coupling.
Definition: struct.hpp:133
int NIsingCoupling
Number of Ising term.
Definition: struct.hpp:151

◆ SetConvergenceFactor()

void SetConvergenceFactor ( struct DefineList X)

function to set convergence factors

Parameters
[in]XDefine list to get Lanczos eps.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 2584 of file readdef.cpp.

References CheckLocSpin(), eps, eps_CG, eps_Energy, eps_Lanczos, and DefineList::LanczosEps.

Referenced by CheckFormatForKondoInt(), and main().

2587 {
2588  //In future, convergence facator can be set by a def file.
2589  int neps = -8;
2590  int nepsCG =-8;
2591  int nEnergy = -12;
2592  eps=pow(10.0, neps);
2593  eps_CG=pow(10.0, nepsCG);
2594  eps_Lanczos = pow(10,-X->LanczosEps);
2595  eps_Energy = pow(10.0, nEnergy);
2596 }
int LanczosEps
log(10 base) of the convergence threshold. Read from Calcmod in readdef.h
Definition: struct.hpp:48
double eps
Definition: global.cpp:63
double eps_Energy
Definition: global.cpp:66
double eps_CG
Definition: global.cpp:64
double eps_Lanczos
Definition: global.cpp:65

◆ ValidateValue()

int ValidateValue ( const int  icheckValue,
const int  ilowestValue,
const int  iHighestValue 
)

Function of Validating value.

Parameters
[in]icheckValuevalue to validate.
[in]ilowestValuelowest value which icheckValue can be set.
[in]iHighestValueheighest value which icheckValue can be set.
Return values
0value is correct.
-1value is incorrect.
Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 115 of file readdef.cpp.

Referenced by ReadcalcmodFile(), and ReadDefFileNInt().

119  {
120 
121  if(icheckValue < ilowestValue || icheckValue > iHighestValue){
122  return(-1);
123  }
124  return 0;
125 }

Variable Documentation

◆ cFileNameListFile

char** cFileNameListFile
static

File Name List in NameListFile.

Definition at line 65 of file readdef.cpp.

◆ cKWListOfFileNameList

char cKWListOfFileNameList[][D_CharTmpReadDef]
static
Initial value:
={
"CalcMod",
"ModPara",
"LocSpin",
"Trans",
"CoulombIntra",
"CoulombInter",
"Hund",
"PairHop",
"Exchange",
"InterAll",
"OneBodyG",
"TwoBodyG",
"PairLift",
"Ising",
"Boost",
"SingleExcitation",
"PairExcitation",
"SpectrumVec",
"Laser",
"TEOneBody",
"TETwoBody"
}

Keyword List in NameListFile.

Definition at line 36 of file readdef.cpp.

Referenced by GetFileName(), and ReadDefFileNInt().

◆ D_iKWNumDef

int D_iKWNumDef = sizeof(cKWListOfFileNameList)/sizeof(cKWListOfFileNameList[0])

Definition at line 60 of file readdef.cpp.

Referenced by GetFileName(), ReadDefFileIdxPara(), and ReadDefFileNInt().