Commit ee487ef4 authored by Steve Plimpton's avatar Steve Plimpton Committed by GitHub
Browse files

Merge pull request #652 from junghans/latte

Add LATTE fix
parents 638b91bf a8ae8866
Loading
Loading
Loading
Loading
+28 −8
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ 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)
set(LAMMPS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src)
set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib)

#To not conflict with old Makefile build system, we build everything here
@@ -16,7 +16,7 @@ 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)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
  #release comes with -O3 by default
@@ -47,6 +47,7 @@ endif()
include(GNUInstallDirs)

set(LAMMPS_LINK_LIBS)
set(LAMMPS_DEPS)
set(LAMMPS_API_DEFINES)
option(ENABLE_MPI "Build MPI version" OFF)
if(ENABLE_MPI)
@@ -95,7 +96,7 @@ 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
set(OTHER_PACKAGES KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE
  USER-ATC USER-AWPMD USER-CGDNA USER-MESO
  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
@@ -130,7 +131,7 @@ endif()
######################################################
# packages with special compiler needs or external libs
######################################################
if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP OR ENABLE_USER-QMMM)
if(ENABLE_REAX OR ENABLE_MEAM OR ENABLE_USER-QUIP OR ENABLE_USER-QMMM OR ENABLE_LATTE)
  enable_language(Fortran)
  include(CheckFortranCompilerFlag)
  check_Fortran_compiler_flag("-fno-second-underscore" FC_HAS_NO_SECOND_UNDERSCORE)
@@ -172,7 +173,7 @@ if(ENABLE_MISC)
  endif()
endif()

if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP)
if(ENABLE_MSCG OR ENABLE_USER-ATC OR ENABLE_USER-AWPMD OR ENABLE_USER-QUIP OR ENABLE_LATTE)
  find_package(LAPACK)
  if(NOT LAPACK_FOUND)
    enable_language(Fortran)
@@ -198,7 +199,7 @@ if(ENABLE_PYTHON)
	  -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)
  endif()
  install(FILES ${CMAKE_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR})
  install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR})
  if(NOT BUILD_SHARED_LIBS)
    message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON")
  endif()
@@ -237,6 +238,24 @@ if(ENABLE_VORONOI)
  list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES})
endif()

if(ENABLE_LATTE)
  find_package(LATTE QUIET)
  if(NOT LATTE_FOUND)
    message(STATUS "LATTE not found - we will build our own")
    include(ExternalProject)
    ExternalProject_Add(latte_build
      URL https://github.com/lanl/LATTE/archive/v1.0.1.tar.gz
      URL_MD5 5137e28cb1a64444bd571c98c98a6eee
      SOURCE_SUBDIR cmake
      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
      )
    ExternalProject_get_property(latte_build INSTALL_DIR)
    set(LATTE_LIBRARIES ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/liblatte.a)
    list(APPEND LAMMPS_DEPS latte_build)
  endif()
  list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES} ${LAPACK_LIBRARIES} ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
endif()

if(ENABLE_USER-MOLFILE)
  add_library(molfile INTERFACE)
  target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile)
@@ -534,7 +553,7 @@ if(ENABLE_GPU)
      set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture")
      set_property(CACHE GPU_ARCH PROPERTY STRINGS sm_10 sm_20 sm_30 sm_60)

      file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu)
      file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cu)
      list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)

      cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
@@ -646,6 +665,7 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR})
############################################
add_library(lammps ${LIB_SOURCES})
target_link_libraries(lammps ${LAMMPS_LINK_LIBS})
add_dependencies(lammps ${LAMMPS_DEPS})
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
if(BUILD_SHARED_LIBS)
  set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
+18 −0
Original line number Diff line number Diff line
# - Find latte
# Find the native LATTE libraries.
#
#  LATTE_LIBRARIES    - List of libraries when using latte.
#  LATTE_FOUND        - True if latte found.
#

find_library(LATTE_LIBRARY NAMES latte)

set(LATTE_LIBRARIES ${LATTE_LIBRARY})

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LATTE_FOUND to TRUE
# if all listed variables are TRUE

find_package_handle_standard_args(LATTE DEFAULT_MSG LATTE_LIBRARY)

