Skip to content

Commit

Permalink
2019_12_29
Browse files Browse the repository at this point in the history
  • Loading branch information
jhsim4279 committed Dec 29, 2019
1 parent 0f70dae commit a13c15f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 27 deletions.
41 changes: 40 additions & 1 deletion src/Construct_hyb_delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,46 @@
#include "TB.h"
#include <Eigen/Dense>

void Construct_H0_local(Eigen::MatrixXcd * Heff_loc, double mu, ImgFreqFtn & SelfE_w, int atom);
//void Construct_H0_local(Eigen::MatrixXcd * Heff_loc, double mu, ImgFreqFtn & SelfE_w, int atom);

void Construct_Gloc(int impurityDim, std::vector<int> impurityOrbit,
ImgFreqFtn & SelfE_w, std::vector<Eigen::MatrixXcd> Gw, double mu,
ImgFreqFtn & weiss_fieldTB, int atom, Eigen::MatrixXcd & SolverBasis ) {



int h2, h1F, h2F, h1H,h2H;
cmplx iw;

std::vector<Eigen::MatrixXcd> projGw(N_freq);
for(int n=0; n<N_freq; n++) {
projGw[n].setZero(impurityDim, impurityDim);
}

for(int h1=0; h1< impurityDim; h1++) {
for(int h2=0; h2< impurityDim; h2++) {
int h1F = impurityOrbit.at(h1);
int h2F = impurityOrbit.at(h2);
for(int n=0; n<N_freq; n++) {
projGw[n](h1,h2) = Gw[n](h1F,h2F);
}
}
}



for(int n=0; n<N_freq; n++) {
iw=I*pi*(2.*n+1.)/beta;
for(int h1=0; h1< impurityDim ; h1++) {
for(int h2=0; h2< impurityDim ; h2++) {
weiss_fieldTB.setValueSubMat(n, atom, h1, h2,
projGw[n](h1,h2) ) ;
}//h2
}//h1
}//n

}


