From 6b19016deb3ef6357bb7b912e24d4d498f79fad0 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 12 Jul 2017 15:54:44 -0600 Subject: [PATCH 01/77] cmake: initial commit --- .gitignore | 8 +++++ CMakeLists.txt | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 74e511515e..50b970249a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,11 @@ log.cite .Trashes ehthumbs.db Thumbs.db + +#cmake +/build* +/CMakeCache.txt +/CMakeFiles/ +/Makefile +/cmake_install.cmake +/lmp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..9bcf3118ae --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.1) + +project(lammps) +set(SOVERSION 0) + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) + #release comes with -O3 by default + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) +endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) + +enable_language(CXX) + +###################################################################### +# compiler tests +# these need ot be done early (before further tests). +##################################################################### + +include(CheckCCompilerFlag) + +######################################################################## +# User input options # +######################################################################## +option(BUILD_SHARED_LIBS "Build shared libs" OFF) +include(GNUInstallDirs) + +option(ENABLE_MPI "Build MPI version" OFF) +if(ENABLE_MPI) + find_package(MPI) + include_directories(${MPI_C_INCLUDE_PATH}) + set(MPI_SOURCES) +else() + file(GLOB MPI_SOURCES src/STUBS/mpi.c) + include_directories(src/STUBS) + set(MPI_CXX_LIBRARIES) +endif() + +find_package(UnixCommands) + +option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) + +######################################################################## +# Basic system tests (standard libraries, headers, functions, types) # +######################################################################## +include(CheckIncludeFile) +foreach(HEADER math.h) + check_include_file(${HEADER} FOUND_${HEADER}) + if(NOT FOUND_${HEADER}) + message(FATAL_ERROR "Could not find needed header - ${HEADER}") + endif(NOT FOUND_${HEADER}) +endforeach(HEADER) + +set(MATH_LIBRARIES "m" CACHE STRING "math library") +mark_as_advanced( MATH_LIBRARIES ) +include(CheckLibraryExists) +foreach(FUNC sin cos) + check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) + if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) + message(FATAL_ERROR "Could not find needed math function - ${FUNC}") + endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) +endforeach(FUNC) + +###################################### +# Include the following subdirectory # +###################################### + +#Do NOT go into src to not conflict with old Makefile build system +#add_subdirectory(src) + +file(GLOB LIB_SOURCES src/*.cpp) +file(GLOB LMP_SOURCES src/main.cpp) +list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) + +add_custom_target(style COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) +add_library(lammps ${LIB_SOURCES} ${MPI_SOURCES}) +add_dependencies(lammps style) +# better but slower +#add_custom_command(TARGET lammps PRE_BUILD COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) +target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${MATH_LIBRARIES}) +set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) +install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +add_executable(lmp ${LMP_SOURCES}) +target_link_libraries(lmp lammps) +install(TARGETS lammps DESTINATION ${CMAKE_INSTALL_BINDIR}) From bfb449cec9788dfa649ab7bbb17964364768c3be Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 13 Jul 2017 22:54:48 -0600 Subject: [PATCH 02/77] cmake: furhter improvments * Add support for one package * Add support for JPEG as external package * Use pre-generated style header * TODO write a script to generate them --- CMakeLists.txt => cmake/CMakeLists.txt | 39 ++++++++--- cmake/Headers/package.h.cmakein | 1 + cmake/Headers/style_angle.h | 3 + cmake/Headers/style_atom.h | 9 +++ cmake/Headers/style_body.h | 1 + cmake/Headers/style_bond.h | 3 + cmake/Headers/style_command.h | 23 +++++++ cmake/Headers/style_compute.h | 66 +++++++++++++++++++ cmake/Headers/style_dihedral.h | 3 + cmake/Headers/style_dump.h | 9 +++ cmake/Headers/style_fix.h | 89 ++++++++++++++++++++++++++ cmake/Headers/style_improper.h | 3 + cmake/Headers/style_integrate.h | 3 + cmake/Headers/style_kspace.h | 1 + cmake/Headers/style_minimize.h | 6 ++ cmake/Headers/style_nbin.h | 2 + cmake/Headers/style_npair.h | 36 +++++++++++ cmake/Headers/style_nstencil.h | 21 ++++++ cmake/Headers/style_ntopo.h | 13 ++++ cmake/Headers/style_pair.h | 47 ++++++++++++++ cmake/Headers/style_reader.h | 3 + cmake/Headers/style_region.h | 9 +++ 22 files changed, 381 insertions(+), 9 deletions(-) rename CMakeLists.txt => cmake/CMakeLists.txt (71%) create mode 100644 cmake/Headers/package.h.cmakein create mode 100644 cmake/Headers/style_angle.h create mode 100644 cmake/Headers/style_atom.h create mode 100644 cmake/Headers/style_body.h create mode 100644 cmake/Headers/style_bond.h create mode 100644 cmake/Headers/style_command.h create mode 100644 cmake/Headers/style_compute.h create mode 100644 cmake/Headers/style_dihedral.h create mode 100644 cmake/Headers/style_dump.h create mode 100644 cmake/Headers/style_fix.h create mode 100644 cmake/Headers/style_improper.h create mode 100644 cmake/Headers/style_integrate.h create mode 100644 cmake/Headers/style_kspace.h create mode 100644 cmake/Headers/style_minimize.h create mode 100644 cmake/Headers/style_nbin.h create mode 100644 cmake/Headers/style_npair.h create mode 100644 cmake/Headers/style_nstencil.h create mode 100644 cmake/Headers/style_ntopo.h create mode 100644 cmake/Headers/style_pair.h create mode 100644 cmake/Headers/style_reader.h create mode 100644 cmake/Headers/style_region.h diff --git a/CMakeLists.txt b/cmake/CMakeLists.txt similarity index 71% rename from CMakeLists.txt rename to cmake/CMakeLists.txt index 9bcf3118ae..4dd54ddf90 100644 --- a/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -29,8 +29,8 @@ if(ENABLE_MPI) include_directories(${MPI_C_INCLUDE_PATH}) set(MPI_SOURCES) else() - file(GLOB MPI_SOURCES src/STUBS/mpi.c) - include_directories(src/STUBS) + file(GLOB MPI_SOURCES ${CMAKE_SOURCE_DIR}/../src/STUBS/mpi.c) + include_directories(${CMAKE_SOURCE_DIR}/../src/STUBS) set(MPI_CXX_LIBRARIES) endif() @@ -38,6 +38,19 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) +set(PACKAGES ASPHERE) +foreach(PKG ${PACKAGES}) + option(ENABLE_${PKG} "Build ${PKG} Package" OFF) +endforeach() + +find_package(JPEG) +if(JPEG_FOUND) + add_definitions(-DLAMMPS_JPEG) + include_directories(${JPEG_INCLUDE_DIR}) +else() + set(JPEG_LIBRARIES) +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## @@ -66,16 +79,24 @@ endforeach(FUNC) #Do NOT go into src to not conflict with old Makefile build system #add_subdirectory(src) -file(GLOB LIB_SOURCES src/*.cpp) -file(GLOB LMP_SOURCES src/main.cpp) +file(GLOB LIB_SOURCES ${CMAKE_SOURCE_DIR}/../src/*.cpp) +file(GLOB LMP_SOURCES ${CMAKE_SOURCE_DIR}/../src/main.cpp) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) -add_custom_target(style COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) +foreach(PKG ${PACKAGES}) + if(ENABLE_${PKG}) + file(GLOB ${PKG}_SOURCES ${CMAKE_SOURCE_DIR}/../src/${PKG}/*.cpp) + list(APPEND LIB_SOURCES ${${PKG}_SOURCES}) + include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG}) + endif() +endforeach() +include_directories(${CMAKE_SOURCE_DIR}/../src) +include_directories(${CMAKE_SOURCE_DIR}/Headers) +configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h) +include_directories(${CMAKE_BINARY_DIR}/cmake) + add_library(lammps ${LIB_SOURCES} ${MPI_SOURCES}) -add_dependencies(lammps style) -# better but slower -#add_custom_command(TARGET lammps PRE_BUILD COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) -target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${MATH_LIBRARIES}) +target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${JPEG_LIBRARIES} ${MATH_LIBRARIES}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/cmake/Headers/package.h.cmakein b/cmake/Headers/package.h.cmakein new file mode 100644 index 0000000000..f582f6f7d5 --- /dev/null +++ b/cmake/Headers/package.h.cmakein @@ -0,0 +1 @@ +#cmakedefine ENABLE_ASPHERE diff --git a/cmake/Headers/style_angle.h b/cmake/Headers/style_angle.h new file mode 100644 index 0000000000..8b395b557f --- /dev/null +++ b/cmake/Headers/style_angle.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "angle_hybrid.h" +#include "angle_zero.h" diff --git a/cmake/Headers/style_atom.h b/cmake/Headers/style_atom.h new file mode 100644 index 0000000000..ec4e5d7d20 --- /dev/null +++ b/cmake/Headers/style_atom.h @@ -0,0 +1,9 @@ +#include "package.h" +#include "atom_vec_atomic.h" +#include "atom_vec_body.h" +#include "atom_vec_charge.h" +#include "atom_vec_ellipsoid.h" +#include "atom_vec_hybrid.h" +#include "atom_vec_line.h" +#include "atom_vec_sphere.h" +#include "atom_vec_tri.h" diff --git a/cmake/Headers/style_body.h b/cmake/Headers/style_body.h new file mode 100644 index 0000000000..b2b5c1f82e --- /dev/null +++ b/cmake/Headers/style_body.h @@ -0,0 +1 @@ +#include "package.h" diff --git a/cmake/Headers/style_bond.h b/cmake/Headers/style_bond.h new file mode 100644 index 0000000000..d18a31ca91 --- /dev/null +++ b/cmake/Headers/style_bond.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "bond_hybrid.h" +#include "bond_zero.h" diff --git a/cmake/Headers/style_command.h b/cmake/Headers/style_command.h new file mode 100644 index 0000000000..08f90396f7 --- /dev/null +++ b/cmake/Headers/style_command.h @@ -0,0 +1,23 @@ +#include "balance.h" +#include "change_box.h" +#include "create_atoms.h" +#include "create_bonds.h" +#include "create_box.h" +#include "delete_atoms.h" +#include "delete_bonds.h" +#include "displace_atoms.h" +#include "info.h" +#include "minimize.h" +#include "read_data.h" +#include "read_dump.h" +#include "read_restart.h" +#include "replicate.h" +#include "rerun.h" +#include "run.h" +#include "set.h" +#include "velocity.h" +#include "write_coeff.h" +#include "write_data.h" +#include "write_dump.h" +#include "package.h" +#include "write_restart.h" diff --git a/cmake/Headers/style_compute.h b/cmake/Headers/style_compute.h new file mode 100644 index 0000000000..bfcd053ed6 --- /dev/null +++ b/cmake/Headers/style_compute.h @@ -0,0 +1,66 @@ +#include "package.h" +#include "compute_angle.h" +#include "compute_angle_local.h" +#include "compute_angmom_chunk.h" +#include "compute_bond.h" +#include "compute_bond_local.h" +#include "compute_centro_atom.h" +#include "compute_chunk_atom.h" +#include "compute_cluster_atom.h" +#include "compute_cna_atom.h" +#include "compute_com.h" +#include "compute_com_chunk.h" +#include "compute_contact_atom.h" +#include "compute_coord_atom.h" +#include "compute_dihedral.h" +#include "compute_dihedral_local.h" +#include "compute_dipole_chunk.h" +#include "compute_displace_atom.h" +#ifdef ENABLE_ASPHERE +#include "compute_erotate_asphere.h" +#endif +#include "compute_erotate_sphere.h" +#include "compute_erotate_sphere_atom.h" +#include "compute_global_atom.h" +#include "compute_group_group.h" +#include "compute_gyration.h" +#include "compute_gyration_chunk.h" +#include "compute_heat_flux.h" +#include "compute_hexorder_atom.h" +#include "compute_improper.h" +#include "compute_improper_local.h" +#include "compute_inertia_chunk.h" +#include "compute_ke.h" +#include "compute_ke_atom.h" +#include "compute_msd.h" +#include "compute_msd_chunk.h" +#include "compute_omega_chunk.h" +#include "compute_orientorder_atom.h" +#include "compute_pair.h" +#include "compute_pair_local.h" +#include "compute_pe.h" +#include "compute_pe_atom.h" +#include "compute_pressure.h" +#include "compute_property_atom.h" +#include "compute_property_chunk.h" +#include "compute_property_local.h" +#include "compute_rdf.h" +#include "compute_reduce.h" +#include "compute_reduce_region.h" +#include "compute_slice.h" +#include "compute_stress_atom.h" +#include "compute_temp.h" +#ifdef ENABLE_ASPHERE +#include "compute_temp_asphere.h" +#endif +#include "compute_temp_chunk.h" +#include "compute_temp_com.h" +#include "compute_temp_deform.h" +#include "compute_temp_partial.h" +#include "compute_temp_profile.h" +#include "compute_temp_ramp.h" +#include "compute_temp_region.h" +#include "compute_temp_sphere.h" +#include "compute_torque_chunk.h" +#include "compute_vacf.h" +#include "compute_vcm_chunk.h" diff --git a/cmake/Headers/style_dihedral.h b/cmake/Headers/style_dihedral.h new file mode 100644 index 0000000000..26cb4a815a --- /dev/null +++ b/cmake/Headers/style_dihedral.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "dihedral_hybrid.h" +#include "dihedral_zero.h" diff --git a/cmake/Headers/style_dump.h b/cmake/Headers/style_dump.h new file mode 100644 index 0000000000..bc8477a6bf --- /dev/null +++ b/cmake/Headers/style_dump.h @@ -0,0 +1,9 @@ +#include "package.h" +#include "dump_atom.h" +#include "dump_cfg.h" +#include "dump_custom.h" +#include "dump_dcd.h" +#include "dump_image.h" +#include "dump_local.h" +#include "dump_movie.h" +#include "dump_xyz.h" diff --git a/cmake/Headers/style_fix.h b/cmake/Headers/style_fix.h new file mode 100644 index 0000000000..5d142e086b --- /dev/null +++ b/cmake/Headers/style_fix.h @@ -0,0 +1,89 @@ +#include "package.h" +#include "fix_adapt.h" +#include "fix_addforce.h" +#include "fix_ave_atom.h" +#include "fix_ave_chunk.h" +#include "fix_ave_correlate.h" +#include "fix_ave_histo.h" +#include "fix_ave_histo_weight.h" +#include "fix_ave_time.h" +#include "fix_aveforce.h" +#include "fix_balance.h" +#include "fix_box_relax.h" +#include "fix_controller.h" +#include "fix_deform.h" +#include "fix_deprecated.h" +#include "fix_drag.h" +#include "fix_dt_reset.h" +#include "fix_enforce2d.h" +#include "fix_external.h" +#include "fix_gravity.h" +#include "fix_group.h" +#include "fix_halt.h" +#include "fix_heat.h" +#include "fix_indent.h" +#include "fix_langevin.h" +#include "fix_lineforce.h" +#include "fix_minimize.h" +#include "fix_momentum.h" +#include "fix_move.h" +#include "fix_nph.h" +#ifdef ENABLE_ASPHERE +#include "fix_nph_asphere.h" +#endif +#include "fix_nph_sphere.h" +#include "fix_npt.h" +#ifdef ENABLE_ASPHERE +#include "fix_npt_asphere.h" +#endif +#include "fix_npt_sphere.h" +#include "fix_nve.h" +#ifdef ENABLE_ASPHERE +#include "fix_nve_asphere.h" +#include "fix_nve_asphere_noforce.h" +#endif +#include "fix_nve_limit.h" +#ifdef ENABLE_ASPHERE +#include "fix_nve_line.h" +#endif +#include "fix_nve_noforce.h" +#include "fix_nve_sphere.h" +#ifdef ENABLE_ASPHERE +#include "fix_nve_tri.h" +#endif +#include "fix_nvt.h" +#ifdef ENABLE_ASPHERE +#include "fix_nvt_asphere.h" +#endif +#include "fix_nvt_sllod.h" +#include "fix_nvt_sphere.h" +#include "fix_planeforce.h" +#include "fix_press_berendsen.h" +#include "fix_print.h" +#include "fix_property_atom.h" +#include "fix_read_restart.h" +#include "fix_recenter.h" +#include "fix_respa.h" +#include "fix_restrain.h" +#include "fix_setforce.h" +#include "fix_shear_history.h" +#include "fix_spring.h" +#include "fix_spring_chunk.h" +#include "fix_spring_rg.h" +#include "fix_spring_self.h" +#include "fix_store.h" +#include "fix_store_force.h" +#include "fix_store_state.h" +#include "fix_temp_berendsen.h" +#include "fix_temp_csld.h" +#include "fix_temp_csvr.h" +#include "fix_temp_rescale.h" +#include "fix_tmd.h" +#include "fix_vector.h" +#include "fix_viscous.h" +#include "fix_wall_harmonic.h" +#include "fix_wall_lj1043.h" +#include "fix_wall_lj126.h" +#include "fix_wall_lj93.h" +#include "fix_wall_reflect.h" +#include "fix_wall_region.h" diff --git a/cmake/Headers/style_improper.h b/cmake/Headers/style_improper.h new file mode 100644 index 0000000000..3de3047d73 --- /dev/null +++ b/cmake/Headers/style_improper.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "improper_hybrid.h" +#include "improper_zero.h" diff --git a/cmake/Headers/style_integrate.h b/cmake/Headers/style_integrate.h new file mode 100644 index 0000000000..0a2fd00cf7 --- /dev/null +++ b/cmake/Headers/style_integrate.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "respa.h" +#include "verlet.h" diff --git a/cmake/Headers/style_kspace.h b/cmake/Headers/style_kspace.h new file mode 100644 index 0000000000..b2b5c1f82e --- /dev/null +++ b/cmake/Headers/style_kspace.h @@ -0,0 +1 @@ +#include "package.h" diff --git a/cmake/Headers/style_minimize.h b/cmake/Headers/style_minimize.h new file mode 100644 index 0000000000..35d9188e8d --- /dev/null +++ b/cmake/Headers/style_minimize.h @@ -0,0 +1,6 @@ +#include "package.h" +#include "min_cg.h" +#include "min_fire.h" +#include "min_hftn.h" +#include "min_quickmin.h" +#include "min_sd.h" diff --git a/cmake/Headers/style_nbin.h b/cmake/Headers/style_nbin.h new file mode 100644 index 0000000000..f0d52b05bc --- /dev/null +++ b/cmake/Headers/style_nbin.h @@ -0,0 +1,2 @@ +#include "package.h" +#include "nbin_standard.h" diff --git a/cmake/Headers/style_npair.h b/cmake/Headers/style_npair.h new file mode 100644 index 0000000000..bd403ebeeb --- /dev/null +++ b/cmake/Headers/style_npair.h @@ -0,0 +1,36 @@ +#include "package.h" +#include "npair_copy.h" +#include "npair_full_bin.h" +#include "npair_full_bin_atomonly.h" +#include "npair_full_bin_ghost.h" +#include "npair_full_multi.h" +#include "npair_full_nsq.h" +#include "npair_full_nsq_ghost.h" +#include "npair_half_bin_atomonly_newton.h" +#include "npair_half_bin_newtoff.h" +#include "npair_half_bin_newtoff_ghost.h" +#include "npair_half_bin_newton.h" +#include "npair_half_bin_newton_tri.h" +#include "npair_half_multi_newtoff.h" +#include "npair_half_multi_newton.h" +#include "npair_half_multi_newton_tri.h" +#include "npair_half_nsq_newtoff.h" +#include "npair_half_nsq_newtoff_ghost.h" +#include "npair_half_nsq_newton.h" +#include "npair_half_respa_bin_newtoff.h" +#include "npair_half_respa_bin_newton.h" +#include "npair_half_respa_bin_newton_tri.h" +#include "npair_half_respa_nsq_newtoff.h" +#include "npair_half_respa_nsq_newton.h" +#include "npair_half_size_bin_newtoff.h" +#include "npair_half_size_bin_newton.h" +#include "npair_half_size_bin_newton_tri.h" +#include "npair_half_size_nsq_newtoff.h" +#include "npair_half_size_nsq_newton.h" +#include "npair_halffull_newtoff.h" +#include "npair_halffull_newton.h" +#include "npair_skip.h" +#include "npair_skip_respa.h" +#include "npair_skip_size.h" +#include "npair_skip_size_off2on.h" +#include "npair_skip_size_off2on_oneside.h" diff --git a/cmake/Headers/style_nstencil.h b/cmake/Headers/style_nstencil.h new file mode 100644 index 0000000000..d28e4b23b1 --- /dev/null +++ b/cmake/Headers/style_nstencil.h @@ -0,0 +1,21 @@ +#include "package.h" +#include "nstencil_full_bin_2d.h" +#include "nstencil_full_bin_3d.h" +#include "nstencil_full_ghost_bin_2d.h" +#include "nstencil_full_ghost_bin_3d.h" +#include "nstencil_full_multi_2d.h" +#include "nstencil_full_multi_3d.h" +#include "nstencil_half_bin_2d_newtoff.h" +#include "nstencil_half_bin_2d_newton.h" +#include "nstencil_half_bin_2d_newton_tri.h" +#include "nstencil_half_bin_3d_newtoff.h" +#include "nstencil_half_bin_3d_newton.h" +#include "nstencil_half_bin_3d_newton_tri.h" +#include "nstencil_half_ghost_bin_2d_newtoff.h" +#include "nstencil_half_ghost_bin_3d_newtoff.h" +#include "nstencil_half_multi_2d_newtoff.h" +#include "nstencil_half_multi_2d_newton.h" +#include "nstencil_half_multi_2d_newton_tri.h" +#include "nstencil_half_multi_3d_newtoff.h" +#include "nstencil_half_multi_3d_newton.h" +#include "nstencil_half_multi_3d_newton_tri.h" diff --git a/cmake/Headers/style_ntopo.h b/cmake/Headers/style_ntopo.h new file mode 100644 index 0000000000..130b10200f --- /dev/null +++ b/cmake/Headers/style_ntopo.h @@ -0,0 +1,13 @@ +#include "package.h" +#include "ntopo_angle_all.h" +#include "ntopo_angle_partial.h" +#include "ntopo_angle_template.h" +#include "ntopo_bond_all.h" +#include "ntopo_bond_partial.h" +#include "ntopo_bond_template.h" +#include "ntopo_dihedral_all.h" +#include "ntopo_dihedral_partial.h" +#include "ntopo_dihedral_template.h" +#include "ntopo_improper_all.h" +#include "ntopo_improper_partial.h" +#include "ntopo_improper_template.h" diff --git a/cmake/Headers/style_pair.h b/cmake/Headers/style_pair.h new file mode 100644 index 0000000000..b2ecef6a2a --- /dev/null +++ b/cmake/Headers/style_pair.h @@ -0,0 +1,47 @@ +#include "package.h" +#include "pair_beck.h" +#include "pair_born.h" +#include "pair_born_coul_dsf.h" +#include "pair_born_coul_wolf.h" +#include "pair_buck.h" +#include "pair_buck_coul_cut.h" +#include "pair_coul_cut.h" +#include "pair_coul_debye.h" +#include "pair_coul_dsf.h" +#include "pair_coul_streitz.h" +#include "pair_coul_wolf.h" +#include "pair_dpd.h" +#include "pair_dpd_tstat.h" +#include "pair_gauss.h" +#ifdef ENABLE_ASPHERE +#include "pair_gayberne.h" +#endif +#include "pair_hybrid.h" +#include "pair_hybrid_overlay.h" +#ifdef ENABLE_ASPHERE +#include "pair_line_lj.h" +#endif +#include "pair_lj96_cut.h" +#include "pair_lj_cubic.h" +#include "pair_lj_cut.h" +#include "pair_lj_cut_coul_cut.h" +#include "pair_lj_cut_coul_debye.h" +#include "pair_lj_cut_coul_dsf.h" +#include "pair_lj_expand.h" +#include "pair_lj_gromacs.h" +#include "pair_lj_gromacs_coul_gromacs.h" +#include "pair_lj_smooth.h" +#include "pair_lj_smooth_linear.h" +#include "pair_mie_cut.h" +#include "pair_morse.h" +#ifdef ENABLE_ASPHERE +#include "pair_resquared.h" +#endif +#include "pair_soft.h" +#include "pair_table.h" +#ifdef ENABLE_ASPHERE +#include "pair_tri_lj.h" +#endif +#include "pair_yukawa.h" +#include "pair_zbl.h" +#include "pair_zero.h" diff --git a/cmake/Headers/style_reader.h b/cmake/Headers/style_reader.h new file mode 100644 index 0000000000..0b8145e13d --- /dev/null +++ b/cmake/Headers/style_reader.h @@ -0,0 +1,3 @@ +#include "package.h" +#include "reader_native.h" +#include "reader_xyz.h" diff --git a/cmake/Headers/style_region.h b/cmake/Headers/style_region.h new file mode 100644 index 0000000000..dc467b2a3d --- /dev/null +++ b/cmake/Headers/style_region.h @@ -0,0 +1,9 @@ +#include "package.h" +#include "region_block.h" +#include "region_cone.h" +#include "region_cylinder.h" +#include "region_intersect.h" +#include "region_plane.h" +#include "region_prism.h" +#include "region_sphere.h" +#include "region_union.h" From 7f1789a0c44c77a3eee1bf05cf0ea66a04a1fe0b Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 13 Jul 2017 23:27:55 -0600 Subject: [PATCH 03/77] cmake: add support for REAX and hence Fortran --- cmake/CMakeLists.txt | 9 ++++++++- cmake/Headers/package.h.cmakein | 1 + cmake/Headers/style_command.h | 2 +- cmake/Headers/style_fix.h | 3 +++ cmake/Headers/style_pair.h | 3 +++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4dd54ddf90..cd3db7b7e9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -38,7 +38,7 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) -set(PACKAGES ASPHERE) +set(PACKAGES ASPHERE REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -90,6 +90,13 @@ foreach(PKG ${PACKAGES}) include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG}) endif() endforeach() + +if(ENABLE_REAX) + enable_language(Fortran) + file(GLOB REAX_SOURCES ${CMAKE_SOURCE_DIR}/../lib/reax/*.F) + list(APPEND LIB_SOURCES ${REAX_SOURCES}) + include_directories(${CMAKE_SOURCE_DIR}/../lib/reax) +endif() include_directories(${CMAKE_SOURCE_DIR}/../src) include_directories(${CMAKE_SOURCE_DIR}/Headers) configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h) diff --git a/cmake/Headers/package.h.cmakein b/cmake/Headers/package.h.cmakein index f582f6f7d5..9c7ff403a4 100644 --- a/cmake/Headers/package.h.cmakein +++ b/cmake/Headers/package.h.cmakein @@ -1 +1,2 @@ #cmakedefine ENABLE_ASPHERE +#cmakedefine ENABLE_REAX diff --git a/cmake/Headers/style_command.h b/cmake/Headers/style_command.h index 08f90396f7..d795f4ba0a 100644 --- a/cmake/Headers/style_command.h +++ b/cmake/Headers/style_command.h @@ -1,3 +1,4 @@ +#include "package.h" #include "balance.h" #include "change_box.h" #include "create_atoms.h" @@ -19,5 +20,4 @@ #include "write_coeff.h" #include "write_data.h" #include "write_dump.h" -#include "package.h" #include "write_restart.h" diff --git a/cmake/Headers/style_fix.h b/cmake/Headers/style_fix.h index 5d142e086b..146616124d 100644 --- a/cmake/Headers/style_fix.h +++ b/cmake/Headers/style_fix.h @@ -62,6 +62,9 @@ #include "fix_print.h" #include "fix_property_atom.h" #include "fix_read_restart.h" +#ifdef ENABLE_REAX +#include "fix_reax_bonds.h" +#endif #include "fix_recenter.h" #include "fix_respa.h" #include "fix_restrain.h" diff --git a/cmake/Headers/style_pair.h b/cmake/Headers/style_pair.h index b2ecef6a2a..067e2cdb23 100644 --- a/cmake/Headers/style_pair.h +++ b/cmake/Headers/style_pair.h @@ -34,6 +34,9 @@ #include "pair_lj_smooth_linear.h" #include "pair_mie_cut.h" #include "pair_morse.h" +#ifdef ENABLE_REAX +#include "pair_reax.h" +#endif #ifdef ENABLE_ASPHERE #include "pair_resquared.h" #endif From a86b0d4c1b3e9a98aa47907401b72cd49a1637b2 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 03:53:07 -0500 Subject: [PATCH 04/77] Add PNG library detection to CMakeList.txt --- cmake/CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index cd3db7b7e9..4692372cec 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -51,6 +51,14 @@ else() set(JPEG_LIBRARIES) endif() +find_package(PNG) +if(PNG_FOUND) + include_directories(${PNG_INCLUDE_DIR}) + add_definitions(-DLAMMPS_PNG) +else(PNG_FOUND) + set(PNG_LIBRARIES) +endif(PNG_FOUND) + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## @@ -103,7 +111,7 @@ configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR} include_directories(${CMAKE_BINARY_DIR}/cmake) add_library(lammps ${LIB_SOURCES} ${MPI_SOURCES}) -target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${JPEG_LIBRARIES} ${MATH_LIBRARIES}) +target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${MATH_LIBRARIES}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) From fdd3d802f06e24c5f0501f6ff9e12d25f1f78198 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 04:00:38 -0500 Subject: [PATCH 05/77] Clean up CMakeList.txt by introducing LAMMPS_SOURCE_DIR variable --- cmake/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4692372cec..14ec5059f1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(lammps) set(SOVERSION 0) +set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) #release comes with -O3 by default @@ -29,8 +30,8 @@ if(ENABLE_MPI) include_directories(${MPI_C_INCLUDE_PATH}) set(MPI_SOURCES) else() - file(GLOB MPI_SOURCES ${CMAKE_SOURCE_DIR}/../src/STUBS/mpi.c) - include_directories(${CMAKE_SOURCE_DIR}/../src/STUBS) + file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) + include_directories(${LAMMPS_SOURCE_DIR}/STUBS) set(MPI_CXX_LIBRARIES) endif() @@ -87,15 +88,15 @@ endforeach(FUNC) #Do NOT go into src to not conflict with old Makefile build system #add_subdirectory(src) -file(GLOB LIB_SOURCES ${CMAKE_SOURCE_DIR}/../src/*.cpp) -file(GLOB LMP_SOURCES ${CMAKE_SOURCE_DIR}/../src/main.cpp) +file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) +file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) foreach(PKG ${PACKAGES}) if(ENABLE_${PKG}) - file(GLOB ${PKG}_SOURCES ${CMAKE_SOURCE_DIR}/../src/${PKG}/*.cpp) + file(GLOB ${PKG}_SOURCES ${LAMMPS_SOURCE_DIR}/${PKG}/*.cpp) list(APPEND LIB_SOURCES ${${PKG}_SOURCES}) - include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG}) + include_directories(${LAMMPS_SOURCE_DIR}/${PKG}) endif() endforeach() @@ -105,7 +106,7 @@ if(ENABLE_REAX) list(APPEND LIB_SOURCES ${REAX_SOURCES}) include_directories(${CMAKE_SOURCE_DIR}/../lib/reax) endif() -include_directories(${CMAKE_SOURCE_DIR}/../src) +include_directories(${LAMMPS_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/Headers) configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h) include_directories(${CMAKE_BINARY_DIR}/cmake) From a566419ca6916f047f9b855437c1729a98638822 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 04:36:52 -0500 Subject: [PATCH 06/77] Add LAMMPS_LIB_SOURCE_DIR variable in CMakeLists.txt --- cmake/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 14ec5059f1..f69d84e852 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1) project(lammps) set(SOVERSION 0) set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) +set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) #release comes with -O3 by default @@ -102,9 +103,9 @@ endforeach() if(ENABLE_REAX) enable_language(Fortran) - file(GLOB REAX_SOURCES ${CMAKE_SOURCE_DIR}/../lib/reax/*.F) + file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) list(APPEND LIB_SOURCES ${REAX_SOURCES}) - include_directories(${CMAKE_SOURCE_DIR}/../lib/reax) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) endif() include_directories(${LAMMPS_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/Headers) From 842dc1b58c4b8f7aa68cf0c64e44d2aaffa753f9 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 14:21:21 -0600 Subject: [PATCH 07/77] cmake: collect link libs --- cmake/CMakeLists.txt | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f69d84e852..074407650e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -25,15 +25,12 @@ include(CheckCCompilerFlag) option(BUILD_SHARED_LIBS "Build shared libs" OFF) include(GNUInstallDirs) +set(LAMMPS_LINK_LIBS) option(ENABLE_MPI "Build MPI version" OFF) if(ENABLE_MPI) - find_package(MPI) + find_package(MPI REQUIRED) include_directories(${MPI_C_INCLUDE_PATH}) - set(MPI_SOURCES) -else() - file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) - include_directories(${LAMMPS_SOURCE_DIR}/STUBS) - set(MPI_CXX_LIBRARIES) + list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES}) endif() find_package(UnixCommands) @@ -49,16 +46,14 @@ find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) include_directories(${JPEG_INCLUDE_DIR}) -else() - set(JPEG_LIBRARIES) + list(APPEND LAMMPS_LINK_LIBS ${JPEG_LIBRARIES}) endif() find_package(PNG) if(PNG_FOUND) include_directories(${PNG_INCLUDE_DIR}) + list(APPEND LAMMPS_LINK_LIBS ${PNG_LIBRARIES}) add_definitions(-DLAMMPS_PNG) -else(PNG_FOUND) - set(PNG_LIBRARIES) endif(PNG_FOUND) ######################################################################## @@ -81,6 +76,7 @@ foreach(FUNC sin cos) message(FATAL_ERROR "Could not find needed math function - ${FUNC}") endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) endforeach(FUNC) +list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) ###################################### # Include the following subdirectory # @@ -93,6 +89,12 @@ file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) +if(NOT ENABLE_MPI) + file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) + list(APPEND LIB_SOURCES ${MPI_SOURCES}) + include_directories(${LAMMPS_SOURCE_DIR}/STUBS) +endif() + foreach(PKG ${PACKAGES}) if(ENABLE_${PKG}) file(GLOB ${PKG}_SOURCES ${LAMMPS_SOURCE_DIR}/${PKG}/*.cpp) @@ -112,8 +114,8 @@ include_directories(${CMAKE_SOURCE_DIR}/Headers) configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h) include_directories(${CMAKE_BINARY_DIR}/cmake) -add_library(lammps ${LIB_SOURCES} ${MPI_SOURCES}) -target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${MATH_LIBRARIES}) +add_library(lammps ${LIB_SOURCES}) +target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) From e4e12521522b1bdbb57758f431d9ef08b6aa7792 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 14:44:44 -0600 Subject: [PATCH 08/77] fix LAMMPS_PNG --- cmake/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 074407650e..a21c81b9cd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -50,11 +50,12 @@ if(JPEG_FOUND) endif() find_package(PNG) -if(PNG_FOUND) - include_directories(${PNG_INCLUDE_DIR}) - list(APPEND LAMMPS_LINK_LIBS ${PNG_LIBRARIES}) +find_package(ZLIB) +if(PNG_FOUND AND ZLIB_FOUND) + include_directories(${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) add_definitions(-DLAMMPS_PNG) -endif(PNG_FOUND) +endif() ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # From c07adac22d577c4ad4cb6546480ca6c669018fdb Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 14:49:53 -0600 Subject: [PATCH 09/77] add support for LAMMPS_GZIP --- cmake/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a21c81b9cd..9db55174fc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -57,6 +57,11 @@ if(PNG_FOUND AND ZLIB_FOUND) add_definitions(-DLAMMPS_PNG) endif() +find_program(GZIP gzip) +if(GZIP) + add_definitions(-DLAMMPS_GZIP) +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## From d5dcb3d32930c2efcd41bd394d21b283c46c78e6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 15:55:36 -0600 Subject: [PATCH 10/77] add support for KSPACE --- cmake/CMakeLists.txt | 14 +++++++++++++- cmake/Headers/style_fix.h | 3 +++ cmake/Headers/style_kspace.h | 12 ++++++++++++ cmake/Headers/style_pair.h | 30 ++++++++++++++++++++++++++++++ cmake/Modules/FindFFTW3.cmake | 25 +++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindFFTW3.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9db55174fc..f0d121d834 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -5,6 +5,9 @@ set(SOVERSION 0) set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) +# Cmake modules/macros are in a subdirectory to keep this file cleaner +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) #release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) @@ -37,11 +40,20 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) -set(PACKAGES ASPHERE REAX) +set(PACKAGES ASPHERE KSPACE REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() +if(ENABLE_KSPACE) + find_package(FFTW3) + if(FFTW3_FOUND) + add_definitions(-DFFT_FFTW3) + include_directories(${FFTW3_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) + endif() +endif() + find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) diff --git a/cmake/Headers/style_fix.h b/cmake/Headers/style_fix.h index 146616124d..fb68f69135 100644 --- a/cmake/Headers/style_fix.h +++ b/cmake/Headers/style_fix.h @@ -82,6 +82,9 @@ #include "fix_temp_csvr.h" #include "fix_temp_rescale.h" #include "fix_tmd.h" +#ifdef ENABLE_KSPACE +#include "fix_tune_kspace.h" +#endif #include "fix_vector.h" #include "fix_viscous.h" #include "fix_wall_harmonic.h" diff --git a/cmake/Headers/style_kspace.h b/cmake/Headers/style_kspace.h index b2b5c1f82e..64760bb422 100644 --- a/cmake/Headers/style_kspace.h +++ b/cmake/Headers/style_kspace.h @@ -1 +1,13 @@ #include "package.h" +#ifdef ENABLE_KSPACE +#include "ewald.h" +#include "ewald_disp.h" +#include "msm.h" +#include "msm_cg.h" +#include "pppm.h" +#include "pppm_cg.h" +#include "pppm_disp.h" +#include "pppm_disp_tip4p.h" +#include "pppm_stagger.h" +#include "pppm_tip4p.h" +#endif diff --git a/cmake/Headers/style_pair.h b/cmake/Headers/style_pair.h index 067e2cdb23..e7676bfabf 100644 --- a/cmake/Headers/style_pair.h +++ b/cmake/Headers/style_pair.h @@ -2,12 +2,25 @@ #include "pair_beck.h" #include "pair_born.h" #include "pair_born_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_born_coul_long.h" +#include "pair_born_coul_msm.h" +#endif #include "pair_born_coul_wolf.h" #include "pair_buck.h" #include "pair_buck_coul_cut.h" +#ifdef ENABLE_KSPACE +#include "pair_buck_coul_long.h" +#include "pair_buck_coul_msm.h" +#include "pair_buck_long_coul_long.h" +#endif #include "pair_coul_cut.h" #include "pair_coul_debye.h" #include "pair_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_coul_long.h" +#include "pair_coul_msm.h" +#endif #include "pair_coul_streitz.h" #include "pair_coul_wolf.h" #include "pair_dpd.h" @@ -22,14 +35,28 @@ #include "pair_line_lj.h" #endif #include "pair_lj96_cut.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_charmm_coul_long.h" +#include "pair_lj_charmm_coul_msm.h" +#include "pair_lj_charmmfsw_coul_long.h" +#endif #include "pair_lj_cubic.h" #include "pair_lj_cut.h" #include "pair_lj_cut_coul_cut.h" #include "pair_lj_cut_coul_debye.h" #include "pair_lj_cut_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_cut_coul_long.h" +#include "pair_lj_cut_coul_msm.h" +#include "pair_lj_cut_tip4p_long.h" +#endif #include "pair_lj_expand.h" #include "pair_lj_gromacs.h" #include "pair_lj_gromacs_coul_gromacs.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_long_coul_long.h" +#include "pair_lj_long_tip4p_long.h" +#endif #include "pair_lj_smooth.h" #include "pair_lj_smooth_linear.h" #include "pair_mie_cut.h" @@ -42,6 +69,9 @@ #endif #include "pair_soft.h" #include "pair_table.h" +#ifdef ENABLE_KSPACE +#include "pair_tip4p_long.h" +#endif #ifdef ENABLE_ASPHERE #include "pair_tri_lj.h" #endif diff --git a/cmake/Modules/FindFFTW3.cmake b/cmake/Modules/FindFFTW3.cmake new file mode 100644 index 0000000000..552bcc4257 --- /dev/null +++ b/cmake/Modules/FindFFTW3.cmake @@ -0,0 +1,25 @@ +# - Find fftw3 +# Find the native FFTW3 headers and libraries. +# +# FFTW3_INCLUDE_DIRS - where to find fftw3.h, etc. +# FFTW3_LIBRARIES - List of libraries when using fftw3. +# FFTW3_FOUND - True if fftw3 found. +# + +find_package(PkgConfig) + +pkg_check_modules(PC_FFTW3 fftw3) +find_path(FFTW3_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3_INCLUDE_DIRS}) + +find_library(FFTW3_LIBRARY NAMES fftw3 HINTS ${PC_FFTW3_LIBRARY_DIRS}) + +set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) +set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR) + +mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY ) From 335ef11a7bf555dfcf524e35b142509fb8a572d3 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 17:49:05 -0500 Subject: [PATCH 11/77] Added style header generation with CMake --- cmake/CMakeLists.txt | 41 +++++++++++-- cmake/Headers/package.h.cmakein | 2 - cmake/Headers/style_angle.h | 3 - cmake/Headers/style_atom.h | 9 --- cmake/Headers/style_body.h | 1 - cmake/Headers/style_bond.h | 3 - cmake/Headers/style_command.h | 23 ------- cmake/Headers/style_compute.h | 66 -------------------- cmake/Headers/style_dihedral.h | 3 - cmake/Headers/style_dump.h | 9 --- cmake/Headers/style_fix.h | 92 ---------------------------- cmake/Headers/style_improper.h | 3 - cmake/Headers/style_integrate.h | 3 - cmake/Headers/style_kspace.h | 1 - cmake/Headers/style_minimize.h | 6 -- cmake/Headers/style_nbin.h | 2 - cmake/Headers/style_npair.h | 36 ----------- cmake/Headers/style_nstencil.h | 21 ------- cmake/Headers/style_ntopo.h | 13 ---- cmake/Headers/style_pair.h | 50 --------------- cmake/Headers/style_reader.h | 3 - cmake/Headers/style_region.h | 9 --- cmake/Modules/StyleHeaderUtils.cmake | 81 ++++++++++++++++++++++++ 23 files changed, 117 insertions(+), 363 deletions(-) delete mode 100644 cmake/Headers/package.h.cmakein delete mode 100644 cmake/Headers/style_angle.h delete mode 100644 cmake/Headers/style_atom.h delete mode 100644 cmake/Headers/style_body.h delete mode 100644 cmake/Headers/style_bond.h delete mode 100644 cmake/Headers/style_command.h delete mode 100644 cmake/Headers/style_compute.h delete mode 100644 cmake/Headers/style_dihedral.h delete mode 100644 cmake/Headers/style_dump.h delete mode 100644 cmake/Headers/style_fix.h delete mode 100644 cmake/Headers/style_improper.h delete mode 100644 cmake/Headers/style_integrate.h delete mode 100644 cmake/Headers/style_kspace.h delete mode 100644 cmake/Headers/style_minimize.h delete mode 100644 cmake/Headers/style_nbin.h delete mode 100644 cmake/Headers/style_npair.h delete mode 100644 cmake/Headers/style_nstencil.h delete mode 100644 cmake/Headers/style_ntopo.h delete mode 100644 cmake/Headers/style_pair.h delete mode 100644 cmake/Headers/style_reader.h delete mode 100644 cmake/Headers/style_region.h create mode 100644 cmake/Modules/StyleHeaderUtils.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9db55174fc..c69ca085e8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -5,6 +5,8 @@ set(SOVERSION 0) set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) #release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) @@ -42,6 +44,11 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() +set(ACCEL_PACKAGES USER-OMP) +foreach(PKG ${ACCEL_PACKAGES}) + option(ENABLE_${PKG} "Build ${PKG} Package" OFF) +endforeach() + find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) @@ -101,24 +108,48 @@ if(NOT ENABLE_MPI) include_directories(${LAMMPS_SOURCE_DIR}/STUBS) endif() +include(StyleHeaderUtils) +RegisterStyles(${LAMMPS_SOURCE_DIR}) + +# packages which include entire content when enabled + foreach(PKG ${PACKAGES}) if(ENABLE_${PKG}) - file(GLOB ${PKG}_SOURCES ${LAMMPS_SOURCE_DIR}/${PKG}/*.cpp) + set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) + + # detects styles in package and adds them to global list + RegisterStyles(${${PKG}_SOURCES_DIR}) + + file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp) list(APPEND LIB_SOURCES ${${PKG}_SOURCES}) - include_directories(${LAMMPS_SOURCE_DIR}/${PKG}) + include_directories(${${PKG}_SOURCES_DIR}) endif() endforeach() +# packages which selectively include variants based on enabled styles +# e.g. accelerator packages + +# TODO + if(ENABLE_REAX) enable_language(Fortran) file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) list(APPEND LIB_SOURCES ${REAX_SOURCES}) include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) endif() + + +###################################################### +# Generate style headers based on global list of +# styles registered during package selection +###################################################### +set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles) + +GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR}) + include_directories(${LAMMPS_SOURCE_DIR}) -include_directories(${CMAKE_SOURCE_DIR}/Headers) -configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h) -include_directories(${CMAKE_BINARY_DIR}/cmake) +include_directories(${LAMMPS_STYLE_HEADERS_DIR}) + add_library(lammps ${LIB_SOURCES}) target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) diff --git a/cmake/Headers/package.h.cmakein b/cmake/Headers/package.h.cmakein deleted file mode 100644 index 9c7ff403a4..0000000000 --- a/cmake/Headers/package.h.cmakein +++ /dev/null @@ -1,2 +0,0 @@ -#cmakedefine ENABLE_ASPHERE -#cmakedefine ENABLE_REAX diff --git a/cmake/Headers/style_angle.h b/cmake/Headers/style_angle.h deleted file mode 100644 index 8b395b557f..0000000000 --- a/cmake/Headers/style_angle.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "angle_hybrid.h" -#include "angle_zero.h" diff --git a/cmake/Headers/style_atom.h b/cmake/Headers/style_atom.h deleted file mode 100644 index ec4e5d7d20..0000000000 --- a/cmake/Headers/style_atom.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "package.h" -#include "atom_vec_atomic.h" -#include "atom_vec_body.h" -#include "atom_vec_charge.h" -#include "atom_vec_ellipsoid.h" -#include "atom_vec_hybrid.h" -#include "atom_vec_line.h" -#include "atom_vec_sphere.h" -#include "atom_vec_tri.h" diff --git a/cmake/Headers/style_body.h b/cmake/Headers/style_body.h deleted file mode 100644 index b2b5c1f82e..0000000000 --- a/cmake/Headers/style_body.h +++ /dev/null @@ -1 +0,0 @@ -#include "package.h" diff --git a/cmake/Headers/style_bond.h b/cmake/Headers/style_bond.h deleted file mode 100644 index d18a31ca91..0000000000 --- a/cmake/Headers/style_bond.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "bond_hybrid.h" -#include "bond_zero.h" diff --git a/cmake/Headers/style_command.h b/cmake/Headers/style_command.h deleted file mode 100644 index d795f4ba0a..0000000000 --- a/cmake/Headers/style_command.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "package.h" -#include "balance.h" -#include "change_box.h" -#include "create_atoms.h" -#include "create_bonds.h" -#include "create_box.h" -#include "delete_atoms.h" -#include "delete_bonds.h" -#include "displace_atoms.h" -#include "info.h" -#include "minimize.h" -#include "read_data.h" -#include "read_dump.h" -#include "read_restart.h" -#include "replicate.h" -#include "rerun.h" -#include "run.h" -#include "set.h" -#include "velocity.h" -#include "write_coeff.h" -#include "write_data.h" -#include "write_dump.h" -#include "write_restart.h" diff --git a/cmake/Headers/style_compute.h b/cmake/Headers/style_compute.h deleted file mode 100644 index bfcd053ed6..0000000000 --- a/cmake/Headers/style_compute.h +++ /dev/null @@ -1,66 +0,0 @@ -#include "package.h" -#include "compute_angle.h" -#include "compute_angle_local.h" -#include "compute_angmom_chunk.h" -#include "compute_bond.h" -#include "compute_bond_local.h" -#include "compute_centro_atom.h" -#include "compute_chunk_atom.h" -#include "compute_cluster_atom.h" -#include "compute_cna_atom.h" -#include "compute_com.h" -#include "compute_com_chunk.h" -#include "compute_contact_atom.h" -#include "compute_coord_atom.h" -#include "compute_dihedral.h" -#include "compute_dihedral_local.h" -#include "compute_dipole_chunk.h" -#include "compute_displace_atom.h" -#ifdef ENABLE_ASPHERE -#include "compute_erotate_asphere.h" -#endif -#include "compute_erotate_sphere.h" -#include "compute_erotate_sphere_atom.h" -#include "compute_global_atom.h" -#include "compute_group_group.h" -#include "compute_gyration.h" -#include "compute_gyration_chunk.h" -#include "compute_heat_flux.h" -#include "compute_hexorder_atom.h" -#include "compute_improper.h" -#include "compute_improper_local.h" -#include "compute_inertia_chunk.h" -#include "compute_ke.h" -#include "compute_ke_atom.h" -#include "compute_msd.h" -#include "compute_msd_chunk.h" -#include "compute_omega_chunk.h" -#include "compute_orientorder_atom.h" -#include "compute_pair.h" -#include "compute_pair_local.h" -#include "compute_pe.h" -#include "compute_pe_atom.h" -#include "compute_pressure.h" -#include "compute_property_atom.h" -#include "compute_property_chunk.h" -#include "compute_property_local.h" -#include "compute_rdf.h" -#include "compute_reduce.h" -#include "compute_reduce_region.h" -#include "compute_slice.h" -#include "compute_stress_atom.h" -#include "compute_temp.h" -#ifdef ENABLE_ASPHERE -#include "compute_temp_asphere.h" -#endif -#include "compute_temp_chunk.h" -#include "compute_temp_com.h" -#include "compute_temp_deform.h" -#include "compute_temp_partial.h" -#include "compute_temp_profile.h" -#include "compute_temp_ramp.h" -#include "compute_temp_region.h" -#include "compute_temp_sphere.h" -#include "compute_torque_chunk.h" -#include "compute_vacf.h" -#include "compute_vcm_chunk.h" diff --git a/cmake/Headers/style_dihedral.h b/cmake/Headers/style_dihedral.h deleted file mode 100644 index 26cb4a815a..0000000000 --- a/cmake/Headers/style_dihedral.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "dihedral_hybrid.h" -#include "dihedral_zero.h" diff --git a/cmake/Headers/style_dump.h b/cmake/Headers/style_dump.h deleted file mode 100644 index bc8477a6bf..0000000000 --- a/cmake/Headers/style_dump.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "package.h" -#include "dump_atom.h" -#include "dump_cfg.h" -#include "dump_custom.h" -#include "dump_dcd.h" -#include "dump_image.h" -#include "dump_local.h" -#include "dump_movie.h" -#include "dump_xyz.h" diff --git a/cmake/Headers/style_fix.h b/cmake/Headers/style_fix.h deleted file mode 100644 index 146616124d..0000000000 --- a/cmake/Headers/style_fix.h +++ /dev/null @@ -1,92 +0,0 @@ -#include "package.h" -#include "fix_adapt.h" -#include "fix_addforce.h" -#include "fix_ave_atom.h" -#include "fix_ave_chunk.h" -#include "fix_ave_correlate.h" -#include "fix_ave_histo.h" -#include "fix_ave_histo_weight.h" -#include "fix_ave_time.h" -#include "fix_aveforce.h" -#include "fix_balance.h" -#include "fix_box_relax.h" -#include "fix_controller.h" -#include "fix_deform.h" -#include "fix_deprecated.h" -#include "fix_drag.h" -#include "fix_dt_reset.h" -#include "fix_enforce2d.h" -#include "fix_external.h" -#include "fix_gravity.h" -#include "fix_group.h" -#include "fix_halt.h" -#include "fix_heat.h" -#include "fix_indent.h" -#include "fix_langevin.h" -#include "fix_lineforce.h" -#include "fix_minimize.h" -#include "fix_momentum.h" -#include "fix_move.h" -#include "fix_nph.h" -#ifdef ENABLE_ASPHERE -#include "fix_nph_asphere.h" -#endif -#include "fix_nph_sphere.h" -#include "fix_npt.h" -#ifdef ENABLE_ASPHERE -#include "fix_npt_asphere.h" -#endif -#include "fix_npt_sphere.h" -#include "fix_nve.h" -#ifdef ENABLE_ASPHERE -#include "fix_nve_asphere.h" -#include "fix_nve_asphere_noforce.h" -#endif -#include "fix_nve_limit.h" -#ifdef ENABLE_ASPHERE -#include "fix_nve_line.h" -#endif -#include "fix_nve_noforce.h" -#include "fix_nve_sphere.h" -#ifdef ENABLE_ASPHERE -#include "fix_nve_tri.h" -#endif -#include "fix_nvt.h" -#ifdef ENABLE_ASPHERE -#include "fix_nvt_asphere.h" -#endif -#include "fix_nvt_sllod.h" -#include "fix_nvt_sphere.h" -#include "fix_planeforce.h" -#include "fix_press_berendsen.h" -#include "fix_print.h" -#include "fix_property_atom.h" -#include "fix_read_restart.h" -#ifdef ENABLE_REAX -#include "fix_reax_bonds.h" -#endif -#include "fix_recenter.h" -#include "fix_respa.h" -#include "fix_restrain.h" -#include "fix_setforce.h" -#include "fix_shear_history.h" -#include "fix_spring.h" -#include "fix_spring_chunk.h" -#include "fix_spring_rg.h" -#include "fix_spring_self.h" -#include "fix_store.h" -#include "fix_store_force.h" -#include "fix_store_state.h" -#include "fix_temp_berendsen.h" -#include "fix_temp_csld.h" -#include "fix_temp_csvr.h" -#include "fix_temp_rescale.h" -#include "fix_tmd.h" -#include "fix_vector.h" -#include "fix_viscous.h" -#include "fix_wall_harmonic.h" -#include "fix_wall_lj1043.h" -#include "fix_wall_lj126.h" -#include "fix_wall_lj93.h" -#include "fix_wall_reflect.h" -#include "fix_wall_region.h" diff --git a/cmake/Headers/style_improper.h b/cmake/Headers/style_improper.h deleted file mode 100644 index 3de3047d73..0000000000 --- a/cmake/Headers/style_improper.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "improper_hybrid.h" -#include "improper_zero.h" diff --git a/cmake/Headers/style_integrate.h b/cmake/Headers/style_integrate.h deleted file mode 100644 index 0a2fd00cf7..0000000000 --- a/cmake/Headers/style_integrate.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "respa.h" -#include "verlet.h" diff --git a/cmake/Headers/style_kspace.h b/cmake/Headers/style_kspace.h deleted file mode 100644 index b2b5c1f82e..0000000000 --- a/cmake/Headers/style_kspace.h +++ /dev/null @@ -1 +0,0 @@ -#include "package.h" diff --git a/cmake/Headers/style_minimize.h b/cmake/Headers/style_minimize.h deleted file mode 100644 index 35d9188e8d..0000000000 --- a/cmake/Headers/style_minimize.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "package.h" -#include "min_cg.h" -#include "min_fire.h" -#include "min_hftn.h" -#include "min_quickmin.h" -#include "min_sd.h" diff --git a/cmake/Headers/style_nbin.h b/cmake/Headers/style_nbin.h deleted file mode 100644 index f0d52b05bc..0000000000 --- a/cmake/Headers/style_nbin.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "package.h" -#include "nbin_standard.h" diff --git a/cmake/Headers/style_npair.h b/cmake/Headers/style_npair.h deleted file mode 100644 index bd403ebeeb..0000000000 --- a/cmake/Headers/style_npair.h +++ /dev/null @@ -1,36 +0,0 @@ -#include "package.h" -#include "npair_copy.h" -#include "npair_full_bin.h" -#include "npair_full_bin_atomonly.h" -#include "npair_full_bin_ghost.h" -#include "npair_full_multi.h" -#include "npair_full_nsq.h" -#include "npair_full_nsq_ghost.h" -#include "npair_half_bin_atomonly_newton.h" -#include "npair_half_bin_newtoff.h" -#include "npair_half_bin_newtoff_ghost.h" -#include "npair_half_bin_newton.h" -#include "npair_half_bin_newton_tri.h" -#include "npair_half_multi_newtoff.h" -#include "npair_half_multi_newton.h" -#include "npair_half_multi_newton_tri.h" -#include "npair_half_nsq_newtoff.h" -#include "npair_half_nsq_newtoff_ghost.h" -#include "npair_half_nsq_newton.h" -#include "npair_half_respa_bin_newtoff.h" -#include "npair_half_respa_bin_newton.h" -#include "npair_half_respa_bin_newton_tri.h" -#include "npair_half_respa_nsq_newtoff.h" -#include "npair_half_respa_nsq_newton.h" -#include "npair_half_size_bin_newtoff.h" -#include "npair_half_size_bin_newton.h" -#include "npair_half_size_bin_newton_tri.h" -#include "npair_half_size_nsq_newtoff.h" -#include "npair_half_size_nsq_newton.h" -#include "npair_halffull_newtoff.h" -#include "npair_halffull_newton.h" -#include "npair_skip.h" -#include "npair_skip_respa.h" -#include "npair_skip_size.h" -#include "npair_skip_size_off2on.h" -#include "npair_skip_size_off2on_oneside.h" diff --git a/cmake/Headers/style_nstencil.h b/cmake/Headers/style_nstencil.h deleted file mode 100644 index d28e4b23b1..0000000000 --- a/cmake/Headers/style_nstencil.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "package.h" -#include "nstencil_full_bin_2d.h" -#include "nstencil_full_bin_3d.h" -#include "nstencil_full_ghost_bin_2d.h" -#include "nstencil_full_ghost_bin_3d.h" -#include "nstencil_full_multi_2d.h" -#include "nstencil_full_multi_3d.h" -#include "nstencil_half_bin_2d_newtoff.h" -#include "nstencil_half_bin_2d_newton.h" -#include "nstencil_half_bin_2d_newton_tri.h" -#include "nstencil_half_bin_3d_newtoff.h" -#include "nstencil_half_bin_3d_newton.h" -#include "nstencil_half_bin_3d_newton_tri.h" -#include "nstencil_half_ghost_bin_2d_newtoff.h" -#include "nstencil_half_ghost_bin_3d_newtoff.h" -#include "nstencil_half_multi_2d_newtoff.h" -#include "nstencil_half_multi_2d_newton.h" -#include "nstencil_half_multi_2d_newton_tri.h" -#include "nstencil_half_multi_3d_newtoff.h" -#include "nstencil_half_multi_3d_newton.h" -#include "nstencil_half_multi_3d_newton_tri.h" diff --git a/cmake/Headers/style_ntopo.h b/cmake/Headers/style_ntopo.h deleted file mode 100644 index 130b10200f..0000000000 --- a/cmake/Headers/style_ntopo.h +++ /dev/null @@ -1,13 +0,0 @@ -#include "package.h" -#include "ntopo_angle_all.h" -#include "ntopo_angle_partial.h" -#include "ntopo_angle_template.h" -#include "ntopo_bond_all.h" -#include "ntopo_bond_partial.h" -#include "ntopo_bond_template.h" -#include "ntopo_dihedral_all.h" -#include "ntopo_dihedral_partial.h" -#include "ntopo_dihedral_template.h" -#include "ntopo_improper_all.h" -#include "ntopo_improper_partial.h" -#include "ntopo_improper_template.h" diff --git a/cmake/Headers/style_pair.h b/cmake/Headers/style_pair.h deleted file mode 100644 index 067e2cdb23..0000000000 --- a/cmake/Headers/style_pair.h +++ /dev/null @@ -1,50 +0,0 @@ -#include "package.h" -#include "pair_beck.h" -#include "pair_born.h" -#include "pair_born_coul_dsf.h" -#include "pair_born_coul_wolf.h" -#include "pair_buck.h" -#include "pair_buck_coul_cut.h" -#include "pair_coul_cut.h" -#include "pair_coul_debye.h" -#include "pair_coul_dsf.h" -#include "pair_coul_streitz.h" -#include "pair_coul_wolf.h" -#include "pair_dpd.h" -#include "pair_dpd_tstat.h" -#include "pair_gauss.h" -#ifdef ENABLE_ASPHERE -#include "pair_gayberne.h" -#endif -#include "pair_hybrid.h" -#include "pair_hybrid_overlay.h" -#ifdef ENABLE_ASPHERE -#include "pair_line_lj.h" -#endif -#include "pair_lj96_cut.h" -#include "pair_lj_cubic.h" -#include "pair_lj_cut.h" -#include "pair_lj_cut_coul_cut.h" -#include "pair_lj_cut_coul_debye.h" -#include "pair_lj_cut_coul_dsf.h" -#include "pair_lj_expand.h" -#include "pair_lj_gromacs.h" -#include "pair_lj_gromacs_coul_gromacs.h" -#include "pair_lj_smooth.h" -#include "pair_lj_smooth_linear.h" -#include "pair_mie_cut.h" -#include "pair_morse.h" -#ifdef ENABLE_REAX -#include "pair_reax.h" -#endif -#ifdef ENABLE_ASPHERE -#include "pair_resquared.h" -#endif -#include "pair_soft.h" -#include "pair_table.h" -#ifdef ENABLE_ASPHERE -#include "pair_tri_lj.h" -#endif -#include "pair_yukawa.h" -#include "pair_zbl.h" -#include "pair_zero.h" diff --git a/cmake/Headers/style_reader.h b/cmake/Headers/style_reader.h deleted file mode 100644 index 0b8145e13d..0000000000 --- a/cmake/Headers/style_reader.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "package.h" -#include "reader_native.h" -#include "reader_xyz.h" diff --git a/cmake/Headers/style_region.h b/cmake/Headers/style_region.h deleted file mode 100644 index dc467b2a3d..0000000000 --- a/cmake/Headers/style_region.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "package.h" -#include "region_block.h" -#include "region_cone.h" -#include "region_cylinder.h" -#include "region_intersect.h" -#include "region_plane.h" -#include "region_prism.h" -#include "region_sphere.h" -#include "region_union.h" diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake new file mode 100644 index 0000000000..2ee9496671 --- /dev/null +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -0,0 +1,81 @@ +function(FindStyleHeaders path style_class file_pattern headers) + file(GLOB files "${path}/${file_pattern}*.h") + get_property(hlist GLOBAL PROPERTY ${headers}) + + foreach(file_name ${files}) + file(STRINGS ${file_name} is_style LIMIT_COUNT 1 REGEX ${style_class}) + if(is_style) + list(APPEND hlist ${file_name}) + endif() + endforeach() + set_property(GLOBAL PROPERTY ${headers} "${hlist}") +endfunction(FindStyleHeaders) + +function(CreateStyleHeader path filename) + math(EXPR N "${ARGC}-2") + + set(temp "") + if(N GREATER 0) + math(EXPR ARG_END "${ARGC}-1") + + foreach(IDX RANGE 2 ${ARG_END}) + list(GET ARGV ${IDX} FNAME) + get_filename_component(FNAME ${FNAME} NAME) + set(temp "${temp}#include \"${FNAME}\"\n") + endforeach() + endif() + message("Generating ${filename}...") + file(WRITE "${path}/${filename}" "${temp}" ) +endfunction(CreateStyleHeader) + +function(GenerateStyleHeader path property style) + get_property(files GLOBAL PROPERTY ${property}) + #message("${property} = ${files}") + CreateStyleHeader("${path}" "style_${style}.h" ${files}) +endfunction(GenerateStyleHeader) + +function(RegisterStyles search_path) + FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force + FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid + FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body + FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force + FindStyleHeaders(${search_path} COMMAND_CLASS "" COMMAND ) # command ) # input + FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify + FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force + FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump + FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify + FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force + FindStyleHeaders(${search_path} INTEGRATE_CLASS "" INTEGRATE ) # integrate ) # update + FindStyleHeaders(${search_path} KSPACE_CLASS "" KSPACE ) # kspace ) # force + FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update + FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor + FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor + FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor + FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor + FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force + FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump + FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain +endfunction(RegisterStyles) + +function(GenerateStyleHeaders output_path) + GenerateStyleHeader(${output_path} ANGLE angle ) # force + GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid + GenerateStyleHeader(${output_path} BODY body ) # atom_vec_body + GenerateStyleHeader(${output_path} BOND bond ) # force + GenerateStyleHeader(${output_path} COMMAND command ) # input + GenerateStyleHeader(${output_path} COMPUTE compute ) # modify + GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force + GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump + GenerateStyleHeader(${output_path} FIX fix ) # modify + GenerateStyleHeader(${output_path} IMPROPER improper ) # force + GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update + GenerateStyleHeader(${output_path} KSPACE kspace ) # force + GenerateStyleHeader(${output_path} MINIMIZE minimize ) # update + GenerateStyleHeader(${output_path} NBIN nbin ) # neighbor + GenerateStyleHeader(${output_path} NPAIR npair ) # neighbor + GenerateStyleHeader(${output_path} NSTENCIL nstencil ) # neighbor + GenerateStyleHeader(${output_path} NTOPO ntopo ) # neighbor + GenerateStyleHeader(${output_path} PAIR pair ) # force + GenerateStyleHeader(${output_path} READER reader ) # read_dump + GenerateStyleHeader(${output_path} REGION region ) # domain +endfunction(GenerateStyleHeaders) From b85979503ffc41a83750efa5caae14e331af9091 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 18:19:59 -0500 Subject: [PATCH 12/77] Add CMake support for more packages BODY, COLLOID, CLASS2, COMPRESS, CORESHELL, DIPOLE, GRANULAR, MC, MOLECULE, MANYBODY, RIGID --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 74785d340f..7fc2304a4c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -40,7 +40,7 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) -set(PACKAGES ASPHERE KSPACE REAX) +set(PACKAGES ASPHERE BODY COLLOID CLASS2 COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MC MOLECULE MANYBODY RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() From 0a6e9c8bf676a12ef9a6dad0c8b67eb2b10e5eff Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 17:41:13 -0600 Subject: [PATCH 13/77] added ENABLE_ALL option --- cmake/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7fc2304a4c..5cff0f0a54 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -40,9 +40,10 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) +option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY COLLOID CLASS2 COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MC MOLECULE MANYBODY RIGID REAX) foreach(PKG ${PACKAGES}) - option(ENABLE_${PKG} "Build ${PKG} Package" OFF) + option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() set(ACCEL_PACKAGES USER-OMP) @@ -169,3 +170,9 @@ install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTI add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) install(TARGETS lammps DESTINATION ${CMAKE_INSTALL_BINDIR}) + +foreach(PKG ${PACKAGES} ${ACCEL_PACKAGES}) + if(ENABLE_${PKG}) + message(STATUS "Building package: ${PKG}") + endif() +endforeach() From 54f2b02ac813f5931a8e4118395ccc86078d583b Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 18:33:27 -0600 Subject: [PATCH 14/77] cmake: fix install --- cmake/CMakeLists.txt | 10 ++++++++-- cmake/Modules/StyleHeaderUtils.cmake | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5cff0f0a54..96d1595f6b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -26,6 +26,7 @@ include(CheckCCompilerFlag) # User input options # ######################################################################## option(BUILD_SHARED_LIBS "Build shared libs" OFF) +option(INSTALL_LIB "Install lammps library and header" ON) include(GNUInstallDirs) set(LAMMPS_LINK_LIBS) @@ -165,11 +166,16 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR}) add_library(lammps ${LIB_SOURCES}) target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) -install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +if(INSTALL_LIB) + install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +elseif(NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "Shared library has to install, use -DBUILD_SHARED_LIBS=OFF to install lammps with a a library") +endif() add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) -install(TARGETS lammps DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) foreach(PKG ${PACKAGES} ${ACCEL_PACKAGES}) if(ENABLE_${PKG}) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 2ee9496671..bbb93e6145 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -24,7 +24,7 @@ function(CreateStyleHeader path filename) set(temp "${temp}#include \"${FNAME}\"\n") endforeach() endif() - message("Generating ${filename}...") + message(STATUS "Generating ${filename}...") file(WRITE "${path}/${filename}" "${temp}" ) endfunction(CreateStyleHeader) From d079b2f758fe1a0235897d9f74376fda07a8ed69 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 18:37:06 -0600 Subject: [PATCH 15/77] CreateStyleHeader: use temp file --- cmake/Modules/StyleHeaderUtils.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index bbb93e6145..b0b9bd9418 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -25,7 +25,8 @@ function(CreateStyleHeader path filename) endforeach() endif() message(STATUS "Generating ${filename}...") - file(WRITE "${path}/${filename}" "${temp}" ) + file(WRITE "${path}/${filename}.tmp" "${temp}" ) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${path}/${filename}.tmp" "${path}/${filename}") endfunction(CreateStyleHeader) function(GenerateStyleHeader path property style) From 5e841bfe1522a4ea54baed7472d5ee74243bacfa Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 14 Jul 2017 22:07:53 -0500 Subject: [PATCH 16/77] Added USER-OMP support to CMake build --- cmake/CMakeLists.txt | 28 ++++++++++++++-- cmake/Modules/StyleHeaderUtils.cmake | 50 ++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7fc2304a4c..35c0708d36 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -45,7 +45,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() -set(ACCEL_PACKAGES USER-OMP) +set(ACCEL_PACKAGES USER_OMP) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -139,7 +139,31 @@ endforeach() # packages which selectively include variants based on enabled styles # e.g. accelerator packages -# TODO +if(ENABLE_USER_OMP) + find_package(OpenMP REQUIRED) + if (OPENMP_FOUND) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + else() + message(FATAL_ERROR "USER-OMP requires a compiler with OpenMP support") + endif() + + set(USER_OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP) + set(USER_OMP_SOURCES ${USER_OMP_SOURCES_DIR}/thr_data.cpp + ${USER_OMP_SOURCES_DIR}/thr_omp.cpp + ${USER_OMP_SOURCES_DIR}/fix_nh_omp.cpp + ${USER_OMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp) + set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER_OMP_SOURCES}") + + # detects styles which have USER-OMP version + RegisterStylesExt(${USER_OMP_SOURCES_DIR} omp OMP_SOURCES) + + get_property(USER_OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES) + + list(APPEND LIB_SOURCES ${USER_OMP_SOURCES}) + include_directories(${USER_OMP_SOURCES_DIR}) +endif() + if(ENABLE_REAX) enable_language(Fortran) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 2ee9496671..55a6c15223 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -11,6 +11,33 @@ function(FindStyleHeaders path style_class file_pattern headers) set_property(GLOBAL PROPERTY ${headers} "${hlist}") endfunction(FindStyleHeaders) +function(FindStyleHeadersExt path style_class extension headers sources) + get_property(hlist GLOBAL PROPERTY ${headers}) + get_property(slist GLOBAL PROPERTY ${sources}) + set(ext_list) + get_filename_component(abs_path "${path}" ABSOLUTE) + + foreach(file_name ${hlist}) + get_filename_component(basename ${file_name} NAME_WE) + set(ext_file_name "${abs_path}/${basename}_${extension}.h") + if(EXISTS "${ext_file_name}") + file(STRINGS ${ext_file_name} is_style LIMIT_COUNT 1 REGEX ${style_class}) + if(is_style) + list(APPEND ext_list ${ext_file_name}) + + set(source_file_name "${abs_path}/${basename}_${extension}.cpp") + if(EXISTS "${source_file_name}") + list(APPEND slist ${source_file_name}) + endif() + endif() + endif() + endforeach() + + list(APPEND hlist ${ext_list}) + set_property(GLOBAL PROPERTY ${headers} "${hlist}") + set_property(GLOBAL PROPERTY ${sources} "${slist}") +endfunction(FindStyleHeadersExt) + function(CreateStyleHeader path filename) math(EXPR N "${ARGC}-2") @@ -57,6 +84,29 @@ function(RegisterStyles search_path) FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain endfunction(RegisterStyles) +function(RegisterStylesExt search_path extension sources) + FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources}) + FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources}) + FindStyleHeadersExt(${search_path} BODY_CLASS ${extension} BODY ${sources}) + FindStyleHeadersExt(${search_path} BOND_CLASS ${extension} BOND ${sources}) + FindStyleHeadersExt(${search_path} COMMAND_CLASS ${extension} COMMAND ${sources}) + FindStyleHeadersExt(${search_path} COMPUTE_CLASS ${extension} COMPUTE ${sources}) + FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources}) + FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources}) + FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources}) + FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources}) + FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources}) + FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources}) + FindStyleHeadersExt(${search_path} MINIMIZE_CLASS ${extension} MINIMIZE ${sources}) + FindStyleHeadersExt(${search_path} NBIN_CLASS ${extension} NBIN ${sources}) + FindStyleHeadersExt(${search_path} NPAIR_CLASS ${extension} NPAIR ${sources}) + FindStyleHeadersExt(${search_path} NSTENCIL_CLASS ${extension} NSTENCIL ${sources}) + FindStyleHeadersExt(${search_path} NTOPO_CLASS ${extension} NTOPO ${sources}) + FindStyleHeadersExt(${search_path} PAIR_CLASS ${extension} PAIR ${sources}) + FindStyleHeadersExt(${search_path} READER_CLASS ${extension} READER ${sources}) + FindStyleHeadersExt(${search_path} REGION_CLASS ${extension} REGION ${sources}) +endfunction(RegisterStylesExt) + function(GenerateStyleHeaders output_path) GenerateStyleHeader(${output_path} ANGLE angle ) # force GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid From acd315e97a7ce25fa2b1d8ef6825ecfd36ecc172 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 15 Jul 2017 15:33:36 -0500 Subject: [PATCH 17/77] Add basic KOKKOS support to CMake build --- cmake/CMakeLists.txt | 59 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index eb84d0eb6a..e23cfa67ff 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -4,6 +4,7 @@ project(lammps) set(SOVERSION 0) set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) +set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib) # Cmake modules/macros are in a subdirectory to keep this file cleaner set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) @@ -47,7 +48,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -set(ACCEL_PACKAGES USER_OMP) +set(ACCEL_PACKAGES USER_OMP KOKKOS) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -61,6 +62,24 @@ if(ENABLE_KSPACE) endif() endif() +if(ENABLE_KOKKOS) + # starting with CMake 3.1 this is all you have to do to enforce C++11 + set (CMAKE_CXX_STANDARD 11) + set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) + set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) + add_definitions(-DLMP_KOKKOS) + add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + message("KOKKOS_DIRS: ${Kokkos_INCLUDE_DIRS}") + + # TODO there probably is a better way + set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src + ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src + ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src + ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + include_directories(${Kokkos_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${Kokkos_LIBRARIES}) +endif() + find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) @@ -166,6 +185,38 @@ if(ENABLE_USER_OMP) include_directories(${USER_OMP_SOURCES_DIR}) endif() +if(ENABLE_KOKKOS) + find_package(OpenMP REQUIRED) + if (OPENMP_FOUND) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + else() + message(FATAL_ERROR "USER-OMP requires a compiler with OpenMP support") + endif() + + set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS) + set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neighbor_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neigh_list_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neigh_bond_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/fix_nh_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp) + set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") + + # detects styles which have KOKKOS version + RegisterStylesExt(${KOKKOS_PKG_SOURCES_DIR} kokkos KOKKOS_PKG_SOURCES) + + get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES) + + list(APPEND LIB_SOURCES ${KOKKOS_PKG_SOURCES}) + include_directories(${KOKKOS_PKG_SOURCES_DIR}) +endif() + if(ENABLE_REAX) enable_language(Fortran) @@ -190,6 +241,11 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR}) add_library(lammps ${LIB_SOURCES}) target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) + +if(ENABLE_KOKKOS) + target_link_libraries(lammps kokkos) +endif() + if(INSTALL_LIB) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) @@ -199,6 +255,7 @@ endif() add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) + install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) foreach(PKG ${PACKAGES} ${ACCEL_PACKAGES}) From 629f1129150d2b6af7ec28ba72aea0eac95aff50 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sat, 15 Jul 2017 16:44:03 -0600 Subject: [PATCH 18/77] add support for MEAM --- cmake/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index eb84d0eb6a..c0153e3d6b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) -set(PACKAGES ASPHERE BODY COLLOID CLASS2 COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MC MOLECULE MANYBODY RIGID REAX) +set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MOLECULE RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -167,13 +167,22 @@ if(ENABLE_USER_OMP) endif() -if(ENABLE_REAX) +if(ENABLE_REAX OR ENABLE_MEAM) enable_language(Fortran) +endif() + +if(ENABLE_REAX) file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) list(APPEND LIB_SOURCES ${REAX_SOURCES}) include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) endif() +if(ENABLE_MEAM) + file(GLOB MEAM_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/meam/*.F ${LAMMPS_LIB_SOURCE_DIR}/meam/*.c) + list(APPEND LIB_SOURCES ${MEAM_SOURCES}) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/meam) +endif() + ###################################################### # Generate style headers based on global list of From 23540cfc94148a2388892f705491a865e93c7c40 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sat, 15 Jul 2017 16:46:20 -0600 Subject: [PATCH 19/77] enable MISC --- cmake/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f81f8f120a..5aa8a7a358 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -43,7 +43,8 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) -set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MOLECULE RIGID REAX) +set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR + KSPACE MANYBODY MC MEAM MISC MOLECULE RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() From fa1f38596c08c4da5570d0d9fdd31969405a7de7 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 15 Jul 2017 18:29:33 -0500 Subject: [PATCH 20/77] Add support for PYTHON in CMake build --- cmake/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5aa8a7a358..a16cad55eb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -44,7 +44,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE PYTHON RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -81,6 +81,17 @@ if(ENABLE_KOKKOS) list(APPEND LAMMPS_LINK_LIBS ${Kokkos_LIBRARIES}) endif() +if(ENABLE_PYTHON) + find_package(PythonLibs) + if(PYTHONLIBS_FOUND) + add_definitions(-DLMP_PYTHON) + include_directories(${PYTHON_INCLUDE_DIR}) + list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) + else() + message(FATAL_ERROR "Could not find needed Python libraries and headers") + endif() +endif() + find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) From 01f5136584b3faf7010f48feddb31257a7ce8803 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 08:22:19 -0600 Subject: [PATCH 21/77] cmake: clean up --- cmake/CMakeLists.txt | 89 +++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 51 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a16cad55eb..7b1aa6363a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -38,8 +38,6 @@ if(ENABLE_MPI) list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES}) endif() -find_package(UnixCommands) - option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) @@ -64,13 +62,10 @@ if(ENABLE_KSPACE) endif() if(ENABLE_KOKKOS) - # starting with CMake 3.1 this is all you have to do to enforce C++11 - set (CMAKE_CXX_STANDARD 11) set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) add_definitions(-DLMP_KOKKOS) add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) - message("KOKKOS_DIRS: ${Kokkos_INCLUDE_DIRS}") # TODO there probably is a better way set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src @@ -78,18 +73,14 @@ if(ENABLE_KOKKOS) ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src ${LAMMPS_LIB_KOKKOS_BIN_DIR}) include_directories(${Kokkos_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${Kokkos_LIBRARIES}) + list(APPEND LAMMPS_LINK_LIBS kokkos) endif() if(ENABLE_PYTHON) - find_package(PythonLibs) - if(PYTHONLIBS_FOUND) - add_definitions(-DLMP_PYTHON) - include_directories(${PYTHON_INCLUDE_DIR}) - list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) - else() - message(FATAL_ERROR "Could not find needed Python libraries and headers") - endif() + find_package(PythonLibs REQUIRED) + add_definitions(-DLMP_PYTHON) + include_directories(${PYTHON_INCLUDE_DIR}) + list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) endif() find_package(JPEG) @@ -169,18 +160,43 @@ foreach(PKG ${PACKAGES}) endif() endforeach() +if(ENABLE_REAX OR ENABLE_MEAM) + enable_language(Fortran) +endif() + + +if(ENABLE_KOKKOS) + # starting with CMake 3.1 this is all you have to do to enforce C++11 + set(CMAKE_CXX_STANDARD 11) # C++11... + set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required... + set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 +endif() + +if(ENABLE_USER_OMP OR ENABLE_KOKKOS) + find_package(OpenMP REQUIRED) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +endif() + + +if(ENABLE_REAX) + file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) + list(APPEND LIB_SOURCES ${REAX_SOURCES}) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) +endif() + +if(ENABLE_MEAM) + file(GLOB MEAM_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/meam/*.F ${LAMMPS_LIB_SOURCE_DIR}/meam/*.c) + list(APPEND LIB_SOURCES ${MEAM_SOURCES}) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/meam) +endif() + +###################################################################### # packages which selectively include variants based on enabled styles # e.g. accelerator packages +###################################################################### if(ENABLE_USER_OMP) - find_package(OpenMP REQUIRED) - if (OPENMP_FOUND) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - else() - message(FATAL_ERROR "USER-OMP requires a compiler with OpenMP support") - endif() - set(USER_OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP) set(USER_OMP_SOURCES ${USER_OMP_SOURCES_DIR}/thr_data.cpp ${USER_OMP_SOURCES_DIR}/thr_omp.cpp @@ -198,14 +214,6 @@ if(ENABLE_USER_OMP) endif() if(ENABLE_KOKKOS) - find_package(OpenMP REQUIRED) - if (OPENMP_FOUND) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - else() - message(FATAL_ERROR "USER-OMP requires a compiler with OpenMP support") - endif() - set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS) set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp @@ -230,23 +238,6 @@ if(ENABLE_KOKKOS) endif() -if(ENABLE_REAX OR ENABLE_MEAM) - enable_language(Fortran) -endif() - -if(ENABLE_REAX) - file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) - list(APPEND LIB_SOURCES ${REAX_SOURCES}) - include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) -endif() - -if(ENABLE_MEAM) - file(GLOB MEAM_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/meam/*.F ${LAMMPS_LIB_SOURCE_DIR}/meam/*.c) - list(APPEND LIB_SOURCES ${MEAM_SOURCES}) - include_directories(${LAMMPS_LIB_SOURCE_DIR}/meam) -endif() - - ###################################################### # Generate style headers based on global list of # styles registered during package selection @@ -263,10 +254,6 @@ add_library(lammps ${LIB_SOURCES}) target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) -if(ENABLE_KOKKOS) - target_link_libraries(lammps kokkos) -endif() - if(INSTALL_LIB) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) From f50a757dc6d34f3a6379fadfa0bdec3ea3a76d3a Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 08:32:14 -0600 Subject: [PATCH 22/77] added MPIIO support --- cmake/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7b1aa6363a..493bafc3ad 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE PYTHON RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MPIIO PYTHON RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -52,6 +52,10 @@ foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() +if(ENABLE_MPIIO AND NOT ENABLE_MPI) + message(FATAL_ERROR "MPIIO package needed to LAMMPS to be build with mpi") +endif() + if(ENABLE_KSPACE) find_package(FFTW3) if(FFTW3_FOUND) From 95d9d323075b204a0663f104f4a0b2efe20b9dcd Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 10:37:24 -0600 Subject: [PATCH 23/77] add support for MSCG --- cmake/CMakeLists.txt | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 493bafc3ad..0032c8100e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MPIIO PYTHON RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PYTHON RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -169,7 +169,7 @@ if(ENABLE_REAX OR ENABLE_MEAM) endif() -if(ENABLE_KOKKOS) +if(ENABLE_KOKKOS OR ENABLE_MSCG) # starting with CMake 3.1 this is all you have to do to enforce C++11 set(CMAKE_CXX_STANDARD 11) # C++11... set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required... @@ -195,6 +195,33 @@ if(ENABLE_MEAM) include_directories(${LAMMPS_LIB_SOURCE_DIR}/meam) endif() +if(ENABLE_MSCG) + find_package(GSL REQUIRED) + find_package(LAPACK REQUIRED) + set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) + set(MSCG_TARBALL ${LAMMPS_LIB_MSCG_BIN_DIR}/MS-CG-master.zip) + set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_MSCG_BIN_DIR}/MSCG-release-master/src) + if(NOT EXISTS ${LAMMPS_LIB_MSCG_BIN_DIR}) + if(NOT EXISTS ${MSCG_TARBALL}) + message(STATUS "Downloading ${MSCG_TARBALL}") + file(DOWNLOAD + https://github.com/uchicago-voth/MSCG-release/archive/master.zip + ${MSCG_TARBALL} SHOW_PROGRESS) #EXPECTED_MD5 cannot be due due to master + endif() + message(STATUS "Unpacking ${MSCG_TARBALL}") + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ${MSCG_TARBALL} + WORKING_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/mscg) + endif() + file(GLOB MSCG_SOURCES ${LAMMPS_LIB_MSCG_BIN_DIR}/*.cpp) + list(APPEND LIB_SOURCES ${MSCG_SOURCES}) + foreach(MSCG_SOURCE ${MSCG_SOURCES}) + set_property(SOURCE ${MSCG_SOURCE} APPEND PROPERTY COMPILE_DEFINITIONS + DIMENSION=3 _exclude_gromacs=1) + endforeach() + include_directories(${LAMMPS_LIB_MSCG_BIN_DIR} ${GSL_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${GSL_LIBRARIES} ${LAPACK_LIBRARIES}) +endif() + ###################################################################### # packages which selectively include variants based on enabled styles # e.g. accelerator packages From 4812d4c659f6e3e7e178744f5721e0419e2da442 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 10:48:29 -0600 Subject: [PATCH 24/77] enable PERI --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0032c8100e..eb613a8089 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PYTHON RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI PYTHON RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() From 742eee1966c1c43e3df1700a08b7dfe81d431d99 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 11:07:36 -0600 Subject: [PATCH 25/77] added support for POEMS --- cmake/CMakeLists.txt | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index eb613a8089..7f825f012e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI PYTHON RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON RIGID REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -182,18 +182,15 @@ if(ENABLE_USER_OMP OR ENABLE_KOKKOS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() - -if(ENABLE_REAX) - file(GLOB REAX_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/reax/*.F) - list(APPEND LIB_SOURCES ${REAX_SOURCES}) - include_directories(${LAMMPS_LIB_SOURCE_DIR}/reax) -endif() - -if(ENABLE_MEAM) - file(GLOB MEAM_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/meam/*.F ${LAMMPS_LIB_SOURCE_DIR}/meam/*.c) - list(APPEND LIB_SOURCES ${MEAM_SOURCES}) - include_directories(${LAMMPS_LIB_SOURCE_DIR}/meam) -endif() +foreach(SIMPLE_LIB REAX MEAM POEMS) + if(ENABLE_${SIMPLE_LIB}) + string(TOLOWER "${SIMPLE_LIB}" INC_DIR) + file(GLOB ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F + ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.cpp) + list(APPEND LIB_SOURCES ${${SIMPLE_LIB}_SOURCES}) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}) + endif() +endforeach() if(ENABLE_MSCG) find_package(GSL REQUIRED) From 140182fb0bb01c46d50352c347c24c8cc2eb9be5 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 11:14:08 -0600 Subject: [PATCH 26/77] added support for QEQ --- cmake/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7f825f012e..d6289fb37c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,8 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON RIGID REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON RIGID QEQ + REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -52,9 +53,14 @@ foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() -if(ENABLE_MPIIO AND NOT ENABLE_MPI) - message(FATAL_ERROR "MPIIO package needed to LAMMPS to be build with mpi") -endif() +macro(pkg_depends PKG1 PKG2) + if(ENABLE_${PKG1} AND NOT ENABLE_${PKG2}) + message(FATAL_ERROR "${PKG1} package needed to LAMMPS to be build with ${PKG2}") + endif() +endmacro() + +pkg_depends(MPIIO MPI) +pkg_depends(QEQ MANYBODY) if(ENABLE_KSPACE) find_package(FFTW3) From c549a16a85ad022796841e0de3daf05733b7a906 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 11:29:31 -0600 Subject: [PATCH 27/77] enable REPLICA RIGID SHOCK SNAP SRD VORONOI --- cmake/CMakeLists.txt | 11 +++++++++-- cmake/Modules/FindVORO.cmake | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 cmake/Modules/FindVORO.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d6289fb37c..54864a8a48 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,8 +42,8 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON RIGID QEQ - REAX) + KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ + REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -113,6 +113,13 @@ if(GZIP) add_definitions(-DLAMMPS_GZIP) endif() +if(ENABLE_VORONOI) + find_package(VORO REQUIRED) #some distros + include_directories(${VORO_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES}) + #TODO download and build voro++ +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## diff --git a/cmake/Modules/FindVORO.cmake b/cmake/Modules/FindVORO.cmake new file mode 100644 index 0000000000..b0cccbcd1d --- /dev/null +++ b/cmake/Modules/FindVORO.cmake @@ -0,0 +1,22 @@ +# - Find voro++ +# Find the native VORO headers and libraries. +# +# VORO_INCLUDE_DIRS - where to find voro++.hh, etc. +# VORO_LIBRARIES - List of libraries when using voro++. +# VORO_FOUND - True if voro++ found. +# + +find_path(VORO_INCLUDE_DIR voro++.hh PATH_SUFFIXES voro++) + +find_library(VORO_LIBRARY NAMES voro++) + +set(VORO_LIBRARIES ${VORO_LIBRARY}) +set(VORO_INCLUDE_DIRS ${VORO_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set VORO_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(VORO DEFAULT_MSG VORO_LIBRARY VORO_INCLUDE_DIR) + +mark_as_advanced(VORO_INCLUDE_DIR VORO_LIBRARY ) From c64424754d32705c6fc5dc7f867baea94e5dd204 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 16:18:58 -0600 Subject: [PATCH 28/77] added USER-ATC --- cmake/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 54864a8a48..46203f43dc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -43,7 +43,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ - REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) + REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -55,12 +55,13 @@ endforeach() macro(pkg_depends PKG1 PKG2) if(ENABLE_${PKG1} AND NOT ENABLE_${PKG2}) - message(FATAL_ERROR "${PKG1} package needed to LAMMPS to be build with ${PKG2}") + message(FATAL_ERROR "${PKG1} package needs LAMMPS to be build with ${PKG2}") endif() endmacro() pkg_depends(MPIIO MPI) pkg_depends(QEQ MANYBODY) +pkg_depends(USER-ATC MANYBODY) if(ENABLE_KSPACE) find_package(FFTW3) @@ -86,6 +87,11 @@ if(ENABLE_KOKKOS) list(APPEND LAMMPS_LINK_LIBS kokkos) endif() +if(ENABLE_MSCG OR ENABLE_USER-ATC) + find_package(LAPACK REQUIRED) + list(APPEND LAMMPS_LINK_LIBS ${LAPACK_LIBRARIES}) +endif() + if(ENABLE_PYTHON) find_package(PythonLibs REQUIRED) add_definitions(-DLMP_PYTHON) @@ -195,8 +201,9 @@ if(ENABLE_USER_OMP OR ENABLE_KOKKOS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() -foreach(SIMPLE_LIB REAX MEAM POEMS) +foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC) if(ENABLE_${SIMPLE_LIB}) + string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") string(TOLOWER "${SIMPLE_LIB}" INC_DIR) file(GLOB ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.cpp) @@ -207,7 +214,6 @@ endforeach() if(ENABLE_MSCG) find_package(GSL REQUIRED) - find_package(LAPACK REQUIRED) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) set(MSCG_TARBALL ${LAMMPS_LIB_MSCG_BIN_DIR}/MS-CG-master.zip) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_MSCG_BIN_DIR}/MSCG-release-master/src) @@ -229,7 +235,7 @@ if(ENABLE_MSCG) DIMENSION=3 _exclude_gromacs=1) endforeach() include_directories(${LAMMPS_LIB_MSCG_BIN_DIR} ${GSL_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${GSL_LIBRARIES} ${LAPACK_LIBRARIES}) + list(APPEND LAMMPS_LINK_LIBS ${GSL_LIBRARIES}) endif() ###################################################################### From d50b62837b42c9390e3bdf6c2d160bee4c1fba3d Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 16:45:28 -0600 Subject: [PATCH 29/77] add USER-AWPMD --- cmake/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 46203f43dc..b1990b1a9c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -43,7 +43,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ - REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC) + REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -87,9 +87,10 @@ if(ENABLE_KOKKOS) list(APPEND LAMMPS_LINK_LIBS kokkos) endif() -if(ENABLE_MSCG OR ENABLE_USER-ATC) +if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD) find_package(LAPACK REQUIRED) list(APPEND LAMMPS_LINK_LIBS ${LAPACK_LIBRARIES}) + #TODO use lib/lapack endif() if(ENABLE_PYTHON) @@ -201,17 +202,22 @@ if(ENABLE_USER_OMP OR ENABLE_KOKKOS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() -foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC) +foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD) if(ENABLE_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") string(TOLOWER "${SIMPLE_LIB}" INC_DIR) - file(GLOB ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F + file(GLOB_RECURSE ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.cpp) list(APPEND LIB_SOURCES ${${SIMPLE_LIB}_SOURCES}) include_directories(${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}) endif() endforeach() +if(ENABLE_USER-AWPMD) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact + ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) +endif() + if(ENABLE_MSCG) find_package(GSL REQUIRED) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) From bb87bd4ac74d4bc5bb1a9b9e3db2562bdacf1984 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 17:01:28 -0600 Subject: [PATCH 30/77] enable more user packages --- cmake/CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b1990b1a9c..43d8f5decf 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -43,7 +43,9 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ - REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD) + REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-CGDNA + USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF + USER-FEP USER-H5MD USER-LB) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -62,6 +64,8 @@ endmacro() pkg_depends(MPIIO MPI) pkg_depends(QEQ MANYBODY) pkg_depends(USER-ATC MANYBODY) +pkg_depends(USER-H5MD MPI) +pkg_depends(USER-LB MPI) if(ENABLE_KSPACE) find_package(FFTW3) @@ -202,7 +206,7 @@ if(ENABLE_USER_OMP OR ENABLE_KOKKOS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() -foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD) +foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD) if(ENABLE_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") string(TOLOWER "${SIMPLE_LIB}" INC_DIR) @@ -218,6 +222,12 @@ if(ENABLE_USER-AWPMD) ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) endif() +if(ENABLE_USER-H5MD) + find_package(HDF5 REQUIRED) + list(APPEND LAMMPS_LINK_LIBS ${HDF5_LIBRARIES}) + include_directories(${HDF5_INCLUDE_DIRS} ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) +endif() + if(ENABLE_MSCG) find_package(GSL REQUIRED) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) From fc2e8b3c5ed552306daf31cba4af56eef3e67861 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 17:52:43 -0600 Subject: [PATCH 31/77] more USER packages --- cmake/CMakeLists.txt | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 43d8f5decf..ed0eeaacdd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -45,7 +45,9 @@ set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF - USER-FEP USER-H5MD USER-LB) + USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC + USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD + USER-SMTBQ USER-SPH USER-TALLY) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -66,6 +68,8 @@ pkg_depends(QEQ MANYBODY) pkg_depends(USER-ATC MANYBODY) pkg_depends(USER-H5MD MPI) pkg_depends(USER-LB MPI) +pkg_depends(USER-MISC MANYBODY) +pkg_depends(USER-PHONON KSPACE) if(ENABLE_KSPACE) find_package(FFTW3) @@ -131,6 +135,22 @@ if(ENABLE_VORONOI) #TODO download and build voro++ endif() +if(ENABLE_USER-MOLFILE) + list(APPEND LAMMPS_LINK_LIBS ${CMAKE_DL_LIBS}) +endif() + +if(ENABLE_USER-NETCDF) + find_package(NetCDF REQUIRED) + include_directories(NETCDF_INCLUDE_DIR) + list(APPEND LAMMPS_LINK_LIBS ${NETCDF_LIBRARY}) + add_definitions(-DLMP_HAS_NETCDF -DNC_64BIT_DATA=0x0020) +endif() + +if(ENABLE_USER-SMD) + find_package(Eigen3 REQUIRED) + include_directories(${EIGEN3_INCLUDE_DIR}) +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## @@ -206,7 +226,8 @@ if(ENABLE_USER_OMP OR ENABLE_KOKKOS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() -foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD) +foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD + USER-MOLFILE) if(ENABLE_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") string(TOLOWER "${SIMPLE_LIB}" INC_DIR) From 9991f679ae03310064281f3c7bf37cf260845451 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 16 Jul 2017 20:41:42 -0400 Subject: [PATCH 32/77] added USER-VTK --- cmake/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ed0eeaacdd..947e29cbd0 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -47,7 +47,7 @@ set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD - USER-SMTBQ USER-SPH USER-TALLY) + USER-SMTBQ USER-SPH USER-TALLY USER-VTK) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -249,6 +249,13 @@ if(ENABLE_USER-H5MD) include_directories(${HDF5_INCLUDE_DIRS} ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) endif() +if(ENABLE_USER-VTK) + find_package(VTK REQUIRED NO_MODULE) + include(${VTK_USE_FILE}) + add_definitions(-DLAMMPS_VTK) + list(APPEND LAMMPS_LINK_LIBS ${VTK_LIBRARIES}) +endif() + if(ENABLE_MSCG) find_package(GSL REQUIRED) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) From 2978cce8db453c4d6e9a251fb42989ff85c3afef Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 16 Jul 2017 20:52:38 -0400 Subject: [PATCH 33/77] Added OPT --- cmake/CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 947e29cbd0..68097d3655 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -52,7 +52,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -set(ACCEL_PACKAGES USER_OMP KOKKOS) +set(ACCEL_PACKAGES USER_OMP KOKKOS OPT) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -328,6 +328,20 @@ if(ENABLE_KOKKOS) include_directories(${KOKKOS_PKG_SOURCES_DIR}) endif() +if(ENABLE_OPT) + set(OPT_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/OPT) + set(OPT_SOURCES) + set_property(GLOBAL PROPERTY "OPT_SOURCES" "${OPT_SOURCES}") + + # detects styles which have OPT version + RegisterStylesExt(${OPT_SOURCES_DIR} opt OPT_SOURCES) + + get_property(OPT_SOURCES GLOBAL PROPERTY OPT_SOURCES) + + list(APPEND LIB_SOURCES ${OPT_SOURCES}) + include_directories(${OPT_SOURCES_DIR}) +endif() + ###################################################### # Generate style headers based on global list of From b6385d6ce21ca19048b9451cff65e7cbaaa1f441 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 20:17:41 -0600 Subject: [PATCH 34/77] add OpenKIM support --- cmake/CMakeLists.txt | 8 ++- cmake/Modules/FindKIM.cmake | 22 ++++++ cmake/Modules/FindNetCDF.cmake | 118 +++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindKIM.cmake create mode 100644 cmake/Modules/FindNetCDF.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 68097d3655..1b6b426ded 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -42,7 +42,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ + KIM KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC @@ -256,6 +256,12 @@ if(ENABLE_USER-VTK) list(APPEND LAMMPS_LINK_LIBS ${VTK_LIBRARIES}) endif() +if(ENABLE_KIM) + find_package(KIM REQUIRED) + list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES}) + include_directories(${KIM_INCLUDE_DIRS}) +endif() + if(ENABLE_MSCG) find_package(GSL REQUIRED) set(LAMMPS_LIB_MSCG_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/mscg) diff --git a/cmake/Modules/FindKIM.cmake b/cmake/Modules/FindKIM.cmake new file mode 100644 index 0000000000..a01f817cf6 --- /dev/null +++ b/cmake/Modules/FindKIM.cmake @@ -0,0 +1,22 @@ +# - Find kim +# Find the native KIM headers and libraries. +# +# KIM_INCLUDE_DIRS - where to find kim.h, etc. +# KIM_LIBRARIES - List of libraries when using kim. +# KIM_FOUND - True if kim found. +# + +find_path(KIM_INCLUDE_DIR KIM_API.h PATH_SUFFIXES kim-api-v1) + +find_library(KIM_LIBRARY NAMES kim-api-v1) + +set(KIM_LIBRARIES ${KIM_LIBRARY}) +set(KIM_INCLUDE_DIRS ${KIM_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set KIM_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(KIM DEFAULT_MSG KIM_LIBRARY KIM_INCLUDE_DIR) + +mark_as_advanced(KIM_INCLUDE_DIR KIM_LIBRARY ) diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake new file mode 100644 index 0000000000..a28c959acf --- /dev/null +++ b/cmake/Modules/FindNetCDF.cmake @@ -0,0 +1,118 @@ +# - Find NetCDF +# Find the native NetCDF includes and library +# +# NETCDF_INCLUDE_DIR - user modifiable choice of where netcdf headers are +# NETCDF_LIBRARY - user modifiable choice of where netcdf libraries are +# +# Your package can require certain interfaces to be FOUND by setting these +# +# NETCDF_CXX - require the C++ interface and link the C++ library +# NETCDF_F77 - require the F77 interface and link the fortran library +# NETCDF_F90 - require the F90 interface and link the fortran library +# +# Or equivalently by calling FindNetCDF with a COMPONENTS argument containing one or +# more of "CXX;F77;F90". +# +# When interfaces are requested the user has access to interface specific hints: +# +# NETCDF_${LANG}_INCLUDE_DIR - where to search for interface header files +# NETCDF_${LANG}_LIBRARY - where to search for interface libraries +# +# This module returns these variables for the rest of the project to use. +# +# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) +# NETCDF_LIBRARIES - All netcdf related libraries. +# NETCDF_INCLUDE_DIRS - All directories to include. +# NETCDF_HAS_INTERFACES - Whether requested interfaces were found or not. +# NETCDF_${LANG}_INCLUDE_DIRS/NETCDF_${LANG}_LIBRARIES - C/C++/F70/F90 only interface +# +# Normal usage would be: +# set (NETCDF_F90 "YES") +# find_package (NetCDF REQUIRED) +# target_link_libraries (uses_everthing ${NETCDF_LIBRARIES}) +# target_link_libraries (only_uses_f90 ${NETCDF_F90_LIBRARIES}) + +#search starting from user editable cache var +if (NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY) + # Already in cache, be silent + set (NETCDF_FIND_QUIETLY TRUE) +endif () + +set(USE_DEFAULT_PATHS "NO_DEFAULT_PATH") +if(NETCDF_USE_DEFAULT_PATHS) + set(USE_DEFAULT_PATHS "") +endif() + +find_path (NETCDF_INCLUDE_DIR netcdf.h + HINTS "${NETCDF_DIR}/include") +mark_as_advanced (NETCDF_INCLUDE_DIR) +set (NETCDF_C_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) + +find_library (NETCDF_LIBRARY NAMES netcdf + HINTS "${NETCDF_DIR}/lib") +mark_as_advanced (NETCDF_LIBRARY) + +set (NETCDF_C_LIBRARIES ${NETCDF_LIBRARY}) + +#start finding requested language components +set (NetCDF_libs "") +set (NetCDF_includes "${NETCDF_INCLUDE_DIR}") + +get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARY}" PATH) +set (NETCDF_HAS_INTERFACES "YES") # will be set to NO if we're missing any interfaces + +macro (NetCDF_check_interface lang header libs) + if (NETCDF_${lang}) + #search starting from user modifiable cache var + find_path (NETCDF_${lang}_INCLUDE_DIR NAMES ${header} + HINTS "${NETCDF_INCLUDE_DIR}" + HINTS "${NETCDF_${lang}_ROOT}/include" + ${USE_DEFAULT_PATHS}) + + find_library (NETCDF_${lang}_LIBRARY NAMES ${libs} + HINTS "${NetCDF_lib_dirs}" + HINTS "${NETCDF_${lang}_ROOT}/lib" + ${USE_DEFAULT_PATHS}) + + mark_as_advanced (NETCDF_${lang}_INCLUDE_DIR NETCDF_${lang}_LIBRARY) + + #export to internal varS that rest of project can use directly + set (NETCDF_${lang}_LIBRARIES ${NETCDF_${lang}_LIBRARY}) + set (NETCDF_${lang}_INCLUDE_DIRS ${NETCDF_${lang}_INCLUDE_DIR}) + + if (NETCDF_${lang}_INCLUDE_DIR AND NETCDF_${lang}_LIBRARY) + list (APPEND NetCDF_libs ${NETCDF_${lang}_LIBRARY}) + list (APPEND NetCDF_includes ${NETCDF_${lang}_INCLUDE_DIR}) + else () + set (NETCDF_HAS_INTERFACES "NO") + message (STATUS "Failed to find NetCDF interface for ${lang}") + endif () + endif () +endmacro () + +list (FIND NetCDF_FIND_COMPONENTS "CXX" _nextcomp) +if (_nextcomp GREATER -1) + set (NETCDF_CXX 1) +endif () +list (FIND NetCDF_FIND_COMPONENTS "F77" _nextcomp) +if (_nextcomp GREATER -1) + set (NETCDF_F77 1) +endif () +list (FIND NetCDF_FIND_COMPONENTS "F90" _nextcomp) +if (_nextcomp GREATER -1) + set (NETCDF_F90 1) +endif () +NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) +NetCDF_check_interface (F77 netcdf.inc netcdff) +NetCDF_check_interface (F90 netcdf.mod netcdff) + +#export accumulated results to internal varS that rest of project can depend on +list (APPEND NetCDF_libs "${NETCDF_C_LIBRARIES}") +set (NETCDF_LIBRARIES ${NetCDF_libs}) +set (NETCDF_INCLUDE_DIRS ${NetCDF_includes}) + +# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (NetCDF + DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS NETCDF_HAS_INTERFACES) From d6f05ea309c8362f8c603022ccf60904551a119b Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 20:19:20 -0600 Subject: [PATCH 35/77] USER_OMP -> USER-OMP --- cmake/CMakeLists.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1b6b426ded..f732576513 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -52,7 +52,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -set(ACCEL_PACKAGES USER_OMP KOKKOS OPT) +set(ACCEL_PACKAGES USER-OMP KOKKOS OPT) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -220,7 +220,7 @@ if(ENABLE_KOKKOS OR ENABLE_MSCG) set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 endif() -if(ENABLE_USER_OMP OR ENABLE_KOKKOS) +if(ENABLE_USER-OMP OR ENABLE_KOKKOS) find_package(OpenMP REQUIRED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") @@ -293,21 +293,21 @@ endif() # e.g. accelerator packages ###################################################################### -if(ENABLE_USER_OMP) - set(USER_OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP) - set(USER_OMP_SOURCES ${USER_OMP_SOURCES_DIR}/thr_data.cpp - ${USER_OMP_SOURCES_DIR}/thr_omp.cpp - ${USER_OMP_SOURCES_DIR}/fix_nh_omp.cpp - ${USER_OMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp) - set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER_OMP_SOURCES}") +if(ENABLE_USER-OMP) + set(USER-OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP) + set(USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/thr_data.cpp + ${USER-OMP_SOURCES_DIR}/thr_omp.cpp + ${USER-OMP_SOURCES_DIR}/fix_nh_omp.cpp + ${USER-OMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp) + set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER-OMP_SOURCES}") # detects styles which have USER-OMP version - RegisterStylesExt(${USER_OMP_SOURCES_DIR} omp OMP_SOURCES) + RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES) - get_property(USER_OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES) + get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES) - list(APPEND LIB_SOURCES ${USER_OMP_SOURCES}) - include_directories(${USER_OMP_SOURCES_DIR}) + list(APPEND LIB_SOURCES ${USER-OMP_SOURCES}) + include_directories(${USER-OMP_SOURCES_DIR}) endif() if(ENABLE_KOKKOS) From fa0f8a9e2ad23f2d7bb780478690e20f04cc66c8 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 21:31:57 -0600 Subject: [PATCH 36/77] added USER-QUIP --- cmake/CMakeLists.txt | 44 ++++++++++++++++++++---------------- cmake/Modules/FindQUIP.cmake | 18 +++++++++++++++ 2 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 cmake/Modules/FindQUIP.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f732576513..b9d57a3736 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -47,7 +47,7 @@ set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD - USER-SMTBQ USER-SPH USER-TALLY USER-VTK) + USER-SMTBQ USER-SPH USER-TALLY USER-VTK USER-QUIP) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -71,6 +71,23 @@ pkg_depends(USER-LB MPI) pkg_depends(USER-MISC MANYBODY) pkg_depends(USER-PHONON KSPACE) +if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP) + enable_language(Fortran) +endif() + +if(ENABLE_KOKKOS OR ENABLE_MSCG) + # starting with CMake 3.1 this is all you have to do to enforce C++11 + set(CMAKE_CXX_STANDARD 11) # C++11... + set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required... + set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 +endif() + +if(ENABLE_USER-OMP OR ENABLE_KOKKOS) + find_package(OpenMP REQUIRED) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +endif() + if(ENABLE_KSPACE) find_package(FFTW3) if(FFTW3_FOUND) @@ -95,7 +112,7 @@ if(ENABLE_KOKKOS) list(APPEND LAMMPS_LINK_LIBS kokkos) endif() -if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD) +if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP) find_package(LAPACK REQUIRED) list(APPEND LAMMPS_LINK_LIBS ${LAPACK_LIBRARIES}) #TODO use lib/lapack @@ -151,6 +168,11 @@ if(ENABLE_USER-SMD) include_directories(${EIGEN3_INCLUDE_DIR}) endif() +if(ENABLE_USER-QUIP) + find_package(QUIP REQUIRED) + list(APPEND LAMMPS_LINK_LIBS ${QUIP_LIBRARIES} ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## @@ -208,24 +230,6 @@ foreach(PKG ${PACKAGES}) endif() endforeach() -if(ENABLE_REAX OR ENABLE_MEAM) - enable_language(Fortran) -endif() - - -if(ENABLE_KOKKOS OR ENABLE_MSCG) - # starting with CMake 3.1 this is all you have to do to enforce C++11 - set(CMAKE_CXX_STANDARD 11) # C++11... - set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required... - set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 -endif() - -if(ENABLE_USER-OMP OR ENABLE_KOKKOS) - find_package(OpenMP REQUIRED) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -endif() - foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-MOLFILE) if(ENABLE_${SIMPLE_LIB}) diff --git a/cmake/Modules/FindQUIP.cmake b/cmake/Modules/FindQUIP.cmake new file mode 100644 index 0000000000..4ee1baf4f8 --- /dev/null +++ b/cmake/Modules/FindQUIP.cmake @@ -0,0 +1,18 @@ +# - Find quip +# Find the native QUIP libraries. +# +# QUIP_LIBRARIES - List of libraries when using fftw3. +# QUIP_FOUND - True if fftw3 found. +# + +find_library(QUIP_LIBRARY NAMES quip) + +set(QUIP_LIBRARIES ${QUIP_LIBRARY}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set QUIP_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(QUIP DEFAULT_MSG QUIP_LIBRARY) + +mark_as_advanced(QUIP_LIBRARY) From 7dd5068740ac38a385252163356fe229d8ba8f22 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 21:43:29 -0600 Subject: [PATCH 37/77] allow internal lapack --- cmake/CMakeLists.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b9d57a3736..7693b0f744 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -6,6 +6,10 @@ set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib) +file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) +file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) +list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) + # Cmake modules/macros are in a subdirectory to keep this file cleaner set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) @@ -113,9 +117,14 @@ if(ENABLE_KOKKOS) endif() if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP) - find_package(LAPACK REQUIRED) - list(APPEND LAMMPS_LINK_LIBS ${LAPACK_LIBRARIES}) - #TODO use lib/lapack + find_package(LAPACK) + if(LAPACK_FOUND) + list(APPEND LAMMPS_LINK_LIBS ${LAPACK_LIBRARIES}) + else() + enable_language(Fortran) + file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/*.f) + list(APPEND LIB_SOURCES ${LAPACK_SOURCES}) + endif() endif() if(ENABLE_PYTHON) @@ -202,10 +211,6 @@ list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) #Do NOT go into src to not conflict with old Makefile build system #add_subdirectory(src) -file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) -file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) -list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) - if(NOT ENABLE_MPI) file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) list(APPEND LIB_SOURCES ${MPI_SOURCES}) From 22ecd9b8d225819de8fe134cf44cdcc8ff1d1a71 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 22:07:21 -0600 Subject: [PATCH 38/77] started on USER-QMMM --- cmake/CMakeLists.txt | 10 ++++++++-- cmake/Modules/FindQE.cmake | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 cmake/Modules/FindQE.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7693b0f744..c40cee9252 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -51,7 +51,7 @@ set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD - USER-SMTBQ USER-SPH USER-TALLY USER-VTK USER-QUIP) + USER-SMTBQ USER-SPH USER-TALLY USER-VTK USER-QUIP USER-QMMM) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() @@ -182,6 +182,12 @@ if(ENABLE_USER-QUIP) list(APPEND LAMMPS_LINK_LIBS ${QUIP_LIBRARIES} ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) endif() +if(ENABLE_USER-QMMM) + find_package(QE REQUIRED) + include_directories(${QE_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${QE_LIBRARIES}) +endif() + ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## @@ -236,7 +242,7 @@ foreach(PKG ${PACKAGES}) endforeach() foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD - USER-MOLFILE) + USER-MOLFILE USER-QMMM) if(ENABLE_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") string(TOLOWER "${SIMPLE_LIB}" INC_DIR) diff --git a/cmake/Modules/FindQE.cmake b/cmake/Modules/FindQE.cmake new file mode 100644 index 0000000000..c46adc1689 --- /dev/null +++ b/cmake/Modules/FindQE.cmake @@ -0,0 +1,22 @@ +# - Find quantum-espresso +# Find the native QE headers and libraries. +# +# QE_INCLUDE_DIRS - where to find quantum-espresso.h, etc. +# QE_LIBRARIES - List of libraries when using quantum-espresso. +# QE_FOUND - True if quantum-espresso found. +# + +find_path(QE_INCLUDE_DIR libqecouple.h PATH_SUFFIXES COUPLE/include) + +find_library(QE_LIBRARY NAMES libqefft) + +set(QE_LIBRARIES ${QE_LIBRARY}) +set(QE_INCLUDE_DIRS ${QE_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set QE_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(QE DEFAULT_MSG QE_LIBRARY QE_INCLUDE_DIR) + +mark_as_advanced(QE_INCLUDE_DIR QE_LIBRARY ) From 7605f72c9a3e484515da9b1bd10d36251dee6a5c Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 22:37:51 -0600 Subject: [PATCH 39/77] finish USER-QMMM --- cmake/CMakeLists.txt | 4 ++-- cmake/Modules/FindQE.cmake | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c40cee9252..7727efa8c9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -75,7 +75,7 @@ pkg_depends(USER-LB MPI) pkg_depends(USER-MISC MANYBODY) pkg_depends(USER-PHONON KSPACE) -if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP) +if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP OR ENABLE_USER-QMMM) enable_language(Fortran) endif() @@ -185,7 +185,7 @@ endif() if(ENABLE_USER-QMMM) find_package(QE REQUIRED) include_directories(${QE_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${QE_LIBRARIES}) + list(APPEND LAMMPS_LINK_LIBS ${QE_LIBRARIES} ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) endif() ######################################################################## diff --git a/cmake/Modules/FindQE.cmake b/cmake/Modules/FindQE.cmake index c46adc1689..4484bd4db2 100644 --- a/cmake/Modules/FindQE.cmake +++ b/cmake/Modules/FindQE.cmake @@ -8,15 +8,22 @@ find_path(QE_INCLUDE_DIR libqecouple.h PATH_SUFFIXES COUPLE/include) -find_library(QE_LIBRARY NAMES libqefft) +find_library(QECOUPLE_LIBRARY NAMES qecouple) +find_library(PW_LIBRARY NAMES pw) +find_library(QEMOD_LIBRARY NAMES qemod) +find_library(QEFFT_LIBRARY NAMES qefft) +find_library(QELA_LIBRARY NAMES qela) +find_library(CLIB_LIBRARY NAMES clib) +find_library(IOTK_LIBRARY NAMES iotk) -set(QE_LIBRARIES ${QE_LIBRARY}) + +set(QE_LIBRARIES ${QECOUPLE_LIBRARY} ${PW_LIBRARY} ${QEMOD_LIBRARY} ${QEFFT_LIBRARY} ${QELA_LIBRARY} ${CLIB_LIBRARY} ${IOTK_LIBRARY}) set(QE_INCLUDE_DIRS ${QE_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set QE_FOUND to TRUE # if all listed variables are TRUE -find_package_handle_standard_args(QE DEFAULT_MSG QE_LIBRARY QE_INCLUDE_DIR) +find_package_handle_standard_args(QE DEFAULT_MSG QECOUPLE_LIBRARY PW_LIBRARY QEMOD_LIBRARY QEFFT_LIBRARY QELA_LIBRARY CLIB_LIBRARY IOTK_LIBRARY QE_INCLUDE_DIR) -mark_as_advanced(QE_INCLUDE_DIR QE_LIBRARY ) +mark_as_advanced(QE_INCLUDE_DIR QECOUPLE_LIBRARY PW_LIBRARY QEMOD_LIBRARY QEFFT_LIBRARY QELA_LIBRARY CLIB_LIBRARY IOTK_LIBRARY) From fc1be074b2957b72911dffdf3ec7f176174904ac Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 22:52:59 -0600 Subject: [PATCH 40/77] added USER-INTEL --- cmake/CMakeLists.txt | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7727efa8c9..1d755913e6 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -56,7 +56,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -set(ACCEL_PACKAGES USER-OMP KOKKOS OPT) +set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -86,7 +86,7 @@ if(ENABLE_KOKKOS OR ENABLE_MSCG) set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 endif() -if(ENABLE_USER-OMP OR ENABLE_KOKKOS) +if(ENABLE_USER-OMP OR ENABLE_KOKKOS OR ENABLE_USER-INTEL) find_package(OpenMP REQUIRED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") @@ -363,6 +363,29 @@ if(ENABLE_OPT) include_directories(${OPT_SOURCES_DIR}) endif() +if(ENABLE_USER-INTEL) + set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) + set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h + ${USER-INTEL_SOURCES_DIR}/intel_buffers.h + ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp + ${USER-INTEL_SOURCES_DIR}/math_extra_intel.h + ${USER-INTEL_SOURCES_DIR}/nbin_intel.h + ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp + ${USER-INTEL_SOURCES_DIR}/npair_intel.h + ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp + ${USER-INTEL_SOURCES_DIR}/intel_simd.h + ${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h) + + set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") + + # detects styles which have USER-INTEL version + RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES) + + get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) + + list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) + include_directories(${USER-INTEL_SOURCES_DIR}) +endif() ###################################################### # Generate style headers based on global list of From 385c6f7f2ba7ee72783f5bd4b205f99e2826853f Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 22:53:53 -0600 Subject: [PATCH 41/77] cmake: clean up --- cmake/CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1d755913e6..8713c3c2db 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -40,6 +40,10 @@ if(ENABLE_MPI) find_package(MPI REQUIRED) include_directories(${MPI_C_INCLUDE_PATH}) list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES}) +else() + file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) + list(APPEND LIB_SOURCES ${MPI_SOURCES}) + include_directories(${LAMMPS_SOURCE_DIR}/STUBS) endif() option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) @@ -217,12 +221,6 @@ list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) #Do NOT go into src to not conflict with old Makefile build system #add_subdirectory(src) -if(NOT ENABLE_MPI) - file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) - list(APPEND LIB_SOURCES ${MPI_SOURCES}) - include_directories(${LAMMPS_SOURCE_DIR}/STUBS) -endif() - include(StyleHeaderUtils) RegisterStyles(${LAMMPS_SOURCE_DIR}) From 80e44486146c35dcfb63ad62e01f88755da2735a Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sun, 16 Jul 2017 23:03:11 -0600 Subject: [PATCH 42/77] added GPU --- cmake/CMakeLists.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 8713c3c2db..e96516c1cd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -60,7 +60,7 @@ foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL) +set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) foreach(PKG ${ACCEL_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -385,6 +385,29 @@ if(ENABLE_USER-INTEL) include_directories(${USER-INTEL_SOURCES_DIR}) endif() +if(ENABLE_GPU) + find_package(CUDA REQUIRED) + + set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) + set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) + + set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}") + + # detects styles which have GPU version + RegisterStylesExt(${GPU_SOURCES_DIR} opt GPU_SOURCES) + + get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) + + + file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp + ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu + cuda_add_library(lammps_gpu ${GPU_LIB_SOURCES}) + + list(APPEND LAMMPS_LINK_LIBS lammps_gpu) + list(APPEND LIB_SOURCES ${GPU_SOURCES}) + include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu) +endif() + ###################################################### # Generate style headers based on global list of # styles registered during package selection From 1c1a1db3666989a327f360d93ed47e111aab2239 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 17 Jul 2017 11:55:05 -0400 Subject: [PATCH 43/77] Fix typo --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e96516c1cd..d768e10662 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -400,7 +400,7 @@ if(ENABLE_GPU) file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp - ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu + ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) cuda_add_library(lammps_gpu ${GPU_LIB_SOURCES}) list(APPEND LAMMPS_LINK_LIBS lammps_gpu) From 5ee2c310389d249b511ab59e27a7332a31db3e0d Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 11:01:08 -0600 Subject: [PATCH 44/77] split PACKAGES, get ENABLE-ALL right --- cmake/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d768e10662..55bed88501 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -51,17 +51,17 @@ option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KIM KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ - REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-CGDNA + REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) +set(USER-PACKAGES USER-ATC USER-AWPMD USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-VTK USER-QUIP USER-QMMM) +set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() - -set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) -foreach(PKG ${ACCEL_PACKAGES}) +foreach(PKG ${ACCEL_PACKAGES} ${USER-PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -226,7 +226,7 @@ RegisterStyles(${LAMMPS_SOURCE_DIR}) # packages which include entire content when enabled -foreach(PKG ${PACKAGES}) +foreach(PKG ${PACKAGES} ${USER-PACKAGES}) if(ENABLE_${PKG}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) From 2411192ab41dc92a3d1bebb3a5f6d80805de8124 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 11:52:06 -0600 Subject: [PATCH 45/77] cmake: add cross-configure warning --- cmake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 55bed88501..1846d6babb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -18,6 +18,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) +foreach(STYLE_FILE style_angle.h style_atom.h style_body.h style_bond.h style_command.h style_compute.h style_dihedral.h style_dump.h + style_fix.h style_improper.h style_integrate.h style_kspace.h style_minimize.h style_nbin.h style_npair.h style_nstencil.h + style_ntopo.h style_pair.h style_reader.h style_region.h) + if(EXISTS ${LAMMPS_SOURCE_DIR}/${STYLE_FILE}) + message(FATAL_ERROR "There is a ${STYLE_FILE} in ${LAMMPS_SOURCE_DIR}, please clean up the source directory first") + endif() +endforeach() + enable_language(CXX) ###################################################################### From 08c920029fc78d0da2da73fc6ecf104e15d1fcf2 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 12:22:28 -0600 Subject: [PATCH 46/77] added lammps size option --- cmake/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1846d6babb..177a9b8296 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -54,6 +54,10 @@ else() include_directories(${LAMMPS_SOURCE_DIR}/STUBS) endif() +set(LAMMPS_SIZE_LIMIT "LAMMPS_SMALLBIG" CACHE STRING "Lammps size limit") +set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIGBIG LAMMPS_SMALLSMALL) +add_definitions(-D${LAMMPS_SIZE_LIMIT}) + option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) From a3885b78ada825208c757cb2a2c7c3a98dfc7496 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 13:21:42 -0600 Subject: [PATCH 47/77] added support -DLAMMPS_XDR and -DPACK_* --- cmake/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 177a9b8296..8095f3e500 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -115,6 +115,16 @@ if(ENABLE_KSPACE) include_directories(${FFTW3_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) endif() + set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") + set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) + add_definitions(-D${PACK_OPTIMIZATION}) +endif() + +if(ENABLE_MISC) + option(LAMMPS_XDR "include XDR compatibility files for doing particle dumps in XTC format" OFF) + if(LAMMPS_XDR) + add_definitions(-DLAMMPS_XDR) + endif() endif() if(ENABLE_KOKKOS) From 99f5f82b0266f47c12ec6d5e61b4d5eb339502ba Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 13:26:46 -0600 Subject: [PATCH 48/77] added support for LAMMPS_MEMALIGN and LAMMPS_LONGLONG_TO_LONG --- cmake/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 8095f3e500..1d912970d2 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -48,6 +48,10 @@ if(ENABLE_MPI) find_package(MPI REQUIRED) include_directories(${MPI_C_INCLUDE_PATH}) list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES}) + option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize "long long" data types" OFF) + if(LAMMPS_LONGLONG_TO_LONG) + add_definitions(-DLAMMPS_LONGLONG_TO_LONG) + endif() else() file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c) list(APPEND LIB_SOURCES ${MPI_SOURCES}) @@ -58,6 +62,9 @@ set(LAMMPS_SIZE_LIMIT "LAMMPS_SMALLBIG" CACHE STRING "Lammps size limit") set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIGBIG LAMMPS_SMALLSMALL) add_definitions(-D${LAMMPS_SIZE_LIMIT}) +set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS") +add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) + option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_ALL "Build all packages" OFF) From 050a82af5813b15536a509f20a62b8b1f0cde0de Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 13:28:34 -0600 Subject: [PATCH 49/77] fix LAMMPS_LONGLONG_TO_LONG description --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1d912970d2..1aeaf33c43 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -48,7 +48,7 @@ if(ENABLE_MPI) find_package(MPI REQUIRED) include_directories(${MPI_C_INCLUDE_PATH}) list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES}) - option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize "long long" data types" OFF) + option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) if(LAMMPS_LONGLONG_TO_LONG) add_definitions(-DLAMMPS_LONGLONG_TO_LONG) endif() From 8bc318461172d95625f0bda8db17bc59b124ff44 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 14:01:05 -0600 Subject: [PATCH 50/77] added support for LAMMPS_FFMPEG --- cmake/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1aeaf33c43..051ff4d290 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -187,6 +187,11 @@ if(GZIP) add_definitions(-DLAMMPS_GZIP) endif() +find_program(FFMPEG ffmpeg) +if(FFMPEG) + add_definitions(-DLAMMPS_FFMPEG) +endif() + if(ENABLE_VORONOI) find_package(VORO REQUIRED) #some distros include_directories(${VORO_INCLUDE_DIRS}) From 3c3baf34c4e55970ae1845cbbc650b0c562efdc8 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 17 Jul 2017 15:04:07 -0600 Subject: [PATCH 51/77] GPU: added cuda includedir --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 051ff4d290..17759cbb65 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -421,6 +421,7 @@ endif() if(ENABLE_GPU) find_package(CUDA REQUIRED) + include_directories(${CUDA_TOOLKIT_INCLUDE}) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) From a9eaeb4d95a896e5ccb60b424152913e250d43d6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 13:47:03 -0600 Subject: [PATCH 52/77] working on GPU build --- cmake/CMakeLists.txt | 29 ++++++++++++++++++++++++++--- lib/gpu/lal_pppm.cu | 5 +++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 17759cbb65..0212e3906d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -421,7 +421,16 @@ endif() if(ENABLE_GPU) find_package(CUDA REQUIRED) + find_program(BIN2C bin2c) + if(NOT BIN2C) + message(FATAL_ERROR "Couldn't find bin2c") + endif() include_directories(${CUDA_TOOLKIT_INCLUDE}) + set(CUDA_BUILD_CUBIN ON) + set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "Lammps gpu precision size") + set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) + add_definitions(-D_${GPU_PREC}) + add_definitions(-DNV_KERNEL -DUSE_CUDPP -DUCL_CUDADR -DCMAKE_GPU) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) @@ -432,15 +441,29 @@ if(ENABLE_GPU) RegisterStylesExt(${GPU_SOURCES_DIR} opt GPU_SOURCES) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) - file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) cuda_add_library(lammps_gpu ${GPU_LIB_SOURCES}) - + #add_custom_target(cubin_headers) + #file(GLOB_RECURSE GPU_LIB_CUBIN ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cubin) + #file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) + #foreach(CUBIN ${GPU_LIB_CUBIN}) + # get_filename_component(CUBIN_NAME NAME_WE ${CUBIN}) + # message("XXX ${CUBIN_NAME}_cubin.h") + # add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR/gpu/${CUBIN_NAME}_cubin.h + # COMMAND ${BIN2C} -c -n ${CUBIN_NAME} ${CUBIN} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CUBIN_NAME}_cubin.h + # DEPENDS ${CUBIN} + # COMMENT "Generating ${CUBIN_NAME}_cubin.h") + # add_custom_target(${CUBIN_NAME}_cubin DEPENDS ${LAMMPS_LIB_BINARY_DIR/gpu/${CUBIN_NAME}_cubin.h) + # add_dependencies(cubin_headers ${CUBIN_NAME}_cubin) + #endforeach() + #add_dependencies(lammps_gpu cubin_headers) + list(APPEND LAMMPS_LINK_LIBS lammps_gpu) list(APPEND LIB_SOURCES ${GPU_SOURCES}) - include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu) + include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu + ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) endif() ###################################################### diff --git a/lib/gpu/lal_pppm.cu b/lib/gpu/lal_pppm.cu index 24636b9a93..fede2180cf 100644 --- a/lib/gpu/lal_pppm.cu +++ b/lib/gpu/lal_pppm.cu @@ -13,6 +13,11 @@ // email : brownw@ornl.gov // ***************************************************************************/ +#ifdef CMAKE_GPU +#define grdtyp float +#define grdtyp4 float4 +#endif + #ifdef NV_KERNEL #include "lal_preprocessor.h" From c3d9786616c62c40d6d03347436855dd67a4e718 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 16:01:35 -0600 Subject: [PATCH 53/77] GPU compiles --- cmake/CMakeLists.txt | 43 ++++++++++++++++++++++++------------------- lib/gpu/lal_pppm.cu | 5 ----- lib/gpu/lal_pppm_d.cu | 6 ++++++ lib/gpu/lal_pppm_f.cu | 6 ++++++ 4 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 lib/gpu/lal_pppm_d.cu create mode 100644 lib/gpu/lal_pppm_f.cu diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0212e3906d..ff92c370d6 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -427,6 +427,7 @@ if(ENABLE_GPU) endif() include_directories(${CUDA_TOOLKIT_INCLUDE}) set(CUDA_BUILD_CUBIN ON) + set(CUDA_GENERATED_OUTPUT_DIR ${LAMMPS_LIB_BINARY_DIR}/gpu) set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "Lammps gpu precision size") set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) add_definitions(-D_${GPU_PREC}) @@ -442,28 +443,29 @@ if(ENABLE_GPU) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) - file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp - ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) - cuda_add_library(lammps_gpu ${GPU_LIB_SOURCES}) - #add_custom_target(cubin_headers) - #file(GLOB_RECURSE GPU_LIB_CUBIN ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cubin) - #file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) - #foreach(CUBIN ${GPU_LIB_CUBIN}) - # get_filename_component(CUBIN_NAME NAME_WE ${CUBIN}) - # message("XXX ${CUBIN_NAME}_cubin.h") - # add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR/gpu/${CUBIN_NAME}_cubin.h - # COMMAND ${BIN2C} -c -n ${CUBIN_NAME} ${CUBIN} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CUBIN_NAME}_cubin.h - # DEPENDS ${CUBIN} - # COMMENT "Generating ${CUBIN_NAME}_cubin.h") - # add_custom_target(${CUBIN_NAME}_cubin DEPENDS ${LAMMPS_LIB_BINARY_DIR/gpu/${CUBIN_NAME}_cubin.h) - # add_dependencies(cubin_headers ${CUBIN_NAME}_cubin) - #endforeach() - #add_dependencies(lammps_gpu cubin_headers) - + file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) + file(GLOB_RECURSE GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) + file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) + list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) + cuda_add_library(lammps_gpu ${GPU_LIB_CU}) + file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) + add_custom_target(cubin_headers) + foreach(CU ${GPU_LIB_CU}) + get_filename_component(CU_NAME ${CU} NAME_WE) + set(CU_OBJ ${CUDA_GENERATED_OUTPUT_DIR}/lammps_gpu_generated_${CU_NAME}.cu.o.cubin.txt) + string(REGEX REPLACE "^lal_" "" CU_HEADER "${CU_NAME}") + add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h + COMMAND ${BIN2C} -c -n ${CU_HEADER} ${CU_OBJ} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h + DEPENDS ${CU_OBJ} + COMMENT "Generating ${CU_HEADER}_cubin.h") + add_custom_target(${CU_HEADER}_cubin DEPENDS ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h) + add_dependencies(cubin_headers ${CU_HEADER}_cubin) + endforeach() list(APPEND LAMMPS_LINK_LIBS lammps_gpu) - list(APPEND LIB_SOURCES ${GPU_SOURCES}) + list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES}) include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu") endif() ###################################################### @@ -479,6 +481,9 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR}) add_library(lammps ${LIB_SOURCES}) +if(ENABLE_GPU) + add_dependencies(lammps cubin_headers) +endif() target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) diff --git a/lib/gpu/lal_pppm.cu b/lib/gpu/lal_pppm.cu index fede2180cf..24636b9a93 100644 --- a/lib/gpu/lal_pppm.cu +++ b/lib/gpu/lal_pppm.cu @@ -13,11 +13,6 @@ // email : brownw@ornl.gov // ***************************************************************************/ -#ifdef CMAKE_GPU -#define grdtyp float -#define grdtyp4 float4 -#endif - #ifdef NV_KERNEL #include "lal_preprocessor.h" diff --git a/lib/gpu/lal_pppm_d.cu b/lib/gpu/lal_pppm_d.cu new file mode 100644 index 0000000000..e00ad50496 --- /dev/null +++ b/lib/gpu/lal_pppm_d.cu @@ -0,0 +1,6 @@ +#ifdef CMAKE_GPU +#define grdtyp double +#define grdtyp4 double4 +#endif + +#include "lal_pppm.cu" diff --git a/lib/gpu/lal_pppm_f.cu b/lib/gpu/lal_pppm_f.cu new file mode 100644 index 0000000000..8c8ca88167 --- /dev/null +++ b/lib/gpu/lal_pppm_f.cu @@ -0,0 +1,6 @@ +#ifdef CMAKE_GPU +#define grdtyp float +#define grdtyp4 float4 +#endif + +#include "lal_pppm.cu" From 4d65c327f54a02d0f1a90de792609baae47fa456 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 16:06:29 -0600 Subject: [PATCH 54/77] added minimal README --- cmake/README | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmake/README diff --git a/cmake/README b/cmake/README new file mode 100644 index 0000000000..cc67cceb52 --- /dev/null +++ b/cmake/README @@ -0,0 +1,19 @@ +cmake-buildsystem +----------------- + +To use the cmake build system instead of the make-driven one, do: +``` +cmake /path/to/lammps/source/cmake +``` +(please note the cmake directory as the very end) + +To enable package, e.g. GPU do +``` +cmake /path/to/lammps/source/cmake -DENABLE_GPU=ON +``` + +cmake has many many options, do get an overview use the curses-based cmake interface, ccmake: +``` +ccmake /path/to/lammps/source/cmake +``` +(Don't forget to press "g" for generate once you are done with configuring) From 864fd9cd8788af46e1e055fa4786a074c1e7d6e6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 18:20:23 -0600 Subject: [PATCH 55/77] remove cubin_headers hack --- cmake/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ff92c370d6..224de45a09 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -449,7 +449,6 @@ if(ENABLE_GPU) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) cuda_add_library(lammps_gpu ${GPU_LIB_CU}) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) - add_custom_target(cubin_headers) foreach(CU ${GPU_LIB_CU}) get_filename_component(CU_NAME ${CU} NAME_WE) set(CU_OBJ ${CUDA_GENERATED_OUTPUT_DIR}/lammps_gpu_generated_${CU_NAME}.cu.o.cubin.txt) @@ -458,8 +457,7 @@ if(ENABLE_GPU) COMMAND ${BIN2C} -c -n ${CU_HEADER} ${CU_OBJ} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h DEPENDS ${CU_OBJ} COMMENT "Generating ${CU_HEADER}_cubin.h") - add_custom_target(${CU_HEADER}_cubin DEPENDS ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h) - add_dependencies(cubin_headers ${CU_HEADER}_cubin) + list(APPEND LIB_SOURCES ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h) endforeach() list(APPEND LAMMPS_LINK_LIBS lammps_gpu) list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES}) @@ -481,9 +479,6 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR}) add_library(lammps ${LIB_SOURCES}) -if(ENABLE_GPU) - add_dependencies(lammps cubin_headers) -endif() target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) From e6f5f77edfacadfd4c4f55c167533279a3f0c6af Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 18:38:36 -0600 Subject: [PATCH 56/77] GPU: clean up --- cmake/CMakeLists.txt | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 224de45a09..c5c8326080 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -447,23 +447,22 @@ if(ENABLE_GPU) file(GLOB_RECURSE GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) - cuda_add_library(lammps_gpu ${GPU_LIB_CU}) + add_custom_target(gpu_objs) + cuda_wrap_srcs(gpu_objs OBJ GPU_OBJS ${GPU_LIB_CU}) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) - foreach(CU ${GPU_LIB_CU}) - get_filename_component(CU_NAME ${CU} NAME_WE) - set(CU_OBJ ${CUDA_GENERATED_OUTPUT_DIR}/lammps_gpu_generated_${CU_NAME}.cu.o.cubin.txt) - string(REGEX REPLACE "^lal_" "" CU_HEADER "${CU_NAME}") - add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h - COMMAND ${BIN2C} -c -n ${CU_HEADER} ${CU_OBJ} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h + foreach(CU_OBJ ${GPU_OBJS}) + get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) + string(REGEX REPLACE "^.*_lal_" "" CU_NAME "${CU_NAME}") + add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h + COMMAND ${BIN2C} -c -n ${CU_NAME} ${CU_OBJ}.cubin.txt > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h DEPENDS ${CU_OBJ} - COMMENT "Generating ${CU_HEADER}_cubin.h") - list(APPEND LIB_SOURCES ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_HEADER}_cubin.h) + COMMENT "Generating ${CU_NAME}_cubin.h") + list(APPEND LIB_SOURCES ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h) endforeach() - list(APPEND LAMMPS_LINK_LIBS lammps_gpu) - list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES}) + list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_OBJS}) include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h") endif() ###################################################### From acbc60319f6eb3ad15007ed568b876f1b8575785 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 18:43:51 -0600 Subject: [PATCH 57/77] GPU: clean up part 2 --- cmake/CMakeLists.txt | 5 ++--- {lib => cmake}/gpu/lal_pppm_d.cu | 2 -- {lib => cmake}/gpu/lal_pppm_f.cu | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) rename {lib => cmake}/gpu/lal_pppm_d.cu (74%) rename {lib => cmake}/gpu/lal_pppm_f.cu (73%) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c5c8326080..99208ff65b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -427,11 +427,10 @@ if(ENABLE_GPU) endif() include_directories(${CUDA_TOOLKIT_INCLUDE}) set(CUDA_BUILD_CUBIN ON) - set(CUDA_GENERATED_OUTPUT_DIR ${LAMMPS_LIB_BINARY_DIR}/gpu) set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "Lammps gpu precision size") set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) add_definitions(-D_${GPU_PREC}) - add_definitions(-DNV_KERNEL -DUSE_CUDPP -DUCL_CUDADR -DCMAKE_GPU) + add_definitions(-DNV_KERNEL -DUSE_CUDPP -DUCL_CUDADR) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) @@ -444,7 +443,7 @@ if(ENABLE_GPU) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) - file(GLOB_RECURSE GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) + file(GLOB_RECURSE GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu) file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) add_custom_target(gpu_objs) diff --git a/lib/gpu/lal_pppm_d.cu b/cmake/gpu/lal_pppm_d.cu similarity index 74% rename from lib/gpu/lal_pppm_d.cu rename to cmake/gpu/lal_pppm_d.cu index e00ad50496..a49a535013 100644 --- a/lib/gpu/lal_pppm_d.cu +++ b/cmake/gpu/lal_pppm_d.cu @@ -1,6 +1,4 @@ -#ifdef CMAKE_GPU #define grdtyp double #define grdtyp4 double4 -#endif #include "lal_pppm.cu" diff --git a/lib/gpu/lal_pppm_f.cu b/cmake/gpu/lal_pppm_f.cu similarity index 73% rename from lib/gpu/lal_pppm_f.cu rename to cmake/gpu/lal_pppm_f.cu index 8c8ca88167..e7f5116fa0 100644 --- a/lib/gpu/lal_pppm_f.cu +++ b/cmake/gpu/lal_pppm_f.cu @@ -1,6 +1,4 @@ -#ifdef CMAKE_GPU #define grdtyp float #define grdtyp4 float4 -#endif #include "lal_pppm.cu" From e2ad4fa74579c8432bb0a286385f329421c7bb2a Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 18 Jul 2017 19:29:40 -0600 Subject: [PATCH 58/77] GPU: cubin not needed --- cmake/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 99208ff65b..5764700ebd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -426,7 +426,6 @@ if(ENABLE_GPU) message(FATAL_ERROR "Couldn't find bin2c") endif() include_directories(${CUDA_TOOLKIT_INCLUDE}) - set(CUDA_BUILD_CUBIN ON) set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "Lammps gpu precision size") set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) add_definitions(-D_${GPU_PREC}) @@ -453,7 +452,7 @@ if(ENABLE_GPU) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) string(REGEX REPLACE "^.*_lal_" "" CU_NAME "${CU_NAME}") add_custom_command(OUTPUT ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h - COMMAND ${BIN2C} -c -n ${CU_NAME} ${CU_OBJ}.cubin.txt > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h + COMMAND ${BIN2C} -c -n ${CU_NAME} ${CU_OBJ} > ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h DEPENDS ${CU_OBJ} COMMENT "Generating ${CU_NAME}_cubin.h") list(APPEND LIB_SOURCES ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h) From 2961ba7ebb0d27accaf9b33957597e592bb56f9e Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 10:35:48 -0600 Subject: [PATCH 59/77] added MKL support --- cmake/CMakeLists.txt | 9 ++++++++- cmake/Modules/FindMKL.cmake | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindMKL.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5764700ebd..9d8b93e12d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -117,14 +117,21 @@ endif() if(ENABLE_KSPACE) find_package(FFTW3) + find_package(MKL) if(FFTW3_FOUND) add_definitions(-DFFT_FFTW3) include_directories(${FFTW3_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) + elseif(MKL_FOUND) + add_definitions(-DFFT_MKL) + include_directories(${MKL_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) endif() set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) - add_definitions(-D${PACK_OPTIMIZATION}) + if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") + add_definitions(-D${PACK_OPTIMIZATION}) + endif() endif() if(ENABLE_MISC) diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake new file mode 100644 index 0000000000..4246062103 --- /dev/null +++ b/cmake/Modules/FindMKL.cmake @@ -0,0 +1,22 @@ +# - Find mkl +# Find the native MKL headers and libraries. +# +# MKL_INCLUDE_DIRS - where to find mkl.h, etc. +# MKL_LIBRARIES - List of libraries when using mkl. +# MKL_FOUND - True if mkl found. +# + +find_path(MKL_INCLUDE_DIR mkl_dfti.h HINTS $ENV{MKLROOT}/include) + +find_library(MKL_LIBRARY NAMES mkl_rt HINTS $ENV{MKLROOT}/lib $ENV{MKLROOT}/lib/intel64) + +set(MKL_LIBRARIES ${MKL_LIBRARY}) +set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARY MKL_INCLUDE_DIR) + +mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY ) From c95db97b83c3e7d6aa72ef2298d901903b3ce562 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 15:15:24 -0600 Subject: [PATCH 60/77] fix PYTHON install --- cmake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9d8b93e12d..7b9d9f14f9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -168,10 +168,18 @@ if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP) endif() if(ENABLE_PYTHON) + find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) add_definitions(-DLMP_PYTHON) include_directories(${PYTHON_INCLUDE_DIR}) list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" + OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + install(FILES ${CMAKE_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) + if(NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "Python package need lammps to be build shared, -DBUILD_SHARED_LIBS=ON") + endif() endif() find_package(JPEG) From a99e3ef4f0e839cd7b6f21f5d1df6b55344e5849 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 15:15:49 -0600 Subject: [PATCH 61/77] cmake: fix typo and pkg info --- cmake/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7b9d9f14f9..af2740eba1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -497,8 +497,8 @@ set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) if(INSTALL_LIB) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -elseif(NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Shared library has to install, use -DBUILD_SHARED_LIBS=OFF to install lammps with a a library") +elseif(BUILD_SHARED_LIBS) + message(FATAL_ERROR "Shared library has to be installed, use -DBUILD_SHARED_LIBS=ON to install lammps with a library") endif() add_executable(lmp ${LMP_SOURCES}) @@ -506,7 +506,7 @@ target_link_libraries(lmp lammps) install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) -foreach(PKG ${PACKAGES} ${ACCEL_PACKAGES}) +foreach(PKG ${PACKAGES} ${USER-PACKAGES} ${ACCEL_PACKAGES}) if(ENABLE_${PKG}) message(STATUS "Building package: ${PKG}") endif() From babba1870efe58f9dbdf3118d44fc51557669965 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 15:33:02 -0600 Subject: [PATCH 62/77] added FFTW2 support --- cmake/CMakeLists.txt | 20 +++++++++----------- cmake/Modules/FindFFTW2.cmake | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 cmake/Modules/FindFFTW2.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index af2740eba1..7b6b2112da 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -116,17 +116,15 @@ if(ENABLE_USER-OMP OR ENABLE_KOKKOS OR ENABLE_USER-INTEL) endif() if(ENABLE_KSPACE) - find_package(FFTW3) - find_package(MKL) - if(FFTW3_FOUND) - add_definitions(-DFFT_FFTW3) - include_directories(${FFTW3_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) - elseif(MKL_FOUND) - add_definitions(-DFFT_MKL) - include_directories(${MKL_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) - endif() + foreach(FFT FFTW3 MKL FFTW2) + find_package(${FFT}) + if(${FFT}_FOUND) + add_definitions(-DFFT_${FFT}) + include_directories(${${FFT}_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) + break() + endif() + endforeach() set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") diff --git a/cmake/Modules/FindFFTW2.cmake b/cmake/Modules/FindFFTW2.cmake new file mode 100644 index 0000000000..c77e6cf8e9 --- /dev/null +++ b/cmake/Modules/FindFFTW2.cmake @@ -0,0 +1,22 @@ +# - Find fftw2 +# Find the native FFTW2 headers and libraries. +# +# FFTW2_INCLUDE_DIRS - where to find fftw2.h, etc. +# FFTW2_LIBRARIES - List of libraries when using fftw2. +# FFTW2_FOUND - True if fftw2 found. +# + +find_path(FFTW2_INCLUDE_DIR fftw.h) + +find_library(FFTW2_LIBRARY NAMES fftw) + +set(FFTW2_LIBRARIES ${FFTW2_LIBRARY}) +set(FFTW2_INCLUDE_DIRS ${FFTW2_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set FFTW2_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(FFTW2 DEFAULT_MSG FFTW2_LIBRARY FFTW2_INCLUDE_DIR) + +mark_as_advanced(FFTW2_INCLUDE_DIR FFTW2_LIBRARY ) From 01bcb79bdc0c6043fc1c4f537884e5c8f5913463 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 18:34:07 -0600 Subject: [PATCH 63/77] cmake: clean up and updated comments --- cmake/CMakeLists.txt | 201 ++++++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 98 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7b6b2112da..262857de16 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,3 +1,7 @@ +######################################## +# CMake build system +# This file is part of LAMMPS +# Created by Christoph Junghans and Richard Berger cmake_minimum_required(VERSION 3.1) project(lammps) @@ -6,6 +10,7 @@ set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib) +#To not conflict with old Makefile build system, we build everything here file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) @@ -32,7 +37,6 @@ enable_language(CXX) # compiler tests # these need ot be done early (before further tests). ##################################################################### - include(CheckCCompilerFlag) ######################################################################## @@ -98,6 +102,9 @@ pkg_depends(USER-LB MPI) pkg_depends(USER-MISC MANYBODY) pkg_depends(USER-PHONON KSPACE) +###################################################### +# packages with special compiler needs or external libs +###################################################### if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP OR ENABLE_USER-QMMM) enable_language(Fortran) endif() @@ -139,21 +146,6 @@ if(ENABLE_MISC) endif() endif() -if(ENABLE_KOKKOS) - set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) - set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) - add_definitions(-DLMP_KOKKOS) - add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) - - # TODO there probably is a better way - set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src - ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src - ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src - ${LAMMPS_LIB_KOKKOS_BIN_DIR}) - include_directories(${Kokkos_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS kokkos) -endif() - if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP) find_package(LAPACK) if(LAPACK_FOUND) @@ -209,7 +201,6 @@ if(ENABLE_VORONOI) find_package(VORO REQUIRED) #some distros include_directories(${VORO_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES}) - #TODO download and build voro++ endif() if(ENABLE_USER-MOLFILE) @@ -239,65 +230,6 @@ if(ENABLE_USER-QMMM) list(APPEND LAMMPS_LINK_LIBS ${QE_LIBRARIES} ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) endif() -######################################################################## -# Basic system tests (standard libraries, headers, functions, types) # -######################################################################## -include(CheckIncludeFile) -foreach(HEADER math.h) - check_include_file(${HEADER} FOUND_${HEADER}) - if(NOT FOUND_${HEADER}) - message(FATAL_ERROR "Could not find needed header - ${HEADER}") - endif(NOT FOUND_${HEADER}) -endforeach(HEADER) - -set(MATH_LIBRARIES "m" CACHE STRING "math library") -mark_as_advanced( MATH_LIBRARIES ) -include(CheckLibraryExists) -foreach(FUNC sin cos) - check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) - if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) - message(FATAL_ERROR "Could not find needed math function - ${FUNC}") - endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) -endforeach(FUNC) -list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) - -###################################### -# Include the following subdirectory # -###################################### - -#Do NOT go into src to not conflict with old Makefile build system -#add_subdirectory(src) - -include(StyleHeaderUtils) -RegisterStyles(${LAMMPS_SOURCE_DIR}) - -# packages which include entire content when enabled - -foreach(PKG ${PACKAGES} ${USER-PACKAGES}) - if(ENABLE_${PKG}) - set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) - - # detects styles in package and adds them to global list - RegisterStyles(${${PKG}_SOURCES_DIR}) - - file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp) - list(APPEND LIB_SOURCES ${${PKG}_SOURCES}) - include_directories(${${PKG}_SOURCES_DIR}) - endif() -endforeach() - -foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD - USER-MOLFILE USER-QMMM) - if(ENABLE_${SIMPLE_LIB}) - string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") - string(TOLOWER "${SIMPLE_LIB}" INC_DIR) - file(GLOB_RECURSE ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F - ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.cpp) - list(APPEND LIB_SOURCES ${${SIMPLE_LIB}_SOURCES}) - include_directories(${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}) - endif() -endforeach() - if(ENABLE_USER-AWPMD) include_directories(${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) @@ -348,11 +280,69 @@ if(ENABLE_MSCG) list(APPEND LAMMPS_LINK_LIBS ${GSL_LIBRARIES}) endif() +######################################################################## +# Basic system tests (standard libraries, headers, functions, types) # +######################################################################## +include(CheckIncludeFile) +foreach(HEADER math.h) + check_include_file(${HEADER} FOUND_${HEADER}) + if(NOT FOUND_${HEADER}) + message(FATAL_ERROR "Could not find needed header - ${HEADER}") + endif(NOT FOUND_${HEADER}) +endforeach(HEADER) + +set(MATH_LIBRARIES "m" CACHE STRING "math library") +mark_as_advanced( MATH_LIBRARIES ) +include(CheckLibraryExists) +foreach(FUNC sin cos) + check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) + if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) + message(FATAL_ERROR "Could not find needed math function - ${FUNC}") + endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) +endforeach(FUNC) +list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) + +###################################### +# Generate Basic Style files +###################################### +include(StyleHeaderUtils) +RegisterStyles(${LAMMPS_SOURCE_DIR}) + +############################################## +# add sources of enabled packages +############################################ +foreach(PKG ${PACKAGES} ${USER-PACKAGES}) + if(ENABLE_${PKG}) + set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) + + # detects styles in package and adds them to global list + RegisterStyles(${${PKG}_SOURCES_DIR}) + + file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp) + list(APPEND LIB_SOURCES ${${PKG}_SOURCES}) + include_directories(${${PKG}_SOURCES_DIR}) + endif() +endforeach() + +############################################## +# add lib sources of (simple) enabled packages +############################################ +foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD + USER-MOLFILE USER-QMMM) + if(ENABLE_${SIMPLE_LIB}) + string(REGEX REPLACE "^USER-" "" SIMPLE_LIB "${SIMPLE_LIB}") + string(TOLOWER "${SIMPLE_LIB}" INC_DIR) + file(GLOB_RECURSE ${SIMPLE_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.F + ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}/*.cpp) + list(APPEND LIB_SOURCES ${${SIMPLE_LIB}_SOURCES}) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/${INC_DIR}) + endif() +endforeach() + ###################################################################### # packages which selectively include variants based on enabled styles # e.g. accelerator packages ###################################################################### - if(ENABLE_USER-OMP) set(USER-OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP) set(USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/thr_data.cpp @@ -371,27 +361,39 @@ if(ENABLE_USER-OMP) endif() if(ENABLE_KOKKOS) - set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS) - set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/neighbor_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/neigh_list_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/neigh_bond_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/fix_nh_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp - ${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp) - set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") + set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) + set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) + add_definitions(-DLMP_KOKKOS) + add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) - # detects styles which have KOKKOS version - RegisterStylesExt(${KOKKOS_PKG_SOURCES_DIR} kokkos KOKKOS_PKG_SOURCES) + set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src + ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src + ${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src + ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + include_directories(${Kokkos_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS kokkos) - get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES) + set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS) + set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neighbor_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neigh_list_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/neigh_bond_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/fix_nh_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp + ${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp) + set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") - list(APPEND LIB_SOURCES ${KOKKOS_PKG_SOURCES}) - include_directories(${KOKKOS_PKG_SOURCES_DIR}) + # detects styles which have KOKKOS version + RegisterStylesExt(${KOKKOS_PKG_SOURCES_DIR} kokkos KOKKOS_PKG_SOURCES) + + get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES) + + list(APPEND LIB_SOURCES ${KOKKOS_PKG_SOURCES}) + include_directories(${KOKKOS_PKG_SOURCES_DIR}) endif() if(ENABLE_OPT) @@ -487,11 +489,12 @@ GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR}) include_directories(${LAMMPS_SOURCE_DIR}) include_directories(${LAMMPS_STYLE_HEADERS_DIR}) - +########################################### +# Actually add executable and lib to build +############################################ add_library(lammps ${LIB_SOURCES}) target_link_libraries(lammps ${LAMMPS_LINK_LIBS}) set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) - if(INSTALL_LIB) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) @@ -501,9 +504,11 @@ endif() add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) - install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) +################################## +# Print package summary +################################## foreach(PKG ${PACKAGES} ${USER-PACKAGES} ${ACCEL_PACKAGES}) if(ENABLE_${PKG}) message(STATUS "Building package: ${PKG}") From 488609a5fdfabbf97e206277b81aa15660671f0b Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 18:54:15 -0600 Subject: [PATCH 64/77] make FFT a selective option --- cmake/CMakeLists.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 262857de16..e8afb6fb56 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -123,15 +123,14 @@ if(ENABLE_USER-OMP OR ENABLE_KOKKOS OR ENABLE_USER-INTEL) endif() if(ENABLE_KSPACE) - foreach(FFT FFTW3 MKL FFTW2) - find_package(${FFT}) - if(${FFT}_FOUND) - add_definitions(-DFFT_${FFT}) - include_directories(${${FFT}_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) - break() - endif() - endforeach() + set(FFT "KISSFFT" CACHE STRING "FFT library for KSPACE package") + set_property(CACHE FFT PROPERTY STRINGS KISSFFT FFTW3 MKL FFTW2) + if(NOT FFT STREQUAL "KISSFFT") + find_package(${FFT} REQUIRED) + add_definitions(-DFFT_${FFT}) + include_directories(${${FFT}_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) + endif() set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") From f037f89f5f4de24f760b608778bb232c8312dc66 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 20 Jul 2017 14:12:17 -0600 Subject: [PATCH 65/77] fix GPU + BUILD_SHARED_LIBS X-Thanks: Robert Maynard --- cmake/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e8afb6fb56..bbf6048460 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -439,11 +439,12 @@ if(ENABLE_GPU) if(NOT BIN2C) message(FATAL_ERROR "Couldn't find bin2c") endif() - include_directories(${CUDA_TOOLKIT_INCLUDE}) + include_directories(${CUDA_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "Lammps gpu precision size") set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) add_definitions(-D_${GPU_PREC}) - add_definitions(-DNV_KERNEL -DUSE_CUDPP -DUCL_CUDADR) + add_definitions(-DNV_KERNEL -DUCL_CUDADR) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) @@ -455,12 +456,13 @@ if(ENABLE_GPU) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) - file(GLOB_RECURSE GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) - file(GLOB_RECURSE GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu) + file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) + file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu) file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) - add_custom_target(gpu_objs) - cuda_wrap_srcs(gpu_objs OBJ GPU_OBJS ${GPU_LIB_CU}) + include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu + ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) + cuda_compile(GPU_OBJS ${GPU_LIB_CU} OPTIONS $<$:-Xcompiler=-fPIC>) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) foreach(CU_OBJ ${GPU_OBJS}) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) @@ -470,10 +472,12 @@ if(ENABLE_GPU) DEPENDS ${CU_OBJ} COMMENT "Generating ${CU_NAME}_cubin.h") list(APPEND LIB_SOURCES ${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h) + if(${CU_NAME} STREQUAL "pppm_d") #pppm_d doesn't get linked into the lib + set(CU_FORBIDDEN_OBJ "${CU_OBJ}") + endif() endforeach() + list(REMOVE_ITEM GPU_OBJS "${CU_FORBIDDEN_OBJ}") list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_OBJS}) - include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu - ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h") endif() From 1749d643c7205ec05655818d2d5b2295bd37b171 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 20 Jul 2017 14:30:52 -0600 Subject: [PATCH 66/77] GPU: bring back CUDPP_OPT --- cmake/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index bbf6048460..4304a8078f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -445,6 +445,7 @@ if(ENABLE_GPU) set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) add_definitions(-D_${GPU_PREC}) add_definitions(-DNV_KERNEL -DUCL_CUDADR) + option(CUDPP_OPT "Enable CUDPP_OPT" ON) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h) @@ -460,9 +461,14 @@ if(ENABLE_GPU) file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu) file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) - include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu - ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu) - cuda_compile(GPU_OBJS ${GPU_LIB_CU} OPTIONS $<$:-Xcompiler=-fPIC>) + include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu) + if(CUDPP_OPT) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) + add_definitions(-DCUDPP_OPT) + file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cpp) + file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cu) + endif() + cuda_compile(GPU_OBJS ${GPU_LIB_CU} ${GPU_LIB_CUDPP_CU} OPTIONS $<$:-Xcompiler=-fPIC>) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) foreach(CU_OBJ ${GPU_OBJS}) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) @@ -477,7 +483,7 @@ if(ENABLE_GPU) endif() endforeach() list(REMOVE_ITEM GPU_OBJS "${CU_FORBIDDEN_OBJ}") - list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_OBJS}) + list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h") endif() From 427ca88dd44dc7638de9f9131e120c85a298942e Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 20 Jul 2017 15:02:41 -0600 Subject: [PATCH 67/77] cmake: error for POEMS + BODY package --- cmake/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4304a8078f..8f375e91bb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -102,6 +102,10 @@ pkg_depends(USER-LB MPI) pkg_depends(USER-MISC MANYBODY) pkg_depends(USER-PHONON KSPACE) +if(ENABLE_BODY AND ENABLE_POEMS) + message(FATAL_ERROR "BODY and POEMS cannot be enabled at the same time") +endif() + ###################################################### # packages with special compiler needs or external libs ###################################################### From c88d1e5510a1999d64604d97df406cf212f14d24 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 20 Jul 2017 15:15:29 -0600 Subject: [PATCH 68/77] make ENABLE_ALL work out of the box --- cmake/CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 8f375e91bb..c9e973e212 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -71,20 +71,21 @@ add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) -option(ENABLE_ALL "Build all packages" OFF) -set(PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KIM KSPACE MANYBODY MC MEAM MISC MOLECULE MSCG MPIIO PERI POEMS PYTHON QEQ - REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) -set(USER-PACKAGES USER-ATC USER-AWPMD USER-CGDNA +option(ENABLE_ALL "Build all default packages" OFF) +set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR + KSPACE MANYBODY MC MEAM MISC MOLECULE PERI QEQ + REAX REPLICA RIGID SHOCK SNAP SRD) +set(OTHER_PACKAGES KIM PYTHON MSCG MPIIO VORONOI POEMS + USER-ATC USER-AWPMD USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-VTK USER-QUIP USER-QMMM) set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) -foreach(PKG ${PACKAGES}) +foreach(PKG ${DEFAULT_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" ${ENABLE_ALL}) endforeach() -foreach(PKG ${ACCEL_PACKAGES} ${USER-PACKAGES}) +foreach(PKG ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() @@ -522,7 +523,7 @@ install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) ################################## # Print package summary ################################## -foreach(PKG ${PACKAGES} ${USER-PACKAGES} ${ACCEL_PACKAGES}) +foreach(PKG ${DEFAULT_PACKAGES} ${OTHER_PACKAGES} ${ACCEL_PACKAGES}) if(ENABLE_${PKG}) message(STATUS "Building package: ${PKG}") endif() From e8e9ea839207e9de447754c843db402b86969092 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 20 Jul 2017 16:14:02 -0600 Subject: [PATCH 69/77] added one trivial test --- cmake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c9e973e212..4a2a8773ec 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -71,6 +71,11 @@ add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) +option(ENABLE_TESTING "Enable testing" OFF) +if(ENABLE_TESTING) + enable_testing() +endif(ENABLE_TESTING) + option(ENABLE_ALL "Build all default packages" OFF) set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MEAM MISC MOLECULE PERI QEQ @@ -519,6 +524,9 @@ endif() add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(ENABLE_TESTING) + add_test(ShowHelp lmp -help) +endif() ################################## # Print package summary From c010edc4fdc34ec1e4f527afbff1e6eb8d5f2293 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 21 Jul 2017 11:38:02 -0600 Subject: [PATCH 70/77] cmake: fixed two typos --- cmake/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4a2a8773ec..ebf452d183 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -142,7 +142,7 @@ if(ENABLE_KSPACE) list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) endif() set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") - set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) + set_property(CACHE PACK_OPTIMIZATION PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") add_definitions(-D${PACK_OPTIMIZATION}) endif() @@ -320,7 +320,7 @@ RegisterStyles(${LAMMPS_SOURCE_DIR}) ############################################## # add sources of enabled packages ############################################ -foreach(PKG ${PACKAGES} ${USER-PACKAGES}) +foreach(PKG ${PACKAGES} ${OTHER-PACKAGES}) if(ENABLE_${PKG}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) From 74deeeca5855742fd2aa8274b4203c45be12086d Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 21 Jul 2017 11:50:13 -0600 Subject: [PATCH 71/77] cmake: fixed another typo --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ebf452d183..228a9e36e3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -320,7 +320,7 @@ RegisterStyles(${LAMMPS_SOURCE_DIR}) ############################################## # add sources of enabled packages ############################################ -foreach(PKG ${PACKAGES} ${OTHER-PACKAGES}) +foreach(PKG ${PACKAGES} ${OTHER_PACKAGES}) if(ENABLE_${PKG}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) From 126d9cd3bc71cd354556999319e48a381d08d980 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sat, 22 Jul 2017 13:57:15 -0600 Subject: [PATCH 72/77] add GZIP and FFMPEG status --- cmake/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 228a9e36e3..959aea869a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -196,13 +196,15 @@ if(PNG_FOUND AND ZLIB_FOUND) add_definitions(-DLAMMPS_PNG) endif() -find_program(GZIP gzip) -if(GZIP) +find_program(GZIP_EXECUTABLE gzip) +find_package_handle_standard_args(GZIP REQUIRED_VARS GZIP_EXECUTABLE) +if(GZIP_FOUND) add_definitions(-DLAMMPS_GZIP) endif() -find_program(FFMPEG ffmpeg) -if(FFMPEG) +find_program(FFMPEG_EXECUTABLE ffmpeg) +find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE) +if(FFMPEG_FOUND) add_definitions(-DLAMMPS_FFMPEG) endif() From f2023431f69bd0449ef0bc622697d9bdca2b9b73 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 24 Jul 2017 12:54:26 -0600 Subject: [PATCH 73/77] cmake: fixed another typo --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 959aea869a..059a8733a3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -322,7 +322,7 @@ RegisterStyles(${LAMMPS_SOURCE_DIR}) ############################################## # add sources of enabled packages ############################################ -foreach(PKG ${PACKAGES} ${OTHER_PACKAGES}) +foreach(PKG ${DEFAULT_PACKAGES} ${OTHER_PACKAGES}) if(ENABLE_${PKG}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) From 6716de5320733f033ebbaba6fc6f2b28cf770c3a Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 24 Jul 2017 20:17:17 -0600 Subject: [PATCH 74/77] allow user to override PYTHON_INSTDIR --- cmake/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 059a8733a3..15a87b7f6e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -172,9 +172,11 @@ if(ENABLE_PYTHON) add_definitions(-DLMP_PYTHON) include_directories(${PYTHON_INCLUDE_DIR}) list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) - execute_process(COMMAND ${PYTHON_EXECUTABLE} + if(NOT PYTHON_INSTDIR) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() install(FILES ${CMAKE_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) if(NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "Python package need lammps to be build shared, -DBUILD_SHARED_LIBS=ON") From 0231cc38a35e1d38a800305cd32cef12bae113b1 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 25 Jul 2017 19:09:20 -0600 Subject: [PATCH 75/77] cmake: some more typo fixes --- cmake/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 15a87b7f6e..d691386c05 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -18,10 +18,10 @@ list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) # Cmake modules/macros are in a subdirectory to keep this file cleaner set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) #release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) -endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) +endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) foreach(STYLE_FILE style_angle.h style_atom.h style_body.h style_bond.h style_command.h style_compute.h style_dihedral.h style_dump.h style_fix.h style_improper.h style_integrate.h style_kspace.h style_minimize.h style_nbin.h style_npair.h style_nstencil.h @@ -498,7 +498,7 @@ if(ENABLE_GPU) endforeach() list(REMOVE_ITEM GPU_OBJS "${CU_FORBIDDEN_OBJ}") list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h") endif() ###################################################### @@ -529,7 +529,7 @@ add_executable(lmp ${LMP_SOURCES}) target_link_libraries(lmp lammps) install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) if(ENABLE_TESTING) - add_test(ShowHelp lmp -help) + add_test(ShowHelp ${CMAKE_CURRENT_BINARY_DIR}/lmp -help) endif() ################################## From 408d9d99a9464c80e4af32834b0873a8a567ac7a Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 31 Jul 2017 11:35:41 -0600 Subject: [PATCH 76/77] cmake: improve some error messages --- cmake/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d691386c05..59a2cc1f7b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -179,7 +179,7 @@ if(ENABLE_PYTHON) endif() install(FILES ${CMAKE_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) if(NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Python package need lammps to be build shared, -DBUILD_SHARED_LIBS=ON") + message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON") endif() endif() @@ -451,7 +451,7 @@ if(ENABLE_GPU) find_package(CUDA REQUIRED) find_program(BIN2C bin2c) if(NOT BIN2C) - message(FATAL_ERROR "Couldn't find bin2c") + message(FATAL_ERROR "Couldn't find bin2c, use -DBIN2C helping cmake to find it.") endif() include_directories(${CUDA_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) @@ -522,7 +522,7 @@ if(INSTALL_LIB) install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) elseif(BUILD_SHARED_LIBS) - message(FATAL_ERROR "Shared library has to be installed, use -DBUILD_SHARED_LIBS=ON to install lammps with a library") + message(FATAL_ERROR "Shared library has to be installed, use -DINSTALL_LIB=ON to install lammps with a library") endif() add_executable(lmp ${LMP_SOURCES}) From 72f50c91ee01cf7744ba14ae320d4c7ac09e991a Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 31 Jul 2017 11:48:22 -0600 Subject: [PATCH 77/77] Add -DLAMMPS_EXCEPTIONS flag --- cmake/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d691386c05..efc0eac5ca 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -69,6 +69,11 @@ add_definitions(-D${LAMMPS_SIZE_LIMIT}) set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS") add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) +option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF) +if(LAMMPS_EXCEPTIONS) + add_definitions(-DLAMMPS_EXCEPTIONS) +endif() + option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_TESTING "Enable testing" OFF)