aboutsummaryrefslogtreecommitdiffstats
path: root/science
diff options
context:
space:
mode:
authoryuri <yuri@FreeBSD.org>2018-09-12 11:00:46 +0800
committeryuri <yuri@FreeBSD.org>2018-09-12 11:00:46 +0800
commitc21d76352657e2c82d44416a2caa4f8571d15573 (patch)
tree8acd51d47f4e5d868b22bf163958c2f660e00b56 /science
parente1c4a9f7f1d1b131789393e6c64909ccd766e15a (diff)
downloadfreebsd-ports-gnome-c21d76352657e2c82d44416a2caa4f8571d15573.tar.gz
freebsd-ports-gnome-c21d76352657e2c82d44416a2caa4f8571d15573.tar.zst
freebsd-ports-gnome-c21d76352657e2c82d44416a2caa4f8571d15573.zip
New port: science/openmx: Nanoscale material simulations using density functional theories (DFT)
Diffstat (limited to 'science')
-rw-r--r--science/Makefile1
-rw-r--r--science/openmx/Makefile69
-rw-r--r--science/openmx/distinfo5
-rw-r--r--science/openmx/files/patch-Band__DFT__Col.c15
-rw-r--r--science/openmx/files/patch-Band__DFT__NonCol.c15
-rw-r--r--science/openmx/files/patch-Cluster__DFT.c46
-rw-r--r--science/openmx/files/patch-Cluster__DFT__ON2.c23
-rw-r--r--science/openmx/files/patch-Input__std.c11
-rw-r--r--science/openmx/files/patch-Mixing__H.c218
-rw-r--r--science/openmx/files/patch-Poisson.c84
-rw-r--r--science/openmx/files/patch-Poisson__ESM.c24
-rw-r--r--science/openmx/files/patch-bandgnu13.c11
-rw-r--r--science/openmx/files/patch-makefile43
-rw-r--r--science/openmx/files/patch-tran__variables.h10
-rw-r--r--science/openmx/pkg-descr24
15 files changed, 599 insertions, 0 deletions
diff --git a/science/Makefile b/science/Makefile
index 102845ab9f0f..3c546a262682 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -149,6 +149,7 @@
SUBDIR += octopus
SUBDIR += openbabel
SUBDIR += openkim
+ SUBDIR += openmx
SUBDIR += openstructure
SUBDIR += p5-Algorithm-SVMLight
SUBDIR += p5-Chemistry-3DBuilder
diff --git a/science/openmx/Makefile b/science/openmx/Makefile
new file mode 100644
index 000000000000..b49baab53dd1
--- /dev/null
+++ b/science/openmx/Makefile
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+PORTNAME= openmx
+DISTVERSION= 3.8.5 # the 18June12 patch upgrades 3.8 -> 3.8.5
+CATEGORIES= science
+MASTER_SITES= http://www.openmx-square.org/ \
+ http://www.openmx-square.org/bugfixed/18June12/:patch
+DISTFILES= ${PORTNAME}${DISTVERSION:R}${EXTRACT_SUFX} \
+ patch${DISTVERSION}${EXTRACT_SUFX}:patch # this patch isn't a patch, but a set of file updates
+DIST_SUBDIR= ${PORTNAME}
+EXTRACT_ONLY= ${PORTNAME}${DISTVERSION:R}${EXTRACT_SUFX}
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Nanoscale material simulations using density functional theories (DFT)
+
+LICENSE= GPLv2
+
+LIB_DEPENDS= libblas.so:math/blas \
+ libfftw3.so:math/fftw3 \
+ liblapack.so:math/lapack \
+ libmpich.so:net/mpich2 \
+ libomp.so:devel/openmp
+
+USES= dos2unix fortran gmake localbase:ldflags
+DOS2UNIX_FILES= openmx_common.h
+USE_CXXSTD= c++11
+MAKEFILE= makefile
+
+WRKSRC= ${WRKDIR}/${PORTNAME}${DISTVERSION:R}
+
+CFLAGS+= -Dkcomp
+LDFLAGS+= ${LOCALBASE}/lib/gcc${GCC_DEFAULT}/libgcc_s.so
+
+WRKSRC_SUBDIR= source
+
+MAKE_ENV= MPICH_CC=${CC}
+MAKE_ARGS+= CFLAGS="${CFLAGS}" FFLAGS="${FFLAGS}" LDFLAGS="${LDFLAGS}" GCC_LIB=${LOCALBASE}/lib/gcc${GCC_DEFAULT}/libgfortran.so
+
+BINARY_ALIAS= gcc=${CXX} gcc7=${CXX}
+
+UTIL_PROGS= DosMain jx analysis_example esp polB bandgnu13 bin2txt cube2xsf intensity_map md2axsf
+
+PLIST_FILES= bin/${PORTNAME} ${UTIL_PROGS:C/^/bin\//}
+
+OPTIONS_DEFINE_amd64= SIMD
+OPTIONS_DEFINE_i386= SIMD
+OPTIONS_DEFAULT_amd64= SIMD
+OPTIONS_DEFAULT_i386= SIMD
+
+SIMD_CFLAGS= -msse -msse2 -mfpmath=sse
+SIMD_CFLAGS_OFF= -Dnosse
+CFLAGS+= ${ARCH:S/amd64//:S/i386//:S/${ARCH}/-Dnosse/}
+
+pre-patch: # overlay files before patching
+ @cd ${WRKSRC} && ${TAR} xzf ${DISTDIR}/${DIST_SUBDIR}/patch${DISTVERSION}${EXTRACT_SUFX}
+
+post-patch:
+ @cd ${WRKSRC} && ${REINPLACE_CMD} 's|DFT_DATA_PATH|"${DATADIR}/DFT_DATA13"|' Input_std.c check_lead.c SetPara_DFT.c OutData.c OutData_Binary.c
+
+post-install:
+.for u in ${UTIL_PROGS}
+ ${INSTALL_PROGRAM} ${WRKSRC}/${u} ${STAGEDIR}${PREFIX}/bin
+.endfor
+ cd ${WRKSRC}/.. && ${COPYTREE_SHARE} DFT_DATA13 ${STAGEDIR}${DATADIR}
+ # autoplist for potentials: about 500 files in DATADIR
+ @cd ${STAGEDIR}${PREFIX} && \
+ ${FIND} ${DATADIR:S/^${PREFIX}\///} -type f >> ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/science/openmx/distinfo b/science/openmx/distinfo
new file mode 100644
index 000000000000..9794f107d104
--- /dev/null
+++ b/science/openmx/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1536713126
+SHA256 (openmx/openmx3.8.tar.gz) = 36ee10d8b1587b25a2ca1d57f110111be65c4fb4dc820e6d93e1ed2b562634a1
+SIZE (openmx/openmx3.8.tar.gz) = 143086177
+SHA256 (openmx/patch3.8.5.tar.gz) = d0fea2ce956d796a87a4bc9e9d580fb115ff2a22764650fffa78bb79a1b30468
+SIZE (openmx/patch3.8.5.tar.gz) = 316333
diff --git a/science/openmx/files/patch-Band__DFT__Col.c b/science/openmx/files/patch-Band__DFT__Col.c
new file mode 100644
index 000000000000..a22e95c8e542
--- /dev/null
+++ b/science/openmx/files/patch-Band__DFT__Col.c
@@ -0,0 +1,15 @@
+--- Band_DFT_Col.c.orig 2018-08-29 06:24:38 UTC
++++ Band_DFT_Col.c
+@@ -483,9 +483,9 @@ double Band_DFT_Col(int SCF_iter,
+
+ /* allocation */
+
+- stat_send = malloc(sizeof(MPI_Status)*numprocs2);
+- request_send = malloc(sizeof(MPI_Request)*numprocs2);
+- request_recv = malloc(sizeof(MPI_Request)*numprocs2);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*numprocs2);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs2);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs2);
+
+ is1 = (int*)malloc(sizeof(int)*numprocs2);
+ ie1 = (int*)malloc(sizeof(int)*numprocs2);
diff --git a/science/openmx/files/patch-Band__DFT__NonCol.c b/science/openmx/files/patch-Band__DFT__NonCol.c
new file mode 100644
index 000000000000..dfbcc2493215
--- /dev/null
+++ b/science/openmx/files/patch-Band__DFT__NonCol.c
@@ -0,0 +1,15 @@
+--- Band_DFT_NonCol.c.orig 2018-08-29 06:26:10 UTC
++++ Band_DFT_NonCol.c
+@@ -554,9 +554,9 @@ double Band_DFT_NonCol(int SCF_iter,
+
+ /* allocation */
+
+- stat_send = malloc(sizeof(MPI_Status)*numprocs1);
+- request_send = malloc(sizeof(MPI_Request)*numprocs1);
+- request_recv = malloc(sizeof(MPI_Request)*numprocs1);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*numprocs1);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs1);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs1);
+
+ is1 = (int*)malloc(sizeof(int)*numprocs1);
+ ie1 = (int*)malloc(sizeof(int)*numprocs1);
diff --git a/science/openmx/files/patch-Cluster__DFT.c b/science/openmx/files/patch-Cluster__DFT.c
new file mode 100644
index 000000000000..cbf76c632080
--- /dev/null
+++ b/science/openmx/files/patch-Cluster__DFT.c
@@ -0,0 +1,46 @@
+--- Cluster_DFT.c.orig 2018-08-29 06:05:22 UTC
++++ Cluster_DFT.c
+@@ -194,9 +194,9 @@ static double Cluster_collinear(
+
+ Num_Comm_World1 = SpinP_switch + 1;
+
+- stat_send = malloc(sizeof(MPI_Status)*numprocs0);
+- request_send = malloc(sizeof(MPI_Request)*numprocs0);
+- request_recv = malloc(sizeof(MPI_Request)*numprocs0);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*numprocs0);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs0);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs0);
+
+ /***********************************************
+ allocation of arrays for the first world
+@@ -1541,9 +1541,9 @@ static double Cluster_non_collinear(
+
+ /* allocation of arrays */
+
+- stat_send = malloc(sizeof(MPI_Status)*numprocs);
+- request_send = malloc(sizeof(MPI_Request)*numprocs);
+- request_recv = malloc(sizeof(MPI_Request)*numprocs);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*numprocs);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs);
+
+ /****************************************************
+ calculation of the array size
+@@ -2649,7 +2649,7 @@ void Save_DOS_Col(int n, int MaxN, int *
+ MPI_Comm_size(mpi_comm_level1,&numprocs);
+ MPI_Comm_rank(mpi_comm_level1,&myid);
+
+- request_recv = malloc(sizeof(MPI_Request)*numprocs);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs);
+
+ /* open file pointers */
+
+@@ -2901,7 +2901,7 @@ void Save_DOS_NonCol(int n, int MaxN, in
+ MPI_Comm_size(mpi_comm_level1,&numprocs);
+ MPI_Comm_rank(mpi_comm_level1,&myid);
+
+- request_recv = malloc(sizeof(MPI_Request)*numprocs);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs);
+
+ /* open file pointers */
+
diff --git a/science/openmx/files/patch-Cluster__DFT__ON2.c b/science/openmx/files/patch-Cluster__DFT__ON2.c
new file mode 100644
index 000000000000..8c9a7660b1f4
--- /dev/null
+++ b/science/openmx/files/patch-Cluster__DFT__ON2.c
@@ -0,0 +1,23 @@
+--- Cluster_DFT_ON2.c.orig 2016-03-27 06:53:28 UTC
++++ Cluster_DFT_ON2.c
+@@ -10,6 +10,7 @@
+
+ ***********************************************************************/
+
++#include <complex.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -1275,9 +1276,9 @@ static void OND_Solver(
+ MPI_Request *request_send;
+ MPI_Request *request_recv;
+
+- stat_send = malloc(sizeof(MPI_Status)*numprocs2);
+- request_send = malloc(sizeof(MPI_Request)*numprocs2);
+- request_recv = malloc(sizeof(MPI_Request)*numprocs2);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*numprocs2);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs2);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*numprocs2);
+
+ al.r = 1.0;
+ al.i = 0.0;
diff --git a/science/openmx/files/patch-Input__std.c b/science/openmx/files/patch-Input__std.c
new file mode 100644
index 000000000000..d8e1325a911b
--- /dev/null
+++ b/science/openmx/files/patch-Input__std.c
@@ -0,0 +1,11 @@
+--- Input_std.c.orig 2018-09-12 02:18:32 UTC
++++ Input_std.c
+@@ -85,7 +85,7 @@ void Input_std(char *file)
+
+ input_string("System.CurrrentDirectory",filepath,"./");
+ input_string("System.Name",filename,"default");
+- input_string("DATA.PATH",DFT_DATA_PATH,"../DFT_DATA13");
++ //input_string("DATA.PATH",DFT_DATA_PATH,"../DFT_DATA13");
+ input_int("level.of.stdout", &level_stdout,1);
+ input_int("level.of.fileout",&level_fileout,1);
+ input_logical("memory.usage.fileout",&memoryusage_fileout,0); /* default=off */
diff --git a/science/openmx/files/patch-Mixing__H.c b/science/openmx/files/patch-Mixing__H.c
new file mode 100644
index 000000000000..ff3e86664dae
--- /dev/null
+++ b/science/openmx/files/patch-Mixing__H.c
@@ -0,0 +1,218 @@
+--- Mixing_H.c.orig 2018-08-29 05:53:55 UTC
++++ Mixing_H.c
+@@ -74,7 +74,7 @@ void Pulay_Mixing_H_MultiSecant(int MD_i
+ double sum,my_sum,tmp1,tmp2,alpha;
+ double r,r10,r11,r12,r13,r20,r21,r22;
+ double h,h10,h11,h12,h13,h20,h21,h22;
+- double my_sy,my_yy,sy,yy,norm,s,y,or,al,be;
++ double my_sy,my_yy,sy,yy,norm,s,y,orx,al,be;
+ double **A,**IA,*coes,*coes2,*ror;
+ char nanchar[300];
+
+@@ -635,44 +635,44 @@ void Pulay_Mixing_H_MultiSecant(int MD_i
+ s = HisH1[m][0][Mc_AN][h_AN][i][j] - HisH1[m+1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[m][0][Mc_AN][h_AN][i][j] - ResidualH1[m+1][0][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH1[dim+1][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH1[dim+1][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH1[m][1][Mc_AN][h_AN][i][j] - HisH1[m+1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[m][1][Mc_AN][h_AN][i][j] - ResidualH1[m+1][1][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH1[dim+1][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH1[dim+1][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH1[m][2][Mc_AN][h_AN][i][j] - HisH1[m+1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[m][2][Mc_AN][h_AN][i][j] - ResidualH1[m+1][2][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH1[dim+1][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH1[dim+1][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH1[m][3][Mc_AN][h_AN][i][j] - HisH1[m+1][3][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[m][3][Mc_AN][h_AN][i][j] - ResidualH1[m+1][3][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH1[dim+1][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH1[dim+1][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH2[m][0][Mc_AN][h_AN][i][j] - HisH2[m+1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[m][0][Mc_AN][h_AN][i][j] - ResidualH2[m+1][0][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH2[dim+1][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH2[dim+1][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH2[m][1][Mc_AN][h_AN][i][j] - HisH2[m+1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[m][1][Mc_AN][h_AN][i][j] - ResidualH2[m+1][1][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH2[dim+1][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH2[dim+1][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ s = HisH2[m][2][Mc_AN][h_AN][i][j] - HisH2[m+1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[m][2][Mc_AN][h_AN][i][j] - ResidualH2[m+1][2][Mc_AN][h_AN][i][j]; /* y */
+ r = s - al*y; /* r */
+- or = ResidualH2[dim+1][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += r*or;
++ orx = ResidualH2[dim+1][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += r*orx;
+
+ }
+ }
+@@ -696,8 +696,8 @@ void Pulay_Mixing_H_MultiSecant(int MD_i
+ s = HisH1[m][spin][Mc_AN][h_AN][i][j] - HisH1[m+1][spin][Mc_AN][h_AN][i][j];
+ y = ResidualH1[m][spin][Mc_AN][h_AN][i][j] - ResidualH1[m+1][spin][Mc_AN][h_AN][i][j];
+ r = s - al*y;
+- or = ResidualH1[dim+1][spin][Mc_AN][h_AN][i][j];
+- my_sum += r*or;
++ orx = ResidualH1[dim+1][spin][Mc_AN][h_AN][i][j];
++ my_sum += r*orx;
+ }
+ }
+ }
+@@ -986,7 +986,7 @@ void Pulay_Mixing_H_with_One_Shot_Hessia
+ double my_sum,tmp1,tmp2,alpha;
+ double r,r10,r11,r12,r13,r20,r21,r22;
+ double h,h10,h11,h12,h13,h20,h21,h22;
+- double my_sy,my_yy,sy,yy,norm,s,y,or,al,be;
++ double my_sy,my_yy,sy,yy,norm,s,y,orx,al,be;
+ double **A,**IA,*coes;
+ char nanchar[300];
+
+@@ -1427,38 +1427,38 @@ void Pulay_Mixing_H_with_One_Shot_Hessia
+
+ s = HisH1[0][0][Mc_AN][h_AN][i][j] - HisH1[1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][0][Mc_AN][h_AN][i][j] - ResidualH1[1][0][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH1[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH1[0][1][Mc_AN][h_AN][i][j] - HisH1[1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][1][Mc_AN][h_AN][i][j] - ResidualH1[1][1][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH1[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH1[0][2][Mc_AN][h_AN][i][j] - HisH1[1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][2][Mc_AN][h_AN][i][j] - ResidualH1[1][2][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH1[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH1[0][3][Mc_AN][h_AN][i][j] - HisH1[1][3][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][3][Mc_AN][h_AN][i][j] - ResidualH1[1][3][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH1[dim][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH2[0][0][Mc_AN][h_AN][i][j] - HisH2[1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][0][Mc_AN][h_AN][i][j] - ResidualH2[1][0][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH2[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH2[0][1][Mc_AN][h_AN][i][j] - HisH2[1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][1][Mc_AN][h_AN][i][j] - ResidualH2[1][1][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH2[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+
+ s = HisH2[0][2][Mc_AN][h_AN][i][j] - HisH2[1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][2][Mc_AN][h_AN][i][j] - ResidualH2[1][2][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH2[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+ }
+ }
+ }
+@@ -1479,8 +1479,8 @@ void Pulay_Mixing_H_with_One_Shot_Hessia
+ for (j=0; j<Spe_Total_NO[Hwan]; j++){
+ s = HisH1[0][spin][Mc_AN][h_AN][i][j] - HisH1[1][spin][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][spin][Mc_AN][h_AN][i][j] - ResidualH1[1][spin][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][spin][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- my_sum += (s-al*y)*or;
++ orx = ResidualH1[dim][spin][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ my_sum += (s-al*y)*orx;
+ }
+ }
+ }
+@@ -1541,38 +1541,38 @@ void Pulay_Mixing_H_with_One_Shot_Hessia
+
+ s = HisH1[0][0][Mc_AN][h_AN][i][j] - HisH1[1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][0][Mc_AN][h_AN][i][j] - ResidualH1[1][0][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- H[0][Mc_AN][h_AN][i][j] = h10 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH1[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ H[0][Mc_AN][h_AN][i][j] = h10 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH1[0][1][Mc_AN][h_AN][i][j] - HisH1[1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][1][Mc_AN][h_AN][i][j] - ResidualH1[1][1][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- H[1][Mc_AN][h_AN][i][j] = h11 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH1[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ H[1][Mc_AN][h_AN][i][j] = h11 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH1[0][2][Mc_AN][h_AN][i][j] - HisH1[1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][2][Mc_AN][h_AN][i][j] - ResidualH1[1][2][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- H[2][Mc_AN][h_AN][i][j] = h12 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH1[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ H[2][Mc_AN][h_AN][i][j] = h12 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH1[0][3][Mc_AN][h_AN][i][j] - HisH1[1][3][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][3][Mc_AN][h_AN][i][j] - ResidualH1[1][3][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- H[3][Mc_AN][h_AN][i][j] = h13 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH1[dim][3][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ H[3][Mc_AN][h_AN][i][j] = h13 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH2[0][0][Mc_AN][h_AN][i][j] - HisH2[1][0][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][0][Mc_AN][h_AN][i][j] - ResidualH2[1][0][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- iHNL[0][Mc_AN][h_AN][i][j] = h20 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH2[dim][0][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ iHNL[0][Mc_AN][h_AN][i][j] = h20 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH2[0][1][Mc_AN][h_AN][i][j] - HisH2[1][1][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][1][Mc_AN][h_AN][i][j] - ResidualH2[1][1][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- iHNL[1][Mc_AN][h_AN][i][j] = h21 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH2[dim][1][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ iHNL[1][Mc_AN][h_AN][i][j] = h21 - alpha*(al*orx + (s-al*y)*be);
+
+ s = HisH2[0][2][Mc_AN][h_AN][i][j] - HisH2[1][2][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH2[0][2][Mc_AN][h_AN][i][j] - ResidualH2[1][2][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH2[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- iHNL[2][Mc_AN][h_AN][i][j] = h22 - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH2[dim][2][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ iHNL[2][Mc_AN][h_AN][i][j] = h22 - alpha*(al*orx + (s-al*y)*be);
+ }
+ }
+ }
+@@ -1599,8 +1599,8 @@ void Pulay_Mixing_H_with_One_Shot_Hessia
+
+ s = HisH1[0][spin][Mc_AN][h_AN][i][j] - HisH1[1][spin][Mc_AN][h_AN][i][j]; /* s */
+ y = ResidualH1[0][spin][Mc_AN][h_AN][i][j] - ResidualH1[1][spin][Mc_AN][h_AN][i][j]; /* y */
+- or = ResidualH1[dim][spin][Mc_AN][h_AN][i][j]; /* OptResidualH */
+- H[spin][Mc_AN][h_AN][i][j] = h - alpha*(al*or + (s-al*y)*be);
++ orx = ResidualH1[dim][spin][Mc_AN][h_AN][i][j]; /* OptResidualH */
++ H[spin][Mc_AN][h_AN][i][j] = h - alpha*(al*orx + (s-al*y)*be);
+
+ }
+ }
diff --git a/science/openmx/files/patch-Poisson.c b/science/openmx/files/patch-Poisson.c
new file mode 100644
index 000000000000..6705c1abff28
--- /dev/null
+++ b/science/openmx/files/patch-Poisson.c
@@ -0,0 +1,84 @@
+--- Poisson.c.orig 2018-08-29 05:58:06 UTC
++++ Poisson.c
+@@ -141,8 +141,8 @@ void FFT_Poisson(double *ReRhor, double
+ allocation of arrays:
+ ****************************************************/
+
+- in = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+- out = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ in = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+
+ /*------------------ FFT along the C-axis in the AB partition ------------------*/
+
+@@ -182,10 +182,10 @@ void FFT_Poisson(double *ReRhor, double
+ array0 = (double*)malloc(sizeof(double)*2*GP_B_AB2CA_S[NN_B_AB2CA_S]);
+ array1 = (double*)malloc(sizeof(double)*2*GP_B_AB2CA_R[NN_B_AB2CA_R]);
+
+- request_send = malloc(sizeof(MPI_Request)*NN_B_AB2CA_S);
+- request_recv = malloc(sizeof(MPI_Request)*NN_B_AB2CA_R);
+- stat_send = malloc(sizeof(MPI_Status)*NN_B_AB2CA_S);
+- stat_recv = malloc(sizeof(MPI_Status)*NN_B_AB2CA_R);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_AB2CA_S);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_AB2CA_R);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_AB2CA_S);
++ stat_recv = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_AB2CA_R);
+
+ NN_S = 0;
+ NN_R = 0;
+@@ -307,10 +307,10 @@ void FFT_Poisson(double *ReRhor, double
+ array0 = (double*)malloc(sizeof(double)*2*GP_B_CA2CB_S[NN_B_CA2CB_S]);
+ array1 = (double*)malloc(sizeof(double)*2*GP_B_CA2CB_R[NN_B_CA2CB_R]);
+
+- request_send = malloc(sizeof(MPI_Request)*NN_B_CA2CB_S);
+- request_recv = malloc(sizeof(MPI_Request)*NN_B_CA2CB_R);
+- stat_send = malloc(sizeof(MPI_Status)*NN_B_CA2CB_S);
+- stat_recv = malloc(sizeof(MPI_Status)*NN_B_CA2CB_R);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_CA2CB_S);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_CA2CB_R);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_CA2CB_S);
++ stat_recv = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_CA2CB_R);
+
+ NN_S = 0;
+ NN_R = 0;
+@@ -503,8 +503,8 @@ void Inverse_FFT_Poisson(double *ReRhor,
+ fftw_complex out[List_YOUSO[17]];
+ ****************************************************/
+
+- in = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+- out = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ in = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+
+ /*------------------ Inverse FFT along the A-axis in the CB partition ------------------*/
+
+@@ -544,10 +544,10 @@ void Inverse_FFT_Poisson(double *ReRhor,
+ array0 = (double*)malloc(sizeof(double)*2*GP_B_CA2CB_R[NN_B_CA2CB_R]);
+ array1 = (double*)malloc(sizeof(double)*2*GP_B_CA2CB_S[NN_B_CA2CB_S]);
+
+- request_send = malloc(sizeof(MPI_Request)*NN_B_CA2CB_R);
+- request_recv = malloc(sizeof(MPI_Request)*NN_B_CA2CB_S);
+- stat_send = malloc(sizeof(MPI_Status)*NN_B_CA2CB_R);
+- stat_recv = malloc(sizeof(MPI_Status)*NN_B_CA2CB_S);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_CA2CB_R);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_CA2CB_S);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_CA2CB_R);
++ stat_recv = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_CA2CB_S);
+
+ NN_S = 0;
+ NN_R = 0;
+@@ -669,10 +669,10 @@ void Inverse_FFT_Poisson(double *ReRhor,
+ array0 = (double*)malloc(sizeof(double)*2*GP_B_AB2CA_R[NN_B_AB2CA_R]);
+ array1 = (double*)malloc(sizeof(double)*2*GP_B_AB2CA_S[NN_B_AB2CA_S]);
+
+- request_send = malloc(sizeof(MPI_Request)*NN_B_AB2CA_R);
+- request_recv = malloc(sizeof(MPI_Request)*NN_B_AB2CA_S);
+- stat_send = malloc(sizeof(MPI_Status)*NN_B_AB2CA_R);
+- stat_recv = malloc(sizeof(MPI_Status)*NN_B_AB2CA_S);
++ request_send = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_AB2CA_R);
++ request_recv = (MPI_Request *)malloc(sizeof(MPI_Request)*NN_B_AB2CA_S);
++ stat_send = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_AB2CA_R);
++ stat_recv = (MPI_Status *)malloc(sizeof(MPI_Status)*NN_B_AB2CA_S);
+
+ NN_S = 0;
+ NN_R = 0;
diff --git a/science/openmx/files/patch-Poisson__ESM.c b/science/openmx/files/patch-Poisson__ESM.c
new file mode 100644
index 000000000000..19224a759e79
--- /dev/null
+++ b/science/openmx/files/patch-Poisson__ESM.c
@@ -0,0 +1,24 @@
+--- Poisson_ESM.c.orig 2018-08-29 06:03:16 UTC
++++ Poisson_ESM.c
+@@ -71,8 +71,8 @@ double Poisson_ESM(int fft_charge_flag,
+ fftw_complex out[List_YOUSO[17]];
+ ****************************************************/
+
+- in0 = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+- out0 = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ in0 = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ out0 = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+
+
+ if (myid==Host_ID) {
+@@ -908,8 +908,8 @@ void One_dim_FFT(FILE *fp,
+ fftw_complex out[List_YOUSO[17]];
+ ****************************************************/
+
+- in = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+- out = fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ in = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
++ out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*List_YOUSO[17]);
+
+ p = fftw_plan_dft_1d(Ngrid1, in, out, sgn2, FFTW_ESTIMATE);
+
diff --git a/science/openmx/files/patch-bandgnu13.c b/science/openmx/files/patch-bandgnu13.c
new file mode 100644
index 000000000000..3c6172bc62e6
--- /dev/null
+++ b/science/openmx/files/patch-bandgnu13.c
@@ -0,0 +1,11 @@
+--- bandgnu13.c.orig 2018-09-11 19:33:10 UTC
++++ bandgnu13.c
+@@ -75,7 +75,7 @@ void vk_rtv(double vk[4], double rtv[4][
+
+ #define MUNIT 2
+
+-main(int argc, char **argv)
++int main(int argc, char **argv)
+ {
+ static double Unit0[MUNIT]={27.2,1.0}; /* Hartree-> eV */
+ static char *Unitname0[MUNIT]={"eV","Hartree"};
diff --git a/science/openmx/files/patch-makefile b/science/openmx/files/patch-makefile
new file mode 100644
index 000000000000..f70af174a079
--- /dev/null
+++ b/science/openmx/files/patch-makefile
@@ -0,0 +1,43 @@
+--- makefile.orig 2016-04-02 12:43:42 UTC
++++ makefile
+@@ -136,15 +136,15 @@
+ #
+
+
+-CC = mpicc -O3 -xHOST -ip -no-prec-div -openmp -I/opt/intel/mkl/include/fftw
+-FC = mpif90 -O3 -xHOST -ip -no-prec-div -openmp
+-LIB= -L/opt/intel/mkl/lib -mkl=parallel -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lifcore -lmpi -lmpi_f90 -lmpi_f77
++CC = mpicc $(CFLAGS) -fopenmp
++FC = mpif90 $(FFLAGS) -fopenmp
++LIB= $(LDFLAGS) -lpthread -llapack -lblas -lgfortran -lfftw3 -liomp5
+
+
+
+
+
+-CFLAGS = -g
++#CFLAGS = -g
+
+ OBJS = openmx.o openmx_common.o Input_std.o Inputtools.o \
+ init.o LU_inverse.o ReLU_inverse.o \
+@@ -661,7 +661,7 @@ Show_DFT_DATA.o: Show_DFT_DATA.c openmx_
+
+ install: $(PROG)
+ strip $(PROG)
+- cp $(PROG) $(DESTDIR)/$(PROG)
++ install $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
+
+ #
+ #
+@@ -889,9 +889,9 @@ TRAN_CDen_Main.o: TRAN_CDen_Main.c openm
+
+ elpa1.o: elpa1.f90
+ $(FC) -c elpa1.f90
+-solve_evp_real.o: solve_evp_real.f90
++solve_evp_real.o: solve_evp_real.f90 elpa1.o
+ $(FC) -c solve_evp_real.f90
+-solve_evp_complex.o: solve_evp_complex.f90
++solve_evp_complex.o: solve_evp_complex.f90 elpa1.o
+ $(FC) -c solve_evp_complex.f90
+
+
diff --git a/science/openmx/files/patch-tran__variables.h b/science/openmx/files/patch-tran__variables.h
new file mode 100644
index 000000000000..7d7d961603d6
--- /dev/null
+++ b/science/openmx/files/patch-tran__variables.h
@@ -0,0 +1,10 @@
+--- tran_variables.h.orig 2018-08-29 05:50:14 UTC
++++ tran_variables.h
+@@ -46,7 +46,6 @@ double TRAN_Poisson_Gpara_Scaling;
+ double ScaleSize_e[2];
+ int SpinP_switch_e[2], atomnum_e[2], SpeciesNum_e[2], Max_FSNAN_e[2];
+ int TCpyCell_e[2], Matomnum_e[2], MatomnumF_e[2], MatomnumS_e[2];
+-int Latomnum,Ratomnum,Catomnum;
+ int *WhatSpecies_e[2];
+ int *Spe_Total_CNO_e[2];
+ int *Spe_Total_NO_e[2];
diff --git a/science/openmx/pkg-descr b/science/openmx/pkg-descr
new file mode 100644
index 000000000000..edb2f2d3343f
--- /dev/null
+++ b/science/openmx/pkg-descr
@@ -0,0 +1,24 @@
+OpenMX (Open source package for Material eXplorer) is a software package for
+nano-scale material simulations based on density functional theories (DFT),
+norm-conserving pseudopotentials, and pseudo-atomic localized basis functions.
+The methods and algorithms used in OpenMX and their implementation are carefully
+designed for the realization of large-scale ab initio electronic structure
+calculations on parallel computers based on the MPI or MPI/OpenMP hybrid
+parallelism. The efficient implementation of DFT enables us to investigate
+electronic, magnetic, and geometrical structures of a wide variety of materials
+such as biological molecules, carbon-based materials, magnetic materials, and
+nanoscale conductors. Systems consisting of 1000 atoms can be treated using the
+conventional diagonalization method if several hundreds cores on a parallel
+computer are used. Even ab initio electronic structure calculations for systems
+consisting of more than 10000 atoms are possible with the O(N) method
+implemented in OpenMX if several thousands cores on a parallel computer are
+available. Since optimized pseudopotentials and basis functions, which are well
+tested, are provided for many elements, users may be able to quickly start own
+calculations without preparing those data by themselves. Considerable
+functionalities have been implemented for calculations of physical properties
+such as magnetic, dielectric, and electric transport properties. Thus, we expect
+that OpenMX can be a useful and powerful theoretical tool for nano-scale
+material sciences, leading to better and deeper understanding of complicated and
+useful materials based on quantum mechanics.
+
+WWW: http://www.openmx-square.org/