Skip to content

Instantly share code, notes, and snippets.

@kylincaster
Last active November 18, 2022 03:26
Show Gist options
  • Save kylincaster/869897e9d232fba7b8108b568b3d2122 to your computer and use it in GitHub Desktop.
Save kylincaster/869897e9d232fba7b8108b568b3d2122 to your computer and use it in GitHub Desktop.
The patch of OpenMX v3.9.9 into the Porting into Mingw-w64
# install the necessary package for OpenMX in Mingw-w64 or Msys2
# Microsoft MPI
# install MSYS2 and add the bin to path
pacman -Syu
pacman -S patch
pacman -S dos2unix
pacman -S mingw-w64-x86_64-msmpi
pacman -S mingw-w64-x86_64-openblas
pacman -S mingw-w64-x86_64-scalapack
pacman -S mingw-w64-x86_64-fftw
# install Microsoft MPI and add into the PATh
# from https://github.com/microsoft/Microsoft-MPI/releases
# Patch the OPENMX
dos2unix ./source/*
bash
patch -p1 < win32_port.patch
# make OpenMX
make -j8
diff --git a/source/Band_DFT_Col.c b/source/Band_DFT_Col.c
index bd0e3a5..5a2761d 100644
--- a/source/Band_DFT_Col.c
+++ b/source/Band_DFT_Col.c
@@ -20,6 +20,7 @@
#include "tran_variables.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Band_DFT_Col_Optical_ScaLAPACK.c b/source/Band_DFT_Col_Optical_ScaLAPACK.c
index 0b76ccd..b61144f 100644
--- a/source/Band_DFT_Col_Optical_ScaLAPACK.c
+++ b/source/Band_DFT_Col_Optical_ScaLAPACK.c
@@ -19,7 +19,7 @@
#include "lapack_prototypes.h"
#include "mpi.h"
#include <omp.h>
-
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Band_DFT_NonCol.c b/source/Band_DFT_NonCol.c
index 5079310..8ba5b01 100644
--- a/source/Band_DFT_NonCol.c
+++ b/source/Band_DFT_NonCol.c
@@ -20,6 +20,7 @@
#include "tran_variables.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Bench_MatMul.c b/source/Bench_MatMul.c
index 02f1c25..f92dfce 100644
--- a/source/Bench_MatMul.c
+++ b/source/Bench_MatMul.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#define asize1 520
diff --git a/source/Cluster_DFT_Col.c b/source/Cluster_DFT_Col.c
index a43877e..54bc56e 100644
--- a/source/Cluster_DFT_Col.c
+++ b/source/Cluster_DFT_Col.c
@@ -17,6 +17,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Cluster_DFT_NonCol.c b/source/Cluster_DFT_NonCol.c
index 88b6fd6..acbea3c 100644
--- a/source/Cluster_DFT_NonCol.c
+++ b/source/Cluster_DFT_NonCol.c
@@ -18,6 +18,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
@@ -422,72 +423,72 @@ double Cluster_DFT_NonCol(
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,rHs11,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,rHs11,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) rHs11[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,rHs11,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,rHs11,&ONE,&ONE,descH);
/* S^t x rHs12 x S */
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,rHs12,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,rHs12,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) rHs12[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,rHs12,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,rHs12,&ONE,&ONE,descH);
/* S^t x rHs22 x S */
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,rHs22,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,rHs22,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) rHs22[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,rHs22,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,rHs22,&ONE,&ONE,descH);
/* S^t x iHs11 x S */
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,iHs11,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,iHs11,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) iHs11[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,iHs11,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,iHs11,&ONE,&ONE,descH);
/* S^t x iHs12 x S */
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,iHs12,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,iHs12,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) iHs12[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,iHs12,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,iHs12,&ONE,&ONE,descH);
/* S^t x iHs22 x S */
for (i=0; i<na_rows*na_cols; i++) Cs[i] = 0.0;
Cblacs_barrier(ictxt1,"A");
- F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha,iHs22,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta,Cs,&ONE,&ONE,descC);
+ F77_NAME(pdgemm,PDGEMM)("N","N",&n,&n,&n,&alpha.r,iHs22,&ONE,&ONE,descH,Ss,&ONE,&ONE,descS,&beta.r,Cs,&ONE,&ONE,descC);
for (i=0; i<na_rows*na_cols; i++) iHs22[i] = 0.0;
Cblacs_barrier(ictxt1,"C");
- F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta,iHs22,&ONE,&ONE,descH);
+ F77_NAME(pdgemm,PDGEMM)("T","N",&n,&n,&n,&alpha.r,Ss,&ONE,&ONE,descS,Cs,&ONE,&ONE,descC,&beta.r,iHs22,&ONE,&ONE,descH);
if (measure_time){
dtime(&etime);
diff --git a/source/Cluster_DFT_Optical_ScaLAPACK.c b/source/Cluster_DFT_Optical_ScaLAPACK.c
index 40e0430..fbf6f2b 100644
--- a/source/Cluster_DFT_Optical_ScaLAPACK.c
+++ b/source/Cluster_DFT_Optical_ScaLAPACK.c
@@ -18,6 +18,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/DFT.c b/source/DFT.c
index 789bc8b..942b190 100644
--- a/source/DFT.c
+++ b/source/DFT.c
@@ -14,11 +14,14 @@
#include <stdlib.h>
#include <math.h>
#include <time.h>
+#include <string.h>
#include "openmx_common.h"
#include "Inputtools.h"
#include "mpi.h"
#include "tran_prototypes.h"
+#include "scalapack.h"
+
int TRAN_SCF_Iter_Band;
/* variables for cluster and band calculations */
diff --git a/source/Divide_Conquer_LNO.c b/source/Divide_Conquer_LNO.c
index 514bcc1..a697ecf 100644
--- a/source/Divide_Conquer_LNO.c
+++ b/source/Divide_Conquer_LNO.c
@@ -19,9 +19,9 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
-
+#include "scalapack.h"
#define measure_time 0
-
+void Eigen_lapack_d(double **a, double *ko, int n, int EVmax);
static double DC_Col(char *mode,
int MD_iter,
diff --git a/source/EGAC_DFT.c b/source/EGAC_DFT.c
index 4300bc9..50ee32c 100644
--- a/source/EGAC_DFT.c
+++ b/source/EGAC_DFT.c
@@ -19,7 +19,9 @@
#include "mpi.h"
#include <omp.h>
#include <complex.h>
+#include "scalapack.h"
+int Lapack_LU_Zinverse(int , dcomplex *);
#define measure_time 0
diff --git a/source/Eigen_PHH.c b/source/Eigen_PHH.c
index ab4d090..4de198b 100644
--- a/source/Eigen_PHH.c
+++ b/source/Eigen_PHH.c
@@ -17,6 +17,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include "f77func.h"
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Eigen_PReHH.c b/source/Eigen_PReHH.c
index ab02e44..ae6115e 100644
--- a/source/Eigen_PReHH.c
+++ b/source/Eigen_PReHH.c
@@ -21,7 +21,7 @@
#include "mpi.h"
#include <omp.h>
#include "f77func.h"
-
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/FT_PAO.c b/source/FT_PAO.c
index 8016260..b7df8ae 100644
--- a/source/FT_PAO.c
+++ b/source/FT_PAO.c
@@ -22,7 +22,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
-
+#include "win32_port.h"
void FT_PAO()
diff --git a/source/Force.c b/source/Force.c
index 3bb2a1c..268b3be 100644
--- a/source/Force.c
+++ b/source/Force.c
@@ -16,6 +16,7 @@
#include <time.h>
#include "openmx_common.h"
#include "mpi.h"
+#include <string.h>
#include <omp.h>
#define measure_time 0
diff --git a/source/Generate_Wannier.c b/source/Generate_Wannier.c
index b9d77cf..232ca84 100644
--- a/source/Generate_Wannier.c
+++ b/source/Generate_Wannier.c
@@ -16,7 +16,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "openmx_common.h"
diff --git a/source/Input_std.c b/source/Input_std.c
index 76adedb..850439d 100644
--- a/source/Input_std.c
+++ b/source/Input_std.c
@@ -94,7 +94,8 @@ void Input_std(char *file)
}
/* add '/' to filepath */
- sprintf(filepath,"%s/",filepath);
+ if (filepath[strlen(filepath)-1]!='/')
+ sprintf(filepath,"%s/",filepath);
input_string("System.Name",filename,"default");
input_string("DATA.PATH",DFT_DATA_PATH,"../DFT_DATA19");
diff --git a/source/LNO.c b/source/LNO.c
index 704e3a4..9b804a1 100644
--- a/source/LNO.c
+++ b/source/LNO.c
@@ -19,6 +19,7 @@
#include "lapack_prototypes.h"
#include "mpi.h"
#include <omp.h>
+#include "scalapack.h"
#define measure_time 0
diff --git a/source/Mio_tester.c b/source/Mio_tester.c
index 5526aef..0589fe2 100644
--- a/source/Mio_tester.c
+++ b/source/Mio_tester.c
@@ -23,7 +23,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#define Msize1 100
diff --git a/source/Mio_tester2.c b/source/Mio_tester2.c
index 3572e58..e6198f7 100644
--- a/source/Mio_tester2.c
+++ b/source/Mio_tester2.c
@@ -23,7 +23,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#define Msize1 100
diff --git a/source/Mixing_H.c b/source/Mixing_H.c
index d2f051b..77e58e4 100644
--- a/source/Mixing_H.c
+++ b/source/Mixing_H.c
@@ -5,7 +5,7 @@
#include <string.h>
#include "openmx_common.h"
#include "mpi.h"
-
+#include "scalapack.h"
static void Simple_Mixing_H(int MD_iter, int SCF_iter, int SCF_iter0 );
static void Pulay_Mixing_H(int MD_iter, int SCF_iter, int SCF_iter0 );
diff --git a/source/Mixing_V.c b/source/Mixing_V.c
index cee3029..d6a6a34 100644
--- a/source/Mixing_V.c
+++ b/source/Mixing_V.c
@@ -3,9 +3,12 @@
#include <math.h>
#include <time.h>
#include <string.h>
+#include <omp.h>
+
#include "openmx_common.h"
#include "tran_variables.h"
#include "mpi.h"
+#include "scalapack.h"
#define maxima_step 300000.0
#define measure_time 0
diff --git a/source/OutData.c b/source/OutData.c
index 9bfa92f..876acc2 100644
--- a/source/OutData.c
+++ b/source/OutData.c
@@ -23,6 +23,9 @@
#include "mpi.h"
#include <omp.h>
+#if (defined(_WIN32) || defined(__WIN32__))
+#define fsync(A) _commit(A)
+#endif
#define CUBE_EXTENSION ".cube"
@@ -2068,11 +2071,14 @@ static void Print_CubeData(FILE *fp, char fext[], double *data0, double *data1,
} while (po==1 && num<100000);
/* system call */
-
+#if (defined(_WIN32) || defined(__WIN32__))
+ sprintf(operate,"coreutils cat %s%s%s_* > %s%s%s",
+ filepath,filename,fext, filepath,filename,fext);
+#else
sprintf(operate,"echo %s%s%s_* | xargs cat > %s%s%s",
- filepath,filename,fext,
- filepath,filename,fext);
-
+ filepath,filename,fext, filepath,filename,fext);
+#endif
+ // printf("operator: %s\n", operate);
ret = system(operate);
/*
@@ -2117,7 +2123,12 @@ static void Print_CubeData(FILE *fp, char fext[], double *data0, double *data1,
/* system call */
- sprintf(operate,"echo %s%s%s_* | xargs rm -f",filepath,filename,fext);
+#if (defined(_WIN32) || defined(__WIN32__))
+ sprintf(operate,"coreutils echo %s%s%s_* | xargs coreutils rm -f",filepath,filename,fext);
+#else
+ sprintf(operate,"echo %s%s%s_* | xargs rm -f",filepath,filename,fext);
+#endif
+ // printf("operator: %s\n", operate);
ret = system(operate);
/*
diff --git a/source/OutData_Binary.c b/source/OutData_Binary.c
index 7dcf8b1..edb0fb4 100644
--- a/source/OutData_Binary.c
+++ b/source/OutData_Binary.c
@@ -20,6 +20,7 @@
#include "openmx_common.h"
#include "mpi.h"
#include <omp.h>
+#include "win32_port.h"
#define CUBE_EXTENSION ".cube.bin"
@@ -1628,7 +1629,13 @@ static void Print_CubeData(FILE *fp, char fext[], double *data0, double *data1,
/* remove all the fraction files */
+#if (defined(_WIN32) || defined(__WIN32__))
+ sprintf(operate,"coreutils rm %s%s%s_*",filepath,filename,fext);
+#else
sprintf(operate,"rm %s%s%s_*",filepath,filename,fext);
+#endif
+ // printf("operator: %s\n", operate);
+
system(operate);
/*
@@ -1810,8 +1817,13 @@ static void Print_VectorData(FILE *fp, char fext[],
}
/* remove all the fraction files */
-
+#if (defined(_WIN32) || defined(__WIN32__))
+ sprintf(operate,"coreutils rm %s%s%s_*",filepath,filename,fext);
+#else
sprintf(operate,"rm %s%s%s_*",filepath,filename,fext);
+#endif
+ // printf("operator: %s\n", operate);
+
system(operate);
/*
diff --git a/source/Population_Analysis_Wannier.c b/source/Population_Analysis_Wannier.c
index 72992d8..4ee34ae 100644
--- a/source/Population_Analysis_Wannier.c
+++ b/source/Population_Analysis_Wannier.c
@@ -15,7 +15,7 @@
#include <time.h>
#include <ctype.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "openmx_common.h"
diff --git a/source/Population_Analysis_Wannier2.c b/source/Population_Analysis_Wannier2.c
index 4d3a15b..4d9177c 100644
--- a/source/Population_Analysis_Wannier2.c
+++ b/source/Population_Analysis_Wannier2.c
@@ -15,7 +15,7 @@
#include <time.h>
#include <ctype.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "openmx_common.h"
diff --git a/source/RestartFileDFT.c b/source/RestartFileDFT.c
index ba2b3d2..9699ad6 100644
--- a/source/RestartFileDFT.c
+++ b/source/RestartFileDFT.c
@@ -24,7 +24,7 @@
/* end stat section */
#include "openmx_common.h"
#include "mpi.h"
-
+#include "win32_port.h"
static int Input_HKS( int MD_iter, double *Uele, double *****CH );
static void Output_HKS(int MD_iter, double *Uele, double *****CH );
diff --git a/source/SCF2File.c b/source/SCF2File.c
index f5eae02..96f6701 100644
--- a/source/SCF2File.c
+++ b/source/SCF2File.c
@@ -828,7 +828,7 @@ void Output( FILE *fp, char *inputfile, double ******OLPpo, double *****OLPmo )
if (myid==Host_ID){
/* Added by N. Yamaguchi ***/
- if (inputfile=='\0') {
+ if (inputfile==NULL) {
return;
}
/* ***/
diff --git a/source/Set_CoreHoleMatrix.c b/source/Set_CoreHoleMatrix.c
index 85f87ad..7d7a954 100644
--- a/source/Set_CoreHoleMatrix.c
+++ b/source/Set_CoreHoleMatrix.c
@@ -18,7 +18,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/source/Set_Nonlocal.c b/source/Set_Nonlocal.c
index 70599a9..94401c9 100644
--- a/source/Set_Nonlocal.c
+++ b/source/Set_Nonlocal.c
@@ -17,11 +17,11 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
#include "openmx_common.h"
+#include "gettimeofday.h"
#include "mpi.h"
#include <omp.h>
diff --git a/source/Set_ProExpn_VNA.c b/source/Set_ProExpn_VNA.c
index e8fb0c8..30affeb 100644
--- a/source/Set_ProExpn_VNA.c
+++ b/source/Set_ProExpn_VNA.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/source/TRAN_CDen_Main.c b/source/TRAN_CDen_Main.c
index 7ca11c9..babb13f 100644
--- a/source/TRAN_CDen_Main.c
+++ b/source/TRAN_CDen_Main.c
@@ -8,6 +8,11 @@
#include "tran_prototypes.h"
#include "tran_variables.h"
+#if (defined(_WIN32) || defined(__WIN32__))
+#include<io.h>
+#define fsync(A) _commit(A)
+#endif
+
void FFT2D_Poisson(double *ReRhor, double *ImRhor, double *ReRhok, double *ImRhok);
diff --git a/source/TRAN_Channel_Output.c b/source/TRAN_Channel_Output.c
index 81788d8..2d9c0c0 100644
--- a/source/TRAN_Channel_Output.c
+++ b/source/TRAN_Channel_Output.c
@@ -14,8 +14,11 @@ xx/Xxx/2015 Released by M. Kawamura
#include <stdlib.h>
#include <math.h>
#include <mpi.h>
+#include <string.h>
#include "openmx_common.h"
+#include "win32_port.h"
+
static void Print_CubeTitle_EigenChannel(
FILE *fp,
double *TRAN_Channel_kpoint,
diff --git a/source/TRAN_DFT.c b/source/TRAN_DFT.c
index f592b5f..bdd0833 100644
--- a/source/TRAN_DFT.c
+++ b/source/TRAN_DFT.c
@@ -23,7 +23,7 @@
#include "openmx_common.h"
#include "tran_prototypes.h"
#include "tran_variables.h"
-
+#include "scalapack.h"
static void TRAN_Add_MAT(
diff --git a/source/TRAN_DFT_NC.c b/source/TRAN_DFT_NC.c
index 5636ee8..1b613e9 100644
--- a/source/TRAN_DFT_NC.c
+++ b/source/TRAN_DFT_NC.c
@@ -25,6 +25,7 @@
#include "tran_prototypes.h"
#include "tran_variables.h"
#include "openmx_common.h"
+#include "scalapack.h"
static void TRAN_Add_MAT(
int mode,
diff --git a/source/Timetool.c b/source/Timetool.c
index 18af8ea..eba8f1a 100644
--- a/source/Timetool.c
+++ b/source/Timetool.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <string.h>
#include <math.h>
diff --git a/source/Z2FH.c b/source/Z2FH.c
index 1a3f1ef..b6c2e52 100644
--- a/source/Z2FH.c
+++ b/source/Z2FH.c
@@ -45,7 +45,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "read_scfout.h"
#include "lapack_prototypes.h"
diff --git a/source/calB.c b/source/calB.c
index 024ddb5..10403e7 100644
--- a/source/calB.c
+++ b/source/calB.c
@@ -26,7 +26,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "read_scfout.h"
#include "lapack_prototypes.h"
diff --git a/source/dtime.c b/source/dtime.c
index 9005ed7..18bed92 100644
--- a/source/dtime.c
+++ b/source/dtime.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <omp.h>
diff --git a/source/gettimeofday.c b/source/gettimeofday.c
new file mode 100644
index 0000000..959ea66
--- /dev/null
+++ b/source/gettimeofday.c
@@ -0,0 +1,65 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#if (defined(_WIN32) || defined(__WIN32__))
+#include "gettimeofday.h"
+int getntptimeofday (struct timespec *tp, struct timezone *z)
+{
+ int res = 0;
+ union {
+ unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
+ FILETIME ft;
+ } _now;
+ TIME_ZONE_INFORMATION TimeZoneInformation;
+ DWORD tzi;
+
+ if (z != NULL)
+ {
+ if ((tzi = GetTimeZoneInformation(&TimeZoneInformation)) != TIME_ZONE_ID_INVALID) {
+ z->tz_minuteswest = TimeZoneInformation.Bias;
+ if (tzi == TIME_ZONE_ID_DAYLIGHT)
+ z->tz_dsttime = 1;
+ else
+ z->tz_dsttime = 0;
+ }
+ else
+ {
+ z->tz_minuteswest = 0;
+ z->tz_dsttime = 0;
+ }
+ }
+
+ if (tp != NULL) {
+ GetSystemTimeAsFileTime (&_now.ft); /* 100-nanoseconds since 1-1-1601 */
+ /* The actual accuracy on XP seems to be 125,000 nanoseconds = 125 microseconds = 0.125 milliseconds */
+ _now.ns100 -= FILETIME_1970; /* 100 nano-seconds since 1-1-1970 */
+ tp->tv_sec = _now.ns100 / HECTONANOSEC_PER_SEC; /* seconds since 1-1-1970 */
+ tp->tv_nsec = (long) (_now.ns100 % HECTONANOSEC_PER_SEC) * 100; /* nanoseconds */
+ }
+ return res;
+}
+
+int __cdecl gettimeofday (struct timeval *p, void *z)
+{
+ struct timespec tp;
+
+ if (getntptimeofday (&tp, (struct timezone *) z))
+ return -1;
+ p->tv_sec=tp.tv_sec;
+ p->tv_usec=(tp.tv_nsec/1000);
+ return 0;
+}
+
+int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z)
+{
+ struct timespec tp;
+
+ if (getntptimeofday (&tp, z))
+ return -1;
+ p->tv_sec=tp.tv_sec;
+ p->tv_usec=(tp.tv_nsec/1000);
+ return 0;
+}
+#endif
\ No newline at end of file
diff --git a/source/gettimeofday.h b/source/gettimeofday.h
new file mode 100644
index 0000000..7a15c49
--- /dev/null
+++ b/source/gettimeofday.h
@@ -0,0 +1,18 @@
+#if (defined(_WIN32) || defined(__WIN32__))
+ #include <time.h>
+ #include <sys/time.h>
+ #include <sys/timeb.h>
+ #include <errno.h>
+ #include <windows.h>
+
+ #define FILETIME_1970 116444736000000000ull /* seconds between 1/1/1601 and 1/1/1970 */
+ #define HECTONANOSEC_PER_SEC 10000000ull
+
+ int getntptimeofday (struct timespec *, struct timezone *);
+ int __cdecl gettimeofday (struct timeval *p, void *z);
+ int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
+
+#else
+ #include <sys/times.h>
+
+#endif
diff --git a/source/io_tester.c b/source/io_tester.c
index cb1b818..f8600e4 100644
--- a/source/io_tester.c
+++ b/source/io_tester.c
@@ -22,7 +22,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#define Msize1 100
diff --git a/source/jx.c b/source/jx.c
index 1bc80a6..038fd9e 100644
--- a/source/jx.c
+++ b/source/jx.c
@@ -18,7 +18,7 @@ Log of jx.c:
//#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
//#include <malloc/malloc.h>
//#include <assert.h>
diff --git a/source/jx_band_indiv.c b/source/jx_band_indiv.c
index c0679d1..572f7f9 100644
--- a/source/jx_band_indiv.c
+++ b/source/jx_band_indiv.c
@@ -8,7 +8,7 @@ Refer to arXiv:1907.08341 for details.
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <string.h>
diff --git a/source/jx_band_psum.c b/source/jx_band_psum.c
index 19016c7..78468df 100644
--- a/source/jx_band_psum.c
+++ b/source/jx_band_psum.c
@@ -8,7 +8,7 @@ Refer to arXiv:1907.08341 for details.
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <string.h>
diff --git a/source/jx_cluster.c b/source/jx_cluster.c
index b48dfb7..166b543 100644
--- a/source/jx_cluster.c
+++ b/source/jx_cluster.c
@@ -17,7 +17,7 @@ Log of jx.c:
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <string.h>
// #include <malloc/malloc.h>
diff --git a/source/jx_tools.c b/source/jx_tools.c
index 6c0d4da..d80e139 100644
--- a/source/jx_tools.c
+++ b/source/jx_tools.c
@@ -7,7 +7,7 @@ Useful functions and subroutines optimized for jx.
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <string.h>
//#include <malloc/malloc.h>
diff --git a/source/lapack_prototypes.h b/source/lapack_prototypes.h
index acd21f5..8e5f8e8 100644
--- a/source/lapack_prototypes.h
+++ b/source/lapack_prototypes.h
@@ -1,3 +1,5 @@
+#ifndef LAPACK_PROTOTYPE_H
+#define LAPACK_PROTOTYPE_H
#include "f77func.h"
#ifdef blaswrap
#define zgemm_ f2c_zgemm
@@ -26,11 +28,11 @@ void zhegv_(INTEGER *itype, char *jobz, char *uplo,
INTEGER *lwork, double *rwork, INTEGER *info);
int zgesvd_(char *jobu, char *jobvt, INTEGER *m, INTEGER *n,
- dcomplex *a, INTEGER *lda,
- double *s, dcomplex *u,
- INTEGER *ldu, dcomplex *vt,
- INTEGER *ldvt, dcomplex *work,
- INTEGER *lwork, double *rwork, INTEGER *info);
+ dcomplex *a, INTEGER *lda,
+ double *s, dcomplex *u,
+ INTEGER *ldu, dcomplex *vt,
+ INTEGER *ldvt, dcomplex *work,
+ INTEGER *lwork, double *rwork, INTEGER *info);
int dgesv_(INTEGER *n, INTEGER *nrhs, double *a, INTEGER *lda, INTEGER *ipiv, double *b,
INTEGER *ldb, INTEGER *info);
@@ -45,7 +47,7 @@ void dgesvd_(char *JOBU, char *JOBVT, INTEGER *M, INTEGER *N, double *A, INTEGER
void dsygv_(INTEGER *itype, char *jobz, char *uplo, INTEGER *n,
double *a, INTEGER *lda, double *b, INTEGER *ldb,
- double *w, double *work, INTEGER *lwork, INTEGER *info);
+ double *w, double *work, INTEGER *lwork, INTEGER *info);
void dsyevx_(char *JOBZ, char *RANGE, char *UPLO, INTEGER *N, double *A, INTEGER *LDA,
double *VL, double *VU,
@@ -80,12 +82,12 @@ int dstegr_(char *JOBZ , char *RANGE , INTEGER *N , double *D , double *E ,
);
int dsteqr_(char *compz, INTEGER *n, double *d__,
- double *e, double *z__, INTEGER *ldz, double *work, INTEGER *info);
+ double *e, double *z__, INTEGER *ldz, double *work, INTEGER *info);
int dgeev_(char *jobvl, char *jobvr, INTEGER *n, double *a, INTEGER *lda,
double *wr, double *wi, double *vl,
- INTEGER *ldvl, double *vr, INTEGER *ldvr, double *work,
- INTEGER *lwork, INTEGER *info);
+ INTEGER *ldvl, double *vr, INTEGER *ldvr, double *work,
+ INTEGER *lwork, INTEGER *info);
void zheev_(char *JOBZ, char *UPLO, INTEGER *N, dcomplex *A, INTEGER *LDA, double *W, dcomplex *WORK, INTEGER *LWORK,
double *RWORK, INTEGER *INFO);
@@ -102,8 +104,8 @@ void zheevx_(char *JOBZ, char *RANGE, char *UPLO, int *N, dcomplex *A, int *LDA,
int dgemm_(char *transa, char *transb, int *m, int *n, int *k,
double *alpha, double *a, int *lda,
- double *b, int *ldb, double *beta, double *c__,
- int *ldc);
+ double *b, int *ldb, double *beta, double *c__,
+ int *ldc);
void zgemm_(char* TRANSA, char* TRANSB, int * M, int * N,int *K, dcomplex *alpha,
dcomplex *A, int *LDA, dcomplex *B, int*LDB, dcomplex *beta, dcomplex *C, int *LDC);
@@ -112,27 +114,34 @@ void zgetri_(int *n,dcomplex *a,int *lda, int *ipvt, dcomplex *work, int *lwork,
int zcopy_(int *n, dcomplex *zx, int *incx, dcomplex *zy, int *incy);
void zgtsv_(INTEGER *n, INTEGER *nrhs, dcomplex *dl,
- dcomplex *d__, dcomplex *du, dcomplex *b, INTEGER *ldb,
- INTEGER *info);
+ dcomplex *d__, dcomplex *du, dcomplex *b, INTEGER *ldb,
+ INTEGER *info);
/* added by mari 08.12.2014 */
void zgesv_(INTEGER *n, INTEGER *nrhs, dcomplex *a, INTEGER *lda,
- INTEGER *ipiv, dcomplex *b, INTEGER *ldb, INTEGER *info);
+ INTEGER *ipiv, dcomplex *b, INTEGER *ldb, INTEGER *info);
void dpotrf_(char *uplo, INTEGER *n, double *a, INTEGER *lda, INTEGER *info);
void dpotri_(char *uplo, INTEGER *n, double *a, INTEGER *lda, INTEGER *info);
void dggevx_(char *balanc, char *jobvl, char *jobvr, char *sense,
INTEGER *n, double *a, INTEGER *lda, double *b,
- INTEGER *ldb, double *alphar, double *alphai, double *beta,
+ INTEGER *ldb, double *alphar, double *alphai, double *beta,
double *vl, INTEGER *ldvl, double *vr, INTEGER *ldvr,
- INTEGER *ilo, INTEGER *ihi, double *lscale, double *rscale,
- double *abnrm, double *bbnrm, double *rconde, double *rcondv,
+ INTEGER *ilo, INTEGER *ihi, double *lscale, double *rscale,
+ double *abnrm, double *bbnrm, double *rconde, double *rcondv,
double *work, INTEGER *lwork, INTEGER *iwork, logical *bwork,
INTEGER *info);
void dsytrd_(char *uplo, INTEGER *n, double *a, INTEGER *lda, double *d__, double *e,
double *tau, double *work, INTEGER *lwork, INTEGER *info);
+typedef logical (*SELECT_FUNC)(double, double);
+void dgeesx_(char *JOBVS, char *SORT, SELECT_FUNC SELECT, char *SENSE,
+ INTEGER *N, double *A, INTEGER *LDA, INTEGER *SDIM,
+ double *WR, double *WI, double *VS, INTEGER *LDVS,
+ double *RCONDE, double *RCONDV, double *WORK,
+ INTEGER *LWORK, INTEGER *IWORK, INTEGER *LIWORK, logical *BWORK,
+ int *INFO);
typedef enum {CblasRowMajor=101, CblasColMajor=102} CBLAS_ORDER;
typedef enum {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113} CBLAS_TRANSPOSE;
@@ -184,3 +193,6 @@ void DGEMM(const char *transa, const char *transb, const MKL_INT *m, const MKL_I
void dgemm(const char *transa, const char *transb, const MKL_INT *m, const MKL_INT *n, const MKL_INT *k,
const double *alpha, const double *a, const MKL_INT *lda, const double *b, const MKL_INT *ldb,
const double *beta, double *c, const MKL_INT *ldc);
+#endif
+
+
diff --git a/source/makefile b/source/makefile
index 5db4d67..3637d5e 100644
--- a/source/makefile
+++ b/source/makefile
@@ -5,10 +5,10 @@
# #
###################################################################
-MKLROOT = /opt/intel/mkl
-CC = mpicc -O3 -xHOST -ip -no-prec-div -qopenmp -I/opt/intel/mkl/include/fftw
-FC = mpif90 -O3 -xHOST -ip -no-prec-div -qopenmp
-LIB= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_openmpi_lp64 -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -liomp5 -lpthread -lm -ldl
+# MKLROOT = /opt/intel/mkl
+# CC = mpicc -O3 -xHOST -ip -no-prec-div -qopenmp -I/opt/intel/mkl/include/fftw
+# FC = mpif90 -O3 -xHOST -ip -no-prec-div -qopenmp
+# LIB= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_openmpi_lp64 -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -liomp5 -lpthread -lm -ldl
#
@@ -52,6 +52,11 @@ LIB= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_
# LIB = -L/opt/gnu/lib/ -lscalapack -lfftw3 -lflame -lblis -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lgfortran -lm
#
+# GNU GCC (Rev6, Built by MSYS2 project) 12.2.0 with MicrosoftMPI [Version 10.1.12498.18]
+CC = mpicc -O2 -Werror-implicit-function-declaration -Wno-alloc-size-larger-than -fcommon -Dkcomp -fopenmp
+FC = mpif90 -O2 -fcommon -Dkcomp -fopenmp -ID:\MSYS2\mingw64\include -Wno-missing-include-dirs
+LIB = -lscalapack -lfftw3 -lgfortran -lm -lopenblas
+
#
# FX100 at Nagoya Univ. (PRIMEHPC FX100, SPARC64b XIfx)
# before compilation do 'ulimit -v 33554432', and comment out elpa related objects
@@ -170,7 +175,8 @@ OBJS = openmx.o openmx_common.o Input_std.o Inputtools.o init.o LU_inverse.o
NBO_Cluster.o NBO_Krylov.o Population_Analysis_Wannier.o Population_Analysis_Wannier2.o \
NabraMatrixElements.o Set_dOrbitals_Grid.o Calc_optical.o \
Band_DFT_NonCol_Optical.o Cluster_DFT_Optical.o \
- Band_DFT_Col_Optical_ScaLAPACK.o Cluster_DFT_Optical_ScaLAPACK.o
+ Band_DFT_Col_Optical_ScaLAPACK.o Cluster_DFT_Optical_ScaLAPACK.o \
+ gettimeofday.o posix_menalign.o
# PROG = openmx.exe
# PROG = openmx
diff --git a/source/mpi_multi_world.c b/source/mpi_multi_world.c
index 0e9aa40..6b13160 100644
--- a/source/mpi_multi_world.c
+++ b/source/mpi_multi_world.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "mpi.h"
diff --git a/source/mpi_multi_world2.c b/source/mpi_multi_world2.c
index bfc5c3a..7c75d4e 100644
--- a/source/mpi_multi_world2.c
+++ b/source/mpi_multi_world2.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "mpi.h"
diff --git a/source/mpi_non_blocking.c b/source/mpi_non_blocking.c
index 0affb07..f1c31e3 100644
--- a/source/mpi_non_blocking.c
+++ b/source/mpi_non_blocking.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include "mpi.h"
diff --git a/source/openmx_common.h b/source/openmx_common.h
index 54544a3..b331619 100644
--- a/source/openmx_common.h
+++ b/source/openmx_common.h
@@ -56,7 +56,7 @@ static char Version_OpenMX[30] = "3.9.9"; /* version of OpenMX */
#define FineGL_Mesh 1500 /* # of grids in fine Gauss-Legendre quadrature */
#define Threshold_OLP_Eigen 1.0e-9 /* threshold for cutting off eigenvalues of OLP */
-#define fp_bsize 2097152 /* buffer size for setvbuf */
+#define fp_bsize 131072 /* buffer size for setvbuf /16 */
#define Shift_K_Point 1.0e-6 /* disturbance for stabilization of eigenvalue routine */
#define LAPACK_ABSTOL 6.0e-15 /* absolute error tolerance for lapack routines */
@@ -4512,3 +4512,4 @@ double Cluster_DFT_Optical_ScaLAPACK(
/* YTL-end */
+
diff --git a/source/polB.c b/source/polB.c
index d9a5054..9937601 100644
--- a/source/polB.c
+++ b/source/polB.c
@@ -18,7 +18,7 @@
#include <math.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include "read_scfout.h"
#include "lapack_prototypes.h"
diff --git a/source/posix_menalign.c b/source/posix_menalign.c
new file mode 100644
index 0000000..69ad153
--- /dev/null
+++ b/source/posix_menalign.c
@@ -0,0 +1,30 @@
+#if (defined(_WIN32) || defined(__WIN32__))
+#include<malloc.h>
+#include<stddef.h>
+#include<errno.h>
+static int check_align(size_t align)
+{
+ for (size_t i = sizeof(void *); i != 0; i *= 2)
+ if (align == i)
+ return 0;
+ return EINVAL;
+}
+
+int posix_memalign(void **ptr, size_t align, size_t size)
+{
+ if (check_align(align))
+ return EINVAL;
+
+ int saved_errno = errno;
+ void *p = _aligned_malloc(size, align);
+ if (p == NULL)
+ {
+ errno = saved_errno;
+ return ENOMEM;
+ }
+
+ *ptr = p;
+ return 0;
+}
+#endif
+
diff --git a/source/scalapack.h b/source/scalapack.h
new file mode 100644
index 0000000..d29e73f
--- /dev/null
+++ b/source/scalapack.h
@@ -0,0 +1,51 @@
+#ifndef SCALAPACK_H
+#define SCALAPACK_H
+
+#include "lapack_prototypes.h"
+#ifndef ___dcomplex_definition___
+ typedef struct { double r,i; } dcomplex;
+#define ___dcomplex_definition___
+#endif
+
+/*
+#ifndef ___fcomplex_definition___
+ typedef struct { float r,i; } fcomplex;
+#define ___fcomplex_definition___
+#endif
+*/
+
+// extern "C" {
+ void Cblacs_pinfo( int* mypnum, int* nprocs);
+ void Cblacs_get(int context, int request, int* value);
+ int Cblacs_gridinit( int* context, char * order, int np_row, int np_col);
+ void Cblacs_gridinfo( int context, int* np_row, int* np_col, int* my_row, int* my_col);
+ void Cblacs_gridexit( int context);
+ void Cblacs_exit( int error_code);
+ void Cblacs_gridmap( int* context, int* map, int ld_usermap, int np_row, int np_col);
+ int Csys2blacs_handle (int MPI_Comm);
+ void Cfree_blacs_system_handle(int handle);
+ void Cblacs_barrier(int, char*);
+
+ int npreroc_(int *n, int *nb, int *iproc, int *isrcproc, int *nprocs);
+ int numroc_(int *n, int *nb, int *iproc, int *isrcproc, int *nprocs);
+
+ void descinit_(int *idescal, int *m, int *n, int *mb, int *nb, int *dummy1 , int *dummy2 , int *icon, int *procRows, int *info);
+
+ void pdgemm_( char* TRANSA, char* TRANSB, int * M, int * N, int * K, double * ALPHA,
+ double * A, int * IA, int * JA, int * DESCA,
+ double * B, int * IB, int * JB, int * DESCB,
+ double * BETA, double * C, int * IC, int * JC, int * DESCC );
+ void pzgemm_( char* TRANSA, char* TRANSB,int * M, int * N, int * K,
+ dcomplex * ALPHA, dcomplex * A, int * IA, int * JA, int * DESCA,
+ dcomplex * B, int * IB, int * JB, int * DESCB,
+ dcomplex * BETA, dcomplex * C, int * IC, int * JC, int * DESCC );
+ void psgesvd_(char *jobu, char *jobvt, int *m, int *n, float *a, int *ia, int *ja, int *desca, float *s, float *u, int *iu, int *ju, int *descu, float *vt, int *ivt, int *jvt, int *descvt, float *work, int *lwork, int *info);
+ void pdgesvd_(char *jobu, char *jobvt, int *m, int *n, double *a, int *ia, int *ja, int *desca, double *s, double *u, int *iu, int *ju, int *descu, double *vt, int *ivt, int *jvt, int *descvt, double *work, int *lwork, int *info);
+ // void pcgesvd_(char *jobu, char *jobvt, int *m, int *n, fcomplex *a, int *ia, int *ja, int *desca, float *s, fcomplex *u, int *iu, int *ju, int *descu, fcomplex *vt, int *ivt, int *jvt, int *descvt, fcomplex *work, int *lwork, float *rwork, int *info);
+ void pzgesvd_(char *jobu, char *jobvt, int *m, int *n, dcomplex *a, int *ia, int *ja, int *desca, double *s, dcomplex *u, int *iu, int *ju, int *descu, dcomplex *vt, int *ivt, int *jvt, int *descvt, dcomplex *work, int *lwork, double *rwork, int *info);
+//}
+void solve_evp_real_(int*, int*, double*, int*, double*, double*, int*, int*, int*, int*);
+void solve_evp_complex_(int*, int*, dcomplex*, int*, double*, dcomplex*, int*, int*, int*, int*);
+
+#endif
+
diff --git a/source/test_mpi2.c b/source/test_mpi2.c
index 6ff9f52..aa6391d 100644
--- a/source/test_mpi2.c
+++ b/source/test_mpi2.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include "mpi.h"
#include "openmx_common.h"
diff --git a/source/test_mpi3.c b/source/test_mpi3.c
index 554bb47..59e99a4 100644
--- a/source/test_mpi3.c
+++ b/source/test_mpi3.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include "mpi.h"
#include "openmx_common.h"
diff --git a/source/test_mpi4.c b/source/test_mpi4.c
index 91e0c3f..edb74ea 100644
--- a/source/test_mpi4.c
+++ b/source/test_mpi4.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include "mpi.h"
#include "openmx_common.h"
diff --git a/source/test_openmp.c b/source/test_openmp.c
index a35650b..83f15f9 100644
--- a/source/test_openmp.c
+++ b/source/test_openmp.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <omp.h>
diff --git a/source/test_openmp2.c b/source/test_openmp2.c
index 2a81d3c..527a760 100644
--- a/source/test_openmp2.c
+++ b/source/test_openmp2.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <omp.h>
diff --git a/source/test_openmp3.c b/source/test_openmp3.c
index 8bed46f..d601f4c 100644
--- a/source/test_openmp3.c
+++ b/source/test_openmp3.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
-#include <sys/times.h>
+#include "gettimeofday.h"
#include <sys/time.h>
#include <omp.h>
diff --git a/source/win32_port.h b/source/win32_port.h
new file mode 100644
index 0000000..5ffe8f6
--- /dev/null
+++ b/source/win32_port.h
@@ -0,0 +1,7 @@
+#if (defined(_WIN32) || defined(__WIN32__))
+#include<io.h>
+#define fsync(A) _commit(A)
+#define mkdir(A, B) mkdir(A)
+int posix_memalign(void **ptr, size_t align, size_t size);
+#endif
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment