diff --git a/CMakeLists.txt b/CMakeLists.txt index 177d29bf..aee0ddb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,6 @@ else() #search for HDF5 if(MGMOL_USE_HDF5P) message(STATUS "Use HDF5 parallel capability") set(HDF5_PREFER_PARALLEL True) - add_definitions(-DMGMOL_USE_HDF5P) endif() message(STATUS "HDF5_ROOT: ${HDF5_ROOT}") find_package(HDF5 REQUIRED COMPONENTS C HL) @@ -73,6 +72,10 @@ else() #search for HDF5 message(FATAL_ERROR "Required HDF5 package not found.") endif (${HDF5_FOUND}) endif() +if(MGMOL_USE_HDF5P) + add_definitions(-DMGMOL_USE_HDF5P) +endif() + set(MGMOL_WITH_LIBXC FALSE CACHE BOOL "Compile with LIBXC") if(${MGMOL_WITH_LIBXC}) diff --git a/scripts/build_condo-mod.sh b/scripts/build_condo-mod.sh index f7be0c3b..d9abe034 100755 --- a/scripts/build_condo-mod.sh +++ b/scripts/build_condo-mod.sh @@ -21,6 +21,7 @@ cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ -DCMAKE_CXX_COMPILER=mpiCC \ -DCMAKE_Fortran_COMPILER=mpif77 \ -DBLA_VENDOR=${BLAS_VENDOR} \ + -DMGMOL_USE_HDF5P=OFF \ -DMGMOL_WITH_CLANG_FORMAT=ON \ -DCMAKE_PREFIX_PATH=${HOME}/bin \ -DSCALAPACK_LIBRARY="${SCALAPACK_DIR}/lib/libscalapack.a;/lib64/libgfortran.so.3" \ diff --git a/src/Ions.cc b/src/Ions.cc index ca5120ab..e2cc9916 100644 --- a/src/Ions.cc +++ b/src/Ions.cc @@ -47,9 +47,10 @@ double Ions::max_Vl_radius_ = -1.; double Ions::max_Vnl_radius_ = -1.; template -void writeData2d(hid_t file_id, std::string datasetname, std::vector& data, - const int n, T element) +void writeData2d(HDFrestart& h5f_file, std::string datasetname, + std::vector& data, const size_t n, T element) { + hid_t file_id = h5f_file.file_id(); #ifdef MGMOL_USE_HDF5P if (h5f_file.useHdf5p()) { @@ -67,7 +68,7 @@ void writeData2d(hid_t file_id, std::string datasetname, std::vector& data, else #endif { - size_t dims[2] = { data.size()/n, n }; + size_t dims[2] = { data.size() / n, n }; mgmol_tools::write2d(file_id, datasetname, data, dims); } } @@ -753,7 +754,7 @@ void Ions::writeAtomicNumbers(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Atomic_numbers"); - writeData2d(file_id, datasetname, data, 1, -1); + writeData2d(h5f_file, datasetname, data, 1, -1); } } @@ -788,12 +789,11 @@ void Ions::writeAtomNames(HDFrestart& h5f_file) // write data hid_t file_id = h5f_file.file_id(); - if (file_id >= 0) { std::string datasetname("/Atomic_names"); std::string empty; - writeData2d(file_id, datasetname, data, 1, empty); + writeData2d(h5f_file, datasetname, data, 1, empty); } } @@ -864,7 +864,7 @@ void Ions::writeLockedAtomNames(HDFrestart& h5f_file) { std::string datasetname("/LockedAtomsNames"); std::string empty; - writeData2d(file_id, datasetname, data, 1, empty); + writeData2d(h5f_file, datasetname, data, 1, empty); } } @@ -900,7 +900,7 @@ void Ions::writeAtomicIDs(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Atomic_IDs"); - writeData2d(file_id, datasetname, data, 1, -1); + writeData2d(h5f_file, datasetname, data, 1, -1); } } @@ -937,7 +937,7 @@ void Ions::writeAtomicNLprojIDs(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/AtomicNLproj_IDs"); - writeData2d(file_id, datasetname, data, 1, -1); + writeData2d(h5f_file, datasetname, data, 1, -1); } } @@ -975,7 +975,7 @@ void Ions::writePositions(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Ionic_positions"); - writeData2d(file_id, datasetname, data, 3, 1.e32); + writeData2d(h5f_file, datasetname, data, 3, 1.e32); } } @@ -1138,7 +1138,7 @@ void Ions::writeVelocities(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Ionic_velocities"); - writeData2d(file_id, datasetname, data, 3, 1.e32); + writeData2d(h5f_file, datasetname, data, 3, 1.e32); } } @@ -1184,7 +1184,7 @@ void Ions::writeRandomStates(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Ionic_RandomStates"); - writeData2d(file_id, datasetname, data, 3, (unsigned short)0); + writeData2d(h5f_file, datasetname, data, 3, (unsigned short)0); } } @@ -1343,7 +1343,7 @@ void Ions::writeForces(HDFrestart& h5f_file) if (file_id >= 0) { std::string datasetname("/Ionic_forces"); - writeData2d(file_id, datasetname, data, 3, 1.e32); + writeData2d(h5f_file, datasetname, data, 3, 1.e32); } }