SIESTA-3.1

ウェブページ

http://www.icmab.es/dmmis/leem/siesta/

バージョン

3.1

ビルド環境

  • Intel Composer XE 2011 sp1.8.273
  • Intel MPI 4.0.2.003

ビルドに必要なファイル

  • netcdf-4.2.tar.gz
  • netcdf-fortran-4.2.tar.gz
  • siesta-3.1.tgz

ビルド手順

#!/bin/csh -f
umask 022
set file_netcdf=/home/users/${USER}/build/siesta31/netcdf-4.2.tar.gz
set file_netcdf_f=/home/users/${USER}/build/siesta31/netcdf-fortran-4.2.tar.gz
set file_siesta=/home/users/${USER}/build/siesta31/siesta-3.1.tgz
set work=/work/users/${USER}
#----------------------------------------------------------------------------
setenv FC ifort
setenv FCFLAGS "-O3 -xHost"
setenv CC icc
setenv CFLAGS "-O3 -xHost"
setenv MPIFC mpiifort
#----------------------------------------------------------------------------
cd ${work}
if (-d netcdf-4.2) then
  mv netcdf-4.2 netcdf-erase
  rm -rf netcdf-erase &
endif
rm -rf ${work}/netcdf
tar xzf ${file_netcdf}
cd netcdf-4.2
./configure --prefix=${work}/netcdf --disable-netcdf-4
make
make install
#----------------------------------------------------------------------------
cd ${work}
setenv CPPFLAGS "-I/work/users/${USER}/netcdf/include"
if (-d netcdf-fortran-4.2) then
  mv netcdf-fortran-4.2 netcdf-fortran-erase
  rm -rf netcdf-fortran-erase &
endif
tar xzf ${file_netcdf_f}
cd netcdf-fortran-4.2
./configure --prefix=${work}/netcdf
make
make install
unsetenv CPPFLAGS
#----------------------------------------------------------------------------
cd ${work}
if (-d siesta-3.1) then
  mv siesta-3.1 siesta-erase
  rm -rf siesta-erase &
endif
tar xzf ${file_siesta}
patch -p0 <<_PATCH1
diff -uNr siesta-3.1-orig/Src/iodm_netcdf.F90 siesta-3.1/Src/iodm_netcdf.F90
--- siesta-3.1-orig/Src/iodm_netcdf.F90 2011-08-26 23:16:50.000000000 +0900
+++ siesta-3.1/Src/iodm_netcdf.F90      2012-07-03 18:05:31.433415350 +0900
@@ -27,7 +27,8 @@
 ! These module variables should be put into a derived type, and maybe
 ! not all of them are really necessary
 !
-integer ncid, norbs_id, nspin_id, nnzs_id, scf_step_id
+integer, save :: ncid = -1
+integer norbs_id, nspin_id, nnzs_id, scf_step_id
 integer no_s_id, indxuo_id
 integer numd_id, row_pointer_id, column_id, dm_id
 
@@ -95,6 +96,7 @@
          else
             write(fname,"(a)") "DM.nc"
          endif
+      if ( ncid > -1 ) call check( nf90_close(ncid))
       call check( nf90_create(fname,NF90_CLOBBER,ncid))
 !
 !     Dimensions
diff -uNr siesta-3.1-orig/Src/iodmhs_netcdf.F90 siesta-3.1/Src/iodmhs_netcdf.F90
--- siesta-3.1-orig/Src/iodmhs_netcdf.F90       2011-08-26 23:16:50.000000000 +0900
+++ siesta-3.1/Src/iodmhs_netcdf.F90    2012-07-03 18:06:19.694168219 +0900
@@ -27,7 +27,8 @@
 ! These module variables should be put into a derived type, and maybe
 ! not all of them are really necessary
 !
-integer ncid, norbs_id, nspin_id, nnzs_id, scf_step_id
+integer, save :: ncid = -1
+integer norbs_id, nspin_id, nnzs_id, scf_step_id
 integer no_s_id, indxuo_id
 integer numd_id, row_pointer_id, column_id, dm_id
 integer dm_in_id, dm_out_id, h_id, overlap_id
@@ -99,6 +100,7 @@
          else
             write(fname,"(a)") "DMHS.nc"
          endif
+      if ( ncid > -1 ) call check( nf90_close(ncid))
       call check( nf90_create(fname,NF90_CLOBBER,ncid))
 !
 !     Dimensions
_PATCH1
patch -p0 <<_PATCH
--- siesta-3.1-single/Src/configure    2011-08-26 23:16:50.000000000 +0900
+++ siesta-3.1/Src/configure    2012-06-25 16:20:02.561207000 +0900
@@ -5104,7 +5104,9 @@
         echo "\$as_me:\$LINENO: checking for MPI_Init" >&5
 echo \$ECHO_N "checking for MPI_Init... \$ECHO_C" >&6
                         cat >conftest.\$ac_ext <<_ACEOF
+      program main
       call MPI_Init
+      end
 _ACEOF
 rm -f conftest.\$ac_objext conftest\$ac_exeext
 if { (eval echo "\$as_me:\$LINENO: \"\$ac_link\"") >&5
@@ -6000,7 +6002,7 @@
   withval="\$with_netcdf"
 
 fi;
-if test x\$with_netcdf != xno; then
+if test "x\$with_netcdf" != xno; then
 
 tw_netcdf_ok=no
 ac_ext=\${FC_SRCEXT-f}
@@ -6071,7 +6073,7 @@
 if test \$tw_netcdf_ok = yes; then
   DEFS="\$DEFS CDF";NETCDF_INTERFACE="libnetcdf_f90.a"
 else
-  NETCDF_LIBS="";tw_netcdf_ok=no;if test ! -z \$with_netcdf; then { { echo "\$as_me:\$LINENO: error: Could not find NetCDF library." >&5
+  NETCDF_LIBS="";tw_netcdf_ok=no;if test ! -z "\$with_netcdf"; then { { echo "\$as_me:\$LINENO: error: Could not find NetCDF library." >&5
 echo "\$as_me: error: Could not find NetCDF library." >&2;}
    { (exit 1); exit 1; }; }; fi
 fi
_PATCH
cd siesta-3.1/Obj
sh ../Src/obj_setup.sh
../Src/configure --enable-mpi --with-netcdf="-I${work}/netcdf/include ${work}/netcdf/lib/libnetcdff.a ${work}/netcdf/lib/libnetcdf.a -lcurl" --with-blacs="-L/opt/intel/composer_xe_2011_sp1/mkl/lib/intel64 -lmkl_blacs_intelmpi_lp64 -mkl" --with-scalapack="-L/opt/intel/composer_xe_2011_sp1/mkl/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -mkl" --with-blas="-mkl" --with-lapack="-mkl"
echo "NETCDF_INCFLAGS=-I/work/users/${USER}/netcdf/include" >> arch.make
# Don't use option "-j N" to avoid compilation error.
make