2
0
mirror of https://github.com/LCPQ/DEHam synced 2024-07-30 09:04:19 +02:00

Added bigger examples and improved notebook functions.

This commit is contained in:
vijay gopal chilkuri 2020-05-01 13:16:05 +02:00
parent 6a456a13ba
commit 0f145b9641
7 changed files with 115 additions and 45 deletions

View File

@ -11,7 +11,7 @@ false
1.0,-1.0,0.0000 1.0,-1.0,0.0000
-1.00,0.0,0.00 -1.00,0.0,0.00
0.0,0.0,0.0,0.0 0.0,0.0,0.0,0.0
2 12
1 1
1 1
1 1

30
examples/tJ_4x5.inp Normal file
View File

@ -0,0 +1,30 @@
20
26
4
1
0
false
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
2, 3, 4, 1, 6, 7, 8, 5, 10, 11, 12, 9, 14, 15, 16, 13, 18, 19, 20, 17, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1.0,-1.0,0.00
1.0,-1.0,0.00
-1.000,0.0,0.00
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
2
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0

30
examples/tJ_4x6.inp Normal file
View File

@ -0,0 +1,30 @@
24
7
4
1
0
false
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
2, 3, 4, 1, 6, 7, 8, 5, 10, 11, 12, 9, 14, 15, 16, 13, 18, 19, 20, 17, 22, 23, 24, 21, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1, 2, 3, 4
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1.0,-1.0,0.00
1.0,-1.0,0.00
-1.000,0.0,0.00
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
2
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0

View File

@ -11,7 +11,7 @@ false
1.0,-1.0,0.0000 1.0,-1.0,0.0000
-1.00,0.0,0.00 -1.00,0.0,0.00
1.0,1.0,1.0,1.0 1.0,1.0,1.0,1.0
12 120
1 1
1 1
1 1

View File

@ -74,10 +74,10 @@
nt2= 3 nt2= 3
nt1 4 nt1 4
nt2= 3 nbeta= 1 nt2= 3 nbeta= 1
Time used to build the matrix: 0.007798 Time used to build the matrix: 0.009882
time = 0.007798 mpiid = 0 time = 0.009882 mpiid = 0
Time used to assemble the matrix: 0.000026 Time used to assemble the matrix: 0.000258
Time used: 0.000336 Time used: 0.004857
Number of iterations of the method: 1 Number of iterations of the method: 1
Solution method: krylovschur Solution method: krylovschur

File diff suppressed because one or more lines are too long

View File

@ -35,20 +35,24 @@ int main(int argc,char **argv)
PetscLogDouble t1,t2,tt1,tt2; PetscLogDouble t1,t2,tt1,tt2;
PetscErrorCode ierr; PetscErrorCode ierr;
int mpiid; int mpiid;
SlepcInitialize(&argc,&argv,(char*)0,NULL);
MPI_Comm_rank(MPI_COMM_WORLD,&mpiid);
char const* const fileName = argv[1]; char const* const fileName = argv[1];
FILE* file = fopen(fileName, "r"); FILE* file = fopen(fileName, "r");
Data getdata; Data getdata;
PetscInt nlocal; //PetscInt nlocal;
/* gather the input data */ /* gather the input data */
if(mpiid==0)printf("Reading data\n");
Data_new(file, &getdata); Data_new(file, &getdata);
getdata.n = get_ntot(getdata.FAM1, getdata.natom, getdata.isz, getdata.ntrou, getdata.fix_trou1, getdata.fix_trou2); getdata.n = get_ntot(getdata.FAM1, getdata.natom, getdata.isz, getdata.ntrou, getdata.fix_trou1, getdata.fix_trou2);
if(mpiid==0)printf("Done reading data\n");
nlocal = getdata.n/getdata.npar; //nlocal = getdata.n/getdata.npar;
PetscScalar *valxr; PetscScalar *valxr;
PetscInt indxr[nlocal]; //PetscInt indxr[nlocal];
char filename[PETSC_MAX_PATH_LEN]="FIL666"; char filename[PETSC_MAX_PATH_LEN]="FIL666";
PetscViewer viewer; PetscViewer viewer;
PetscBool ishermitian; PetscBool ishermitian;
@ -77,7 +81,7 @@ int main(int argc,char **argv)
PetscReal trace2rdm=0.0; PetscReal trace2rdm=0.0;
PetscReal trace2rdmfin=0.0; PetscReal trace2rdmfin=0.0;
IS from, to; /* index sets that define the scatter */ IS from, to; /* index sets that define the scatter */
PetscInt idx_to[nlocal], idx_from[nlocal]; //PetscInt idx_to[nlocal], idx_from[nlocal];
PetscScalar *values; PetscScalar *values;
int ndim=(getdata.natom/2)*((getdata.natom/2)-1)/2; int ndim=(getdata.natom/2)*((getdata.natom/2)-1)/2;
double a, b, c; double a, b, c;
@ -85,16 +89,16 @@ int main(int argc,char **argv)
double gamma_pfin = 0.0, gamma_mfin = 0.0; double gamma_pfin = 0.0, gamma_mfin = 0.0;
double nel, s2dens; double nel, s2dens;
double nelfin, s2densfin; double nelfin, s2densfin;
double densmat2[getdata.natom][getdata.natom][getdata.natom][getdata.natom]; //double densmat2[getdata.natom][getdata.natom][getdata.natom][getdata.natom];
memset(densmat2, 0, sizeof(densmat2)); //memset(densmat2, 0, sizeof(densmat2));
SlepcInitialize(&argc,&argv,(char*)0,NULL); if(mpiid==0)printf("Initializing Slepc vars\n");
ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D t-J Eigenproblem, n=%D\n\n",getdata.n);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D t-J Eigenproblem, n=%D\n\n",getdata.n);CHKERRQ(ierr);
ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
ierr = MatCreateAIJ(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,getdata.n,getdata.n,10*getdata.natom,NULL,10*getdata.natom,NULL,&A);CHKERRQ(ierr); ierr = MatCreateAIJ(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,getdata.n,getdata.n,10*getdata.natom,NULL,10*getdata.natom,NULL,&A);CHKERRQ(ierr);
ierr = MatMPIAIJSetPreallocation(A,10*getdata.natom,NULL,10*getdata.natom,NULL);CHKERRQ(ierr); ierr = MatMPIAIJSetPreallocation(A,10*getdata.natom,NULL,10*getdata.natom,NULL);CHKERRQ(ierr);
if(mpiid==0)printf("Done Initializing Slepc\n");
MPI_Comm_rank(MPI_COMM_WORLD,&mpiid);
ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr);
ierr = PetscTime(&tt1);CHKERRQ(ierr); ierr = PetscTime(&tt1);CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD," start: %d end: %d \n",Istart, Iend);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," start: %d end: %d \n",Istart, Iend);CHKERRQ(ierr);