mark_as_advanced(LATTE_LIBRARY)
+1 −0
Original line number Diff line number Diff line
@@ -580,6 +580,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
"halt"_fix_halt.html,
"heat"_fix_heat.html,
"indent"_fix_indent.html,
"latte"_fix_latte.html,
"langevin (k)"_fix_langevin.html,
"lineforce"_fix_lineforce.html,
"momentum (k)"_fix_momentum.html,
+60 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ Package, Description, Doc page, Example, Library
"KIM"_#KIM, OpenKIM wrapper, "pair_style kim"_pair_kim.html, kim, ext
"KOKKOS"_#KOKKOS, Kokkos-enabled styles, "Section 5.3.3"_accelerate_kokkos.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, -
"KSPACE"_#KSPACE, long-range Coulombic solvers, "kspace_style"_kspace_style.html, peptide, -
"LATTE"_#LATTE, quantum DFTB forces via LATTE, "fix latte"_fix_latte.html, latte, ext
"MANYBODY"_#MANYBODY, many-body potentials, "pair_style tersoff"_pair_tersoff.html, shear, -
"MC"_#MC, Monte Carlo options, "fix gcmc"_fix_gcmc.html, -, -
"MEAM"_#MEAM, modified EAM potential, "pair_style meam"_pair_meam.html, meam, int
@@ -695,6 +696,65 @@ bench/in.rhodo :ul

:line

LATTE package :link(LATTE),h4

[Contents:]

A fix command which wraps the LATTE DFTB code, so that molecular
dynamics can be run with LAMMPS using density-functional tight-binding
quantum forces calculated by LATTE.

More information on LATTE can be found at this web site:
"https://github.com/lanl/LATTE"_#latte_home.  A brief technical
description is given with the "fix latte"_fix_latte.html command.

:link(latte_home,https://github.com/lanl/LATTE)

[Authors:] Christian Negre (LANL) and Steve Plimpton (Sandia).  LATTE
itself is developed at Los Alamos National Laboratory by Marc
Cawkwell, Anders Niklasson, and Christian Negre.

[Install or un-install:]

Before building LAMMPS with this package, you must first download and
build the LATTE library.  You can do this manually if you prefer;
follow the instructions in lib/latte/README.  You can also do it in
one step from the lammps/src dir, using a command like these, which
simply invokes the lib/latte/Install.py script with the specified
args:

make lib-latte                          # print help message
make lib-latte args="-b"                # download and build in lib/latte/LATTE-master
make lib-latte args="-p $HOME/latte"    # use existing LATTE installation in $HOME/latte
make lib-latte args="-b -m gfortran"    # download and build in lib/latte and 
                                        #   copy Makefile.lammps.gfortran to Makefile.lammps

Note that 3 symbolic (soft) links, "includelink" and "liblink" and
"filelink", are created in lib/latte to point into the LATTE home dir.
When LAMMPS builds in src it will use these links.  You should 
also check that the Makefile.lammps file you create is apporpriate
for the compiler you use on your system to build LATTE.

You can then install/un-install the package and build LAMMPS in the
usual manner:

make yes-latte
make machine :pre

make no-latte
make machine :pre

[Supporting info:]

src/LATTE: filenames -> commands
src/LATTE/README
lib/latte/README
"fix latte"_fix_latte.html
examples/latte
"LAMMPS-LATTE tutorial"_https://github.com/lanl/LATTE/wiki/Using-LATTE-through-LAMMPS :ul

:line

MANYBODY package :link(MANYBODY),h4

[Contents:]
+1 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ of "this page"_Section_commands.html#cmd_5.
"halt"_fix_halt.html - terminate a dynamics run or minimization
"heat"_fix_heat.html - add/subtract momentum-conserving heat
"indent"_fix_indent.html - impose force due to an indenter
"latte"_fix_latte.html - wrapper on LATTE density-functional tight-binding code
"langevin"_fix_langevin.html - Langevin temperature control
"lineforce"_fix_lineforce.html - constrain atoms to move in a line
"momentum"_fix_momentum.html - zero the linear and/or angular momentum of a group of atoms
Loading