void Construct_hyb_delta(int impurityDim, std::vector<int> impurityOrbit,
ImgFreqFtn & SelfE_w, std::vector<Eigen::MatrixXcd> Gw, double mu,
Expand Down
2 changes: 1 addition & 1 deletion src/SOLVER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void SOLVER(
MPI_Barrier(MPI_COMM_WORLD);

/*set solver command*/
ifroot std::cout << "ALPS, CT-HYB solver\n";
ifroot std::cout << "ALPS, CT-SEG solver\n";
MPI_Comm communication;

std::ostringstream impSolver_hyb_comm;
Expand Down
10 changes: 5 additions & 5 deletions src/dmft_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ int main(int argc, char *argv[]) {
}


weiss_field_strongCorr.dataOut(std::string("delta_w.dat"));
weiss_field_strongCorr.dataOut_full(std::string("delta_w.full.dat"));
ifroot std::cout << "FILEOUT:delta_w.dat\n" ;
// weiss_field_strongCorr.dataOut(std::string("delta_w.dat"));
// weiss_field_strongCorr.dataOut_full(std::string("delta_w.full.dat"));
// ifroot std::cout << "FILEOUT:delta_w.dat\n" ;


/***********************************************************
Expand Down Expand Up @@ -853,8 +853,8 @@ void write_results(int DFTIt, int currentIt, std::string system_name, int NumCor
cp_comm = std::string("cp ctqmc.log ./") +system_name+ "/" + chr + "ctqmc.log";
system(cp_comm.c_str());

cp_comm = std::string("cp delta_w.dat ./") +system_name+ "/" + chr + "delta_w.dat";
system(cp_comm.c_str());
// cp_comm = std::string("cp delta_w.dat ./") +system_name+ "/" + chr + "delta_w.dat";
// system(cp_comm.c_str());
cp_comm = std::string("cp Numele.dat ./") +system_name+ "/" + chr + "Numele.dat";
system(cp_comm.c_str());
cp_comm = std::string("cp ctqmc.log ./") +system_name+ "/" + chr + "ctqmc.log";
Expand Down
47 changes: 27 additions & 20 deletions src/mpi_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,18 @@ void data_sync_EigenMat(Eigen::MatrixXcd *A, int startRow, int endRow, int matri
end[itsRank]=iend;
}
int lenRow = endRow-startRow+1;
cmplx AA[lenRow][matrix_dim*matrix_dim];
int mat_size= matrix_dim*matrix_dim;
cmplx * AA = new cmplx [lenRow * mat_size ];
for(row=0; row <lenRow ; row++ ) {
for(int i=0; i<matrix_dim; i++) {
for(int j=0; j<matrix_dim; j++) {
AA[row][i*matrix_dim + j] = A[row+startRow](i,j);
AA[row*mat_size + i*matrix_dim + j] = A[row+startRow](i,j);
}
}
}

for(myrank=0; myrank<nprocs; myrank++) {
MPI_Bcast(&(AA[start[myrank]-startRow][0]), (end[myrank]-start[myrank]+1)*(matrix_dim*matrix_dim), MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
MPI_Bcast(&(AA[(start[myrank]-startRow)*mat_size]), (end[myrank]-start[myrank]+1)*(matrix_dim*matrix_dim), MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
//for(row=start[myrank]; row <=end[myrank] ; row++ ) {
// MPI_Bcast(A[row].data(), A[row].size(), MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
//}
Expand All @@ -139,11 +140,12 @@ void data_sync_EigenMat(Eigen::MatrixXcd *A, int startRow, int endRow, int matri
for(row=0; row <lenRow ; row++ ) {
for(int i=0; i<matrix_dim; i++) {
for(int j=0; j<matrix_dim; j++) {
A[row+startRow](i,j) = AA[row][i*matrix_dim + j] ;
A[row+startRow](i,j) = AA[row*mat_size+i*matrix_dim + j] ;
}
}
}

delete [] AA;
delete [] start;
delete [] end;
}
Expand All @@ -160,21 +162,22 @@ void data_sync(cmplx **A, int startRow, int endRow, int lenColumn, int nprocs)
end[itsRank]=iend;
}
int lenRow = endRow-startRow+1;
cmplx AA[lenRow][lenColumn];
cmplx * AA = new cmplx [lenRow * lenColumn];
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
AA[i][j] = A[i+startRow][j];
AA[i*lenColumn + j] = A[i+startRow][j];
}
}

for(myrank=0; myrank<nprocs; myrank++) {
MPI_Bcast(&(AA[start[myrank]-startRow][0]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
MPI_Bcast(&(AA[ (start[myrank]-startRow)*lenColumn]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
}
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
A[i+startRow][j]=AA[i][j];
A[i+startRow][j]=AA[i*lenColumn+j];
}
}
delete [] AA;
delete [] start;
delete [] end;
}
Expand All @@ -190,21 +193,22 @@ void data_sync(double **A, int startRow, int endRow, int lenColumn, int nprocs)
end[itsRank]=iend;
}
int lenRow = endRow-startRow+1;
double AA[lenRow][lenColumn];
double * AA = new double [lenRow * lenColumn];
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
AA[i][j] = A[i+startRow][j];
AA[i*lenColumn+j] = A[i+startRow][j];
}
}
for(myrank=0; myrank<nprocs; myrank++) {
MPI_Bcast(&(AA[start[myrank]-startRow][0]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_DOUBLE, myrank, MPI_COMM_WORLD);
MPI_Bcast(&(AA[(start[myrank]-startRow) * lenColumn]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_DOUBLE, myrank, MPI_COMM_WORLD);
}
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
A[i+startRow][j]=AA[i][j];
A[i+startRow][j]=AA[i*lenColumn+j];
}
}

delete [] AA;
delete [] start;
delete [] end;
}
Expand All @@ -220,20 +224,21 @@ void data_sync(int **A, int startRow, int endRow, int lenColumn, int nprocs) {
end[itsRank]=iend;
}
int lenRow = endRow-startRow+1;
int AA[lenRow][lenColumn];
int * AA = new int [lenRow * lenColumn];
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
AA[i][j] = A[i+startRow][j];
AA[i*lenColumn +j] = A[i+startRow][j];
}
}
for(myrank=0; myrank<nprocs; myrank++) {
MPI_Bcast(&(AA[start[myrank]-startRow][0]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_INT, myrank, MPI_COMM_WORLD);
MPI_Bcast(&(AA[(start[myrank]-startRow)*lenColumn]), (end[myrank]-start[myrank]+1)*lenColumn, MPI_INT, myrank, MPI_COMM_WORLD);
}
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
A[i+startRow][j]=AA[i][j];
A[i+startRow][j]=AA[i*lenColumn +j];
}
}
delete [] AA;
delete [] start;
delete [] end;
}
Expand All @@ -249,27 +254,29 @@ void data_sync(cmplx ***A, int startRow, int endRow, int lenColumn, int lenhight
end[itsRank]=iend;
}
int lenRow = endRow-startRow+1;
cmplx AA[lenRow][lenColumn*lenhight];
int mat_size= lenColumn*lenhight;
cmplx * AA = new cmplx [lenRow * mat_size ];
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
for(int k=0; k<lenhight; k++) {
AA[i][j*lenhight+k] = A[i+startRow][j][k];
AA[i*mat_size+ j*lenhight+k] = A[i+startRow][j][k];
}
}
}
for(myrank=0; myrank<nprocs; myrank++) {
MPI_Bcast(&(AA[start[myrank]-startRow][0]), (end[myrank]-start[myrank]+1)*(lenColumn*lenhight), MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
MPI_Bcast(&(AA[(start[myrank]-startRow)*mat_size]), (end[myrank]-start[myrank]+1)*(lenColumn*lenhight), MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
// for(row=start[myrank]; row <=end[myrank] ; row++ ) {
// MPI_Bcast(&A[row][0][0], lenColumn*lenhight, MPI_DOUBLE_COMPLEX, myrank, MPI_COMM_WORLD);
// }
}
for(int i=0; i<lenRow; i++) {
for(int j=0; j<lenColumn; j++) {
for(int k=0; k<lenhight; k++) {
A[i+startRow][j][k] = AA[i][j*lenhight+k] ;
A[i+startRow][j][k] = AA[i*mat_size +j*lenhight+k] ;
}
}
}
delete [] AA;
delete [] start;
delete [] end;
}

0 comments on commit a13c15f

Please sign in to comment.